From 3340c13ecce624306e7bee37e91cbd77f53c8181 Mon Sep 17 00:00:00 2001 From: shilei Date: Wed, 9 Nov 2022 14:38:10 +0800 Subject: [PATCH] add Signed-off-by: shilei Change-Id: I7e95213f27e39e45021e09e36b0162c5caf542c5 --- .../bundlemgr_lite/src/gt_bundle_installer.cpp | 9 ++++++--- .../src/gt_bundle_manager_service.cpp | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/services/bundlemgr_lite/src/gt_bundle_installer.cpp b/services/bundlemgr_lite/src/gt_bundle_installer.cpp index 7bf71ee..6ffb76e 100644 --- a/services/bundlemgr_lite/src/gt_bundle_installer.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_installer.cpp @@ -586,11 +586,11 @@ uint8_t GtBundleInstaller::Uninstall(const char *bundleName) if (sprintf_s(bundleJsonPath, PATH_LENGTH, "%s%s%s", JSON_PATH, bundleName, JSON_SUFFIX) < 0) { return ERR_APPEXECFWK_UNINSTALL_FAILED_INTERNAL_ERROR; } - +#ifndef __LITEOS_M__ if (DeletePermissions(const_cast(bundleName)) < 0) { return ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_PERMISSIONS_ERROR; } - +#endif bool res = CheckIsThirdSystemBundle(bundleName); if (!(BundleUtil::RemoveDir(bundleInfo->codePath) && BundleUtil::RemoveDir(bundleInfo->dataPath))) { GtManagerService::GetInstance().RemoveBundleInfo(bundleName); @@ -743,10 +743,12 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr bool isUpdate) { if (permNum == 0) { +#ifndef __LITEOS_M__ if (isUpdate) { int32_t ret = DeletePermissions(bundleName); HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] delete permissions, result is %d", ret); } +#endif return ERR_OK; } @@ -757,11 +759,12 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr if (!BundleUtil::IsDir(PERMISSIONS_PATH)) { BundleUtil::MkDirs(PERMISSIONS_PATH); } - +#ifndef __LITEOS_M__ if (SaveOrUpdatePermissions(const_cast(bundleName), permissions, permNum, static_cast(isUpdate)) != 0) { return ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR; } +#endif return ERR_OK; } diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index 2001898..61f763f 100644 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -126,9 +126,13 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP SetCurrentBundle(bundleInstallMsg_->bundleName); (void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback); +#ifdef BC_TRANS_ENABLE DisableServiceWdg(); +#endif ret = installer_->Install(path, installerCallback); +#ifdef BC_TRANS_ENABLE EnableServiceWdg(); +#endif HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Install ret is %d", ret); if (ret == 0) { (void) ReportInstallCallback(ret, BUNDLE_INSTALL_OK, BMS_INSTALLATION_COMPLETED, installerCallback); @@ -167,9 +171,13 @@ bool GtManagerService::Uninstall(const char *bundleName, const InstallParam *ins (void) ReportUninstallCallback(OPERATION_DOING, BUNDLE_UNINSTALL_DOING, innerBundleName, BMS_UNINSTALLATION_START, installerCallback); +#ifdef BC_TRANS_ENABLE DisableServiceWdg(); +#endif uint8_t ret = installer_->Uninstall(innerBundleName); +#ifdef BC_TRANS_ENABLE EnableServiceWdg(); +#endif HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Uninstall ret is %d", ret); if (ret == 0) { (void) ReportUninstallCallback(ret, BUNDLE_UNINSTALL_OK, innerBundleName, @@ -302,7 +310,9 @@ void GtManagerService::InstallPreBundle(List systemPathList, } // scan system apps and third system apps +#ifdef BC_TRANS_ENABLE DisableServiceWdg(); +#endif ScanSystemApp(uninstallRecord, &systemPathList_); if (uninstallRecord != nullptr) { cJSON_Delete(uninstallRecord); @@ -310,7 +320,9 @@ void GtManagerService::InstallPreBundle(List systemPathList, // scan third apps ScanThirdApp(INSTALL_PATH, &systemPathList_); +#ifdef BC_TRANS_ENABLE EnableServiceWdg(); +#endif for (auto node = systemPathList.Begin(); node != systemPathList.End(); node = node->next_) { ToBeInstalledApp *toBeInstalledApp = node->value_; if (!BundleUtil::IsFile(toBeInstalledApp->path) || @@ -766,6 +778,7 @@ void GtManagerService::UpdateBundleInfoList() } } +#ifdef BC_TRANS_ENABLE void GtManagerService::TransformJsToBcWhenRestart(const char *codePath, const char *bundleName) { if (codePath == nullptr) { @@ -876,6 +889,7 @@ void GtManagerService::TransformJsToBc(const char *codePath, const char *bundleJ } (void)BundleUtil::StoreJsonContentToFile(bundleJsonPath, installRecordObj); } +#endif bool GtManagerService::CheckThirdSystemBundleHasUninstalled(const char *bundleName, const cJSON *object) { -- Gitee