diff --git a/frameworks/bundle_lite/include/bundlems_slite_client.h b/frameworks/bundle_lite/include/bundlems_slite_client.h index 2c92dd4e45a068e6cd34421569ec0e871efa8c8b..a96f37d3d38b3d9ad17df03ae3b679bb529a44c1 100755 --- a/frameworks/bundle_lite/include/bundlems_slite_client.h +++ b/frameworks/bundle_lite/include/bundlems_slite_client.h @@ -47,8 +47,6 @@ public: bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess) const; - bool GetUninstallState(const char *bundleName, UninstallState *uninstallState) const; - uint32_t GetBundleSize(const char *bundleName) const; private: diff --git a/frameworks/bundle_lite/src/slite/bundle_manager_inner.cpp b/frameworks/bundle_lite/src/slite/bundle_manager_inner.cpp index 23e0083b4df86719e38173d25deef023dd462c8c..04c4e1b0827cf76e1f66b4da4ee1092a6d455f73 100755 --- a/frameworks/bundle_lite/src/slite/bundle_manager_inner.cpp +++ b/frameworks/bundle_lite/src/slite/bundle_manager_inner.cpp @@ -24,11 +24,6 @@ bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t return OHOS::BundleMsClient::GetInstance().GetInstallState(bundleName, installState, installProcess); } -bool GetUninstallState(const char *bundleName, UninstallState *uninstallState) -{ - return OHOS::BundleMsClient::GetInstance().GetUninstallState(bundleName, uninstallState); -} - uint32_t GetBundleSize(const char *bundleName) { return OHOS::BundleMsClient::GetInstance().GetBundleSize(bundleName); diff --git a/frameworks/bundle_lite/src/slite/bundlems_slite_client.cpp b/frameworks/bundle_lite/src/slite/bundlems_slite_client.cpp index e8f0d77f924504d2f97cfaba936d324e16bd9722..ba326bc2bc3ad77dd1d9df58ecee398a6cc92a89 100755 --- a/frameworks/bundle_lite/src/slite/bundlems_slite_client.cpp +++ b/frameworks/bundle_lite/src/slite/bundlems_slite_client.cpp @@ -158,14 +158,6 @@ bool BundleMsClient::GetInstallState (const char *bundleName, InstallState *inst return bmsProxy_->GetInstallState(bundleName, installState, installProcess); } -bool BundleMsClient::GetUninstallState (const char *bundleName, UninstallState *uninstallState) const -{ - if (!Initialize()) { - return false; - } - return bmsProxy_->GetUninstallState(bundleName, uninstallState); -} - uint32_t BundleMsClient::GetBundleSize (const char *bundleName) const { if (!Initialize()) { diff --git a/interfaces/innerkits/bundlemgr_lite/bundle_service_interface.h b/interfaces/innerkits/bundlemgr_lite/bundle_service_interface.h index 064633e4f3c3ee58023da3f1e989b35298b8cf43..fec629bfa11cbc4daef9d6414ca084cf1599bda1 100755 --- a/interfaces/innerkits/bundlemgr_lite/bundle_service_interface.h +++ b/interfaces/innerkits/bundlemgr_lite/bundle_service_interface.h @@ -50,7 +50,6 @@ struct BmsSliteInterface { uint8_t (*GetBundleInfo)(const char *bundleName, int32_t flags, BundleInfo *bundleInfo); uint8_t (*GetBundleInfos)(int32_t flags, BundleInfo **bundleInfos, int32_t *len); bool (*GetInstallState)(const char *bundleName, InstallState *installState, uint8_t *installProcess); - bool (*GetUninstallState)(const char *bundleName, UninstallState *uninstallState); uint32_t (*GetBundleSize)(const char *bundleName); }; #ifdef __cplusplus diff --git a/interfaces/innerkits/bundlemgr_lite/slite/bundle_install_msg.h b/interfaces/innerkits/bundlemgr_lite/slite/bundle_install_msg.h index a4f844dde68d374fdb9ac0f8432a2ba6ae982a33..77523d537267542afb783e07fc9514465f0aba6a 100644 --- a/interfaces/innerkits/bundlemgr_lite/slite/bundle_install_msg.h +++ b/interfaces/innerkits/bundlemgr_lite/slite/bundle_install_msg.h @@ -27,7 +27,10 @@ extern "C" { typedef enum { BUNDLE_INSTALL_DOING = 0, BUNDLE_INSTALL_OK = 1, - BUNDLE_INSTALL_FAIL = 2 + BUNDLE_INSTALL_FAIL = 2, + BUNDLE_UNINSTALL_DOING = 3, + BUNDLE_UNINSTALL_OK = 4, + BUNDLE_UNINSTALL_FAIL = 5 } InstallState; typedef struct { @@ -39,12 +42,6 @@ typedef struct { uint8_t installProcess; } BundleInstallMsg; -typedef enum { - BUNDLE_UNINSTALL_DOING = 0, - BUNDLE_UNINSTALL_OK = 1, - BUNDLE_UNINSTALL_FAIL = 2 -} UninstallState; - /** * @brief Get the install state and install process of the bundle. * @@ -58,16 +55,6 @@ typedef enum { */ bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess); -/** - * @brief Get the uninstall state and uninstall state of the bundle. - * - * @param bundleName Indicates the name of the bundle. - * @param uninstallState Obtains uninstall state. - * @return Returns success or not. - * - */ -bool GetUninstallState(const char *bundleName, UninstallState *uninstallState); - /** * @brief Get the bundle size. * diff --git a/services/bundlemgr_lite/include/bundle_mgr_slite_feature.h b/services/bundlemgr_lite/include/bundle_mgr_slite_feature.h index 3008e5b2f3b5028c27f7e0d5bb97a11c215cdfe6..b81bdf48025f42bc005e1ed61535f4deaf843b91 100755 --- a/services/bundlemgr_lite/include/bundle_mgr_slite_feature.h +++ b/services/bundlemgr_lite/include/bundle_mgr_slite_feature.h @@ -36,7 +36,6 @@ public: static uint8_t GetBundleInfo(const char *bundleName, int32_t flags, BundleInfo *bundleInfo); static uint8_t GetBundleInfos(int32_t flags, BundleInfo **bundleInfos, int32_t *len); static bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess); - static bool GetUninstallState(const char *bundleName, UninstallState *uninstallState); static uint32_t GetBundleSize (const char *bundleName); static BundleMgrSliteFeature *GetInstance() diff --git a/services/bundlemgr_lite/include/gt_bundle_manager_service.h b/services/bundlemgr_lite/include/gt_bundle_manager_service.h index 8cbecf4db6691cfd2cda5a17b943182c9fa55f35..4f0564bcce48a2c954372bf0d5449f7e255ab702 100755 --- a/services/bundlemgr_lite/include/gt_bundle_manager_service.h +++ b/services/bundlemgr_lite/include/gt_bundle_manager_service.h @@ -49,11 +49,6 @@ typedef enum { BUNDLE_UPDATE, } BundleState; -typedef struct { - char *bundleName; - UninstallState uninstallState; -} BundleUninstallMsg; - class GtManagerService { public: static GtManagerService &GetInstance() @@ -79,10 +74,9 @@ public: void ReduceNumOfThirdBundles(); int32_t ReportInstallCallback(uint8_t errCode, uint8_t installState, uint8_t process, InstallerCallback installerCallback); - int32_t ReportUninstallCallback(uint8_t errCode, char *bundleName, + int32_t ReportUninstallCallback(uint8_t errCode, uint8_t installState, char *bundleName, uint8_t process, InstallerCallback installerCallback); bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess); - bool GetUninstallState(const char *bundleName, UninstallState *uninstallState); uint32_t GetBundleSize(const char *bundleName); private: @@ -113,7 +107,6 @@ private: BundleMap *bundleMap_; List *bundleResList_; BundleInstallMsg *bundleInstallMsg_; - BundleUninstallMsg *bundleUninstallMsg_; char *jsEngineVer_; uint32_t installedThirdBundleNum_; }; diff --git a/services/bundlemgr_lite/src/bundle_mgr_slite_feature.cpp b/services/bundlemgr_lite/src/bundle_mgr_slite_feature.cpp index 2fcbcd5faabc16401f086561b1d1e95133753daa..5b12cff9841c1b5405284a983fd7aaaf9596f714 100755 --- a/services/bundlemgr_lite/src/bundle_mgr_slite_feature.cpp +++ b/services/bundlemgr_lite/src/bundle_mgr_slite_feature.cpp @@ -33,7 +33,6 @@ BundleMgrSliteFeatureImpl g_bmsSliteImpl = { .GetBundleInfo = BundleMgrSliteFeature::GetBundleInfo, .GetBundleInfos = BundleMgrSliteFeature::GetBundleInfos, .GetInstallState = BundleMgrSliteFeature::GetInstallState, - .GetUninstallState = BundleMgrSliteFeature::GetUninstallState, .GetBundleSize = BundleMgrSliteFeature::GetBundleSize, DEFAULT_IUNKNOWN_ENTRY_END }; @@ -129,11 +128,6 @@ bool BundleMgrSliteFeature::GetInstallState(const char *bundleName, InstallState return OHOS::GtManagerService::GetInstance().GetInstallState(bundleName, installState, installProcess); } -bool BundleMgrSliteFeature::GetUninstallState(const char *bundleName, UninstallState *uninstallState) -{ - return OHOS::GtManagerService::GetInstance().GetUninstallState(bundleName, uninstallState); -} - uint32_t BundleMgrSliteFeature::GetBundleSize(const char *bundleName) { return OHOS::GtManagerService::GetInstance().GetBundleSize(bundleName); diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index 86f97ccc11eb76f87ae9555a2f0760cb72a1969f..a8eb9479d3fc580bc8ab01074d281effa980d065 100755 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -49,7 +49,6 @@ GtManagerService::GtManagerService() bundleResList_ = new List(); bundleMap_ = BundleMap::GetInstance(); bundleInstallMsg_ = nullptr; - bundleUninstallMsg_ = nullptr; jsEngineVer_ = nullptr; installedThirdBundleNum_ = 0; } @@ -150,30 +149,19 @@ bool GtManagerService::Uninstall(const char *bundleName, const InstallParam *ins } SetCurrentBundle(innerBundleName); - bundleUninstallMsg_ = reinterpret_cast(AdapterMalloc(sizeof(BundleUninstallMsg))); - if (bundleUninstallMsg_ == nullptr) { - return false; - } - if (memset_s(bundleUninstallMsg_, sizeof(BundleUninstallMsg), 0, sizeof(BundleUninstallMsg)) != EOK) { - AdapterFree(bundleUninstallMsg_); - return false; - } - bundleUninstallMsg_->bundleName = innerBundleName; - bundleUninstallMsg_->uninstallState = BUNDLE_UNINSTALL_DOING; - - (void) ReportUninstallCallback(OPERATION_DOING, innerBundleName, BMS_UNINSTALLATION_START, installerCallback); + (void) ReportUninstallCallback(OPERATION_DOING, BUNDLE_UNINSTALL_DOING, innerBundleName, + BMS_UNINSTALLATION_START, installerCallback); uint8_t ret = installer_->Uninstall(innerBundleName); if (ret == 0) { - bundleUninstallMsg_->uninstallState = BUNDLE_UNINSTALL_OK; + (void) ReportUninstallCallback(ret, BUNDLE_UNINSTALL_OK, innerBundleName, + BMS_INSTALLATION_COMPLETED, installerCallback); } else { - bundleUninstallMsg_->uninstallState = BUNDLE_UNINSTALL_FAIL; + (void) ReportUninstallCallback(ret, BUNDLE_UNINSTALL_FAIL, innerBundleName, + BMS_INSTALLATION_COMPLETED, installerCallback); } - (void) ReportUninstallCallback(ret, innerBundleName, BMS_INSTALLATION_COMPLETED, installerCallback); SetCurrentBundle(nullptr); AdapterFree(innerBundleName); - AdapterFree(bundleUninstallMsg_); - bundleUninstallMsg_ = nullptr; return true; } @@ -224,21 +212,6 @@ uint32_t GtManagerService::GetBundleSize(const char *bundleName) return codeBundleSize + dataBundleSize; } -bool GtManagerService::GetUninstallState(const char *bundleName, UninstallState *uninstallState) -{ - BundleInfo *uninstalledInfo = bundleMap_->Get(bundleName); - if (uninstalledInfo == nullptr) { - *uninstallState = BUNDLE_UNINSTALL_OK; - return true; - } - if (strcmp(bundleName, bundleUninstallMsg_->bundleName) == 0) { - *uninstallState = bundleUninstallMsg_->uninstallState; - return true; - } - *uninstallState = BUNDLE_UNINSTALL_DOING; - return true; -} - uint8_t GtManagerService::QueryAbilityInfo(const Want *want, AbilityInfo *abilityInfo) { if (want->element == nullptr) { @@ -909,19 +882,20 @@ int32_t GtManagerService::ReportInstallCallback(uint8_t errCode, uint8_t install return 0; } -int32_t GtManagerService::ReportUninstallCallback(uint8_t errCode, char *bundleName, +int32_t GtManagerService::ReportUninstallCallback(uint8_t errCode, uint8_t installState, char *bundleName, uint8_t process, InstallerCallback installerCallback) { if (installerCallback == nullptr) { return -1; } - BundleInstallMsg *bundleUninstallMsg = reinterpret_cast(AdapterMalloc(sizeof(BundleInstallMsg))); + BundleInstallMsg *bundleInstallMsg = reinterpret_cast(AdapterMalloc(sizeof(BundleInstallMsg))); if (bundleUninstallMsg == nullptr) { return -1; } - bundleUninstallMsg->bundleName = bundleName; - bundleUninstallMsg->installProcess = process; - (*installerCallback)(errCode, bundleUninstallMsg); + bundleInstallMsg->installState = static_cast(installState); + bundleInstallMsg->bundleName = bundleName; + bundleInstallMsg->installProcess = process; + (*installerCallback)(errCode, bundleInstallMsg); return 0; }