mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-20 23:55:24 -04:00
add
Signed-off-by: shilei <shilei91@huawei.com> Change-Id: I7e95213f27e39e45021e09e36b0162c5caf542c5
This commit is contained in:
@@ -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) {
|
if (sprintf_s(bundleJsonPath, PATH_LENGTH, "%s%s%s", JSON_PATH, bundleName, JSON_SUFFIX) < 0) {
|
||||||
return ERR_APPEXECFWK_UNINSTALL_FAILED_INTERNAL_ERROR;
|
return ERR_APPEXECFWK_UNINSTALL_FAILED_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
#ifndef __LITEOS_M__
|
||||||
if (DeletePermissions(const_cast<char *>(bundleName)) < 0) {
|
if (DeletePermissions(const_cast<char *>(bundleName)) < 0) {
|
||||||
return ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_PERMISSIONS_ERROR;
|
return ERR_APPEXECFWK_UNINSTALL_FAILED_DELETE_PERMISSIONS_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
bool res = CheckIsThirdSystemBundle(bundleName);
|
bool res = CheckIsThirdSystemBundle(bundleName);
|
||||||
if (!(BundleUtil::RemoveDir(bundleInfo->codePath) && BundleUtil::RemoveDir(bundleInfo->dataPath))) {
|
if (!(BundleUtil::RemoveDir(bundleInfo->codePath) && BundleUtil::RemoveDir(bundleInfo->dataPath))) {
|
||||||
GtManagerService::GetInstance().RemoveBundleInfo(bundleName);
|
GtManagerService::GetInstance().RemoveBundleInfo(bundleName);
|
||||||
@@ -743,10 +743,12 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr
|
|||||||
bool isUpdate)
|
bool isUpdate)
|
||||||
{
|
{
|
||||||
if (permNum == 0) {
|
if (permNum == 0) {
|
||||||
|
#ifndef __LITEOS_M__
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
int32_t ret = DeletePermissions(bundleName);
|
int32_t ret = DeletePermissions(bundleName);
|
||||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] delete permissions, result is %d", ret);
|
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] delete permissions, result is %d", ret);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,11 +759,12 @@ uint8_t GtBundleInstaller::StorePermissions(const char *bundleName, PermissionTr
|
|||||||
if (!BundleUtil::IsDir(PERMISSIONS_PATH)) {
|
if (!BundleUtil::IsDir(PERMISSIONS_PATH)) {
|
||||||
BundleUtil::MkDirs(PERMISSIONS_PATH);
|
BundleUtil::MkDirs(PERMISSIONS_PATH);
|
||||||
}
|
}
|
||||||
|
#ifndef __LITEOS_M__
|
||||||
if (SaveOrUpdatePermissions(const_cast<char *>(bundleName), permissions, permNum,
|
if (SaveOrUpdatePermissions(const_cast<char *>(bundleName), permissions, permNum,
|
||||||
static_cast<IsUpdate>(isUpdate)) != 0) {
|
static_cast<IsUpdate>(isUpdate)) != 0) {
|
||||||
return ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR;
|
return ERR_APPEXECFWK_INSTALL_FAILED_STORE_PERMISSIONS_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,9 +126,13 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
|
|||||||
|
|
||||||
SetCurrentBundle(bundleInstallMsg_->bundleName);
|
SetCurrentBundle(bundleInstallMsg_->bundleName);
|
||||||
(void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback);
|
(void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback);
|
||||||
|
#ifdef BC_TRANS_ENABLE
|
||||||
DisableServiceWdg();
|
DisableServiceWdg();
|
||||||
|
#endif
|
||||||
ret = installer_->Install(path, installerCallback);
|
ret = installer_->Install(path, installerCallback);
|
||||||
|
#ifdef BC_TRANS_ENABLE
|
||||||
EnableServiceWdg();
|
EnableServiceWdg();
|
||||||
|
#endif
|
||||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Install ret is %d", ret);
|
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Install ret is %d", ret);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
(void) ReportInstallCallback(ret, BUNDLE_INSTALL_OK, BMS_INSTALLATION_COMPLETED, installerCallback);
|
(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,
|
(void) ReportUninstallCallback(OPERATION_DOING, BUNDLE_UNINSTALL_DOING, innerBundleName,
|
||||||
BMS_UNINSTALLATION_START, installerCallback);
|
BMS_UNINSTALLATION_START, installerCallback);
|
||||||
|
#ifdef BC_TRANS_ENABLE
|
||||||
DisableServiceWdg();
|
DisableServiceWdg();
|
||||||
|
#endif
|
||||||
uint8_t ret = installer_->Uninstall(innerBundleName);
|
uint8_t ret = installer_->Uninstall(innerBundleName);
|
||||||
|
#ifdef BC_TRANS_ENABLE
|
||||||
EnableServiceWdg();
|
EnableServiceWdg();
|
||||||
|
#endif
|
||||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Uninstall ret is %d", ret);
|
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] Uninstall ret is %d", ret);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
(void) ReportUninstallCallback(ret, BUNDLE_UNINSTALL_OK, innerBundleName,
|
(void) ReportUninstallCallback(ret, BUNDLE_UNINSTALL_OK, innerBundleName,
|
||||||
@@ -302,7 +310,9 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// scan system apps and third system apps
|
// scan system apps and third system apps
|
||||||
|
#ifdef BC_TRANS_ENABLE
|
||||||
DisableServiceWdg();
|
DisableServiceWdg();
|
||||||
|
#endif
|
||||||
ScanSystemApp(uninstallRecord, &systemPathList_);
|
ScanSystemApp(uninstallRecord, &systemPathList_);
|
||||||
if (uninstallRecord != nullptr) {
|
if (uninstallRecord != nullptr) {
|
||||||
cJSON_Delete(uninstallRecord);
|
cJSON_Delete(uninstallRecord);
|
||||||
@@ -310,7 +320,9 @@ void GtManagerService::InstallPreBundle(List<ToBeInstalledApp *> systemPathList,
|
|||||||
|
|
||||||
// scan third apps
|
// scan third apps
|
||||||
ScanThirdApp(INSTALL_PATH, &systemPathList_);
|
ScanThirdApp(INSTALL_PATH, &systemPathList_);
|
||||||
|
#ifdef BC_TRANS_ENABLE
|
||||||
EnableServiceWdg();
|
EnableServiceWdg();
|
||||||
|
#endif
|
||||||
for (auto node = systemPathList.Begin(); node != systemPathList.End(); node = node->next_) {
|
for (auto node = systemPathList.Begin(); node != systemPathList.End(); node = node->next_) {
|
||||||
ToBeInstalledApp *toBeInstalledApp = node->value_;
|
ToBeInstalledApp *toBeInstalledApp = node->value_;
|
||||||
if (!BundleUtil::IsFile(toBeInstalledApp->path) ||
|
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)
|
void GtManagerService::TransformJsToBcWhenRestart(const char *codePath, const char *bundleName)
|
||||||
{
|
{
|
||||||
if (codePath == nullptr) {
|
if (codePath == nullptr) {
|
||||||
@@ -876,6 +889,7 @@ void GtManagerService::TransformJsToBc(const char *codePath, const char *bundleJ
|
|||||||
}
|
}
|
||||||
(void)BundleUtil::StoreJsonContentToFile(bundleJsonPath, installRecordObj);
|
(void)BundleUtil::StoreJsonContentToFile(bundleJsonPath, installRecordObj);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool GtManagerService::CheckThirdSystemBundleHasUninstalled(const char *bundleName, const cJSON *object)
|
bool GtManagerService::CheckThirdSystemBundleHasUninstalled(const char *bundleName, const cJSON *object)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user