From 8902c1ec424618c1d3f4fb86ff12493776a139fc Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Thu, 19 Jun 2025 15:11:06 +0800 Subject: [PATCH] overlay_manager_idl Signed-off-by: lanhaoyu --- .../bundle_mgr_helper.cpp | 15 +---- .../ability_runtime/context/context_impl.cpp | 36 +---------- frameworks/native/appkit/app/main_thread.cpp | 10 +-- .../bundle_mgr_helper.h | 3 +- .../ability_runtime/context/context_impl.h | 4 +- .../appmgr/include/app_mgr_service_inner.h | 1 + services/appmgr/src/app_mgr_service_inner.cpp | 29 ++++----- .../bundlemgrhelper_fuzzer.cpp | 3 +- .../include/mock_bundle_manager_proxy.h | 10 +-- .../include/mock_bundle_manager_service.h | 10 +-- .../include/mock_bundle_manager.cpp | 15 +---- .../include/mock_bundle_manager.h | 5 +- .../include/mock_overlay_manager.cpp | 36 ----------- .../include/mock_overlay_manager.h | 46 -------------- .../include/mock_bundle_manager.h | 5 +- .../include/mock_overlay_manager.h | 46 -------------- .../src/mock_bundle_manager.cpp | 15 +---- .../src/mock_overlay_manager.cpp | 12 +--- test/moduletest/ability_test/BUILD.gn | 5 +- .../quick_fix_manager_module_test/BUILD.gn | 3 +- .../mock/src/mock_bundle_mgr_helper.cpp | 6 -- .../ams_app_death_recipient_test/BUILD.gn | 3 +- .../unittest/ams_app_life_cycle_test/BUILD.gn | 3 +- .../ams_app_running_record_test/BUILD.gn | 3 +- .../ams_mgr_scheduler_second_test/BUILD.gn | 3 +- test/unittest/ams_mgr_scheduler_test/BUILD.gn | 3 +- .../ams_recent_app_list_test/BUILD.gn | 3 +- .../BUILD.gn | 3 +- .../mock/include/mock_bundle_mgr_helper.h | 1 - .../mock/include/mock_my_status.h | 1 - .../mock/src/mock_bundle_mgr_helper.cpp | 6 -- .../mock/src/mock_bundle_mgr_helper.cpp | 6 -- .../app_mgr_service_inner_seventh_test.cpp | 61 ------------------- .../mock/src/mock_bundle_mgr_helper.cpp | 6 -- .../mock/include/mock_bundle_mgr_helper.h | 1 - .../app_running_processes_info_test/BUILD.gn | 3 +- .../unittest/appkit/main_fourth_test/BUILD.gn | 4 +- .../main_fourth_by_mock_bms_test.cpp | 3 +- .../unittest/appkit/main_thread_test/BUILD.gn | 4 +- .../main_thread_by_mock_bms_test.cpp | 3 +- .../bundle_mgr_helper_test.cpp | 13 +--- .../cj_ability_stage_object_test/BUILD.gn | 3 +- test/unittest/cj_ability_stage_test/BUILD.gn | 3 +- .../BUILD.gn | 2 - .../BUILD.gn | 4 -- .../BUILD.gn | 1 - .../quick_fix_manager_service_test/BUILD.gn | 4 +- 47 files changed, 47 insertions(+), 418 deletions(-) delete mode 100644 test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp delete mode 100644 test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.h delete mode 100644 test/mock/services_appmgr_test/include/mock_overlay_manager.h diff --git a/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp b/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp index 94c8a8e6dde..5cf662b863f 100644 --- a/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp +++ b/frameworks/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -466,19 +466,6 @@ bool BundleMgrHelper::GetGroupDir(const std::string &dataGroupId, std::string &d return bundleMgr->GetGroupDir(dataGroupId, dir); } -sptr BundleMgrHelper::GetOverlayManagerProxy() -{ - TAG_LOGD(AAFwkTag::BUNDLEMGRHELPER, "called"); - auto bundleMgr = Connect(); - if (bundleMgr == nullptr) { - TAG_LOGE(AAFwkTag::BUNDLEMGRHELPER, "null bundleMgr"); - return nullptr; - } - - HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - return bundleMgr->GetOverlayManagerProxy(); -} - bool BundleMgrHelper::QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo) { TAG_LOGD(AAFwkTag::BUNDLEMGRHELPER, "called"); diff --git a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp index cab45fda83e..eba6aa4aebf 100644 --- a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp +++ b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp @@ -1435,42 +1435,14 @@ Global::Resource::DeviceType ContextImpl::GetDeviceType() const return deviceType_; } -ErrCode ContextImpl::GetOverlayMgrProxy() -{ - HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - int errCode = GetBundleManager(); - if (errCode != ERR_OK) { - TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode); - return errCode; - } - - std::lock_guard lock(overlayMgrProxyMutex_); - if (overlayMgrProxy_ != nullptr) { - return ERR_OK; - } - - overlayMgrProxy_ = bundleMgr_->GetOverlayManagerProxy(); - if (overlayMgrProxy_ == nullptr) { - TAG_LOGE(AAFwkTag::APPKIT, "null overlayMgrProxy"); - return ERR_NULL_OBJECT; - } - - TAG_LOGD(AAFwkTag::APPKIT, "Success."); - return ERR_OK; -} - int ContextImpl::GetOverlayModuleInfos(const std::string &bundleName, const std::string &moduleName, std::vector &overlayModuleInfos) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - int errCode = GetOverlayMgrProxy(); - if (errCode != ERR_OK) { - TAG_LOGE(AAFwkTag::APPKIT, "failed, errCode: %{public}d", errCode); - return errCode; - } { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "overlayMgrProxy_->GetTargetOverlayModuleInfo"); - auto ret = overlayMgrProxy_->GetTargetOverlayModuleInfo(moduleName, overlayModuleInfos); + auto ret = + AppExecFwk::OverlayManagerClient::GetInstance().GetTargetOverlayModuleInfo(moduleName, overlayModuleInfos); if (ret != ERR_OK) { TAG_LOGD(AAFwkTag::APPKIT, "GetOverlayModuleInfo form bms failed"); return ret; @@ -1634,10 +1606,6 @@ void ContextImpl::ShallowCopySelf(std::shared_ptr &contextImpl) std::lock_guard lock(bundleManagerMutex_); contextImpl->bundleMgr_ = bundleMgr_; } - { - std::lock_guard lock(overlayMgrProxyMutex_); - contextImpl->overlayMgrProxy_ = overlayMgrProxy_; - } contextImpl->resetFlag_ = resetFlag_; contextImpl->processName_ = processName_; } diff --git a/frameworks/native/appkit/app/main_thread.cpp b/frameworks/native/appkit/app/main_thread.cpp index 7b446e28799..c6deafe7047 100644 --- a/frameworks/native/appkit/app/main_thread.cpp +++ b/frameworks/native/appkit/app/main_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -3694,13 +3694,7 @@ int MainThread::GetOverlayModuleInfos(const std::string &bundleName, const std:: return ERR_INVALID_VALUE; } - auto overlayMgrProxy = bundleMgrHelper->GetOverlayManagerProxy(); - if (overlayMgrProxy == nullptr) { - TAG_LOGE(AAFwkTag::APPKIT, "null overlayMgrProxy"); - return ERR_INVALID_VALUE; - } - - auto ret = overlayMgrProxy->GetTargetOverlayModuleInfo(moduleName, overlayModuleInfos); + auto ret = OverlayManagerClient::GetInstance().GetTargetOverlayModuleInfo(moduleName, overlayModuleInfos); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::APPKIT, "failed"); return ret; diff --git a/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h b/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h index 3862786ed6c..0760249732f 100644 --- a/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h +++ b/interfaces/kits/native/appkit/ability_bundle_manager_helper/bundle_mgr_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -60,7 +60,6 @@ public: ErrCode GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo, GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO); bool GetGroupDir(const std::string &dataGroupId, std::string &dir); - sptr GetOverlayManagerProxy(); bool QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo); bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo); bool GetBundleInfos(int32_t flags, diff --git a/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h b/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h index 5e82b637987..04efb58a890 100644 --- a/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h +++ b/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h @@ -19,6 +19,7 @@ #include "context.h" #include "bundle_mgr_interface.h" +#include "overlay_manager_client.h" namespace OHOS { namespace AppExecFwk { @@ -522,7 +523,6 @@ private: int32_t GetBundleInfo(const std::string &bundleName, AppExecFwk::BundleInfo &bundleInfo, bool ¤tBundle); void GetBundleInfo(const std::string &bundleName, AppExecFwk::BundleInfo &bundleInfo, std::shared_ptr inputContext = nullptr); - ErrCode GetOverlayMgrProxy(); void UnsubscribeToOverlayEvents(); void ShallowCopySelf(std::shared_ptr &contextImpl); bool UpdateDisplayConfiguration(std::shared_ptr &contextImpl, uint64_t displayId, @@ -546,8 +546,6 @@ private: std::mutex bundleManagerMutex_; std::shared_ptr bundleMgr_; - std::mutex overlayMgrProxyMutex_; - sptr overlayMgrProxy_ = nullptr; // True: need to get a new fms remote object, // False: no need to get a new fms remote object. diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 9bc66b07c2f..d38e2d4972d 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -67,6 +67,7 @@ #include "kia_interceptor_interface.h" #include "kill_process_config.h" #include "killed_process_info.h" +#include "overlay_manager_client.h" #include "process_memory_state.h" #include "process_util.h" #include "record_query_result.h" diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index d0e90aca3f7..e8cc1b64402 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -3664,22 +3664,19 @@ void AppMgrServiceInner::SetOverlayInfo(const std::string &bundleName, TAG_LOGE(AAFwkTag::APPMGR, "bundleMgrHelper null"); return; } - auto overlayMgrProxy = bundleMgrHelper->GetOverlayManagerProxy(); - if (overlayMgrProxy != nullptr) { - std::vector overlayModuleInfo; - TAG_LOGD(AAFwkTag::APPMGR, "Check overlay app begin."); - HITRACE_METER_NAME(HITRACE_TAG_APP, "BMS->GetOverlayModuleInfoForTarget"); - auto targetRet = IN_PROCESS_CALL(overlayMgrProxy->GetOverlayModuleInfoForTarget( - bundleName, "", overlayModuleInfo, userId)); - if (targetRet == ERR_OK && overlayModuleInfo.size() != 0) { - TAG_LOGD(AAFwkTag::APPMGR, "Start an overlay app process."); - startMsg.flags = startMsg.flags | APP_OVERLAY_FLAG; - std::string overlayInfoPaths; - for (auto it : overlayModuleInfo) { - overlayInfoPaths += (it.hapPath + "|"); - } - startMsg.overlayInfo = overlayInfoPaths; - } + std::vector overlayModuleInfo; + TAG_LOGD(AAFwkTag::APPMGR, "Check overlay app begin."); + HITRACE_METER_NAME(HITRACE_TAG_APP, "BMS->GetOverlayModuleInfoForTarget"); + auto targetRet = IN_PROCESS_CALL(AppExecFwk::OverlayManagerClient::GetInstance().GetOverlayModuleInfoForTarget( + bundleName, "", overlayModuleInfo, userId)); + if (targetRet == ERR_OK && overlayModuleInfo.size() != 0) { + TAG_LOGD(AAFwkTag::APPMGR, "Start an overlay app process."); + startMsg.flags = startMsg.flags | APP_OVERLAY_FLAG; + std::string overlayInfoPaths; + for (auto it : overlayModuleInfo) { + overlayInfoPaths += (it.hapPath + "|"); + } + startMsg.overlayInfo = overlayInfoPaths; } } diff --git a/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp b/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp index a6731b31a39..738d1effdcc 100755 --- a/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp +++ b/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -93,7 +93,6 @@ void BundleMgrHelperFuzztest1(bool boolParam, std::string &stringParam, int32_t bmHelper->GetBundleInfoForSelf(int32Param, bundleInfo); bmHelper->GetDependentBundleInfo(stringParam, bundleInfo, static_cast(int32Param)); bmHelper->GetGroupDir(stringParam, stringParam); - bmHelper->GetOverlayManagerProxy(); bmHelper->QueryAbilityInfo(want, abilityInfo); bmHelper->QueryAbilityInfo(want, int32Param, int32Param, abilityInfo); std::vector bundleInfos; diff --git a/test/mock/common/include/mock_bundle_manager_proxy.h b/test/mock/common/include/mock_bundle_manager_proxy.h index 830968bdb9e..44dd69a1ab1 100644 --- a/test/mock/common/include/mock_bundle_manager_proxy.h +++ b/test/mock/common/include/mock_bundle_manager_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,7 +22,6 @@ #include "iremote_object.h" #include "iremote_stub.h" #include "module_info.h" -#include "mock_overlay_manager.h" namespace OHOS { constexpr int32_t BASE_USER_RANGE = 200000; @@ -55,13 +54,6 @@ public: MOCK_METHOD5(ImplicitQueryInfoByPriority, bool(const Want&, int32_t, int32_t, AppExecFwk::AbilityInfo&, AppExecFwk::ExtensionAbilityInfo&)); - sptr GetOverlayManagerProxy() - { - sptr overlayModuleProxy = - new (std::nothrow) AppExecFwk::OverlayManagerProxy(nullptr); - return overlayModuleProxy; - } - bool GetBundleInfo(const std::string &bundleName, const AppExecFwk::BundleFlag flag, AppExecFwk::BundleInfo &bundleInfo, int32_t userId) override { diff --git a/test/mock/common/include/mock_bundle_manager_service.h b/test/mock/common/include/mock_bundle_manager_service.h index 3250f6078bc..b52197a3562 100644 --- a/test/mock/common/include/mock_bundle_manager_service.h +++ b/test/mock/common/include/mock_bundle_manager_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,7 +22,6 @@ #include "iremote_object.h" #include "iremote_stub.h" #include "module_info.h" -#include "mock_overlay_manager.h" namespace OHOS { namespace { @@ -57,13 +56,6 @@ public: MOCK_METHOD5(ImplicitQueryInfoByPriority, bool(const Want&, int32_t, int32_t, AppExecFwk::AbilityInfo&, AppExecFwk::ExtensionAbilityInfo&)); - sptr GetOverlayManagerProxy() - { - sptr overlayModuleProxy = - new (std::nothrow) AppExecFwk::OverlayManagerProxy(nullptr); - return overlayModuleProxy; - } - bool GetBundleInfo(const std::string &bundleName, const AppExecFwk::BundleFlag flag, AppExecFwk::BundleInfo &bundleInfo, int32_t userId) override { diff --git a/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp b/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp index 40cf3503eac..69554c0a7ca 100644 --- a/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp +++ b/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,7 +17,6 @@ #include #include "ability_info.h" #include "application_info.h" -#include "mock_overlay_manager.h" namespace OHOS { namespace AppExecFwk { @@ -67,12 +66,6 @@ bool BundleMgrProxy::GetHapModuleInfo(const AbilityInfo& abilityInfo, int32_t us return true; } -sptr BundleMgrProxy::GetOverlayManagerProxy() -{ - sptr overlayModuleProxy = new (std::nothrow) OverlayManagerProxy(nullptr); - return overlayModuleProxy; -} - int BundleMgrStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { GTEST_LOG_(INFO) << " BundleMgrStub::OnRemoteRequest"; @@ -137,11 +130,5 @@ bool BundleMgrService::GetHapModuleInfo(const AbilityInfo& abilityInfo, int32_t hapModuleInfo.name = abilityInfo.package; return true; } - -sptr BundleMgrService::GetOverlayManagerProxy() -{ - sptr overlayManagerProxy = new (std::nothrow) OverlayManagerProxy(nullptr); - return overlayManagerProxy; -} } // namespace AppExecFwk } // namespace OHOS diff --git a/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.h b/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.h index 5a5bbd01101..4b6207b85a8 100644 --- a/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.h +++ b/test/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -62,8 +62,6 @@ public: { return ERR_OK; } - - sptr GetOverlayManagerProxy() override; }; class BundleMgrStub : public IRemoteStub { @@ -99,7 +97,6 @@ public: { return ERR_OK; } - sptr GetOverlayManagerProxy() override; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp b/test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp deleted file mode 100644 index bc5914a250b..00000000000 --- a/test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "mock_overlay_manager.h" - -#include "ability_info.h" -#include "application_info.h" - -namespace OHOS { -namespace AppExecFwk { -OverlayManagerProxy::OverlayManagerProxy(const sptr &object) : IRemoteProxy(object) -{} - -ErrCode OverlayManagerProxy::GetTargetOverlayModuleInfo(const std::string &targetModuleName, - std::vector &overlayModuleInfos, int32_t userId) -{ - return ERR_OK; -} - -int OverlayManagerHost::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) -{ - return 0; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.h b/test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.h deleted file mode 100644 index 2f855928b8c..00000000000 --- a/test/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MOCK_OHOS_ABILITY_RUNTIME_MOCK_OVERLAY_MANAGER_H -#define MOCK_OHOS_ABILITY_RUNTIME_MOCK_OVERLAY_MANAGER_H - -#include -#include "ability_info.h" -#include "application_info.h" -#include "want.h" -#include "iremote_proxy.h" -#include "iremote_stub.h" -#include "overlay_manager_interface.h" - -namespace OHOS { -namespace AppExecFwk { -class OverlayManagerProxy : public IRemoteProxy { -public: - explicit OverlayManagerProxy(const sptr &object); - virtual ~OverlayManagerProxy() - {} - - virtual ErrCode GetTargetOverlayModuleInfo(const std::string &targetModuleName, - std::vector &overlayModuleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) override; -}; - -class OverlayManagerHost : public IRemoteStub { -public: - int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; -}; -} // namespace AppExecFwk -} // namespace OHOS - -#endif // MOCK_OHOS_ABILITY_RUNTIME_MOCK_OVERLAY_MANAGER_H diff --git a/test/mock/services_appmgr_test/include/mock_bundle_manager.h b/test/mock/services_appmgr_test/include/mock_bundle_manager.h index 78c15388e17..2b629d9c0c0 100644 --- a/test/mock/services_appmgr_test/include/mock_bundle_manager.h +++ b/test/mock/services_appmgr_test/include/mock_bundle_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -76,8 +76,6 @@ public: { return ERR_OK; } - - sptr GetOverlayManagerProxy() override; }; class BundleMgrStub : public IRemoteStub { @@ -155,7 +153,6 @@ public: { return ERR_OK; } - sptr GetOverlayManagerProxy() override; private: std::vector bundleInfos_; sptr quickFixManager_ = nullptr; diff --git a/test/mock/services_appmgr_test/include/mock_overlay_manager.h b/test/mock/services_appmgr_test/include/mock_overlay_manager.h deleted file mode 100644 index 2f855928b8c..00000000000 --- a/test/mock/services_appmgr_test/include/mock_overlay_manager.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef MOCK_OHOS_ABILITY_RUNTIME_MOCK_OVERLAY_MANAGER_H -#define MOCK_OHOS_ABILITY_RUNTIME_MOCK_OVERLAY_MANAGER_H - -#include -#include "ability_info.h" -#include "application_info.h" -#include "want.h" -#include "iremote_proxy.h" -#include "iremote_stub.h" -#include "overlay_manager_interface.h" - -namespace OHOS { -namespace AppExecFwk { -class OverlayManagerProxy : public IRemoteProxy { -public: - explicit OverlayManagerProxy(const sptr &object); - virtual ~OverlayManagerProxy() - {} - - virtual ErrCode GetTargetOverlayModuleInfo(const std::string &targetModuleName, - std::vector &overlayModuleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) override; -}; - -class OverlayManagerHost : public IRemoteStub { -public: - int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; -}; -} // namespace AppExecFwk -} // namespace OHOS - -#endif // MOCK_OHOS_ABILITY_RUNTIME_MOCK_OVERLAY_MANAGER_H diff --git a/test/mock/services_appmgr_test/src/mock_bundle_manager.cpp b/test/mock/services_appmgr_test/src/mock_bundle_manager.cpp index 63e480a21e4..0b503c781f8 100644 --- a/test/mock/services_appmgr_test/src/mock_bundle_manager.cpp +++ b/test/mock/services_appmgr_test/src/mock_bundle_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,7 +19,6 @@ #include "ability_info.h" #include "application_info.h" #include "hilog_tag_wrapper.h" -#include "mock_overlay_manager.h" namespace { const int32_t HQF_VERSION_CODE = 1000; } @@ -123,12 +122,6 @@ std::string BundleMgrProxy::GetAppType(const std::string& bundleName) return "system"; } -sptr BundleMgrProxy::GetOverlayManagerProxy() -{ - sptr overlayModuleProxy = new (std::nothrow) OverlayManagerProxy(nullptr); - return overlayModuleProxy; -} - int BundleMgrStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { return 0; @@ -385,11 +378,5 @@ ErrCode BundleMgrService::GetBundleInfoForSelf(int32_t flags, BundleInfo &bundle } return ERR_OK; } - -sptr BundleMgrService::GetOverlayManagerProxy() -{ - sptr overlayManagerProxy = new (std::nothrow) OverlayManagerProxy(nullptr); - return overlayManagerProxy; -} } // namespace AppExecFwk } // namespace OHOS diff --git a/test/mock/services_appmgr_test/src/mock_overlay_manager.cpp b/test/mock/services_appmgr_test/src/mock_overlay_manager.cpp index c8198657d0a..5b84dd237db 100644 --- a/test/mock/services_appmgr_test/src/mock_overlay_manager.cpp +++ b/test/mock/services_appmgr_test/src/mock_overlay_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "mock_overlay_manager.h" #include #include "mock_bundle_manager.h" @@ -22,15 +21,6 @@ namespace OHOS { namespace AppExecFwk { -OverlayManagerProxy::OverlayManagerProxy(const sptr &object) : IRemoteProxy(object) -{} - -ErrCode OverlayManagerProxy::GetTargetOverlayModuleInfo(const std::string &targetModuleName, - std::vector &overlayModuleInfos, int32_t userId) -{ - return ERR_OK; -} - int OverlayManagerHost::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { return 0; diff --git a/test/moduletest/ability_test/BUILD.gn b/test/moduletest/ability_test/BUILD.gn index b4490926194..ce43f39d9a7 100644 --- a/test/moduletest/ability_test/BUILD.gn +++ b/test/moduletest/ability_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,7 +41,6 @@ ohos_moduletest("ability_moduletest") { module_out_path = module_output_path sources = [ "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_test/AMS/mock_ability_manager_client.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_test/AMS/mock_ability_manager_service.cpp", @@ -103,7 +102,6 @@ ohos_moduletest("ability_conetxt_test") { module_out_path = module_output_path sources = [ "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_test/AMS/mock_ability_manager_client.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_test/AMS/mock_serviceability_manager_service.cpp", @@ -194,7 +192,6 @@ ohos_moduletest("data_ability_operation_moduletest") { module_out_path = module_output_path sources = [ "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_test/AMS/mock_ability_manager_client.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_test/AMS/mock_ability_manager_service.cpp", diff --git a/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn b/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn index a81da9d4457..e160c611d99 100644 --- a/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn +++ b/test/moduletest/quick_fix/quick_fix_manager_module_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -26,7 +26,6 @@ ohos_moduletest("quick_fix_manager_module_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp", "quick_fix_manager_module_test.cpp", ] diff --git a/test/unittest/ability_permission_util_second_test/mock/src/mock_bundle_mgr_helper.cpp b/test/unittest/ability_permission_util_second_test/mock/src/mock_bundle_mgr_helper.cpp index b49f03f696f..f7bed0b8e93 100755 --- a/test/unittest/ability_permission_util_second_test/mock/src/mock_bundle_mgr_helper.cpp +++ b/test/unittest/ability_permission_util_second_test/mock/src/mock_bundle_mgr_helper.cpp @@ -154,12 +154,6 @@ bool BundleMgrHelper::GetGroupDir(const std::string& dataGroupId, std::string& d return false; } -sptr BundleMgrHelper::GetOverlayManagerProxy() -{ - sptr getOverlay_ = nullptr; - return getOverlay_; -} - bool BundleMgrHelper::QueryAbilityInfo(const Want& want, AbilityInfo& abilityInfo) { return false; diff --git a/test/unittest/ams_app_death_recipient_test/BUILD.gn b/test/unittest/ams_app_death_recipient_test/BUILD.gn index 61c2a129d0f..c5a08449df5 100644 --- a/test/unittest/ams_app_death_recipient_test/BUILD.gn +++ b/test/unittest/ams_app_death_recipient_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -21,7 +21,6 @@ ohos_unittest("AppDeathRecipientTest") { cflags_cc = [] sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "ams_app_death_recipient_test.cpp", ] diff --git a/test/unittest/ams_app_life_cycle_test/BUILD.gn b/test/unittest/ams_app_life_cycle_test/BUILD.gn index 384f8fa973a..110ee95a04e 100644 --- a/test/unittest/ams_app_life_cycle_test/BUILD.gn +++ b/test/unittest/ams_app_life_cycle_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -40,7 +40,6 @@ ohos_unittest("AmsAppLifeCycleTest") { "${ability_runtime_services_path}/appmgr/src/module_running_record.cpp", "${ability_runtime_services_path}/appmgr/src/remote_client_manager.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", ] sources += [ "ams_app_life_cycle_test.cpp" ] diff --git a/test/unittest/ams_app_running_record_test/BUILD.gn b/test/unittest/ams_app_running_record_test/BUILD.gn index f14a268f81d..6562bb822da 100644 --- a/test/unittest/ams_app_running_record_test/BUILD.gn +++ b/test/unittest/ams_app_running_record_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -36,7 +36,6 @@ ohos_unittest("AmsAppRunningRecordTest") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "ams_app_running_record_test.cpp", ] diff --git a/test/unittest/ams_mgr_scheduler_second_test/BUILD.gn b/test/unittest/ams_mgr_scheduler_second_test/BUILD.gn index 8f5da579d8d..d85efcc4375 100644 --- a/test/unittest/ams_mgr_scheduler_second_test/BUILD.gn +++ b/test/unittest/ams_mgr_scheduler_second_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,7 +41,6 @@ ohos_unittest("ams_mgr_scheduler_second_test") { "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp", "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "mock/src/mock_ipc_skeleton.cpp", "mock/src/mock_my_flag.cpp", "mock/src/mock_permission_verification.cpp", diff --git a/test/unittest/ams_mgr_scheduler_test/BUILD.gn b/test/unittest/ams_mgr_scheduler_test/BUILD.gn index 81afb0159e3..bb789860754 100644 --- a/test/unittest/ams_mgr_scheduler_test/BUILD.gn +++ b/test/unittest/ams_mgr_scheduler_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,7 +38,6 @@ ohos_unittest("ams_mgr_scheduler_test") { sources = [ "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "mock/src/mock_my_flag.cpp", "mock/src/mock_permission_verification.cpp", ] diff --git a/test/unittest/ams_recent_app_list_test/BUILD.gn b/test/unittest/ams_recent_app_list_test/BUILD.gn index 1c4b9e155f4..adc5b82f538 100644 --- a/test/unittest/ams_recent_app_list_test/BUILD.gn +++ b/test/unittest/ams_recent_app_list_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -49,7 +49,6 @@ ohos_unittest("AmsRecentAppListTest") { "${ability_runtime_services_path}/appmgr/src/window_focus_changed_listener.cpp", "${ability_runtime_services_path}/appmgr/src/window_visibility_changed_listener.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", ] sources += [ "ams_recent_app_list_test.cpp" ] diff --git a/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 6e21ffaa9de..6644d751d24 100644 --- a/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -56,7 +56,6 @@ ohos_unittest("AmsServiceLoadAbilityProcessTest") { "${ability_runtime_services_path}/appmgr/src/window_focus_changed_listener.cpp", "${ability_runtime_services_path}/appmgr/src/window_visibility_changed_listener.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", ] sources += [ "ams_service_load_ability_process_test.cpp" ] diff --git a/test/unittest/app_mgr_service_fourth_test/mock/include/mock_bundle_mgr_helper.h b/test/unittest/app_mgr_service_fourth_test/mock/include/mock_bundle_mgr_helper.h index 68693fbcd7d..4a11faf87ae 100755 --- a/test/unittest/app_mgr_service_fourth_test/mock/include/mock_bundle_mgr_helper.h +++ b/test/unittest/app_mgr_service_fourth_test/mock/include/mock_bundle_mgr_helper.h @@ -55,7 +55,6 @@ public: ErrCode GetDependentBundleInfo(const std::string& sharedBundleName, BundleInfo& sharedBundleInfo, GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO); bool GetGroupDir(const std::string& dataGroupId, std::string& dir); - sptr GetOverlayManagerProxy(); bool QueryAbilityInfo(const Want& want, AbilityInfo& abilityInfo); bool QueryAbilityInfo(const Want& want, int32_t flags, int32_t userId, AbilityInfo& abilityInfo); bool GetBundleInfos( diff --git a/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h b/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h index 5436fc4dbf6..6a5fba1ad05 100755 --- a/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h +++ b/test/unittest/app_mgr_service_inner_eighth_test/mock/include/mock_my_status.h @@ -92,7 +92,6 @@ public: bool getApplicationInfo_ = false; AppExecFwk::ApplicationInfo applicationInfo_; int getOverlayCall_ = 0; - sptr getOverlay_ = nullptr; int getBaseSharedBundleInfos_ = 0; std::vector baseSharedBundleInfos_; bool queryDataGroupInfos_ = false; diff --git a/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_bundle_mgr_helper.cpp b/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_bundle_mgr_helper.cpp index 817574298de..48fc8df834f 100755 --- a/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_bundle_mgr_helper.cpp +++ b/test/unittest/app_mgr_service_inner_eighth_test/mock/src/mock_bundle_mgr_helper.cpp @@ -148,12 +148,6 @@ bool BundleMgrHelper::GetGroupDir(const std::string& dataGroupId, std::string& d return false; } -sptr BundleMgrHelper::GetOverlayManagerProxy() -{ - AAFwk::MyStatus::GetInstance().getOverlayCall_++; - return AAFwk::MyStatus::GetInstance().getOverlay_; -} - bool BundleMgrHelper::QueryAbilityInfo(const Want& want, AbilityInfo& abilityInfo) { return false; diff --git a/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_bundle_mgr_helper.cpp b/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_bundle_mgr_helper.cpp index 817574298de..48fc8df834f 100644 --- a/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_bundle_mgr_helper.cpp +++ b/test/unittest/app_mgr_service_inner_ninth_test/mock/src/mock_bundle_mgr_helper.cpp @@ -148,12 +148,6 @@ bool BundleMgrHelper::GetGroupDir(const std::string& dataGroupId, std::string& d return false; } -sptr BundleMgrHelper::GetOverlayManagerProxy() -{ - AAFwk::MyStatus::GetInstance().getOverlayCall_++; - return AAFwk::MyStatus::GetInstance().getOverlay_; -} - bool BundleMgrHelper::QueryAbilityInfo(const Want& want, AbilityInfo& abilityInfo) { return false; diff --git a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp index 65aa161005f..cf5574d0d86 100644 --- a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp +++ b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp @@ -1063,67 +1063,6 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartPerfProcessByStartMsg_002, TestSize TAG_LOGI(AAFwkTag::TEST, "StartPerfProcessByStartMsg_002 end"); } -/** -* @tc.name: SetOverlayInfo_001 -* @tc.desc: test SetOverlayInfo_001 -* @tc.type: FUNC -*/ -HWTEST_F(AppMgrServiceInnerSeventhTest, SetOverlayInfo_001, TestSize.Level1) -{ - TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_001 start"); - auto appMgrServiceInner = std::make_shared(); - AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = nullptr; - AAFwk::MyStatus::GetInstance().getOverlayCall_ = 0; - - std::string bundleName = ""; - int32_t userId = 0; - AppSpawnStartMsg startMs; - appMgrServiceInner->SetOverlayInfo(bundleName, userId, startMs); - EXPECT_EQ(AAFwk::MyStatus::GetInstance().getOverlayCall_, 0); - TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_001 end"); -} - -/** -* @tc.name: SetOverlayInfo_002 -* @tc.desc: test SetOverlayInfo_002 -* @tc.type: FUNC -*/ -HWTEST_F(AppMgrServiceInnerSeventhTest, SetOverlayInfo_002, TestSize.Level1) -{ - TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_002 start"); - auto appMgrServiceInner = std::make_shared(); - AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = std::make_shared(); - AAFwk::MyStatus::GetInstance().getOverlayCall_ = 0; - - std::string bundleName = ""; - int32_t userId = 0; - AppSpawnStartMsg startMs; - appMgrServiceInner->SetOverlayInfo(bundleName, userId, startMs); - EXPECT_EQ(AAFwk::MyStatus::GetInstance().getOverlayCall_, 1); - TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_002 end"); -} - -/** -* @tc.name: SetOverlayInfo_003 -* @tc.desc: test SetOverlayInfo_003 -* @tc.type: FUNC -*/ -HWTEST_F(AppMgrServiceInnerSeventhTest, SetOverlayInfo_003, TestSize.Level1) -{ - TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_003 start"); - auto appMgrServiceInner = std::make_shared(); - AAFwk::MyStatus::GetInstance().getBundleManagerHelper_ = std::make_shared(); - AAFwk::MyStatus::GetInstance().getOverlayCall_ = 0; - AAFwk::MyStatus::GetInstance().getOverlay_ = new (std::nothrow) AppExecFwk::OverlayManagerProxy(nullptr); - - std::string bundleName = ""; - int32_t userId = 0; - AppSpawnStartMsg startMs; - appMgrServiceInner->SetOverlayInfo(bundleName, userId, startMs); - EXPECT_EQ(AAFwk::MyStatus::GetInstance().getOverlayCall_, 1); - TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_003 end"); -} - /** * @tc.name: CreatNewStartMsg_001 * @tc.desc: test CreatNewStartMsg_001 diff --git a/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_bundle_mgr_helper.cpp b/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_bundle_mgr_helper.cpp index 88fbfdea14d..0ff691cc89a 100755 --- a/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_bundle_mgr_helper.cpp +++ b/test/unittest/app_mgr_service_inner_seventh_test/mock/src/mock_bundle_mgr_helper.cpp @@ -148,12 +148,6 @@ bool BundleMgrHelper::GetGroupDir(const std::string& dataGroupId, std::string& d return false; } -sptr BundleMgrHelper::GetOverlayManagerProxy() -{ - AAFwk::MyStatus::GetInstance().getOverlayCall_++; - return AAFwk::MyStatus::GetInstance().getOverlay_; -} - bool BundleMgrHelper::QueryAbilityInfo(const Want& want, AbilityInfo& abilityInfo) { return false; diff --git a/test/unittest/app_mgr_service_inner_sixth_test/mock/include/mock_bundle_mgr_helper.h b/test/unittest/app_mgr_service_inner_sixth_test/mock/include/mock_bundle_mgr_helper.h index e6862802f30..babdbe4f78d 100755 --- a/test/unittest/app_mgr_service_inner_sixth_test/mock/include/mock_bundle_mgr_helper.h +++ b/test/unittest/app_mgr_service_inner_sixth_test/mock/include/mock_bundle_mgr_helper.h @@ -57,7 +57,6 @@ public: ErrCode GetDependentBundleInfo(const std::string& sharedBundleName, BundleInfo& sharedBundleInfo, GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO); bool GetGroupDir(const std::string& dataGroupId, std::string& dir); - sptr GetOverlayManagerProxy(); bool QueryAbilityInfo(const Want& want, AbilityInfo& abilityInfo); bool QueryAbilityInfo(const Want& want, int32_t flags, int32_t userId, AbilityInfo& abilityInfo); bool GetBundleInfos( diff --git a/test/unittest/app_running_processes_info_test/BUILD.gn b/test/unittest/app_running_processes_info_test/BUILD.gn index 38ca4ebfca0..4db7e2c0608 100644 --- a/test/unittest/app_running_processes_info_test/BUILD.gn +++ b/test/unittest/app_running_processes_info_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -48,7 +48,6 @@ ohos_unittest("AppRunningProcessesInfoTest") { "${ability_runtime_services_path}/appmgr/src/user_record_manager.cpp", "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", ] sources += [ "app_running_processes_info_test.cpp" ] diff --git a/test/unittest/appkit/main_fourth_test/BUILD.gn b/test/unittest/appkit/main_fourth_test/BUILD.gn index 1cca5d29256..dee45bc5b4e 100644 --- a/test/unittest/appkit/main_fourth_test/BUILD.gn +++ b/test/unittest/appkit/main_fourth_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -25,7 +25,6 @@ ohos_unittest("main_fourth_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/sys_mgr_client_mock.cpp", "main_fourth_test.cpp", ] @@ -83,7 +82,6 @@ ohos_unittest("main_fourth_by_mock_bms_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/sys_mgr_client_mock.cpp", "main_fourth_by_mock_bms_test.cpp", ] diff --git a/test/unittest/appkit/main_fourth_test/main_fourth_by_mock_bms_test.cpp b/test/unittest/appkit/main_fourth_test/main_fourth_by_mock_bms_test.cpp index 89e6fcd8465..18d609163a8 100644 --- a/test/unittest/appkit/main_fourth_test/main_fourth_by_mock_bms_test.cpp +++ b/test/unittest/appkit/main_fourth_test/main_fourth_by_mock_bms_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,7 +23,6 @@ #include "main_thread.h" #include "mock_bundle_installer_service.h" #include "mock_bundle_manager.h" -#include "mock_overlay_manager.h" #include "mock_system_ability_manager.h" #include "ohos_application.h" #include "process_info.h" diff --git a/test/unittest/appkit/main_thread_test/BUILD.gn b/test/unittest/appkit/main_thread_test/BUILD.gn index a48709c3575..fd2c5f19767 100644 --- a/test/unittest/appkit/main_thread_test/BUILD.gn +++ b/test/unittest/appkit/main_thread_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -25,7 +25,6 @@ ohos_unittest("main_thread_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/sys_mgr_client_mock.cpp", "main_thread_test.cpp", ] @@ -83,7 +82,6 @@ ohos_unittest("main_thread_by_mock_bms_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/services_appmgr_test/src/sys_mgr_client_mock.cpp", "main_thread_by_mock_bms_test.cpp", ] diff --git a/test/unittest/appkit/main_thread_test/main_thread_by_mock_bms_test.cpp b/test/unittest/appkit/main_thread_test/main_thread_by_mock_bms_test.cpp index 89e6fcd8465..18d609163a8 100644 --- a/test/unittest/appkit/main_thread_test/main_thread_by_mock_bms_test.cpp +++ b/test/unittest/appkit/main_thread_test/main_thread_by_mock_bms_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,7 +23,6 @@ #include "main_thread.h" #include "mock_bundle_installer_service.h" #include "mock_bundle_manager.h" -#include "mock_overlay_manager.h" #include "mock_system_ability_manager.h" #include "ohos_application.h" #include "process_info.h" diff --git a/test/unittest/bundle_mgr_helper_test/bundle_mgr_helper_test.cpp b/test/unittest/bundle_mgr_helper_test/bundle_mgr_helper_test.cpp index 7624899366b..d8763e37d4c 100644 --- a/test/unittest/bundle_mgr_helper_test/bundle_mgr_helper_test.cpp +++ b/test/unittest/bundle_mgr_helper_test/bundle_mgr_helper_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -167,17 +167,6 @@ HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_GetGroupDir_001, TestSize.Leve EXPECT_EQ(ret, false); } -/** - * @tc.name: BundleMgrHelperTest_GetOverlayManagerProxy_001 - * @tc.desc: GetOverlayManagerProxy - * @tc.type: FUNC - */ -HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_GetOverlayManagerProxy_001, TestSize.Level1) -{ - auto ret = bundleMgrHelper->GetOverlayManagerProxy(); - EXPECT_NE(ret, nullptr); -} - /** * @tc.name: BundleMgrHelperTest_QueryAbilityInfo_002 * @tc.desc: QueryAbilityInfo diff --git a/test/unittest/cj_ability_stage_object_test/BUILD.gn b/test/unittest/cj_ability_stage_object_test/BUILD.gn index 2f3502ed99c..426e3e1f150 100644 --- a/test/unittest/cj_ability_stage_object_test/BUILD.gn +++ b/test/unittest/cj_ability_stage_object_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -39,7 +39,6 @@ ohos_unittest("cj_ability_stage_object_test") { "${ability_runtime_path}/frameworks/native/appkit/ability_runtime/app/cj_ability_stage_context.cpp", "${ability_runtime_path}/frameworks/native/appkit/ability_runtime/app/cj_ability_stage_object.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "cj_ability_stage_object_test.cpp", ] diff --git a/test/unittest/cj_ability_stage_test/BUILD.gn b/test/unittest/cj_ability_stage_test/BUILD.gn index 65d21dfbae7..770304f7ec0 100644 --- a/test/unittest/cj_ability_stage_test/BUILD.gn +++ b/test/unittest/cj_ability_stage_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,7 +38,6 @@ ohos_unittest("cj_ability_stage_test") { "${ability_runtime_path}/frameworks/native/appkit/ability_runtime/app/cj_ability_stage.cpp", "${ability_runtime_path}/frameworks/native/appkit/ability_runtime/app/cj_ability_stage_context.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "cj_ability_stage_test.cpp", ] diff --git a/test/unittest/frameworks_kits_ability_native_test/BUILD.gn b/test/unittest/frameworks_kits_ability_native_test/BUILD.gn index 475cb31348a..6864309cbf9 100644 --- a/test/unittest/frameworks_kits_ability_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_ability_native_test/BUILD.gn @@ -259,7 +259,6 @@ ohos_unittest("ability_context_test") { "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_clientex.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_service.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "ability_context_test.cpp", ] @@ -1863,7 +1862,6 @@ ohos_unittest("ability_permission_test") { sources = [ "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_ability_manager_service.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "ability_permission_test.cpp", ] diff --git a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn index edff3a58eaa..9b4e0f03fa0 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn @@ -101,7 +101,6 @@ ohos_unittest("application_test") { "${ability_runtime_native_path}/appkit/app/application_cleaner.cpp", "${ability_runtime_native_path}/appkit/app/ohos_application.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "application_test.cpp", ] @@ -343,7 +342,6 @@ ohos_unittest("context_container_test") { "${ability_runtime_native_path}/appkit/app/application_cleaner.cpp", "${ability_runtime_native_path}/appkit/app/ohos_application.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "context_container_test.cpp", ] @@ -536,7 +534,6 @@ ohos_unittest("context_deal_test") { "${ability_runtime_native_path}/appkit/app/application_cleaner.cpp", "${ability_runtime_native_path}/appkit/app/ohos_application.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include/mock_ability_manager_client.cpp", "context_deal_test.cpp", @@ -692,7 +689,6 @@ ohos_unittest("ability_stage_test") { sources = [ "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/mock_overlay_manager.cpp", "${ability_runtime_test_path}/mock/frameworks_kits_ability_native_test/include/sys_mgr_client_mock.cpp", "ability_stage_test.cpp", "application_data_manager_test.cpp", diff --git a/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn b/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn index fae57fb64e6..1392b0e33d8 100644 --- a/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn +++ b/test/unittest/quick_fix/quick_fix_manager_service_second_test/BUILD.gn @@ -28,7 +28,6 @@ ohos_unittest("quick_fix_manager_service_second_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp", "mock/src/mock_my_flag.cpp", "mock/src/mock_permission_verification.cpp", diff --git a/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn b/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn index e35e6e9b2e2..c865b4176e7 100644 --- a/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn +++ b/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -27,7 +27,6 @@ ohos_unittest("quick_fix_manager_service_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp", "quick_fix_manager_service_test.cpp", ] @@ -77,7 +76,6 @@ ohos_unittest("quick_fix_manager_apply_task_test") { sources = [ "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp", - "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp", "${ability_runtime_test_path}/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp", "quick_fix_manager_apply_task_test.cpp", ] -- Gitee