diff --git a/services/bundlemgr_lite/include/gt_bundle_manager_service.h b/services/bundlemgr_lite/include/gt_bundle_manager_service.h index 3a937124c149c6c2ddc3c83dc54e6c059cebb447..5aba5f3526cce19ff30eda99cf8dc9a3f4313df5 100755 --- a/services/bundlemgr_lite/include/gt_bundle_manager_service.h +++ b/services/bundlemgr_lite/include/gt_bundle_manager_service.h @@ -56,6 +56,7 @@ public: static GtManagerService instance; return instance; } + bool InstallOperation(const char *hapPath, InstallerCallback installerCallback); bool Install(const char *hapPath, const InstallParam *installParam, InstallerCallback installerCallback); bool Uninstall(const char *bundleName, const InstallParam *installParam, InstallerCallback installerCallback); uint8_t QueryAbilityInfo(const Want *want, AbilityInfo *abilityInfo); diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index d5bb5fcd218dd0f0cb09ed4ae624e236bac26bf5..f2cff33b789463094f589d59a021292ac53bceeb 100755 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -65,13 +65,8 @@ GtManagerService::~GtManagerService() bundleResList_ = nullptr; } -bool GtManagerService::Install(const char *hapPath, const InstallParam *installParam, - InstallerCallback installerCallback) +bool GtManagerService::InstallOperation(const char *hapPath, InstallerCallback installerCallback) { - HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] install start"); - if (installer_ == nullptr) { - installer_ = new GtBundleInstaller(); - } if (hapPath == nullptr) { return false; } @@ -88,8 +83,20 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP AdapterFree(path); return false; } +} -#ifndef __LITEOS_M__ +bool GtManagerService::Install(const char *hapPath, const InstallParam *installParam, + InstallerCallback installerCallback) +{ + HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] install start"); + if (installer_ == nullptr) { + installer_ = new GtBundleInstaller(); + } + if (!InstallOperation(hapPath, installerCallback)) { + return false; + } + + #ifndef __LITEOS_M__ // delete resource temp dir first (void) BundleUtil::RemoveDir(TMP_RESOURCE_DIR); // create new bundleInstallMsg