From 2c1053d88fc07ef0fafddce51cb1d3746102c6bd Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Wed, 19 Feb 2025 10:13:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E9=94=81=E5=AF=B9bm=E5=B7=A5=E5=85=B7=E7=9A=84=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lanhaoyu --- frameworks/src/bundle_command.cpp | 1 - frameworks/src/bundle_command_common.cpp | 4 ---- 2 files changed, 5 deletions(-) diff --git a/frameworks/src/bundle_command.cpp b/frameworks/src/bundle_command.cpp index 915ad2e..d04574c 100644 --- a/frameworks/src/bundle_command.cpp +++ b/frameworks/src/bundle_command.cpp @@ -926,7 +926,6 @@ ErrCode BundleManagerShellCommand::RunAsUninstallCommand() InstallParam installParam; installParam.userId = userId; installParam.isKeepData = isKeepData; - installParam.parameters.emplace(Constants::VERIFY_UNINSTALL_RULE_KEY, Constants::VERIFY_UNINSTALL_RULE_VALUE); int32_t uninstallResult = UninstallOperation(bundleName, moduleName, installParam); if (uninstallResult == OHOS::ERR_OK) { resultReceiver_ = STRING_UNINSTALL_BUNDLE_OK + "\n"; diff --git a/frameworks/src/bundle_command_common.cpp b/frameworks/src/bundle_command_common.cpp index 800cfc7..eafb823 100644 --- a/frameworks/src/bundle_command_common.cpp +++ b/frameworks/src/bundle_command_common.cpp @@ -703,10 +703,6 @@ std::map BundleCommandCommon::bundleMessageMap_ = { IStatusReceiver::ERR_INSTALL_ENCRYPTED_BUNDLE_NOT_ALLOWED_FOR_SHELL, "error: Encrypted bundle cannot be installed." }, - { - IStatusReceiver::ERR_UNINSTALL_DISPOSED_RULE_DENIED, - "error: Failed to uninstall the app because the app is locked." - }, { IStatusReceiver::ERR_INSTALL_APPID_NOT_SAME_WITH_PREINSTALLED, "error: Bundle cannot be installed because the appId is not same with preinstalled bundle." -- Gitee From b053fb3c16227e6e7a6feea6cb88dd362be9a9e5 Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Fri, 20 Jun 2025 10:40:04 +0800 Subject: [PATCH 2/2] overlay_manager_idl Signed-off-by: lanhaoyu --- frameworks/src/bundle_command.cpp | 27 +++++++++--------------- frameworks/src/bundle_command_common.cpp | 4 ++++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/frameworks/src/bundle_command.cpp b/frameworks/src/bundle_command.cpp index 312d624..22d663a 100644 --- a/frameworks/src/bundle_command.cpp +++ b/frameworks/src/bundle_command.cpp @@ -26,6 +26,7 @@ #include "bundle_command_common.h" #include "bundle_death_recipient.h" #include "bundle_mgr_client.h" +#include "overlay_manager_client.h" #include "bundle_mgr_proxy.h" #include "clean_cache_callback_host.h" #include "json_serializer.h" @@ -990,6 +991,7 @@ ErrCode BundleManagerShellCommand::RunAsUninstallCommand() InstallParam installParam; installParam.userId = userId; installParam.isKeepData = isKeepData; + installParam.parameters.emplace(Constants::VERIFY_UNINSTALL_RULE_KEY, Constants::VERIFY_UNINSTALL_RULE_VALUE); int32_t uninstallResult = UninstallOperation(bundleName, moduleName, installParam); if (uninstallResult == OHOS::ERR_OK) { resultReceiver_ = STRING_UNINSTALL_BUNDLE_OK + "\n"; @@ -2479,25 +2481,21 @@ std::string BundleManagerShellCommand::DumpOverlayInfo(const std::string &bundle return res; } - auto overlayManagerProxy = bundleMgrProxy_->GetOverlayManagerProxy(); - if (overlayManagerProxy == nullptr) { - APP_LOGE("overlayManagerProxy is null"); - return res; - } std::vector overlayModuleInfos; OverlayModuleInfo overlayModuleInfo; ErrCode ret = ERR_OK; userId = BundleCommandCommon::GetCurrentUserId(userId); if (moduleName.empty() && targetModuleName.empty()) { - ret = overlayManagerProxy->GetAllOverlayModuleInfo(bundleName, overlayModuleInfos, userId); + ret = OverlayManagerClient::GetInstance().GetAllOverlayModuleInfo(bundleName, overlayModuleInfos, userId); if (overlayModuleInfos.empty()) { ret = ERR_BUNDLEMANAGER_OVERLAY_QUERY_FAILED_NO_OVERLAY_MODULE_INFO; } } else if (!moduleName.empty()) { - ret = overlayManagerProxy->GetOverlayModuleInfo(bundleName, moduleName, overlayModuleInfo, userId); + ret = OverlayManagerClient::GetInstance().GetOverlayModuleInfo(bundleName, moduleName, + overlayModuleInfo, userId); } else { - ret = overlayManagerProxy->GetOverlayModuleInfoForTarget(bundleName, targetModuleName, overlayModuleInfos, - userId); + ret = OverlayManagerClient::GetInstance().GetOverlayModuleInfoForTarget(bundleName, targetModuleName, + overlayModuleInfos, userId); if (overlayModuleInfos.empty()) { ret = ERR_BUNDLEMANAGER_OVERLAY_QUERY_FAILED_NO_OVERLAY_MODULE_INFO; } @@ -2524,18 +2522,12 @@ std::string BundleManagerShellCommand::DumpTargetOverlayInfo(const std::string & APP_LOGE("error value of the dump-target-overlay command options"); return res; } - auto overlayManagerProxy = bundleMgrProxy_->GetOverlayManagerProxy(); - if (overlayManagerProxy == nullptr) { - APP_LOGE("overlayManagerProxy is null"); - return res; - } - userId = BundleCommandCommon::GetCurrentUserId(userId); ErrCode ret = ERR_OK; nlohmann::json overlayInfoJson; if (moduleName.empty()) { std::vector overlayBundleInfos; - ret = overlayManagerProxy->GetOverlayBundleInfoForTarget(bundleName, overlayBundleInfos, userId); + ret = OverlayManagerClient::GetInstance().GetOverlayBundleInfoForTarget(bundleName, overlayBundleInfos, userId); if (ret != ERR_OK || overlayBundleInfos.empty()) { APP_LOGE("dump-target-overlay failed due to errcode %{public}d", ret); return res; @@ -2543,7 +2535,8 @@ std::string BundleManagerShellCommand::DumpTargetOverlayInfo(const std::string & overlayInfoJson = nlohmann::json {{OVERLAY_BUNDLE_INFOS, overlayBundleInfos}}; } else { std::vector overlayModuleInfos; - ret = overlayManagerProxy->GetOverlayModuleInfoForTarget(bundleName, moduleName, overlayModuleInfos, userId); + ret = OverlayManagerClient::GetInstance().GetOverlayModuleInfoForTarget(bundleName, moduleName, + overlayModuleInfos, userId); if (ret != ERR_OK || overlayModuleInfos.empty()) { APP_LOGE("dump-target-overlay failed due to errcode %{public}d", ret); return res; diff --git a/frameworks/src/bundle_command_common.cpp b/frameworks/src/bundle_command_common.cpp index 986cba0..6534d5b 100644 --- a/frameworks/src/bundle_command_common.cpp +++ b/frameworks/src/bundle_command_common.cpp @@ -703,6 +703,10 @@ std::map BundleCommandCommon::bundleMessageMap_ = { IStatusReceiver::ERR_INSTALL_ENCRYPTED_BUNDLE_NOT_ALLOWED_FOR_SHELL, "error: Encrypted bundle cannot be installed." }, + { + IStatusReceiver::ERR_UNINSTALL_DISPOSED_RULE_DENIED, + "error: Failed to uninstall the app because the app is locked." + }, { IStatusReceiver::ERR_INSTALL_APPID_NOT_SAME_WITH_PREINSTALLED, "error: Bundle cannot be installed because the appId is not same with preinstalled bundle." -- Gitee