diff --git a/services/bundlemgr/include/bundle_mgr_host_impl.h b/services/bundlemgr/include/bundle_mgr_host_impl.h index ff713c2d6ef8cd153f226aa8bfac4a8e3c7de639..c914377f23ee0aa402dfac65b328b7d610a9c5e6 100644 --- a/services/bundlemgr/include/bundle_mgr_host_impl.h +++ b/services/bundlemgr/include/bundle_mgr_host_impl.h @@ -1035,6 +1035,7 @@ private: void SetProvisionInfoToInnerBundleInfo(const std::string &hapPath, InnerBundleInfo &info); bool CheckAppIndex(const std::string &bundleName, int32_t userId, int32_t appIndex); bool CheckCanSetEnable(const std::string &bundleName); + bool IsAppLinking(int32_t flags) const; std::atomic isBrokerServiceExisted_ = false; }; diff --git a/services/bundlemgr/src/bundle_mgr_host_impl.cpp b/services/bundlemgr/src/bundle_mgr_host_impl.cpp index ad0bb24640de85e5d9f902638d2bcae3ab947087..c3ff6639fe33419d51bd974af8d5e4478a5fa251 100644 --- a/services/bundlemgr/src/bundle_mgr_host_impl.cpp +++ b/services/bundlemgr/src/bundle_mgr_host_impl.cpp @@ -759,7 +759,7 @@ bool BundleMgrHostImpl::QueryAbilityInfo(const Want &want, int32_t flags, int32_ } bool res = dataMgr->QueryAbilityInfo(want, flags, userId, abilityInfo); if (!res) { - if (isBrokerServiceExisted_) { + if (!IsAppLinking(flags) && isBrokerServiceExisted_) { auto bmsExtensionClient = std::make_shared(); return (bmsExtensionClient->QueryAbilityInfo(want, flags, userId, abilityInfo) == ERR_OK); } @@ -795,7 +795,7 @@ bool BundleMgrHostImpl::QueryAbilityInfos( return false; } dataMgr->QueryAbilityInfos(want, flags, userId, abilityInfos); - if (isBrokerServiceExisted_) { + if (!IsAppLinking(flags) && isBrokerServiceExisted_) { auto bmsExtensionClient = std::make_shared(); bmsExtensionClient->QueryAbilityInfos(want, flags, userId, abilityInfos); } @@ -824,7 +824,7 @@ ErrCode BundleMgrHostImpl::QueryAbilityInfosV9( } auto res = dataMgr->QueryAbilityInfosV9(want, flags, userId, abilityInfos); auto bmsExtensionClient = std::make_shared(); - if (isBrokerServiceExisted_ && + if (!IsAppLinking(flags) && isBrokerServiceExisted_ && bmsExtensionClient->QueryAbilityInfos(want, flags, userId, abilityInfos, true) == ERR_OK) { LOG_D(BMS_TAG_QUERY, "query ability infos from bms extension successfully"); return ERR_OK; @@ -856,7 +856,7 @@ ErrCode BundleMgrHostImpl::BatchQueryAbilityInfos( } auto res = dataMgr->BatchQueryAbilityInfos(wants, flags, userId, abilityInfos); auto bmsExtensionClient = std::make_shared(); - if (isBrokerServiceExisted_ && + if (!IsAppLinking(flags) && isBrokerServiceExisted_ && bmsExtensionClient->BatchQueryAbilityInfos(wants, flags, userId, abilityInfos, true) == ERR_OK) { APP_LOGD("query ability infos from bms extension successfully"); return ERR_OK; @@ -2910,14 +2910,8 @@ bool BundleMgrHostImpl::ImplicitQueryInfos(const Want &want, int32_t flags, int3 APP_LOGD("default app has been found and unnecessary to find from bms extension"); return ret; } - if ((static_cast(flags) & - static_cast(GetAbilityInfoFlag::GET_ABILITY_INFO_WITH_APP_LINKING)) == - static_cast(GetAbilityInfoFlag::GET_ABILITY_INFO_WITH_APP_LINKING)) { - APP_LOGI("contains app linking flag, no need to query from bms extension"); - return ret; - } auto bmsExtensionClient = std::make_shared(); - if (isBrokerServiceExisted_ && + if (!IsAppLinking(flags) && isBrokerServiceExisted_ && bmsExtensionClient->ImplicitQueryAbilityInfos(want, flags, userId, abilityInfos, false) == ERR_OK) { APP_LOGD("implicitly query from bms extension successfully"); FilterAbilityInfos(abilityInfos); @@ -4228,5 +4222,16 @@ bool BundleMgrHostImpl::CheckCanSetEnable(const std::string &bundleName) } return false; } + +bool BundleMgrHostImpl::IsAppLinking(int32_t flags) const +{ + if ((static_cast(flags) & + static_cast(GetAbilityInfoFlag::GET_ABILITY_INFO_WITH_APP_LINKING)) == + static_cast(GetAbilityInfoFlag::GET_ABILITY_INFO_WITH_APP_LINKING)) { + APP_LOGI("contains app linking flag, no need to query from bms extension"); + return true; + } + return false; +} } // namespace AppExecFwk } // namespace OHOS