Signed-off-by: shilei <shilei91@huawei.com>
Change-Id: I7e95213f27e39e45021e09e36b0162c5caf542c5
This commit is contained in:
shilei
2022-11-09 14:38:10 +08:00
parent 241d1ed518
commit 38f09d0918
2 changed files with 20 additions and 3 deletions
@@ -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<char *>(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<char *>(bundleName), permissions, permNum,
static_cast<IsUpdate>(isUpdate)) != 0) {
return ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR;
}
#endif
return ERR_OK;
}
@@ -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<ToBeInstalledApp *> 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<ToBeInstalledApp *> 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)
{