From e55e89059831a97fff4d6baf1917b6ae5e3745f0 Mon Sep 17 00:00:00 2001 From: Zhou Shihui Date: Tue, 23 Jul 2024 11:36:09 +0800 Subject: [PATCH] =?UTF-8?q?applinking=E4=B8=8D=E6=9F=A5=E8=AF=A2=E6=B9=96?= =?UTF-8?q?=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zhou Shihui --- .../bundlemgr/include/bundle_mgr_host_impl.h | 1 + .../bundlemgr/src/bundle_mgr_host_impl.cpp | 27 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/services/bundlemgr/include/bundle_mgr_host_impl.h b/services/bundlemgr/include/bundle_mgr_host_impl.h index ff713c2d6e..c914377f23 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 ad0bb24640..c3ff6639fe 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 -- Gitee