From 8f8b9976448b094bd61b7ea9db667dffc7f48731 Mon Sep 17 00:00:00 2001 From: lanhaoyu Date: Tue, 17 Jun 2025 14:30:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Ddefault=5Fapp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lanhaoyu --- .../bundle_mgr_helper.cpp | 13 ----------- .../bundle_mgr_helper.h | 1 - .../include/implicit_start_processor.h | 1 - .../src/implicit_start_processor.cpp | 22 +++---------------- .../bundlemgrhelper_fuzzer.cpp | 1 - .../mock/src/mock_bundle_mgr_helper.cpp | 5 ----- .../mock/include/mock_bundle_mgr_helper.h | 1 - .../mock/src/mock_bundle_mgr_helper.cpp | 5 ----- .../mock/src/mock_bundle_mgr_helper.cpp | 5 ----- .../mock/src/mock_bundle_mgr_helper.cpp | 5 ----- .../mock/include/mock_bundle_mgr_helper.h | 1 - .../bundle_mgr_helper_test.cpp | 11 ---------- .../implicit_start_processor_test.cpp | 15 ------------- 13 files changed, 3 insertions(+), 83 deletions(-) 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..e2c139fe30c 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 @@ -900,19 +900,6 @@ ErrCode BundleMgrHelper::QueryExtensionAbilityInfosOnlyWithTypeName(const std::s return bundleMgr->QueryExtensionAbilityInfosOnlyWithTypeName(extensionTypeName, flag, userId, extensionInfos); } -sptr BundleMgrHelper::GetDefaultAppProxy() -{ - 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->GetDefaultAppProxy(); -} - ErrCode BundleMgrHelper::GetJsonProfile(ProfileType profileType, const std::string &bundleName, const std::string &moduleName, std::string &profile, int32_t userId) { 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..1181ca97211 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 @@ -101,7 +101,6 @@ public: ErrCode GetUidByBundleName(const std::string &bundleName, int32_t userId, int32_t appCloneIndex); ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string &extensionTypeName, const uint32_t flag, const int32_t userId, std::vector &extensionInfos); - sptr GetDefaultAppProxy(); ErrCode GetLaunchWantForBundle(const std::string &bundleName, Want &want, int32_t userId); ErrCode QueryCloneAbilityInfo(const ElementName &element, int32_t flags, int32_t appCloneIndex, AbilityInfo &abilityInfo, int32_t userId); diff --git a/services/abilitymgr/include/implicit_start_processor.h b/services/abilitymgr/include/implicit_start_processor.h index fe0f546095f..6a0407526d8 100644 --- a/services/abilitymgr/include/implicit_start_processor.h +++ b/services/abilitymgr/include/implicit_start_processor.h @@ -106,7 +106,6 @@ private: bool FilterAbilityList(const Want &want, std::vector &abilityInfos, std::vector extensionInfos, int32_t userId); - sptr GetDefaultAppProxy(); void GetEcologicalCallerInfo(const Want &want, ErmsCallerInfo &callerInfo, int32_t userId); diff --git a/services/abilitymgr/src/implicit_start_processor.cpp b/services/abilitymgr/src/implicit_start_processor.cpp index 9ad8163c34b..4fad9f6dd18 100644 --- a/services/abilitymgr/src/implicit_start_processor.cpp +++ b/services/abilitymgr/src/implicit_start_processor.cpp @@ -17,6 +17,7 @@ #include "ability_manager_service.h" #include "ability_util.h" #include "app_utils.h" +#include "default_app_client.h" #include "dialog_session_manager.h" #include "ecological_rule/ability_ecological_rule_mgr_service.h" #include "global_constant.h" @@ -823,21 +824,6 @@ std::shared_ptr ImplicitStartProcessor::GetBundleMa return iBundleManagerHelper_; } -sptr ImplicitStartProcessor::GetDefaultAppProxy() -{ - auto bundleMgrHelper = GetBundleManagerHelper(); - if (bundleMgrHelper == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null bundleMgrHelper"); - return nullptr; - } - auto defaultAppProxy = bundleMgrHelper->GetDefaultAppProxy(); - if (defaultAppProxy == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null defaultAppProxy"); - return nullptr; - } - return defaultAppProxy; -} - bool ImplicitStartProcessor::FilterAbilityList(const Want &want, std::vector &abilityInfos, std::vector extensionInfos, int32_t userId) { @@ -973,12 +959,10 @@ void ImplicitStartProcessor::AddAbilityInfoToDialogInfos(const AddInfoParam &par bool ImplicitStartProcessor::IsExistDefaultApp(int32_t userId, const std::string &typeName) { - auto defaultMgr = GetDefaultAppProxy(); - CHECK_POINTER_AND_RETURN_LOG(defaultMgr, false, "defaultMgr null"); AppExecFwk::BundleInfo bundleInfo; TAG_LOGD(AAFwkTag::ABILITYMGR, "userId: %{public}d, typeName: %{public}s", userId, typeName.c_str()); - ErrCode ret = - IN_PROCESS_CALL(defaultMgr->GetDefaultApplication(userId, typeName, bundleInfo)); + ErrCode ret = IN_PROCESS_CALL( + AppExecFwk::DefaultAppClient::GetInstance().GetDefaultApplication(userId, typeName, bundleInfo)); if (ret != ERR_OK) { return false; } diff --git a/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp b/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp index a6731b31a39..c3ab84d991d 100755 --- a/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp +++ b/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp @@ -134,7 +134,6 @@ void BundleMgrHelperFuzztest2(bool boolParam, std::string &stringParam, int32_t bmHelper->QueryAppGalleryBundleName(stringParam); bmHelper->GetUidByBundleName(stringParam, int32Param, int32Param); bmHelper->QueryExtensionAbilityInfosOnlyWithTypeName(stringParam, int32Param, int32Param, extensionInfos); - bmHelper->GetDefaultAppProxy(); bmHelper->GetJsonProfile(static_cast(int32Param), stringParam, stringParam, stringParam, int32Param); bmHelper->GetLaunchWantForBundle(stringParam, want, int32Param); ElementName element; 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..8f809aa3b72 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 @@ -307,11 +307,6 @@ ErrCode BundleMgrHelper::QueryExtensionAbilityInfosOnlyWithTypeName(const std::s return ERR_OK; } -sptr BundleMgrHelper::GetDefaultAppProxy() -{ - return nullptr; -} - ErrCode BundleMgrHelper::GetLaunchWantForBundle(const std::string& bundleName, Want& want, int32_t userId) { return ERR_OK; 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..ff966aa3389 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 @@ -95,7 +95,6 @@ public: ErrCode GetUidByBundleName(const std::string& bundleName, int32_t userId, int32_t appCloneIndex); ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string& extensionTypeName, const uint32_t flag, const int32_t userId, std::vector& extensionInfos); - sptr GetDefaultAppProxy(); ErrCode GetLaunchWantForBundle(const std::string& bundleName, Want& want, int32_t userId); ErrCode QueryCloneAbilityInfo( const ElementName& element, int32_t flags, int32_t appCloneIndex, AbilityInfo& abilityInfo, int32_t userId); 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..62337df0ce0 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 @@ -305,11 +305,6 @@ ErrCode BundleMgrHelper::QueryExtensionAbilityInfosOnlyWithTypeName(const std::s return ERR_OK; } -sptr BundleMgrHelper::GetDefaultAppProxy() -{ - return nullptr; -} - ErrCode BundleMgrHelper::GetLaunchWantForBundle(const std::string& bundleName, Want& want, int32_t userId) { return ERR_OK; 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..62337df0ce0 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 @@ -305,11 +305,6 @@ ErrCode BundleMgrHelper::QueryExtensionAbilityInfosOnlyWithTypeName(const std::s return ERR_OK; } -sptr BundleMgrHelper::GetDefaultAppProxy() -{ - return nullptr; -} - ErrCode BundleMgrHelper::GetLaunchWantForBundle(const std::string& bundleName, Want& want, int32_t userId) { return ERR_OK; 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..bf2507b34a5 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 @@ -303,11 +303,6 @@ ErrCode BundleMgrHelper::QueryExtensionAbilityInfosOnlyWithTypeName(const std::s return ERR_OK; } -sptr BundleMgrHelper::GetDefaultAppProxy() -{ - return nullptr; -} - ErrCode BundleMgrHelper::GetLaunchWantForBundle(const std::string& bundleName, Want& want, int32_t userId) { return ERR_OK; 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..46930a2f251 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 @@ -97,7 +97,6 @@ public: ErrCode GetUidByBundleName(const std::string& bundleName, int32_t userId, int32_t appCloneIndex); ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string& extensionTypeName, const uint32_t flag, const int32_t userId, std::vector& extensionInfos); - sptr GetDefaultAppProxy(); ErrCode GetLaunchWantForBundle(const std::string& bundleName, Want& want, int32_t userId); ErrCode QueryCloneAbilityInfo( const ElementName& element, int32_t flags, int32_t appCloneIndex, AbilityInfo& abilityInfo, int32_t userId); 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..a674dc5872b 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 @@ -498,17 +498,6 @@ HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_QueryAbilityInfo_003, TestSize EXPECT_EQ(ret, false); } -/** - * @tc.name: BundleMgrHelperTest_GetDefaultAppProxy_001 - * @tc.desc: GetDefaultAppProxy - * @tc.type: FUNC - */ -HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_GetDefaultAppProxy_001, TestSize.Level1) -{ - auto ret = bundleMgrHelper->GetDefaultAppProxy(); - EXPECT_NE(ret, nullptr); -} - #ifdef WITH_DLP /** * @tc.name: BundleMgrHelperTest_InstallSandboxApp_001 diff --git a/test/unittest/implicit_start_processor_test/implicit_start_processor_test.cpp b/test/unittest/implicit_start_processor_test/implicit_start_processor_test.cpp index 6cdb8fee688..a240b3d1bc3 100644 --- a/test/unittest/implicit_start_processor_test/implicit_start_processor_test.cpp +++ b/test/unittest/implicit_start_processor_test/implicit_start_processor_test.cpp @@ -990,21 +990,6 @@ HWTEST_F(ImplicitStartProcessorTest, OnlyKeepReserveApp_005, TestSize.Level1) } } -/* - * Feature: ImplicitStartProcessor - * Function: GetDefaultAppProxy - * SubFunction: NA - * FunctionPoints:ImplicitStartProcessor GetDefaultAppProxy - * EnvConditions: NA - * CaseDescription: Verify GetDefaultAppProxy etc. - */ -HWTEST_F(ImplicitStartProcessorTest, GetDefaultAppProxy_001, TestSize.Level1) -{ - auto processor = std::make_shared(); - auto result = processor->GetDefaultAppProxy(); - EXPECT_EQ(result, nullptr); -} - /* * Feature: ImplicitStartProcessor * Function: FilterAbilityList -- Gitee