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 94c8a8e6dde48e88e30a7a71b00a403e3e690acf..ac47fe1f75214a35ced64c800838a2f4dcef1331 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 @@ -541,19 +541,6 @@ bool BundleMgrHelper::GetBundleInfos(const BundleFlag flag, std::vectorGetBundleInfos(flag, bundleInfos, userId); } -sptr BundleMgrHelper::GetQuickFixManagerProxy() -{ - 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->GetQuickFixManagerProxy(); -} - bool BundleMgrHelper::ProcessPreload(const Want &want) { TAG_LOGD(AAFwkTag::BUNDLEMGRHELPER, "called"); diff --git a/interfaces/inner_api/quick_fix/src/quick_fix_manager_client.cpp b/interfaces/inner_api/quick_fix/src/quick_fix_manager_client.cpp index 35e8b4d652f2db95143f71610f56326934390edc..51392fb8977df905d7c33351cc282d99cd58bc93 100644 --- a/interfaces/inner_api/quick_fix/src/quick_fix_manager_client.cpp +++ b/interfaces/inner_api/quick_fix/src/quick_fix_manager_client.cpp @@ -20,6 +20,7 @@ #include "hitrace_meter.h" #include "if_system_ability_manager.h" #include "iservice_registry.h" +#include "quick_fix/quick_fix_manager_client.h" #include "quick_fix_error_utils.h" #include "quick_fix_load_callback.h" #include "quick_fix_manager_proxy.h" @@ -44,14 +45,9 @@ int32_t QuickFixManagerClient::ApplyQuickFix(const std::vector &qui return QUICK_FIX_CONNECT_FAILED; } - auto bundleQuickFixMgr = QuickFixUtil::GetBundleQuickFixMgrProxy(); - if (bundleQuickFixMgr == nullptr) { - return QUICK_FIX_CONNECT_FAILED; - } - TAG_LOGD(AAFwkTag::QUICKFIX, "hqf file number need to apply: %{public}zu", quickFixFiles.size()); std::vector destFiles; - auto copyRet = bundleQuickFixMgr->CopyFiles(quickFixFiles, destFiles); + auto copyRet = AppExecFwk::QuickFixManagerClient::GetInstance().CopyFiles(quickFixFiles, destFiles); if (copyRet != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "Copy files failed."); return (copyRet == ERR_BUNDLEMANAGER_QUICK_FIX_PERMISSION_DENIED) ? QUICK_FIX_VERIFY_PERMISSION_FAILED : diff --git a/interfaces/inner_api/quick_fix/src/quick_fix_utils.cpp b/interfaces/inner_api/quick_fix/src/quick_fix_utils.cpp index 973505237273288212102654d5f210cd76b047a9..15d72672613fd41caa004f992a28cabbf37cf61e 100644 --- a/interfaces/inner_api/quick_fix/src/quick_fix_utils.cpp +++ b/interfaces/inner_api/quick_fix/src/quick_fix_utils.cpp @@ -45,23 +45,5 @@ sptr QuickFixUtil::GetAppManagerProxy() { return iface_cast(GetRemoteObjectOfSystemAbility(APP_MGR_SERVICE_ID)); } - -sptr QuickFixUtil::GetBundleQuickFixMgrProxy() -{ - TAG_LOGD(AAFwkTag::QUICKFIX, "called"); - auto bundleMgrHelper = DelayedSingleton::GetInstance(); - if (bundleMgrHelper == nullptr) { - TAG_LOGE(AAFwkTag::QUICKFIX, "The bundleMgrHelper is nullptr"); - return nullptr; - } - - auto bundleQuickFixMgr = bundleMgrHelper->GetQuickFixManagerProxy(); - if (bundleQuickFixMgr == nullptr) { - TAG_LOGE(AAFwkTag::QUICKFIX, "The bundleQuickFixMgr is nullptr"); - return nullptr; - } - - return bundleQuickFixMgr; -} } // namespace AAFwk } // namespace OHOS 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 3862786ed6c4f836224d8800ce8b9c26fbaa2b73..bd558a6430a0060f511b724d533480e0332ad6bb 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 @@ -65,7 +65,6 @@ public: bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo); bool GetBundleInfos(int32_t flags, std::vector &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID); - sptr GetQuickFixManagerProxy(); bool ProcessPreload(const Want &want); sptr GetAppControlProxy(); bool QueryExtensionAbilityInfos(const Want &want, const int32_t &flag, const int32_t &userId, diff --git a/services/quickfixmgr/include/quick_fix_manager_apply_task.h b/services/quickfixmgr/include/quick_fix_manager_apply_task.h index aa3baea1eb0840c56411d40d12a2257cea8ab31f..8ace6a1fbf37ff8db8139a13f16b2ca91c64082b 100644 --- a/services/quickfixmgr/include/quick_fix_manager_apply_task.h +++ b/services/quickfixmgr/include/quick_fix_manager_apply_task.h @@ -17,10 +17,10 @@ #define OHOS_ABILITY_RUNTIME_QUICK_FIX_MANAGER_APPLY_TASK_H #include "app_mgr_interface.h" +#include "appexecfwk_core/iquick_fix_manager.h" #include "cJSON.h" #include "event_handler.h" #include "quick_fix_result_info.h" -#include "quick_fix/quick_fix_manager_interface.h" namespace OHOS { namespace AAFwk { diff --git a/services/quickfixmgr/include/quick_fix_manager_service.h b/services/quickfixmgr/include/quick_fix_manager_service.h index 59573e3e997e8faaa2fd956e33c873a04eed994e..0553ef3b0bf28ad781b7f327bd7038d98acfe60f 100644 --- a/services/quickfixmgr/include/quick_fix_manager_service.h +++ b/services/quickfixmgr/include/quick_fix_manager_service.h @@ -18,9 +18,9 @@ #include +#include "appexecfwk_core/iquick_fix_manager.h" #include "event_runner.h" #include "event_handler.h" -#include "quick_fix/quick_fix_manager_interface.h" #include "quick_fix_manager_apply_task.h" #include "quick_fix_manager_stub.h" diff --git a/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp b/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp index 7c72d1af32e1a492eec6db6787c42dab56994136..9d2471ddb96296badfbf97217bd939022a595327 100644 --- a/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp +++ b/services/quickfixmgr/src/quick_fix_manager_apply_task.cpp @@ -412,7 +412,10 @@ void QuickFixManagerApplyTask::PostDeployQuickFixTask(const std::vectorbundleQfMgr_->DeployQuickFix(quickFixFiles, callback, isDebug, "", isReplace); + int32_t funcResult = -1; + auto ret = applyTask->bundleQfMgr_->DeployQuickFix( + quickFixFiles, callback, isDebug, "", isReplace, funcResult); + ret = (ret == 0) ? funcResult : ret; if (ret != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "failed: %{public}d", ret); applyTask->NotifyApplyStatus(QUICK_FIX_DEPLOY_FAILED); @@ -451,7 +454,9 @@ void QuickFixManagerApplyTask::PostSwitchQuickFixTask() return; } - auto ret = applyTask->bundleQfMgr_->SwitchQuickFix(applyTask->bundleName_, true, callback); + int32_t funcResult = -1; + auto ret = applyTask->bundleQfMgr_->SwitchQuickFix(applyTask->bundleName_, true, callback, funcResult); + ret = (ret == 0) ? funcResult : ret; if (ret != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "failed: %{public}d", ret); applyTask->NotifyApplyStatus(QUICK_FIX_SWICH_FAILED); @@ -490,7 +495,9 @@ void QuickFixManagerApplyTask::PostDeleteQuickFixTask() return; } - auto ret = applyTask->bundleQfMgr_->DeleteQuickFix(applyTask->bundleName_, callback); + int32_t funcResult = -1; + auto ret = applyTask->bundleQfMgr_->DeleteQuickFix(applyTask->bundleName_, callback, funcResult); + ret = (ret == 0) ? funcResult : ret; if (ret != 0) { TAG_LOGE(AAFwkTag::QUICKFIX, "delete quick fix failed: %{public}d", ret); applyTask->NotifyApplyStatus(QUICK_FIX_DELETE_FAILED); @@ -912,7 +919,9 @@ void QuickFixManagerApplyTask::PostRevokeQuickFixDeleteTask() } // call delete patch to bms - auto ret = bundleQfMgr_->DeleteQuickFix(bundleName_, callback); + int32_t funcResult = -1; + auto ret = bundleQfMgr_->DeleteQuickFix(bundleName_, callback, funcResult); + ret = (ret == 0) ? funcResult : ret; if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::QUICKFIX, "failed: %{public}d", ret); NotifyApplyStatus(QUICK_FIX_DELETE_FAILED); @@ -939,7 +948,9 @@ void QuickFixManagerApplyTask::HandleRevokeQuickFixAppStop() return; } - auto ret = bundleQfMgr_->SwitchQuickFix(bundleName_, false, callback); + int32_t funcResult = -1; + auto ret = bundleQfMgr_->SwitchQuickFix(bundleName_, false, callback, funcResult); + ret = (ret == 0) ? funcResult : ret; if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::QUICKFIX, "failed: %{public}d", ret); NotifyApplyStatus(QUICK_FIX_SWICH_FAILED); diff --git a/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp b/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp index a6731b31a3925d34cb6bb0a3527a3e698c8d3eee..4a56feee0c4b8474e2dbd663becdc9becc856e75 100755 --- a/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp +++ b/test/fuzztest/bundlemgrhelper_fuzzer/bundlemgrhelper_fuzzer.cpp @@ -99,7 +99,6 @@ void BundleMgrHelperFuzztest1(bool boolParam, std::string &stringParam, int32_t std::vector bundleInfos; bmHelper->GetBundleInfos(int32Param, bundleInfos, int32Param); bmHelper->GetBundleInfos(static_cast(int32Param), bundleInfos, int32Param); - bmHelper->GetQuickFixManagerProxy(); bmHelper->ProcessPreload(want); bmHelper->GetAppControlProxy(); bmHelper->QueryExtensionAbilityInfos(want, int32Param, int32Param, extensionInfos); 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 78c15388e177f92387845f22850b8b587e653bae..c554512363265086d3659680552f27e093f00233 100644 --- a/test/mock/services_appmgr_test/include/mock_bundle_manager.h +++ b/test/mock/services_appmgr_test/include/mock_bundle_manager.h @@ -176,12 +176,6 @@ public: MOCK_METHOD2(DeleteQuickFix, ErrCode(const std::string& bundleName, const sptr& statusCallback)); MOCK_METHOD3(CreateFd, ErrCode(const std::string& fileName, int32_t& fd, std::string& path)); - - virtual ErrCode CopyFiles(const std::vector& sourceFiles, std::vector& destFiles) override - { - destFiles = sourceFiles; - return 0; - } }; } // namespace AppExecFwk } // namespace OHOS 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 b49f03f696fb1b8240fe062f8cbccfac97a4c42c..e05f9ee6d2f09a45fb40bd7e0b4a1bd2ef070b4f 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 @@ -176,11 +176,6 @@ bool BundleMgrHelper::GetBundleInfos( return false; } -sptr BundleMgrHelper::GetQuickFixManagerProxy() -{ - return nullptr; -} - bool BundleMgrHelper::ProcessPreload(const Want& want) { return false; 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 68693fbcd7d6e32a11ef338cd87f39219bfe2ae3..1b56b245c39b440ac15a844444cb5b7745fb335a 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 @@ -60,7 +60,6 @@ public: bool QueryAbilityInfo(const Want& want, int32_t flags, int32_t userId, AbilityInfo& abilityInfo); bool GetBundleInfos( int32_t flags, std::vector& bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID); - sptr GetQuickFixManagerProxy(); bool ProcessPreload(const Want& want); sptr GetAppControlProxy(); bool QueryExtensionAbilityInfos(const Want& want, const int32_t& flag, const 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 817574298de80de1e658e041752c21587e2c3061..0f4a2e4587c43d003e55267c72c5a226bbd67e19 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 @@ -171,11 +171,6 @@ bool BundleMgrHelper::GetBundleInfos( return false; } -sptr BundleMgrHelper::GetQuickFixManagerProxy() -{ - return nullptr; -} - bool BundleMgrHelper::ProcessPreload(const Want& want) { 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 817574298de80de1e658e041752c21587e2c3061..0f4a2e4587c43d003e55267c72c5a226bbd67e19 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 @@ -171,11 +171,6 @@ bool BundleMgrHelper::GetBundleInfos( return false; } -sptr BundleMgrHelper::GetQuickFixManagerProxy() -{ - return nullptr; -} - bool BundleMgrHelper::ProcessPreload(const Want& want) { return false; 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 88fbfdea14d87ce20d537b56ad6b06392a34dcc6..b1eff9e9e1adf3dc1c19a0815f4967dcdf860556 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 @@ -170,11 +170,6 @@ bool BundleMgrHelper::GetBundleInfos( return false; } -sptr BundleMgrHelper::GetQuickFixManagerProxy() -{ - return nullptr; -} - bool BundleMgrHelper::ProcessPreload(const Want& want) { 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 e6862802f30c3093f9b542b163cf9676a2902c7e..0c63ce8414bdf40ca650ff7a8893a6f0645a2186 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 @@ -62,7 +62,6 @@ public: bool QueryAbilityInfo(const Want& want, int32_t flags, int32_t userId, AbilityInfo& abilityInfo); bool GetBundleInfos( int32_t flags, std::vector& bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID); - sptr GetQuickFixManagerProxy(); bool ProcessPreload(const Want& want); sptr GetAppControlProxy(); bool QueryExtensionAbilityInfos(const Want& want, const int32_t& flag, const 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 7624899366b7e2f1f1c5bc89b700a0e696273706..c1432e2958faac453b321a4c2537f0a109e9ccca 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 @@ -279,17 +279,6 @@ HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_RegisterBundleEventCallback_00 EXPECT_EQ(ret, false); } -/** - * @tc.name: BundleMgrHelperTest_GetQuickFixManagerProxy_001 - * @tc.desc: GetQuickFixManagerProxy - * @tc.type: FUNC - */ -HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_GetQuickFixManagerProxy_001, TestSize.Level1) -{ - auto ret = bundleMgrHelper->GetQuickFixManagerProxy(); - EXPECT_NE(ret, nullptr); -} - /** * @tc.name: BundleMgrHelperTest_QueryExtensionAbilityInfos_002 * @tc.desc: QueryExtensionAbilityInfos diff --git a/test/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp b/test/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp index 6d6c4e9bc35f00ef0e5afd3f65459458c9344083..142f48f02a1f3a3b925f8e412a7aec708b216d39 100644 --- a/test/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp +++ b/test/unittest/quick_fix/mock/src/mock_quick_fix_util.cpp @@ -60,25 +60,6 @@ sptr QuickFixUtil::GetBundleManagerProxy() return iface_cast(GetRemoteObjectOfSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID)); } -sptr QuickFixUtil::GetBundleQuickFixMgrProxy() -{ - TAG_LOGD(AAFwkTag::TEST, "function called."); - auto bundleMgr = GetBundleManagerProxy(); - if (bundleMgr == nullptr) { - TAG_LOGE(AAFwkTag::TEST, "Failed to get bms."); - return nullptr; - } - - auto bundleQuickFixMgr = bundleMgr->GetQuickFixManagerProxy(); - if (bundleQuickFixMgr == nullptr) { - TAG_LOGE(AAFwkTag::TEST, "Failed to get bundle quick fix manager."); - return nullptr; - } - - TAG_LOGD(AAFwkTag::TEST, "function finished."); - return bundleQuickFixMgr; -} - void QuickFixUtil::RegisterSystemAbility(const int32_t systemAbilityId, sptr object) { std::lock_guard lock(saMutex_);