diff --git a/frameworks/src/bundle_command.cpp b/frameworks/src/bundle_command.cpp index 609b7fe93c0b355b8b00a02bbfa64dd6f8ae4558..22d663af149531e0ac6c70b63cde4ab78c84d901 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" @@ -2480,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; } @@ -2525,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; @@ -2544,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;