diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index b6213569a5..19b80930fa 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -3591,7 +3591,7 @@ private: bool ShouldPreventStartAbility(const AbilityRequest &abilityRequest); - void PrintStartAbilityInfo(AppExecFwk::AbilityInfo callerInfo, AppExecFwk::AbilityInfo calledInfo); + void PrintStartAbilityInfo(const AppExecFwk::AbilityInfo &callerInfo, const AppExecFwk::AbilityInfo &calledInfo); bool IsInWhiteList(const std::string &callerBundleName, const std::string &calleeBundleName, const std::string &calleeAbilityName); diff --git a/services/abilitymgr/include/free_install_manager.h b/services/abilitymgr/include/free_install_manager.h index eea5c87181..5f733fc5fa 100644 --- a/services/abilitymgr/include/free_install_manager.h +++ b/services/abilitymgr/include/free_install_manager.h @@ -229,10 +229,10 @@ private: void PostUpgradeAtomicServiceTask(int resultCode, const Want &want, int32_t userId); - void StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName, std::string &abilityName, - std::string &startTime); - void StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime); + void StartAbilityByFreeInstall(FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime); + void StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime); int32_t UpdateElementName(Want &want, int32_t userId) const; void HandleFreeInstallResult(int32_t recordId, FreeInstallInfo &freeInstallInfo, int resultCode, bool isAsync); void HandleOnFreeInstallSuccess(int32_t recordId, FreeInstallInfo &freeInstallInfo, bool isAsync); diff --git a/services/abilitymgr/include/interceptor/ability_interceptor_executer.h b/services/abilitymgr/include/interceptor/ability_interceptor_executer.h index dfba43fb4d..f27d771edd 100644 --- a/services/abilitymgr/include/interceptor/ability_interceptor_executer.h +++ b/services/abilitymgr/include/interceptor/ability_interceptor_executer.h @@ -50,7 +50,7 @@ public: /** * Excute the DoProcess of the interceptors. */ - ErrCode DoProcess(AbilityInterceptorParam param); + ErrCode DoProcess(const AbilityInterceptorParam ¶m); void SetTaskHandler(std::shared_ptr taskHandler); private: diff --git a/services/abilitymgr/include/interceptor/ability_interceptor_interface.h b/services/abilitymgr/include/interceptor/ability_interceptor_interface.h index acbbc2a72e..96eca441bb 100644 --- a/services/abilitymgr/include/interceptor/ability_interceptor_interface.h +++ b/services/abilitymgr/include/interceptor/ability_interceptor_interface.h @@ -60,7 +60,7 @@ public: /** * Excute interception processing. */ - virtual ErrCode DoProcess(AbilityInterceptorParam param) = 0; + virtual ErrCode DoProcess(const AbilityInterceptorParam ¶m) = 0; /** * Set handler for async task executing. diff --git a/services/abilitymgr/include/interceptor/ability_jump_interceptor.h b/services/abilitymgr/include/interceptor/ability_jump_interceptor.h index ed100b7f98..f7f0a517db 100644 --- a/services/abilitymgr/include/interceptor/ability_jump_interceptor.h +++ b/services/abilitymgr/include/interceptor/ability_jump_interceptor.h @@ -28,7 +28,7 @@ class AbilityJumpInterceptor : public IAbilityInterceptor { public: AbilityJumpInterceptor() = default; ~AbilityJumpInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; virtual void SetTaskHandler(std::shared_ptr taskHandler) override { return; diff --git a/services/abilitymgr/include/interceptor/block_all_app_start_interceptor.h b/services/abilitymgr/include/interceptor/block_all_app_start_interceptor.h index 4be0ac4fd6..7e84f37d43 100644 --- a/services/abilitymgr/include/interceptor/block_all_app_start_interceptor.h +++ b/services/abilitymgr/include/interceptor/block_all_app_start_interceptor.h @@ -24,7 +24,7 @@ class BlockAllAppStartInterceptor : public IAbilityInterceptor { public: BlockAllAppStartInterceptor() = default; ~BlockAllAppStartInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; virtual void SetTaskHandler(std::shared_ptr taskHandler) override { return; diff --git a/services/abilitymgr/include/interceptor/control_interceptor.h b/services/abilitymgr/include/interceptor/control_interceptor.h index a2c5eecfa7..cb8666e18c 100644 --- a/services/abilitymgr/include/interceptor/control_interceptor.h +++ b/services/abilitymgr/include/interceptor/control_interceptor.h @@ -27,7 +27,7 @@ class ControlInterceptor : public IAbilityInterceptor { public: ControlInterceptor() = default; ~ControlInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; virtual void SetTaskHandler(std::shared_ptr taskHandler) override { return; diff --git a/services/abilitymgr/include/interceptor/crowd_test_interceptor.h b/services/abilitymgr/include/interceptor/crowd_test_interceptor.h index e09445a40a..48c722a5b8 100644 --- a/services/abilitymgr/include/interceptor/crowd_test_interceptor.h +++ b/services/abilitymgr/include/interceptor/crowd_test_interceptor.h @@ -24,7 +24,7 @@ class CrowdTestInterceptor : public IAbilityInterceptor { public: CrowdTestInterceptor() = default; ~CrowdTestInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; virtual void SetTaskHandler(std::shared_ptr taskHandler) override { return; diff --git a/services/abilitymgr/include/interceptor/disposed_rule_interceptor.h b/services/abilitymgr/include/interceptor/disposed_rule_interceptor.h index 9660b72ea3..9b0178d4e7 100644 --- a/services/abilitymgr/include/interceptor/disposed_rule_interceptor.h +++ b/services/abilitymgr/include/interceptor/disposed_rule_interceptor.h @@ -33,7 +33,7 @@ public: ~DisposedRuleInterceptor() = default; static std::string GenerateTimeoutTaskName(int32_t uid); static std::string GenerateEventTaskName(int32_t uid); - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; void SetTaskHandler(std::shared_ptr taskHandler) override { taskHandler_ = taskHandler; diff --git a/services/abilitymgr/include/interceptor/ecological_rule_interceptor.h b/services/abilitymgr/include/interceptor/ecological_rule_interceptor.h index 7c6ab4d74e..6e1c9de805 100644 --- a/services/abilitymgr/include/interceptor/ecological_rule_interceptor.h +++ b/services/abilitymgr/include/interceptor/ecological_rule_interceptor.h @@ -35,7 +35,7 @@ class EcologicalRuleInterceptor : public IAbilityInterceptor { public: EcologicalRuleInterceptor() = default; ~EcologicalRuleInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; bool DoProcess(Want &want, int32_t userId); virtual void SetTaskHandler(std::shared_ptr taskHandler) override { diff --git a/services/abilitymgr/include/interceptor/extension_control_interceptor.h b/services/abilitymgr/include/interceptor/extension_control_interceptor.h index 77a99a127b..65753cf061 100644 --- a/services/abilitymgr/include/interceptor/extension_control_interceptor.h +++ b/services/abilitymgr/include/interceptor/extension_control_interceptor.h @@ -26,7 +26,7 @@ class ExtensionControlInterceptor : public IAbilityInterceptor { public: ExtensionControlInterceptor() = default; ~ExtensionControlInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; private: bool IsExtensionStartThirdPartyAppEnable(std::string extensionTypeName, std::string targetBundleName); bool IsExtensionStartServiceEnable(std::string extensionTypeName, std::string targetUri); diff --git a/services/abilitymgr/include/interceptor/kiosk_interceptor.h b/services/abilitymgr/include/interceptor/kiosk_interceptor.h index 6edd86ee4f..f888561177 100644 --- a/services/abilitymgr/include/interceptor/kiosk_interceptor.h +++ b/services/abilitymgr/include/interceptor/kiosk_interceptor.h @@ -22,7 +22,7 @@ namespace OHOS { namespace AAFwk { class KioskInterceptor : public IAbilityInterceptor { public: - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/interceptor/screen_unlock_interceptor.h b/services/abilitymgr/include/interceptor/screen_unlock_interceptor.h index 4e25cc09f3..454e6a650b 100644 --- a/services/abilitymgr/include/interceptor/screen_unlock_interceptor.h +++ b/services/abilitymgr/include/interceptor/screen_unlock_interceptor.h @@ -24,7 +24,7 @@ class ScreenUnlockInterceptor : public IAbilityInterceptor { public: ScreenUnlockInterceptor() = default; ~ScreenUnlockInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; virtual void SetTaskHandler(std::shared_ptr taskHandler) override { return; diff --git a/services/abilitymgr/include/interceptor/start_other_app_interceptor.h b/services/abilitymgr/include/interceptor/start_other_app_interceptor.h index 2bd03007dd..0aea7ade11 100644 --- a/services/abilitymgr/include/interceptor/start_other_app_interceptor.h +++ b/services/abilitymgr/include/interceptor/start_other_app_interceptor.h @@ -26,7 +26,7 @@ class StartOtherAppInterceptor : public IAbilityInterceptor { public: StartOtherAppInterceptor() = default; ~StartOtherAppInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; virtual void SetTaskHandler(std::shared_ptr taskHandler) override { return; diff --git a/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h b/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h index 4ee213bc7b..91c5f530d1 100644 --- a/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h +++ b/services/abilitymgr/include/scene_board/ui_ability_lifecycle_manager.h @@ -59,7 +59,7 @@ struct SpecifiedRequest { bool isCold = false; bool preCreateProcessName = false; - SpecifiedRequest(int32_t requestId, AbilityRequest request) : requestId(requestId), abilityRequest(request) {} + SpecifiedRequest(int32_t requestId, const AbilityRequest &request) : requestId(requestId), abilityRequest(request) {} }; struct AbilitiesRequest { diff --git a/services/abilitymgr/src/ability_bundle_event_callback.cpp b/services/abilitymgr/src/ability_bundle_event_callback.cpp index 125bc72c99..1d69330681 100644 --- a/services/abilitymgr/src/ability_bundle_event_callback.cpp +++ b/services/abilitymgr/src/ability_bundle_event_callback.cpp @@ -50,10 +50,10 @@ void AbilityBundleEventCallback::OnReceiveEvent(const EventFwk::CommonEventData } const Want& want = eventData.GetWant(); // action contains the change type of haps. - std::string action = want.GetAction(); + std::string action = want.GetActionRef(); int32_t installType = want.GetIntParam(TYPE, 0); - std::string bundleName = want.GetElement().GetBundleName(); - std::string moduleName = want.GetElement().GetModuleName(); + std::string bundleName = want.GetBundleNameRef(); + std::string moduleName = want.GetModuleNameRef(); auto tokenId = static_cast(want.GetIntParam(KEY_TOKEN, 0)); int uid = want.GetIntParam(KEY_UID, 0); auto bundleType = want.GetIntParam(BUNDLE_TYPE, 0); diff --git a/services/abilitymgr/src/ability_cache_manager.cpp b/services/abilitymgr/src/ability_cache_manager.cpp index 17019bd83a..8fda089e99 100644 --- a/services/abilitymgr/src/ability_cache_manager.cpp +++ b/services/abilitymgr/src/ability_cache_manager.cpp @@ -159,7 +159,7 @@ bool AbilityCacheManager::IsRecInfoSame(const AbilityRequest& abilityRequest, { return abilityRecord != nullptr && abilityRequest.abilityInfo.moduleName == abilityRecord->GetAbilityInfo().moduleName && - abilityRequest.want.GetElement().GetAbilityName() == abilityRecord->GetAbilityName(); + abilityRequest.want.GetAbilityNameRef() == abilityRecord->GetAbilityName(); } std::shared_ptr AbilityCacheManager::GetAbilityRecInProcList(const AbilityRequest &abilityRequest) diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index cf4f8f5a10..411aaf1e37 100644 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -141,13 +141,13 @@ int AbilityConnectManager::StopServiceAbility(const AbilityRequest &abilityReque int AbilityConnectManager::StartAbilityLocked(const AbilityRequest &abilityRequest) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::EXT, "forbid start: %{public}s", abilityRequest.want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::EXT, "forbid start: %{public}s", abilityRequest.want.GetBundleNameRef().c_str()); return INNER_ERR; } HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); TAG_LOGD(AAFwkTag::EXT, "bundle/ability:%{public}s/%{public}s", - abilityRequest.want.GetBundle().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); int32_t ret = AbilityPermissionUtil::GetInstance().CheckMultiInstanceKeyForExtension(abilityRequest); if (ret != ERR_OK) { @@ -202,8 +202,8 @@ void AbilityConnectManager::EnqueueStartServiceReq(const AbilityRequest &ability abilityUri = serviceUri; } TAG_LOGI(AAFwkTag::EXT, "abilityUri: %{public}s/%{public}s", - abilityRequest.want.GetBundle().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); auto reqListIt = startServiceReqList_.find(abilityUri); if (reqListIt != startServiceReqList_.end()) { reqListIt->second->push_back(abilityRequest); @@ -1545,7 +1545,7 @@ void AbilityConnectManager::HandleRestartResidentTask(const AbilityRequest &abil auto findRestartResidentTask = [&srcElement](const AbilityRequest &requestInfo) { auto dstElement = requestInfo.want.GetElement(); return (dstElement.GetBundleName() == srcElement.GetBundleName() && - dstElement.GetModuleName() == srcElement.GetModuleName() && + dstElement.GetModuleNameRef() == srcElement.GetModuleNameRef() && dstElement.GetAbilityName() == srcElement.GetAbilityName()); }; auto findIter = find_if(restartResidentTaskList_.begin(), restartResidentTaskList_.end(), findRestartResidentTask); @@ -2595,7 +2595,7 @@ void AbilityConnectManager::RestartAbility(const std::shared_ptr(param.want)); //intent openlink do not RemoveInsightIntent @@ -844,7 +844,7 @@ int32_t AbilityManagerService::StartAbilityByFreeInstall(const StartAbilityWrapP } TAG_LOGD(AAFwkTag::ABILITYMGR, "Start ability come, ability is %{public}s, userId is %{public}d", - param.want.GetElement().GetAbilityName().c_str(), param.userId); + param.want.GetAbilityNameRef().c_str(), param.userId); int32_t ret = StartAbilityWrap(param); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "StartAbilityByFreeInstall error:%{public}d", ret); @@ -856,10 +856,10 @@ int AbilityManagerService::StartAbilityWithSpecifyTokenId(const Want &want, cons uint32_t specifyTokenId, int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); if (IPCSkeleton::GetCallingUid() != FOUNDATION_UID) { TAG_LOGE(AAFwkTag::ABILITYMGR, "startAbility with specialId, current process not foundation process"); return CHECK_PERMISSION_FAILED; @@ -887,7 +887,7 @@ int AbilityManagerService::StartAbilityWithSpecifyTokenIdInner(const Want &want, } TAG_LOGI(AAFwkTag::ABILITYMGR, "start ability come, ability:%{public}s, userId:%{public}d, " - "specifyTokenId:%{public}u, appIndex:%{public}d", want.GetElement().GetAbilityName().c_str(), userId, + "specifyTokenId:%{public}u, appIndex:%{public}d", want.GetAbilityNameRef().c_str(), userId, specifyTokenId, want.GetIntParam(Want::PARAM_APP_CLONE_INDEX_KEY, -1)); StartAbilityWrapParam startAbilityWrapParam = { .want = want, @@ -918,12 +918,12 @@ int32_t AbilityManagerService::StartAbilityByInsightIntent(const Want &want, con uint64_t intentId, int32_t userId) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); - std::string bundleNameFromWant = want.GetBundle(); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); + const auto &bundleNameFromWant = want.GetBundleNameRef(); std::string bundleNameFromIntentMgr = ""; if (DelayedSingleton::GetInstance()-> GetBundleName(intentId, bundleNameFromIntentMgr) != ERR_OK) { @@ -950,7 +950,7 @@ int32_t AbilityManagerService::StartAbilityByOEExt(const Want &want, sptr callerToken, int32_t hostPid, const std::string &specifiedFlag) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); std::string hostBundleName; int32_t userId = -1; @@ -965,7 +965,7 @@ int32_t AbilityManagerService::StartAbilityByOEExt(const Want &want, SendAbilityEvent(EventName::START_ABILITY, HISYSEVENT_BEHAVIOR, eventInfo); TAG_LOGI(AAFwkTag::ABILITYMGR, "StartAbilityByOEExt: hostPid=%{public}d, specifiedFlag=%{public}s) %{public}s", - hostPid, specifiedFlag.c_str(), want.GetBundle().c_str()); + hostPid, specifiedFlag.c_str(), want.GetBundleNameRef().c_str()); StartAbilityWrapParam startAbilityWrapParam = { .want = want, .callerToken = callerToken, @@ -982,10 +982,10 @@ int AbilityManagerService::StartAbilityByUIContentSession(const Want &want, cons const sptr &sessionInfo, int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); if (!callerToken || !sessionInfo) { TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken or sessionInfo null"); return ERR_INVALID_VALUE; @@ -1021,10 +1021,10 @@ int AbilityManagerService::StartAbilityByUIContentSession(const Want &want, cons const sptr &callerToken, const sptr &sessionInfo, int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); if (!callerToken || !sessionInfo) { TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken or sessionInfo null"); return ERR_INVALID_VALUE; @@ -1060,10 +1060,10 @@ int AbilityManagerService::StartAbilityOnlyUIAbility(const Want &want, const spt uint32_t specifyTokenId) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); if (IPCSkeleton::GetCallingUid() != FOUNDATION_UID) { TAG_LOGE(AAFwkTag::ABILITYMGR, "StartAbility with specialId, process not foundation process"); return CHECK_PERMISSION_FAILED; @@ -1085,7 +1085,7 @@ int AbilityManagerService::StartAbilityOnlyUIAbility(const Want &want, const spt TAG_LOGI(AAFwkTag::ABILITYMGR, "start, ability: %{public}s, userId: %{public}d, specifyTokenId: %{public}u", - want.GetElement().GetAbilityName().c_str(), DEFAULT_INVAL_VALUE, specifyTokenId); + want.GetAbilityNameRef().c_str(), DEFAULT_INVAL_VALUE, specifyTokenId); StartAbilityWrapParam startAbilityWrapParam = { .want = want, .callerToken = callerToken, @@ -1103,10 +1103,10 @@ int AbilityManagerService::StartAbilityAsCaller(const Want &want, const sptr asCallerSourceToken, int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); return StartAbilityAsCallerDetails(want, callerToken, asCallerSourceToken, userId, requestCode); } @@ -1115,7 +1115,7 @@ int AbilityManagerService::ImplicitStartAbilityAsCaller(const Want &want, const sptr callback) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } return StartAbilityAsCallerDetails(want, callerToken, asCallerSourceToken, userId, @@ -1144,7 +1144,7 @@ int AbilityManagerService::StartAbilityAsCallerDetails(const Want &want, const s AAFwk::Want newWant = want; UpdateCallerInfoUtil::GetInstance().UpdateAsCallerSourceInfo(newWant, asCallerSourceToken, callerToken); TAG_LOGI(AAFwkTag::ABILITYMGR, "start ability come, ability:%{public}s, userId:%{public}d", - want.GetElement().GetAbilityName().c_str(), userId); + want.GetAbilityNameRef().c_str(), userId); std::string callerPkg; std::string targetPkg; if (AbilityUtil::CheckJumpInterceptorWant(newWant, callerPkg, targetPkg)) { @@ -1398,7 +1398,7 @@ void AbilityManagerService::CheckExtensionRateLimit(const Want &want) return; } EventInfo eventInfo; - eventInfo.abilityName = want.GetBundle() + "/" + want.GetElement().GetAbilityName(); + eventInfo.abilityName = want.GetBundleNameRef() + "/" + want.GetAbilityNameRef(); eventInfo.callerBundleName = callerBundleName; eventInfo.moduleName = "ReachLimit"; eventInfo.extensionType = limitResult.triggeredLimit; @@ -1600,7 +1600,7 @@ int AbilityManagerService::StartAbilityInner(StartAbilityWrapParam ¶m) } return AbilityErrorUtil::ConvertToOriginErrorCode(result); } - if (param.want.GetAction().compare(ACTION_CHOOSE) == 0) { + if (param.want.GetActionRef().compare(ACTION_CHOOSE) == 0) { result = ShowPickerDialog(param.want, validUserId, param.callerToken); AbilityEventUtil::SendStartAbilityErrorEvent(*eventInfo, result, "ShowPickerDialog failed"); return result; @@ -1611,8 +1611,8 @@ int AbilityManagerService::StartAbilityInner(StartAbilityWrapParam ¶m) auto collaborator = GetCollaborator(CollaboratorType::RESERVE_TYPE); CollaboratorUtil::UpdateTargetIfNeed(collaborator, param.want, callerBundleName); result = GenerateAbilityRequest(param.want, param.requestCode, abilityRequest, param.callerToken, validUserId); - bool selfFreeInstallEnable = (result == RESOLVE_ABILITY_ERR && param.want.GetModuleName() != "" && - param.want.GetBundle() == callerBundleName); + bool selfFreeInstallEnable = (result == RESOLVE_ABILITY_ERR && param.want.GetModuleNameRef() != "" && + param.want.GetBundleNameRef() == callerBundleName); bool isStartFreeInstallByWant = AbilityUtil::IsStartFreeInstall(param.want); if (isStartFreeInstallByWant || selfFreeInstallEnable) { TAG_LOGD(AAFwkTag::ABILITYMGR, "selfFreeInstallEnable: %{public}d, isStartFreeInstallByWant: %{public}d", @@ -1664,7 +1664,7 @@ int AbilityManagerService::StartAbilityInner(StartAbilityWrapParam ¶m) if (abilityRequest.requestCode != DEFAULT_REQUEST_CODE && ForegroundAppConnectionManager::IsForegroundAppConnection(abilityRequest.abilityInfo, abilityRecord)) { DelayedSingleton::GetInstance()->OnCallerStarted(IPCSkeleton::GetCallingPid(), - IPCSkeleton::GetCallingUid(), param.want.GetBundle()); + IPCSkeleton::GetCallingUid(), param.want.GetBundleNameRef()); } if ((param.specifyTokenId > 0 || param.isStartByOEExt) && param.callerToken != nullptr) { // for sa specify tokenId and caller token @@ -1685,7 +1685,7 @@ int AbilityManagerService::StartAbilityInner(StartAbilityWrapParam ¶m) #endif // SUPPORT_SCREEN } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; if (param.isUIAbilityOnly && abilityInfo.type != AbilityType::PAGE) { TAG_LOGE(AAFwkTag::ABILITYMGR, "ability type no UIAbility"); AbilityEventUtil::SendStartAbilityErrorEvent(*eventInfo, RESOLVE_CALL_ABILITY_TYPE_ERR, "not UIAbility"); @@ -1851,7 +1851,7 @@ int AbilityManagerService::PreStartFreeInstall(const Want &want, sptr(want)).RemoveParam("send_to_erms_embedded"); localWant = want; - if (!localWant.GetDeviceId().empty()) { + if (!localWant.GetDeviceIdRef().empty()) { localWant.SetDeviceId(""); } if (specifyTokenId > 0 && callerToken != nullptr) { // for sa specify tokenId and caller token @@ -1883,11 +1883,11 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett const sptr &callerToken, int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); #ifdef SUPPORT_SCREEN DmsUtil::GetInstance().UpdateFlagForCollaboration(want); #endif @@ -2047,7 +2047,7 @@ int AbilityManagerService::StartAbilityDetails(const Want &want, const AbilitySt } return AbilityErrorUtil::ConvertToOriginErrorCode(result); } - if (want.GetAction().compare(ACTION_CHOOSE) == 0) { + if (want.GetActionRef().compare(ACTION_CHOOSE) == 0) { result = ShowPickerDialog(want, validUserId, callerToken); AbilityEventUtil::SendStartAbilityErrorEvent(*eventInfo, result, "ShowPickerDialog failed"); return result; @@ -2061,7 +2061,7 @@ int AbilityManagerService::StartAbilityDetails(const Want &want, const AbilitySt } abilityRequest.want.RemoveParam(PARAM_SPECIFIED_PROCESS_FLAG); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; validUserId = abilityInfo.applicationInfo.singleton ? U0_USER_ID : validUserId; TAG_LOGD(AAFwkTag::ABILITYMGR, "userId : %{public}d, singleton is : %{public}d", validUserId, static_cast(abilityInfo.applicationInfo.singleton)); @@ -2149,10 +2149,10 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st const sptr &callerToken, int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); TAG_LOGD(AAFwkTag::ABILITYMGR, "Start ability with startOptions."); AbilityUtil::RemoveShowModeKey(const_cast(want)); @@ -2190,10 +2190,10 @@ int AbilityManagerService::StartAbilityAsCaller(const Want &want, const StartOpt int32_t userId, int requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); TAG_LOGD(AAFwkTag::ABILITYMGR, "Start ability as caller with startOptions."); CHECK_CALLER_IS_SYSTEM_APP; @@ -2207,10 +2207,10 @@ int AbilityManagerService::StartAbilityForResultAsCaller( const Want &want, const sptr &callerToken, int requestCode, int32_t userId) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); CHECK_CALLER_IS_SYSTEM_APP; @@ -2239,10 +2239,10 @@ int AbilityManagerService::StartAbilityForResultAsCaller(const Want &want, const const sptr &callerToken, int requestCode, int32_t userId) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); CHECK_CALLER_IS_SYSTEM_APP; @@ -2449,7 +2449,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St } return AbilityErrorUtil::ConvertToOriginErrorCode(result); } - if (want.GetAction().compare(ACTION_CHOOSE) == 0) { + if (want.GetActionRef().compare(ACTION_CHOOSE) == 0) { result = ShowPickerDialog(want, validUserId, callerToken); AbilityEventUtil::SendStartAbilityErrorEvent(*eventInfo, result, "ShowPickerDialog failed"); return result; @@ -2466,7 +2466,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St if (abilityRequest.requestCode != DEFAULT_REQUEST_CODE && ForegroundAppConnectionManager::IsForegroundAppConnection(abilityRequest.abilityInfo, callerRecord)) { DelayedSingleton::GetInstance()->OnCallerStarted(IPCSkeleton::GetCallingPid(), - IPCSkeleton::GetCallingUid(), want.GetBundle()); + IPCSkeleton::GetCallingUid(), want.GetBundleNameRef()); } std::string currentProcessName = startOptions.GetCurrentProcessName(); if (!currentProcessName.empty()) { @@ -2485,7 +2485,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St TAG_LOGD(AAFwkTag::ABILITYMGR, "do not start as caller, UpdateCallerInfo"); UpdateCallerInfoUtil::GetInstance().UpdateCallerInfo(abilityRequest.want, callerToken); } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; validUserId = abilityInfo.applicationInfo.singleton ? U0_USER_ID : validUserId; TAG_LOGD(AAFwkTag::ABILITYMGR, "userId : %{public}d, singleton is : %{public}d", validUserId, static_cast(abilityInfo.applicationInfo.singleton)); @@ -2627,7 +2627,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St abilityRequest.supportWindowModes = startOptions.supportWindowModes_; auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); std::string callerBundleName = abilityRecord ? abilityRecord->GetAbilityInfo().bundleName : ""; - if (abilityRequest.want.GetBundle() == callerBundleName) { + if (abilityRequest.want.GetBundleNameRef() == callerBundleName) { abilityRequest.hideStartWindow = startOptions.GetHideStartWindow(); } auto uiAbilityManager = GetUIAbilityManagerByUserId(oriValidUserId); @@ -2718,7 +2718,7 @@ int32_t AbilityManagerService::StartUIAbilitiesInSplitWindowModeHandleWant(const bool isReplaceWantExist = newWant.GetBoolParam("queryWantFromErms", false); newWant.RemoveParam("queryWantFromErms"); auto callerTokenId = IPCSkeleton::GetCallingTokenID(); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; RemoveUnauthorizedLaunchReasonMessage(secondaryWant, abilityRequest, callerTokenId); if (!IsAbilityControllerStart(secondaryWant, abilityInfo.bundleName)) { TAG_LOGE(AAFwkTag::ABILITYMGR, @@ -2742,7 +2742,7 @@ int32_t AbilityManagerService::GenerateAbilityForSplitMode(const AAFwk::Want &se auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); std::string callerBundleName = abilityRecord ? abilityRecord->GetAbilityInfo().bundleName : ""; UpdateCallerInfoUtil::GetInstance().UpdateCallerInfoFromToken(abilityRequest.want, callerToken); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; if (abilityInfo.type != AbilityType::PAGE) { TAG_LOGE(AAFwkTag::ABILITYMGR, "StartUIAbilitiesInSplitWindowMode ability type no UIAbility"); return RESOLVE_ABILITY_ERR; @@ -2836,7 +2836,7 @@ ErrCode AbilityManagerService::StartUIAbilities(const std::vector & TAG_LOGD(AAFwkTag::ABILITYMGR, "StartUIAbilities ready to NotifySCBToStartUIAbilities"); for (AbilityRequest &abilityRequest : abilityRequestList) { - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; ReportEventToRSS(abilityInfo, abilityRequest.callerToken); abilityRequest.userId = oriValidUserId; abilityRequest.want.SetParam(ServerConstant::IS_CALL_BY_SCB, false); @@ -2925,7 +2925,7 @@ int32_t AbilityManagerService::StartUIAbilitiesHandleWant(const Want &want, sptr UpdateCallerInfoUtil::GetInstance().UpdateCallerInfo(abilityRequest.want, callerToken); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; if (abilityInfo.type != AbilityType::PAGE) { TAG_LOGE(AAFwkTag::ABILITYMGR, "StartUIAbilities only support UIAbility"); return START_UI_ABILITIES_ONLY_SUPPORT_UI_ABILITY; @@ -2990,7 +2990,7 @@ int32_t AbilityManagerService::StartUIAbilitiesInterceptorCheck(const Want &want { int32_t requestCode = DEFAULT_INVAL_VALUE; Want newWant = abilityRequest.want; - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; auto shouldBlockFunc = [aams = shared_from_this()]() { return aams->ShouldBlockAllAppStart(); }; AbilityInterceptorParam interceptorParam = AbilityInterceptorParam(want, requestCode, userId, true, nullptr, shouldBlockFunc); @@ -3030,7 +3030,7 @@ int32_t AbilityManagerService::RequestDialogService(const Want &want, const sptr } TAG_LOGI(AAFwkTag::ABILITYMGR, "request dialog service, target:%{public}s/%{public}s", - want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str()); + want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str()); return RequestDialogServiceInner(want, callerToken, -1, -1); } @@ -3107,7 +3107,7 @@ int32_t AbilityManagerService::RequestDialogServiceInner(const Want &want, const } UpdateCallerInfoUtil::GetInstance().UpdateCallerInfo(abilityRequest.want, callerToken); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; threadLocalInfo.SetStartAbilityInfo(abilityInfo); EventInfo eventInfo; @@ -3172,17 +3172,17 @@ int32_t AbilityManagerService::OpenAtomicService(AAFwk::Want& want, const StartO int AbilityManagerService::SetWantForSessionInfo(sptr sessionInfo) { CHECK_POINTER_AND_RETURN(sessionInfo, ERR_INVALID_VALUE); - if (!(sessionInfo->want).GetElement().GetAbilityName().empty() && - !(sessionInfo->want).GetModuleName().empty()) { + if (!(sessionInfo->want).GetAbilityNameRef().empty() && + !(sessionInfo->want).GetModuleNameRef().empty()) { return ERR_OK; } auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bundleMgrHelper, ERR_INVALID_VALUE); Want launchWant; - TAG_LOGD(AAFwkTag::ABILITYMGR, "bundleName:%{public}s, userId:%{public}d", sessionInfo->want.GetBundle().c_str(), + TAG_LOGD(AAFwkTag::ABILITYMGR, "bundleName:%{public}s, userId:%{public}d", sessionInfo->want.GetBundleNameRef().c_str(), GetValidUserId(sessionInfo->userId)); auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle( - (sessionInfo->want).GetBundle(), launchWant, GetValidUserId(sessionInfo->userId))); + (sessionInfo->want).GetBundleNameRef(), launchWant, GetValidUserId(sessionInfo->userId))); if (errCode != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "getLaunchWantForBundle returns %{public}d", errCode); return errCode; @@ -3212,7 +3212,7 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr sessionInfo, Ab sessionInfo->want.SetParam(AbilityRuntime::GlobalConstant::PAGE_CONFIG, params.pageConfig); auto eventInfo = BuildEventInfo(sessionInfo->want, -1); #ifdef MEMMGR_OVERRIDE_ENABLE - auto bundleName = (sessionInfo->want).GetBundle(); + const auto& bundleName = (sessionInfo->want).GetBundleNameRef(); int windowMode = sessionInfo->want.GetIntParam(EXPECT_WINDOW_MODE, 0); if (AppUtils::GetInstance().IsRequireBigMemoryProcess(bundleName) && sessionInfo->want.HasParameter(EXPECT_WINDOW_MODE) && @@ -3235,7 +3235,7 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr sessionInfo, Ab "not sceneboard", true); return ERR_WRONG_INTERFACE_CALL; } - std::string targetBundleName = sessionInfo->want.GetBundle(); + const auto &targetBundleName = sessionInfo->want.GetBundleNameRef(); if (!AbilityPermissionUtil::GetInstance().CheckStartUIAbilityByUserLockStatus(targetBundleName)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "scb call, user lock"); return ERR_BLOCK_START_FIRST_BOOT_SCREEN_UNLOCK; @@ -3296,7 +3296,7 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr sessionInfo, Ab TAG_LOGI(AAFwkTag::ABILITYMGR, "free install task in progress"); const Want& want = sessionInfo->want; - freeInstallManager_->SetSCBCallStatus(want.GetBundle(), want.GetElement().GetAbilityName(), + freeInstallManager_->SetSCBCallStatus(want.GetBundleNameRef(), want.GetAbilityNameRef(), want.GetStringParam(Want::PARAM_RESV_START_TIME), true); return ERR_OK; } @@ -3385,7 +3385,7 @@ int AbilityManagerService::StartUIAbilityBySCBDefault(sptr sessionI (sessionInfo->want).RemoveParam(SPECIFY_TOKEN_ID); abilityRequest.specifyTokenId = specifyTokenId; - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { TAG_LOGE(AAFwkTag::ABILITYMGR, "only support page type ability"); AbilityEventUtil::SendStartAbilityErrorEvent(*eventInfo, ERR_INVALID_VALUE, @@ -3425,7 +3425,7 @@ int AbilityManagerService::StartUIAbilityBySCBDefault(sptr sessionI int32_t AbilityManagerService::StartUIAbilityBySCBDefaultCommon(AbilityRequest &abilityRequest, sptr sessionInfo, AbilityRuntime::StartParamsBySCB ¶ms, bool &isColdStart) { - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; if (!AbilityUtil::IsSystemDialogAbility(abilityInfo.bundleName, abilityInfo.name)) { int32_t result = PreLoadAppDataAbilities(abilityInfo.bundleName, IPCSkeleton::GetCallingUid() / BASE_USER_RANGE); if (result != ERR_OK) { @@ -3453,7 +3453,7 @@ int AbilityManagerService::HandleSandboxCloneLaunch(sptr sessionInf AppExecFwk::AbilityInfo sandboxAbilityInfo; if (sessionInfo->callerToken != nullptr) { auto callerRecord = Token::GetAbilityRecordByToken(sessionInfo->callerToken); - if (callerRecord && callerRecord->GetAbilityInfo().bundleName == sessionInfo->want.GetBundle()) { + if (callerRecord && callerRecord->GetAbilityInfo().bundleName == sessionInfo->want.GetBundleNameRef()) { auto callerSandboxCloneParam = callerRecord->GetSandboxCloneParams(); if (callerSandboxCloneParam && sandboxCloneParams) { sandboxCloneParams->callerBundleName = callerSandboxCloneParam->callerBundleName; @@ -3894,7 +3894,7 @@ int32_t AbilityManagerService::GetConfiguration(AppExecFwk::Configuration& confi int AbilityManagerService::CheckOptExtensionAbility(const Want &want, AbilityRequest &abilityRequest, int32_t validUserId, AppExecFwk::ExtensionAbilityType extensionType, bool isImplicit, bool isStartAsCaller) { - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; auto type = abilityInfo.type; if (type != AppExecFwk::AbilityType::EXTENSION) { TAG_LOGE(AAFwkTag::ABILITYMGR, "not extension ability"); @@ -4069,17 +4069,15 @@ void AbilityManagerService::ReportAbilityStartInfoToRSS(const AppExecFwk::Abilit if (abilityInfo.type == AppExecFwk::AbilityType::PAGE && abilityInfo.launchMode != AppExecFwk::LaunchMode::SPECIFIED) { std::vector runningProcessInfos; - if (IN_PROCESS_CALL(GetProcessRunningInfos(runningProcessInfos)) != ERR_OK) { + if (IN_PROCESS_CALL(GetProcessRunningInfosByAccessTokenId( + abilityInfo.applicationInfo.accessTokenId, runningProcessInfos)) != ERR_OK) { return; } bool isColdStart = true; int32_t pid = 0; bool supportWarmSmartGC = false; - int32_t preloadMode = -1; + int32_t preloadMode = gamePrelaunchFlag ? static_cast(AppExecFwk::PreloadMode::GAME_PRELAUNCH) : -1; bool isSuggestCache = false; - if (gamePrelaunchFlag) { - preloadMode = static_cast(AppExecFwk::PreloadMode::GAME_PRELAUNCH); - } for (auto const &info : runningProcessInfos) { if (info.uid_ == abilityInfo.applicationInfo.uid && info.processType_ == AppExecFwk::ProcessType::NORMAL && @@ -4205,7 +4203,7 @@ int AbilityManagerService::PreloadUIExtensionAbility(const Want &want, std::stri int32_t userId, int32_t hostPid, int32_t requestCode) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } TAG_LOGI(AAFwkTag::UI_EXT, "callerBundle: %{public}s", bundleName.c_str()); @@ -4226,7 +4224,7 @@ int AbilityManagerService::PreloadUIExtensionAbilityInner( const Want &want, std::string &hostBundleName, int32_t userId, int32_t hostPid, int32_t requestCode) { TAG_LOGD(AAFwkTag::UI_EXT, "PreloadUIExtension called, elementName: %{public}s/%{public}s", - want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str()); + want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str()); int32_t validUserId = GetValidUserId(userId); #ifdef ENABLE_CLONE_FOR_ACCOUNT CHECK_TRUE_RETURN_RET(!CloneForAccountUtil::ProcessAppIndex(const_cast(want), validUserId, true), @@ -4269,7 +4267,7 @@ int AbilityManagerService::PreloadUIExtensionAbilityInner( abilityRequest.requestCode = requestCode; abilityRequest.extensionType = abilityRequest.abilityInfo.extensionAbilityType; abilityRequest.want.SetParam(IS_PRELOAD_UIEXTENSION_ABILITY, true); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; abilityRequest.moduleProcess = ""; AppExecFwk::HapModuleInfo hapModuleInfo; if (DelayedSingleton::GetInstance()->GetHapModuleInfo( @@ -4499,7 +4497,7 @@ int32_t AbilityManagerService::StartExtensionAbilityInner(const Want &want, cons HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); TAG_LOGI(AAFwkTag::SERVICE_EXT, "StartExt,bundle:%{public}s,ability:%{public}s,u:%{public}d", - want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str(), userId); + want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str(), userId); CheckExtensionRateLimit(want); if (checkSystemCaller) { CHECK_CALLER_IS_SYSTEM_APP; @@ -4617,7 +4615,7 @@ int32_t AbilityManagerService::StartExtensionAbilityInner(const Want &want, cons if (!CheckWorkSchedulerPermission(callerToken, abilityRequest.abilityInfo.applicationInfo.uid)) { return CHECK_PERMISSION_FAILED; } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; validUserId = abilityInfo.applicationInfo.uid / BASE_USER_RANGE; TAG_LOGD(AAFwkTag::SERVICE_EXT, "userId is : %{public}d, singleton is : %{public}d", validUserId, static_cast(abilityInfo.applicationInfo.singleton)); @@ -4693,7 +4691,7 @@ int32_t AbilityManagerService::StartExtensionAbilityInner(const Want &want, cons bool AbilityManagerService::JudgeSystemParamsForPicker(const WantParams ¶meters) { - auto systemParamsForPickerMap = parameters.GetParams(); + const auto &systemParamsForPickerMap = parameters.GetParams(); if (systemParamsForPickerMap.find(SCREENCONFIG_SCREENMODE) == systemParamsForPickerMap.end()) { return true; } @@ -4710,8 +4708,8 @@ void AbilityManagerService::SetPickerElementNameAndParams(const sptrwant.GetStringParam(UIEXTENSION_TARGET_TYPE_KEY); if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled() && - extensionSessionInfo->want.GetBundle().empty() && - extensionSessionInfo->want.GetElement().GetAbilityName().empty() && + extensionSessionInfo->want.GetBundleNameRef().empty() && + extensionSessionInfo->want.GetAbilityNameRef().empty() && COMMON_PICKER_TYPE.find(targetType) != COMMON_PICKER_TYPE.end()) { std::string abilityName = "CommonSelectPickerAbility"; std::string bundleName = "com.ohos.amsdialog"; @@ -4725,8 +4723,8 @@ void AbilityManagerService::SetPickerElementNameAndParams(const sptrwant.SetParams(parameters); return; } - if (extensionSessionInfo->want.GetBundle().empty() && - extensionSessionInfo->want.GetElement().GetAbilityName().empty() && !targetType.empty()) { + if (extensionSessionInfo->want.GetBundleNameRef().empty() && + extensionSessionInfo->want.GetAbilityNameRef().empty() && !targetType.empty()) { std::string abilityName; std::string bundleName; std::string pickerType; @@ -4843,9 +4841,9 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr &exte auto bms = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bms, ERR_INVALID_VALUE); TAG_LOGD(AAFwkTag::UI_EXT, "bundleName: %{public}s, userId: %{public}d", - extensionSessionInfo->want.GetBundle().c_str(), GetValidUserId(userId)); + extensionSessionInfo->want.GetBundleNameRef().c_str(), GetValidUserId(userId)); AppExecFwk::BundleInfo bundleInfo; - if (!IN_PROCESS_CALL(bms->GetBundleInfo(extensionSessionInfo->want.GetBundle(), + if (!IN_PROCESS_CALL(bms->GetBundleInfo(extensionSessionInfo->want.GetBundleNameRef(), AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo, GetValidUserId(userId)))) { TAG_LOGE(AAFwkTag::UI_EXT, "verifyPermission failed get application info"); return CHECK_PERMISSION_FAILED; @@ -4854,7 +4852,7 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr &exte TAG_LOGE(AAFwkTag::UI_EXT, "only support atomicService"); return ERR_INVALID_CALLER; } - if (extensionSessionInfo->want.GetElement().GetAbilityName().empty()) { + if (extensionSessionInfo->want.GetAbilityNameRef().empty()) { if (bundleInfo.abilityInfos.empty()) { TAG_LOGE(AAFwkTag::UI_EXT, "failed get abilityInfos"); eventInfo->errReason = "failed get abilityInfos"; @@ -4962,8 +4960,8 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr &exte static_cast(callerRecord->GetRecordId()) << OFFSET) | static_cast(abilityRequest.sessionInfo->persistentId); TAG_LOGI(AAFwkTag::UI_EXT, "StartUIExtension: persistentId: %{public}d, element: %{public}s/%{public}s", - abilityRequest.sessionInfo->persistentId, extensionSessionInfo->want.GetBundle().c_str(), - extensionSessionInfo->want.GetElement().GetAbilityName().c_str()); + abilityRequest.sessionInfo->persistentId, extensionSessionInfo->want.GetBundleNameRef().c_str(), + extensionSessionInfo->want.GetAbilityNameRef().c_str()); if (result != ERR_OK) { TAG_LOGE(AAFwkTag::UI_EXT, "generate ability request local error"); eventInfo->errReason = "generate ability request local error"; @@ -4985,7 +4983,7 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr &exte if (!HandleExecuteSAInterceptor(extensionSessionInfo->want, callerToken, abilityRequest, result)) { return result; } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; threadLocalInfo.SetStartAbilityInfo(abilityInfo); validUserId = abilityInfo.applicationInfo.singleton ? U0_USER_ID : validUserId; TAG_LOGD(AAFwkTag::UI_EXT, "userId is : %{public}d, singleton is : %{public}d", @@ -5055,7 +5053,7 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr(abilityInfo.applicationInfo.singleton)); @@ -5184,7 +5182,7 @@ void AbilityManagerService::StopSwitchUserDialogInner(const Want &want, const in return; } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; auto stopUserId = abilityInfo.applicationInfo.uid / BASE_USER_RANGE; result = CheckOptExtensionAbility(want, abilityRequest, stopUserId, AppExecFwk::ExtensionAbilityType::SERVICE); if (result != ERR_OK) { @@ -5480,8 +5478,8 @@ int AbilityManagerService::TerminateUIExtensionAbility(const sptr & } TAG_LOGD(AAFwkTag::ABILITYMGR, "UIExtension persistentId: %{public}d, element: %{public}s/%{public}s", - extensionSessionInfo->persistentId, extensionSessionInfo->want.GetBundle().c_str(), - extensionSessionInfo->want.GetElement().GetAbilityName().c_str()); + extensionSessionInfo->persistentId, extensionSessionInfo->want.GetBundleNameRef().c_str(), + extensionSessionInfo->want.GetAbilityNameRef().c_str()); connectManager->TerminateAbilityWindowLocked(targetRecord, extensionSessionInfo); return ERR_OK; } @@ -5695,9 +5693,9 @@ bool AbilityManagerService::CheckIsRemote(const std::string& deviceId) bool AbilityManagerService::CheckIfOperateRemote(const Want &want) { - std::string deviceId = want.GetDeviceId(); - if (deviceId.empty() || want.GetBundle().empty() || - want.GetElement().GetAbilityName().empty()) { + const auto &deviceId = want.GetDeviceIdRef(); + if (deviceId.empty() || want.GetBundleNameRef().empty() || + want.GetAbilityNameRef().empty()) { TAG_LOGD(AAFwkTag::ABILITYMGR, "CheckIfOperateRemote: DeviceId or BundleName or GetAbilityName empty"); return false; } @@ -5801,8 +5799,8 @@ int AbilityManagerService::MinimizeUIExtensionAbility(const sptr &e static_cast(abilityRecord->GetRecordId()) << OFFSET) | static_cast(extensionSessionInfo->persistentId); TAG_LOGD(AAFwkTag::ABILITYMGR, "UIExtension component id: %{public}" PRId64 ", element: %{public}s/%{public}s", - extensionSessionInfo->uiExtensionComponentId, extensionSessionInfo->want.GetBundle().c_str(), - extensionSessionInfo->want.GetElement().GetAbilityName().c_str()); + extensionSessionInfo->uiExtensionComponentId, extensionSessionInfo->want.GetBundleNameRef().c_str(), + extensionSessionInfo->want.GetAbilityNameRef().c_str()); connectManager->BackgroundAbilityWindowLocked(targetRecord, extensionSessionInfo); return ERR_OK; } @@ -5898,7 +5896,7 @@ int32_t AbilityManagerService::ConnectAbilityCommon( } if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } if (specifiedFullTokenId != 0 && IPCSkeleton::GetCallingUid() != DMS_UID) { @@ -5906,9 +5904,9 @@ int32_t AbilityManagerService::ConnectAbilityCommon( specifiedFullTokenId = 0; } HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); TAG_LOGI(AAFwkTag::SERVICE_EXT, "element: %{public}s/%{public}s", - want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str()); + want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str()); int result = AgentAbilityUtil::CheckAgentConnectEntry(want, extensionType); if (result != ERR_OK) { return result; @@ -6007,7 +6005,7 @@ int32_t AbilityManagerService::ConnectAbilityCommon( Want abilityWant = checkedWant; AbilityRequest abilityRequest; - std::string uri = abilityWant.GetUri().ToString(); + std::string uri = abilityWant.GetUriRef().ToString(); bool isFileUri = (abilityWant.GetUri().GetScheme() == "file"); if (!uri.empty() && !isFileUri) { // if the want include uri, it may only has uri information. it is probably a datashare extension. @@ -6085,14 +6083,14 @@ int AbilityManagerService::ConnectUIExtensionAbility(const Want &want, const spt const sptr &sessionInfo, int32_t userId, sptr connectInfo) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); XCOLLIE_TIMER_LESS(__PRETTY_FUNCTION__); TAG_LOGI(AAFwkTag::UI_EXT, "ConnectUIExtensionAbility bundlename: %{public}s, ability is %{public}s, userId is %{private}d", - want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str(), userId); + want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str(), userId); CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); CHECK_POINTER_AND_RETURN(sessionInfo, ERR_INVALID_VALUE); @@ -6137,12 +6135,12 @@ int AbilityManagerService::ConnectUIExtensionAbility(const Want &want, const spt Want abilityWant = want; AbilityRequest abilityRequest; - std::string uri = abilityWant.GetUri().ToString(); + std::string uri = abilityWant.GetUriRef().ToString(); if (!uri.empty()) { // if the want include uri, it may only has uri information. TAG_LOGI(AAFwkTag::UI_EXT, "called. uri:%{public}s/%{public}s, userId %{public}d", - abilityWant.GetBundle().c_str(), - abilityWant.GetElement().GetAbilityName().c_str(), validUserId); + abilityWant.GetBundleNameRef().c_str(), + abilityWant.GetAbilityNameRef().c_str(), validUserId); AppExecFwk::ExtensionAbilityInfo extensionInfo; auto bms = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bms, ERR_INVALID_VALUE); @@ -6188,9 +6186,9 @@ std::shared_ptr AbilityManagerService::BuildEventInfo(const Want &wan { auto eventInfo = std::make_shared(); eventInfo->userId = userId; - eventInfo->bundleName = want.GetBundle(); - eventInfo->moduleName = want.GetModuleName(); - eventInfo->abilityName = want.GetElement().GetAbilityName(); + eventInfo->bundleName = want.GetBundleNameRef(); + eventInfo->moduleName = want.GetModuleNameRef(); + eventInfo->abilityName = want.GetAbilityNameRef(); return eventInfo; } @@ -6302,7 +6300,7 @@ int32_t AbilityManagerService::ConnectLocalAbility(const Want &want, const int32 return result; } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; threadLocalInfo.SetStartAbilityInfo(abilityInfo); if (abilityInfo.isStageBasedModel) { bool isService = (abilityInfo.extensionAbilityType == AppExecFwk::ExtensionAbilityType::SERVICE); @@ -6463,7 +6461,7 @@ int AbilityManagerService::ConnectRemoteAbility(Want &want, const sptr AbilityManagerService::GetWantSenderByUserId(const WantSenderI { bool isSpecifyUserId = wantSenderInfo.userId > 0; std::string bundleName = wantSenderInfo.allWants.empty() ? "" : - wantSenderInfo.allWants.back().want.GetBundle(); + wantSenderInfo.allWants.back().want.GetBundleNameRef(); bool isSACall = AAFwk::PermissionVerification::GetInstance()->IsSACall(); bool isSystemApp = AAFwk::PermissionVerification::GetInstance()->IsSystemAppCall(); int32_t userId = -1; @@ -7006,7 +7004,7 @@ sptr AbilityManagerService::GetWantSender( int32_t appIndex = 0; std::string bundleName = ""; if (!wantSenderInfo.allWants.empty()) { - bundleName = wantSenderInfo.allWants.back().want.GetBundle(); + bundleName = wantSenderInfo.allWants.back().want.GetBundleNameRef(); } if (!bundleName.empty()) { if (!isSpecifyUidBySa) { @@ -7537,7 +7535,7 @@ int AbilityManagerService::CleanAllMissions() Want want; want.SetElementName(AbilityConfig::LAUNCHER_BUNDLE_NAME, AbilityConfig::LAUNCHER_ABILITY_NAME); if (!IsAbilityControllerStart(want, AbilityConfig::LAUNCHER_BUNDLE_NAME)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "isAbilityControllerStart failed:%{public}s", want.GetBundle().c_str()); + TAG_LOGE(AAFwkTag::ABILITYMGR, "isAbilityControllerStart failed:%{public}s", want.GetBundleNameRef().c_str()); return ERR_WOULD_BLOCK; } @@ -7670,9 +7668,9 @@ bool AbilityManagerService::IsAbilityControllerStartById(int32_t missionId) "cannot find mission info:%{public}d", missionId); return true; } - if (!IsAbilityControllerStart(innerMissionInfo.missionInfo.want, innerMissionInfo.missionInfo.want.GetBundle())) { + if (!IsAbilityControllerStart(innerMissionInfo.missionInfo.want, innerMissionInfo.missionInfo.want.GetBundleNameRef())) { TAG_LOGE(AAFwkTag::ABILITYMGR, "isAbilityControllerStart failed:%{public}s", - innerMissionInfo.missionInfo.want.GetBundle().c_str()); + innerMissionInfo.missionInfo.want.GetBundleNameRef().c_str()); return false; } return true; @@ -8774,13 +8772,13 @@ int AbilityManagerService::GenerateAbilityRequest(const Want &want, int requestC request.callerTokenRecordId = abilityRecord->GetRecordId(); } if (abilityRecord && AbilityRuntime::GlobalConstant::IsDlpIndex(abilityRecord->GetAppIndex()) && - abilityRecord->GetApplicationInfo().bundleName == want.GetBundle()) { + abilityRecord->GetApplicationInfo().bundleName == want.GetBundleNameRef()) { (const_cast(want)).SetParam(AbilityRuntime::ServerConstant::DLP_INDEX, abilityRecord->GetAppIndex()); (const_cast(want)).SetParam(DLP_PARAMS_SECURITY_FLAG, abilityRecord->GetSecurityFlag()); } if (abilityRecord != nullptr && - abilityRecord->GetApplicationInfo().bundleName == want.GetBundle() && + abilityRecord->GetApplicationInfo().bundleName == want.GetBundleNameRef() && (!want.HasParameter(Want::PARAM_APP_CLONE_INDEX_KEY) || want.GetIntParam(Want::PARAM_APP_CLONE_INDEX_KEY, 0) == abilityRecord->GetAppIndex())) { (const_cast(want)).SetParam(AbilityConfig::DEBUG_APP, abilityRecord->IsDebugApp()); @@ -8796,7 +8794,7 @@ int AbilityManagerService::GenerateAbilityRequest(const Want &want, int requestC } auto abilityInfo = StartAbilityUtils::startAbilityInfo; - if (abilityInfo == nullptr || abilityInfo->GetAppBundleName() != want.GetBundle()) { + if (abilityInfo == nullptr || abilityInfo->GetAppBundleName() != want.GetBundleNameRef()) { int32_t appIndex = 0; if (!StartAbilityUtils::GetAppIndex(want, callerToken, appIndex)) { return ERR_APP_CLONE_INDEX_INVALID; @@ -8915,7 +8913,7 @@ int AbilityManagerService::GenerateExtensionAbilityRequest(const Want &want, Abi } } if (abilityRecord && AbilityRuntime::GlobalConstant::IsDlpIndex(abilityRecord->GetAppIndex()) && - abilityRecord->GetApplicationInfo().bundleName == want.GetBundle()) { + abilityRecord->GetApplicationInfo().bundleName == want.GetBundleNameRef()) { (const_cast(want)).SetParam(AbilityRuntime::ServerConstant::DLP_INDEX, abilityRecord->GetAppIndex()); (const_cast(want)).SetParam(DLP_PARAMS_SECURITY_FLAG, abilityRecord->GetSecurityFlag()); } @@ -8927,7 +8925,7 @@ int AbilityManagerService::GenerateExtensionAbilityRequest(const Want &want, Abi } auto abilityInfo = StartAbilityUtils::startAbilityInfo; - if (abilityInfo == nullptr || abilityInfo->GetAppBundleName() != want.GetBundle()) { + if (abilityInfo == nullptr || abilityInfo->GetAppBundleName() != want.GetBundleNameRef()) { int32_t appIndex = 0; if (!StartAbilityUtils::GetAppIndex(want, callerToken, appIndex)) { return ERR_APP_CLONE_INDEX_INVALID; @@ -8983,7 +8981,7 @@ int32_t AbilityManagerService::InitialAbilityRequest(AbilityRequest &request, int AbilityManagerService::StopServiceAbility(const Want &want, int32_t userId, const sptr &token) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); TAG_LOGD(AAFwkTag::ABILITYMGR, "call."); auto isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall(); @@ -9014,7 +9012,7 @@ int AbilityManagerService::StopServiceAbility(const Want &want, int32_t userId, return result; } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; validUserId = abilityInfo.applicationInfo.uid / BASE_USER_RANGE; TAG_LOGD(AAFwkTag::ABILITYMGR, "validUserId : %{public}d, singleton is : %{public}d", validUserId, static_cast(abilityInfo.applicationInfo.singleton)); @@ -10215,10 +10213,10 @@ int AbilityManagerService::StartAbilityByCallWithErrMsg(const Want &want, const } auto eventInfo = BuildEventInfo(want, accountId); if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } - XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceId().empty()); + XCOLLIE_TIMER_LESS_IGNORE(__PRETTY_FUNCTION__, !want.GetDeviceIdRef().empty()); TAG_LOGD(AAFwkTag::ABILITYMGR, "call"); int paramCheckResult = AbilityStartByCallHelper::CheckParam(connect, errMsg); if (paramCheckResult != ERR_OK) { @@ -11274,7 +11272,7 @@ void AbilityManagerService::StartSwitchUserDialogInner(const Want &want, int32_t return; } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; auto startUserId = abilityInfo.applicationInfo.uid / BASE_USER_RANGE; abilityRequest.userId = startUserId; result = CheckOptExtensionAbility(want, abilityRequest, startUserId, AppExecFwk::ExtensionAbilityType::SERVICE); @@ -11732,9 +11730,9 @@ int AbilityManagerService::DelegatorDoAbilityForeground(const sptrGetWant(); - if (!IsAbilityControllerStart(want, want.GetBundle())) { + if (!IsAbilityControllerStart(want, want.GetBundleNameRef())) { TAG_LOGE(AAFwkTag::ABILITYMGR, - "sceneBoard IsAbilityControllerStart failed:%{public}s", want.GetBundle().c_str()); + "sceneBoard IsAbilityControllerStart failed:%{public}s", want.GetBundleNameRef().c_str()); return ERR_WOULD_BLOCK; } return ERR_OK; @@ -11923,7 +11921,7 @@ bool AbilityManagerService::CheckOneSkillPermission(const AppExecFwk::Skill &ski int AbilityManagerService::CheckStaticCfgPermissionForSkill(const AppExecFwk::AbilityRequest &abilityRequest, uint32_t tokenId) { - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; auto resultAbilityPermission = CheckStaticCfgPermissionForAbility(abilityInfo, tokenId); if (resultAbilityPermission != AppExecFwk::Constants::PERMISSION_GRANTED) { return resultAbilityPermission; @@ -11948,7 +11946,7 @@ int AbilityManagerService::CheckStaticCfgPermissionForSkill(const AppExecFwk::Ab int AbilityManagerService::CheckStaticCfgPermission(const AppExecFwk::AbilityRequest &abilityRequest, bool isStartAsCaller, uint32_t callerTokenId, bool isData, bool isSaCall, bool isImplicit) { - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); if (AppUtils::GetInstance().IsSupportAncoApp() && StartAbilityUtils::IsCallFromAncoShellOrBroker(abilityRequest.callerToken)) { @@ -12691,7 +12689,7 @@ int AbilityManagerService::CheckCallServicePermission(const AbilityRequest &abil { if (abilityRequest.want.GetIntParam(Want::PARAM_RESV_CALLER_UID, IPCSkeleton::GetCallingUid()) == AppUtils::GetInstance().GetCollaboratorBrokerUID() && - abilityRequest.want.GetBundle() == AppUtils::GetInstance().GetBrokerDelegateBundleName()) { + abilityRequest.want.GetBundleNameRef() == AppUtils::GetInstance().GetBrokerDelegateBundleName()) { auto collaborator = GetCollaborator(CollaboratorType::RESERVE_TYPE); if (collaborator != nullptr) { TAG_LOGI(AAFwkTag::ABILITYMGR, "Collaborator CheckCallAbilityPermission"); @@ -13119,8 +13117,8 @@ bool AbilityManagerService::CheckUIExtensionCallerIsForeground(const AbilityRequ } TAG_LOGE(AAFwkTag::ABILITYMGR, "caller app not foreground, can't start %{public}s/%{public}s", - abilityRequest.want.GetBundle().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); return false; } @@ -13489,8 +13487,8 @@ bool AbilityManagerService::IsTargetPermission(const Want &want) const bundleName = info.grantBundleName; abilityName = info.grantServiceAbilityName; } - if (want.GetBundle() == bundleName && - want.GetElement().GetAbilityName() == abilityName) { + if (want.GetBundleNameRef() == bundleName && + want.GetAbilityNameRef() == abilityName) { return true; } @@ -13595,7 +13593,7 @@ int AbilityManagerService::CheckDlpForExtension( HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); // check if form frs auto callingUid = IPCSkeleton::GetCallingUid(); - std::string bundleName = want.GetBundle(); + const auto &bundleName = want.GetBundleNameRef(); if (callingUid == FOUNDATION_UID && FRS_BUNDLE_NAME == bundleName) { return ERR_OK; } @@ -13922,7 +13920,7 @@ int32_t AbilityManagerService::StartSpecifiedAbilityBySCB(const Want &want, cons TAG_LOGE(AAFwkTag::ABILITYMGR, "no sceneboard called, no allowed"); return ERR_PERMISSION_DENIED; } - std::string targetBundleName = want.GetBundle(); + const auto &targetBundleName = want.GetBundleNameRef(); if (!AbilityPermissionUtil::GetInstance().CheckStartUIAbilityByUserLockStatus(targetBundleName)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "scb call, user lock"); return ERR_BLOCK_START_FIRST_BOOT_SCREEN_UNLOCK; @@ -15059,7 +15057,7 @@ bool AbilityManagerService::IsAbilityControllerStart(const Want &want) bool isBrokerCall = (callingUid == AppUtils::GetInstance().GetCollaboratorBrokerUID() || callingUid == AppUtils::GetInstance().GetCollaboratorBrokerReserveUID()); if (isBrokerCall) { - return IsAbilityControllerStart(want, want.GetBundle()); + return IsAbilityControllerStart(want, want.GetBundleNameRef()); } TAG_LOGE(AAFwkTag::ABILITYMGR, "interface only support broker"); return true; @@ -15397,7 +15395,7 @@ int32_t AbilityManagerService::GetForegroundUIAbilities(std::vectorGetAbilityInfo(); PrintStartAbilityInfo(callerAbilityInfo, abilityInfo); if (abilityRecord->GetApplicationInfo().apiTargetVersion % API_VERSION_MOD < API12) { @@ -16468,7 +16466,7 @@ bool AbilityManagerService::ShouldPreventStartAbility(const AbilityRequest &abil return true; } -void AbilityManagerService::PrintStartAbilityInfo(AppExecFwk::AbilityInfo callerInfo, AppExecFwk::AbilityInfo calledInfo) +void AbilityManagerService::PrintStartAbilityInfo(const AppExecFwk::AbilityInfo &callerInfo, const AppExecFwk::AbilityInfo &calledInfo) { TAG_LOGD(AAFwkTag::ABILITYMGR, "calledAbilityInfo toString: " "calledUid is: %{public}d, " @@ -16855,12 +16853,12 @@ int32_t AbilityManagerService::PreStartInner(const FreeInstallInfo& taskInfo) return errCode; } CHECK_POINTER_AND_RETURN(freeInstallManager_, ERR_INVALID_VALUE); - freeInstallManager_->SetFreeInstallTaskSessionId(taskInfo.want.GetBundle(), - taskInfo.want.GetElement().GetAbilityName(), + freeInstallManager_->SetFreeInstallTaskSessionId(taskInfo.want.GetBundleNameRef(), + taskInfo.want.GetAbilityNameRef(), taskInfo.want.GetStringParam(Want::PARAM_RESV_START_TIME), sessionId); - freeInstallManager_->SetPreStartMissionCallStatus(taskInfo.want.GetBundle(), - taskInfo.want.GetElement().GetAbilityName(), + freeInstallManager_->SetPreStartMissionCallStatus(taskInfo.want.GetBundleNameRef(), + taskInfo.want.GetAbilityNameRef(), taskInfo.want.GetStringParam(Want::PARAM_RESV_START_TIME), true); return ERR_OK; @@ -16885,8 +16883,8 @@ int32_t AbilityManagerService::StartUIAbilityByPreInstall(const FreeInstallInfo TAG_LOGE(AAFwkTag::ABILITYMGR, "session id empty"); return ERR_INVALID_VALUE; } - auto bundleName = want.GetBundle(); - auto abilityName = want.GetElement().GetAbilityName(); + const auto &bundleName = want.GetBundleNameRef(); + const auto &abilityName = want.GetAbilityNameRef(); auto startTime = want.GetStringParam(Want::PARAM_RESV_START_TIME); TAG_LOGI(AAFwkTag::ABILITYMGR, "call" "sessionId=%{public}s,bundleName=%{public}s,abilityName=%{public}s,startTime=%{public}s", @@ -16990,7 +16988,7 @@ int AbilityManagerService::StartUIAbilityByPreInstallInner(sptr ses #endif // SUPPORT_SCREEN } - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; validUserId = abilityInfo.applicationInfo.uid / BASE_USER_RANGE; TAG_LOGD(AAFwkTag::ABILITYMGR, "userId is : %{public}d, singleton is : %{public}d", validUserId, static_cast(abilityInfo.applicationInfo.singleton)); @@ -17214,7 +17212,7 @@ ErrCode AbilityManagerService::OpenLinkInner(const Want& want, sptr callerToken) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } XCOLLIE_TIMER_LESS(__PRETTY_FUNCTION__); @@ -17867,7 +17865,7 @@ int AbilityManagerService::StartSelfUIAbilityWithStartOptionsAndToken(const Want const StartOptions &options, sptr callerToken) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } XCOLLIE_TIMER_LESS(__PRETTY_FUNCTION__); @@ -18019,7 +18017,7 @@ int32_t AbilityManagerService::StartUIAbilityWithCallback(const Want &want, sptr sptr callback) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetBundleNameRef().c_str()); return INNER_ERR; } sptr effectiveCallback = callback; @@ -18051,7 +18049,7 @@ int32_t AbilityManagerService::CheckStartPlugin(const Want& want, sptr &callerRecord, AppExecFwk::AbilityInfo &abilityInfo) { CHECK_POINTER_AND_RETURN(callerRecord, INNER_ERR); - std::string targetBundleName = want.GetBundle(); - std::string targetAbilityName = want.GetElement().GetAbilityName(); + const auto &targetBundleName = want.GetBundleNameRef(); + const auto &targetAbilityName = want.GetAbilityNameRef(); CHECK_TRUE_RETURN_RET(targetBundleName.empty() || targetAbilityName.empty(), START_UI_ABILITIES_NOT_SUPPORT_IMPLICIT_START, "implicit start not allowed"); CHECK_TRUE_RETURN_RET(targetBundleName != callerRecord->GetApplicationInfo().bundleName, @@ -19047,7 +19045,7 @@ int32_t AbilityManagerService::StartSandboxCloneAbility(const Want &want, const modifiedWant.RemoveParam(AbilityRuntime::ServerConstant::DLP_INDEX); StartAbilityWrapParam startParam; - startParam.want = modifiedWant; + startParam.want = std::move(modifiedWant); startParam.sandboxCloneParams = std::make_shared(params); int32_t result = StartAbilityInner(startParam); if (result != ERR_OK) { diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index fcd06173a3..9824b87a45 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -2158,19 +2158,19 @@ Want AbilityRecord::GetWant() const std::string AbilityRecord::GetAbilityName() const { std::lock_guard guard(wantLock_); - return want_.GetElement().GetAbilityName(); + return want_.GetAbilityNameRef(); } std::string AbilityRecord::GetBundleName() const { std::lock_guard guard(wantLock_); - return want_.GetBundle(); + return want_.GetBundleNameRef(); } std::string AbilityRecord::GetModuleName() const { std::lock_guard guard(wantLock_); - return want_.GetModuleName(); + return want_.GetModuleNameRef(); } std::string AbilityRecord::GetStringParam(const std::string &key) const diff --git a/services/abilitymgr/src/assert_fault_proxy.cpp b/services/abilitymgr/src/assert_fault_proxy.cpp index 246be12e3e..7664b5f57c 100644 --- a/services/abilitymgr/src/assert_fault_proxy.cpp +++ b/services/abilitymgr/src/assert_fault_proxy.cpp @@ -200,9 +200,9 @@ void ModalSystemAssertUIExtension::AssertDialogConnection::OnAbilityConnectDone( MessageOption option; data.WriteInt32(MESSAGE_PARCEL_KEY_SIZE); data.WriteString16(u"bundleName"); - data.WriteString16(Str8ToStr16(want_.GetElement().GetBundleName())); + data.WriteString16(Str8ToStr16(want_.GetBundleNameRef())); data.WriteString16(u"abilityName"); - data.WriteString16(Str8ToStr16(want_.GetElement().GetAbilityName())); + data.WriteString16(Str8ToStr16(want_.GetAbilityNameRef())); data.WriteString16(u"parameters"); nlohmann::json param; param[UIEXTENSION_TYPE_KEY] = want_.GetStringParam(UIEXTENSION_TYPE_KEY); diff --git a/services/abilitymgr/src/connection_record.cpp b/services/abilitymgr/src/connection_record.cpp index 5020486b97..1df47977ff 100644 --- a/services/abilitymgr/src/connection_record.cpp +++ b/services/abilitymgr/src/connection_record.cpp @@ -145,7 +145,7 @@ void ConnectionRecord::CompleteConnect() targetService_->SetAbilityState(AbilityState::ACTIVE); TAG_LOGI(AAFwkTag::ABILITYMGR, "Connect,%{public}s", targetService_->GetAbilityInfo().name.c_str()); const AppExecFwk::AbilityInfo &abilityInfo = targetService_->GetAbilityInfo(); - AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceId(), abilityInfo.bundleName, + AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceIdRef(), abilityInfo.bundleName, abilityInfo.name, abilityInfo.moduleName); auto remoteObject = targetService_->GetConnRemoteObject(); auto callback = GetAbilityConnectCallback(); @@ -198,7 +198,7 @@ void ConnectionRecord::CompleteConnectAndOnlyCallConnectDone() CHECK_POINTER(targetService_); TAG_LOGI(AAFwkTag::ABILITYMGR, "CompleteConnect,%{public}s", targetService_->GetAbilityInfo().name.c_str()); const AppExecFwk::AbilityInfo &abilityInfo = targetService_->GetAbilityInfo(); - AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceId(), abilityInfo.bundleName, + AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceIdRef(), abilityInfo.bundleName, abilityInfo.name, abilityInfo.moduleName); auto remoteObject = targetService_->GetConnRemoteObject(); auto callback = GetAbilityConnectCallback(); @@ -287,7 +287,7 @@ void ConnectionRecord::CompleteDisconnect(int resultCode, bool isCallerDied, boo } CHECK_POINTER(targetService_); const AppExecFwk::AbilityInfo &abilityInfo = targetService_->GetAbilityInfo(); - AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceId(), abilityInfo.bundleName, + AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceIdRef(), abilityInfo.bundleName, abilityInfo.name, abilityInfo.moduleName); auto code = isTargetDied ? (resultCode - 1) : resultCode; auto onDisconnectDoneTask = [connCallback = GetAbilityConnectCallback(), element, code, @@ -447,7 +447,7 @@ void ConnectionRecord::CompleteLowCodeAgentInvocation(const Want &want, const sp { CHECK_POINTER(targetService_); const AppExecFwk::AbilityInfo &abilityInfo = targetService_->GetAbilityInfo(); - AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceId(), abilityInfo.bundleName, + AppExecFwk::ElementName element(targetService_->GetWant().GetDeviceIdRef(), abilityInfo.bundleName, abilityInfo.name, abilityInfo.moduleName); auto remoteObject = targetService_->GetConnRemoteObject(); if (remoteObject == nullptr) { diff --git a/services/abilitymgr/src/dialog_session/dialog_session_manager.cpp b/services/abilitymgr/src/dialog_session/dialog_session_manager.cpp index 6ad6674424..80edf325ec 100644 --- a/services/abilitymgr/src/dialog_session/dialog_session_manager.cpp +++ b/services/abilitymgr/src/dialog_session/dialog_session_manager.cpp @@ -424,7 +424,7 @@ int DialogSessionManager::CreateImplicitSelectorModalDialog(AbilityRequest &abil sessionWant.SetParam("deviceType", OHOS::system::GetDeviceType()); sessionWant.SetParam("userId", userId); - sessionWant.SetParam("action", abilityRequest.want.GetAction()); + sessionWant.SetParam("action", abilityRequest.want.GetActionRef()); sessionWant.SetParam("wantType", abilityRequest.want.GetType()); sessionWant.SetParam("uri", abilityRequest.want.GetUriString()); sessionWant.SetParam("entities", abilityRequest.want.GetEntities()); diff --git a/services/abilitymgr/src/extension_record/base_extension_record.cpp b/services/abilitymgr/src/extension_record/base_extension_record.cpp index 40d0514dc6..680c8a70cc 100644 --- a/services/abilitymgr/src/extension_record/base_extension_record.cpp +++ b/services/abilitymgr/src/extension_record/base_extension_record.cpp @@ -272,7 +272,7 @@ void BaseExtensionRecord::DumpUIExtensionRootHostInfo(std::vector & std::string dumpInfo = " root host bundle name [" + hostInfo.elementName_.GetBundleName() + "]"; info.emplace_back(dumpInfo); - dumpInfo = " root host module name [" + hostInfo.elementName_.GetModuleName() + "]"; + dumpInfo = " root host module name [" + hostInfo.elementName_.GetModuleNameRef() + "]"; info.emplace_back(dumpInfo); dumpInfo = " root host ability name [" + hostInfo.elementName_.GetAbilityName() + "]"; info.emplace_back(dumpInfo); diff --git a/services/abilitymgr/src/extension_record/extension_record_manager.cpp b/services/abilitymgr/src/extension_record/extension_record_manager.cpp index d09c24ccf8..57320bea82 100644 --- a/services/abilitymgr/src/extension_record/extension_record_manager.cpp +++ b/services/abilitymgr/src/extension_record/extension_record_manager.cpp @@ -239,7 +239,7 @@ int32_t ExtensionRecordManager::GetOrCreateExtensionRecord(const AAFwk::AbilityR auto wantEle = abilityRequest.want.GetElement(); std::string abilityName = wantEle.GetAbilityName(); std::string bundleName = wantEle.GetBundleName(); - std::string moduleName = wantEle.GetModuleName(); + std::string moduleName = wantEle.GetModuleNameRef(); auto extensionRecordMapKey = std::make_tuple(abilityName, bundleName, moduleName, hostPid); RemovePreloadUIExtensionRecord(extensionRecordMapKey); HandlePreloadUIExtensionLoaded(extensionRecord); @@ -492,7 +492,7 @@ bool ExtensionRecordManager::IsPreloadExtensionRecord(const AAFwk::AbilityReques auto wantEle = abilityRequest.want.GetElement(); std::string abilityName = wantEle.GetAbilityName(); std::string bundleName = wantEle.GetBundleName(); - std::string moduleName = wantEle.GetModuleName(); + std::string moduleName = wantEle.GetModuleNameRef(); auto extensionRecordMapKey = std::make_tuple(abilityName, bundleName, moduleName, hostPid); TAG_LOGD(AAFwkTag::ABILITYMGR, "hostBundleName: %{public}d, bundleName: %{public}s", hostPid, bundleName.c_str()); diff --git a/services/abilitymgr/src/free_install_manager.cpp b/services/abilitymgr/src/free_install_manager.cpp index 172189ca27..6879c2b6bf 100644 --- a/services/abilitymgr/src/free_install_manager.cpp +++ b/services/abilitymgr/src/free_install_manager.cpp @@ -121,7 +121,7 @@ int FreeInstallManager::StartFreeInstall(const Want &want, int32_t userId, int r sptr callerToken, std::shared_ptr param) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - TAG_LOGI(AAFwkTag::FREE_INSTALL, "StartFreeInstall:%{public}s", want.GetBundle().c_str()); + TAG_LOGI(AAFwkTag::FREE_INSTALL, "StartFreeInstall:%{public}s", want.GetBundleNameRef().c_str()); bool skipPermissionCheck = param != nullptr ? param->skipStartFreeInstallPermissionCheck : false; if (!skipPermissionCheck && !VerifyStartFreeInstallPermission(callerToken)) { TAG_LOGE(AAFwkTag::FREE_INSTALL, "permission denied"); @@ -165,7 +165,7 @@ int FreeInstallManager::StartFreeInstall(const Want &want, int32_t userId, int r auto future = info.promise->get_future(); std::future_status status = future.wait_for(std::chrono::milliseconds(DELAY_LOCAL_FREE_INSTALL_TIMEOUT)); if (status == std::future_status::timeout) { - RemoveFreeInstallInfo(info.want.GetBundle(), info.want.GetElement().GetAbilityName(), + RemoveFreeInstallInfo(info.want.GetBundleNameRef(), info.want.GetAbilityNameRef(), info.want.GetStringParam(Want::PARAM_RESV_START_TIME)); return FREE_INSTALL_TIMEOUT; } @@ -267,9 +267,9 @@ void FreeInstallManager::NotifyDmsCallback(const Want &want, int resultCode) return; } - auto srcAbilityName = want.GetElement().GetAbilityName(); + const auto &srcAbilityName = want.GetAbilityNameRef(); for (auto it = dmsFreeInstallCbs_.begin(); it != dmsFreeInstallCbs_.end();) { - std::string abilityName = (*it).want.GetElement().GetAbilityName(); + const auto &abilityName = (*it).want.GetAbilityNameRef(); if (srcAbilityName == abilityName) { HandleDMSCallback(resultCode, *it); it = dmsFreeInstallCbs_.erase(it); @@ -292,14 +292,14 @@ void FreeInstallManager::NotifyFreeInstallResult(int32_t recordId, const Want &w } bool isFromRemote = want.GetBoolParam(FROM_REMOTE_KEY, false); - auto srcBundleName = want.GetBundle(); - auto srcAbilityName = want.GetElement().GetAbilityName(); + const auto &srcBundleName = want.GetBundleNameRef(); + const auto &srcAbilityName = want.GetAbilityNameRef(); auto srcStartTime = want.GetStringParam(Want::PARAM_RESV_START_TIME); auto srcUri = want.GetUriString(); for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { FreeInstallInfo &freeInstallInfo = *it; - if (srcBundleName != freeInstallInfo.want.GetBundle() || - srcAbilityName != freeInstallInfo.want.GetElement().GetAbilityName() || + if (srcBundleName != freeInstallInfo.want.GetBundleNameRef() || + srcAbilityName != freeInstallInfo.want.GetAbilityNameRef() || srcStartTime != freeInstallInfo.want.GetStringParam(Want::PARAM_RESV_START_TIME) || srcUri != freeInstallInfo.want.GetUriString()) { it++; @@ -332,8 +332,8 @@ void FreeInstallManager::HandleOnFreeInstallSuccess(int32_t recordId, FreeInstal if (isAsync) { std::string startTime = freeInstallInfo.want.GetStringParam(Want::PARAM_RESV_START_TIME); - std::string bundleName = freeInstallInfo.want.GetBundle(); - std::string abilityName = freeInstallInfo.want.GetElement().GetAbilityName(); + const auto &bundleName = freeInstallInfo.want.GetBundleNameRef(); + const auto &abilityName = freeInstallInfo.want.GetAbilityNameRef(); if (freeInstallInfo.isPreStartMissionCalled) { StartAbilityByPreInstall(recordId, freeInstallInfo, bundleName, abilityName, startTime); return; @@ -380,8 +380,8 @@ void FreeInstallManager::HandleOnFreeInstallFail(int32_t recordId, FreeInstallIn return; } - std::string bundleName = freeInstallInfo.want.GetBundle(); - std::string abilityName = freeInstallInfo.want.GetElement().GetAbilityName(); + const auto &bundleName = freeInstallInfo.want.GetBundleNameRef(); + const auto &abilityName = freeInstallInfo.want.GetAbilityNameRef(); DelayedSingleton::GetInstance()->OnInstallFinished( recordId, bundleName, abilityName, startTime, resultCode); return; @@ -399,15 +399,15 @@ void FreeInstallManager::HandleFreeInstallResult(int32_t recordId, FreeInstallIn HandleOnFreeInstallFail(recordId, freeInstallInfo, resultCode, isAsync); } -void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime) +void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime) { info.want.SetFlags(info.want.GetFlags() ^ Want::FLAG_INSTALL_ON_DEMAND); auto identity = IPCSkeleton::ResetCallingIdentity(); TAG_LOGD(AAFwkTag::FREE_INSTALL, "identity: %{public}s", info.identity.c_str()); IPCSkeleton::SetCallingIdentity(info.identity); int32_t result = ERR_OK; - if (info.want.GetElement().GetAbilityName().empty()) { + if (info.want.GetAbilityNameRef().empty()) { result = UpdateElementName(info.want, info.userId); } if (result == ERR_OK) { @@ -433,15 +433,15 @@ void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, std::s recordId, bundleName, abilityName, startTime, result); } -void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime) +void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, + const std::string &bundleName, const std::string &abilityName, const std::string &startTime) { info.want.SetFlags(info.want.GetFlags() ^ Want::FLAG_INSTALL_ON_DEMAND); auto identity = IPCSkeleton::ResetCallingIdentity(); TAG_LOGD(AAFwkTag::FREE_INSTALL, "identity: %{public}s", info.identity.c_str()); IPCSkeleton::SetCallingIdentity(info.identity); int32_t result = ERR_OK; - if (info.want.GetElement().GetAbilityName().empty()) { + if (info.want.GetAbilityNameRef().empty()) { result = UpdateElementName(info.want, info.userId); } if (result == ERR_OK) { @@ -473,7 +473,7 @@ void FreeInstallManager::StartAbilityByConvertedWant(FreeInstallInfo &info, cons TAG_LOGD(AAFwkTag::FREE_INSTALL, "identity: %{public}s", info.identity.c_str()); IPCSkeleton::SetCallingIdentity(info.identity); int32_t result = ERR_OK; - if (info.want.GetElement().GetAbilityName().empty()) { + if (info.want.GetAbilityNameRef().empty()) { result = UpdateElementName(info.want, info.userId); } if (result == ERR_OK) { @@ -523,8 +523,8 @@ int32_t FreeInstallManager::UpdateElementName(Want &want, int32_t userId) const auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bundleMgrHelper, ERR_INVALID_VALUE); Want launchWant; - TAG_LOGD(AAFwkTag::FREE_INSTALL, "bundleName: %{public}s, userId: %{public}d", want.GetBundle().c_str(), userId); - auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundle(), launchWant, userId)); + TAG_LOGD(AAFwkTag::FREE_INSTALL, "bundleName: %{public}s, userId: %{public}d", want.GetBundleNameRef().c_str(), userId); + auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundleNameRef(), launchWant, userId)); if (errCode != ERR_OK) { return errCode; } @@ -566,7 +566,7 @@ int FreeInstallManager::ConnectFreeInstall(const Want &want, int32_t userId, { auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bundleMgrHelper, GET_ABILITY_SERVICE_FAILED); - std::string wantDeviceId = want.GetDeviceId(); + const auto &wantDeviceId = want.GetDeviceIdRef(); if (!(localDeviceId == wantDeviceId || wantDeviceId.empty())) { TAG_LOGE(AAFwkTag::FREE_INSTALL, "deviceID empty"); return INVALID_PARAMETERS_ERR; @@ -581,8 +581,8 @@ int FreeInstallManager::ConnectFreeInstall(const Want &want, int32_t userId, } if (!isSaCall) { - const std::string wantAbilityName = want.GetElement().GetAbilityName(); - const std::string wantBundleName = want.GetBundle(); + const std::string wantAbilityName = want.GetAbilityNameRef(); + const std::string wantBundleName = want.GetBundleNameRef(); if (wantBundleName.empty() || wantAbilityName.empty()) { TAG_LOGE(AAFwkTag::FREE_INSTALL, "wantBundleName or wantAbilityName empty."); return INVALID_PARAMETERS_ERR; @@ -598,7 +598,7 @@ int FreeInstallManager::ConnectFreeInstall(const Want &want, int32_t userId, int callerUid = IPCSkeleton::GetCallingUid(); std::string localBundleName; auto res = IN_PROCESS_CALL(bundleMgrHelper->GetNameForUid(callerUid, localBundleName)); - if (res != ERR_OK || localBundleName != want.GetBundle()) { + if (res != ERR_OK || localBundleName != want.GetBundleNameRef()) { TAG_LOGE(AAFwkTag::FREE_INSTALL, "not local BundleName"); return INVALID_PARAMETERS_ERR; } @@ -609,8 +609,8 @@ int FreeInstallManager::ConnectFreeInstall(const Want &want, int32_t userId, std::vector extensionInfos; TAG_LOGD(AAFwkTag::FREE_INSTALL, "bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s, userId: %{public}d", - want.GetBundle().c_str(), want.GetModuleName().c_str(), - want.GetElement().GetAbilityName().c_str(), userId); + want.GetBundleNameRef().c_str(), want.GetModuleNameRef().c_str(), + want.GetAbilityNameRef().c_str(), userId); bool queryAbilityResult = IN_PROCESS_CALL(bundleMgrHelper->QueryAbilityInfo( want, AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, userId, abilityInfo)); bool queryExtensionResult = false; @@ -679,9 +679,9 @@ void FreeInstallManager::PostUpgradeAtomicServiceTask(int resultCode, const Want } TAG_LOGD(AAFwkTag::FREE_INSTALL, "bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s, userId: %{public}d", - want.GetBundle().c_str(), want.GetModuleName().c_str(), - want.GetElement().GetAbilityName().c_str(), userId); - std::string nameKey = want.GetBundle() + want.GetModuleName(); + want.GetBundleNameRef().c_str(), want.GetModuleNameRef().c_str(), + want.GetAbilityNameRef().c_str(), userId); + std::string nameKey = want.GetBundleNameRef() + want.GetModuleNameRef(); bool needUpgrade = false; { std::lock_guard lock(freeInstallManager->timestampMapLock_); @@ -730,8 +730,8 @@ void FreeInstallManager::RemoveFreeInstallInfo(const std::string &bundleName, co { std::lock_guard lock(freeInstallListLock_); for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { - if ((*it).want.GetBundle() == bundleName && - (*it).want.GetElement().GetAbilityName() == abilityName && + if ((*it).want.GetBundleNameRef() == bundleName && + (*it).want.GetAbilityNameRef() == abilityName && (*it).want.GetStringParam(Want::PARAM_RESV_START_TIME) == startTime) { it = freeInstallList_.erase(it); } else { @@ -772,7 +772,7 @@ int FreeInstallManager::SetAppRunningState(Want &want) return ERR_NULL_APP_MGR_CLIENT; } - bool isAppRunning = appMgr->GetAppRunningStateByBundleName(want.GetBundle()); + bool isAppRunning = appMgr->GetAppRunningStateByBundleName(want.GetBundleNameRef()); TAG_LOGI(AAFwkTag::FREE_INSTALL, "isAppRunning:%{public}d", static_cast(isAppRunning)); want.SetParam(KEY_IS_APP_RUNNING, isAppRunning); return ERR_OK; @@ -783,8 +783,8 @@ bool FreeInstallManager::GetFreeInstallTaskInfo(const std::string& bundleName, c { std::lock_guard lock(freeInstallListLock_); for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { - if ((*it).want.GetBundle() == bundleName && - (*it).want.GetElement().GetAbilityName() == abilityName && + if ((*it).want.GetBundleNameRef() == bundleName && + (*it).want.GetAbilityNameRef() == abilityName && (*it).want.GetStringParam(Want::PARAM_RESV_START_TIME) == startTime) { taskInfo = *it; return true; @@ -812,8 +812,8 @@ void FreeInstallManager::SetSCBCallStatus(const std::string& bundleName, const s { std::lock_guard lock(freeInstallListLock_); for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { - if ((*it).want.GetBundle() == bundleName && - (*it).want.GetElement().GetAbilityName() == abilityName && + if ((*it).want.GetBundleNameRef() == bundleName && + (*it).want.GetAbilityNameRef() == abilityName && (*it).want.GetStringParam(Want::PARAM_RESV_START_TIME) == startTime) { (*it).isStartUIAbilityBySCBCalled = scbCallStatus; return; @@ -827,8 +827,8 @@ void FreeInstallManager::SetPreStartMissionCallStatus(const std::string& bundleN { std::lock_guard lock(freeInstallListLock_); for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { - if ((*it).want.GetBundle() == bundleName && - (*it).want.GetElement().GetAbilityName() == abilityName && + if ((*it).want.GetBundleNameRef() == bundleName && + (*it).want.GetAbilityNameRef() == abilityName && (*it).want.GetStringParam(Want::PARAM_RESV_START_TIME) == startTime) { (*it).isPreStartMissionCalled = preStartMissionCallStatus; return; @@ -842,8 +842,8 @@ void FreeInstallManager::SetFreeInstallTaskSessionId(const std::string& bundleNa { std::lock_guard lock(freeInstallListLock_); for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { - if ((*it).want.GetBundle() == bundleName && - (*it).want.GetElement().GetAbilityName() == abilityName && + if ((*it).want.GetBundleNameRef() == bundleName && + (*it).want.GetAbilityNameRef() == abilityName && (*it).want.GetStringParam(Want::PARAM_RESV_START_TIME) == startTime) { (*it).want.SetParam(KEY_SESSION_ID, sessionId); return; @@ -857,7 +857,7 @@ void FreeInstallManager::NotifyInsightIntentFreeInstallResult(const Want &want, HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); TAG_LOGI(AAFwkTag::FREE_INSTALL, "insight install result:%{public}d", resultCode); if (resultCode != ERR_OK) { - RemoveFreeInstallInfo(want.GetBundle(), want.GetElement().GetAbilityName(), + RemoveFreeInstallInfo(want.GetBundleNameRef(), want.GetAbilityNameRef(), want.GetStringParam(Want::PARAM_RESV_START_TIME)); NotifyInsightIntentExecuteDone(want, ERR_INVALID_VALUE); return; @@ -870,17 +870,17 @@ void FreeInstallManager::NotifyInsightIntentFreeInstallResult(const Want &want, } for (auto it = freeInstallList_.begin(); it != freeInstallList_.end();) { - std::string bundleName = (*it).want.GetBundle(); - std::string abilityName = (*it).want.GetElement().GetAbilityName(); + const std::string& bundleName = (*it).want.GetBundleNameRef(); + const std::string& abilityName = (*it).want.GetAbilityNameRef(); std::string startTime = (*it).want.GetStringParam(Want::PARAM_RESV_START_TIME); - if (want.GetBundle() != bundleName || - want.GetElement().GetAbilityName() != abilityName || + if (want.GetBundleNameRef() != bundleName || + want.GetAbilityNameRef() != abilityName || want.GetStringParam(Want::PARAM_RESV_START_TIME) != startTime) { it++; continue; } - auto moduleName = (*it).want.GetModuleName(); + const auto& moduleName = (*it).want.GetModuleNameRef(); auto insightIntentName = (*it).want.GetStringParam(AppExecFwk::INSIGHT_INTENT_EXECUTE_PARAM_NAME); auto executeMode = static_cast( it->want.GetIntParam(AppExecFwk::INSIGHT_INTENT_EXECUTE_PARAM_MODE, 0)); diff --git a/services/abilitymgr/src/implicit_start_processor.cpp b/services/abilitymgr/src/implicit_start_processor.cpp index d5dffd31e7..76156ff773 100644 --- a/services/abilitymgr/src/implicit_start_processor.cpp +++ b/services/abilitymgr/src/implicit_start_processor.cpp @@ -89,9 +89,9 @@ bool ImplicitStartProcessor::IsImplicitStartAction(const Want &want) return false; } - if (want.GetAction() != BLACK_ACTION_SELECT_DATA && + if (want.GetActionRef() != BLACK_ACTION_SELECT_DATA && !want.HasParameter(AppExecFwk::INSIGHT_INTENT_EXECUTE_OPENLINK_FLAG)) {//intent openlink do not Implicit compare - TAG_LOGI(AAFwkTag::ABILITYMGR, "implicit start, action:%{public}s", want.GetAction().data()); + TAG_LOGI(AAFwkTag::ABILITYMGR, "implicit start, action:%{public}s", want.GetActionRef().data()); return true; } @@ -429,7 +429,7 @@ int ImplicitStartProcessor::ImplicitStartAG(int32_t userId, AbilityRequest &requ std::vector &dialogAppInfos, GenerateRequestParam &genReqParam, bool &queryAGSuccess) { TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s", __func__); - std::string linkUri = request.want.GetUri().ToString(); + std::string linkUri = request.want.GetUriRef().ToString(); Want agWant; auto ret = 0; ret = OHOS::AppDomainVerify::AppDomainVerifyMgrClient::GetInstance()->QueryAppDetailsWant(linkUri, agWant); @@ -438,7 +438,7 @@ int ImplicitStartProcessor::ImplicitStartAG(int32_t userId, AbilityRequest &requ return ret; } queryAGSuccess = true; - request.want = agWant; + request.want = std::move(agWant); genReqParam.fromImplicitStartAG = true; return GenerateAbilityRequestByAction(userId, request, dialogAppInfos, genReqParam); } @@ -552,7 +552,7 @@ int ImplicitStartProcessor::GenerateAbilityRequestByAction(int32_t userId, Abili Want implicitwant; std::string typeName = MatchTypeAndUri(request.want); - implicitwant.SetAction(request.want.GetAction()); + implicitwant.SetAction(request.want.GetActionRef()); implicitwant.SetType(TYPE_ONLY_MATCH_WILDCARD); std::vector implicitAbilityInfos; std::vector implicitExtensionInfos; @@ -628,7 +628,7 @@ int ImplicitStartProcessor::GenerateAbilityRequestByAction(int32_t userId, Abili int ImplicitStartProcessor::GenerateAbilityRequestByAppIndexes(int32_t userId, AbilityRequest &request, std::vector &dialogAppInfos) { - auto appIndexes = StartAbilityUtils::GetCloneAppIndexes(request.want.GetBundle(), userId); + auto appIndexes = StartAbilityUtils::GetCloneAppIndexes(request.want.GetBundleNameRef(), userId); if (appIndexes.size() > AbilityRuntime::GlobalConstant::MAX_APP_CLONE_INDEX) { TAG_LOGE(AAFwkTag::ABILITYMGR, "too large appIndexes"); return ERR_TOO_LARGE_APPINDEXES; @@ -643,7 +643,7 @@ int ImplicitStartProcessor::GenerateAbilityRequestByAppIndexes(int32_t userId, A AppExecFwk::AbilityInfo abilityInfo; TAG_LOGD(AAFwkTag::ABILITYMGR, "abilityName: %{public}s, appIndex: %{public}d, userId: %{public}d", - request.want.GetElement().GetAbilityName().c_str(), appIndex, userId); + request.want.GetAbilityNameRef().c_str(), appIndex, userId); IN_PROCESS_CALL_WITHOUT_RET(bms->QueryCloneAbilityInfo(request.want.GetElement(), abilityInfoFlag, appIndex, abilityInfo, userId)); if (abilityInfo.name.empty() || abilityInfo.bundleName.empty()) { @@ -720,7 +720,7 @@ int ImplicitStartProcessor::QueryBmsAppInfos(AbilityRequest &request, int32_t us want.SetElementName(appInfos[0], queryAbilityName); TAG_LOGD(AAFwkTag::ABILITYMGR, - "abilityName: %{public}s, userId: %{public}d", want.GetElement().GetAbilityName().c_str(), userId); + "abilityName: %{public}s, userId: %{public}d", want.GetAbilityNameRef().c_str(), userId); IN_PROCESS_CALL_WITHOUT_RET(bundleMgrHelper->QueryAbilityInfo(want, abilityInfoFlag, userId, abilityInfo)); if (!abilityInfo.name.empty() && !abilityInfo.bundleName.empty() && !abilityInfo.moduleName.empty()) { @@ -762,7 +762,7 @@ std::vector ImplicitStartProcessor::SplitStr(const std::string& str bool ImplicitStartProcessor::CheckImplicitStartExtensionIsValid(const AbilityRequest &request, const AppExecFwk::ExtensionAbilityInfo &extensionInfo) { - if (!request.want.GetBundle().empty()) { + if (!request.want.GetBundleNameRef().empty()) { return true; } TAG_LOGD( @@ -831,7 +831,7 @@ int ImplicitStartProcessor::CallStartAbilityInner(int32_t userId, eventInfo.userId = userId; auto element = want.GetElement(); eventInfo.bundleName = element.GetBundleName(); - eventInfo.moduleName = element.GetModuleName(); + eventInfo.moduleName = element.GetModuleNameRef(); eventInfo.abilityName = element.GetAbilityName(); if (callType == AbilityCallType::INVALID_TYPE) { @@ -904,7 +904,7 @@ void ImplicitStartProcessor::GetEcologicalCallerInfo(const Want &want, ErmsCalle return; } - std::string targetBundleName = want.GetBundle(); + const auto &targetBundleName = want.GetBundleNameRef(); AppExecFwk::ApplicationInfo targetAppInfo; TAG_LOGD(AAFwkTag::ABILITYMGR, "targetBundleName: %{public}s, userId: %{public}d", targetBundleName.c_str(), userId); @@ -1047,7 +1047,7 @@ void ImplicitStartProcessor::SetTargetLinkInfo(const std::vector::GetInstance()->GetInsightIntentInfo( - want.GetBundle(), want.GetModuleName(), intentName, userId, info); + want.GetBundleNameRef(), want.GetModuleNameRef(), intentName, userId, info); if (info.genericInfo.decoratorType != AbilityRuntime::INSIGHT_INTENTS_DECORATOR_TYPE_ENTRY) { TAG_LOGW(AAFwkTag::INTENT, "decorator %{public}s misMatch", info.genericInfo.decoratorType.c_str()); return ERR_INVALID_VALUE; @@ -244,7 +244,7 @@ int32_t InsightIntentExecuteManager::UpdateEntryDecoratorParams(Want &want, Exec TAG_LOGE(AAFwkTag::INTENT, "execute mode mismatch"); return ERR_INVALID_VALUE; } - if (want.GetElement().GetAbilityName() != info.genericInfo.get().abilityName) { + if (want.GetAbilityNameRef() != info.genericInfo.get().abilityName) { TAG_LOGE(AAFwkTag::INTENT, "ability name mismatch"); return ERR_INVALID_VALUE; } diff --git a/services/abilitymgr/src/insight_intent/insight_intent_execute_param.cpp b/services/abilitymgr/src/insight_intent/insight_intent_execute_param.cpp index 90128e22f6..95381f66b1 100644 --- a/services/abilitymgr/src/insight_intent/insight_intent_execute_param.cpp +++ b/services/abilitymgr/src/insight_intent/insight_intent_execute_param.cpp @@ -246,7 +246,7 @@ bool InsightIntentExecuteParam::GenerateFromWant(const AAFwk::Want &want, AppExecFwk::ElementName elementName = want.GetElement(); executeParam.bundleName_ = elementName.GetBundleName(); - executeParam.moduleName_ = elementName.GetModuleName(); + executeParam.moduleName_ = elementName.GetModuleNameRef(); executeParam.abilityName_ = elementName.GetAbilityName(); executeParam.insightIntentName_ = wantParams.GetStringParam(INSIGHT_INTENT_EXECUTE_PARAM_NAME); executeParam.insightIntentId_ = insightIntentId; diff --git a/services/abilitymgr/src/insight_intent/insight_intent_sys_event_receiver.cpp b/services/abilitymgr/src/insight_intent/insight_intent_sys_event_receiver.cpp index 9395d54d2f..095d57ea27 100644 --- a/services/abilitymgr/src/insight_intent/insight_intent_sys_event_receiver.cpp +++ b/services/abilitymgr/src/insight_intent/insight_intent_sys_event_receiver.cpp @@ -278,7 +278,7 @@ void InsightIntentSysEventReceiver::HandleUserRemove(const EventFwk::CommonEvent void InsightIntentSysEventReceiver::OnReceiveEvent(const EventFwk::CommonEventData &data) { const AAFwk::Want &want = data.GetWant(); - std::string action = want.GetAction(); + const auto &action = want.GetActionRef(); TAG_LOGI(AAFwkTag::INTENT, "the action: %{public}s", action.c_str()); if (action == EventFwk::CommonEventSupport::COMMON_EVENT_BUNDLE_SCAN_FINISHED) { diff --git a/services/abilitymgr/src/interceptor/ability_interceptor_executer.cpp b/services/abilitymgr/src/interceptor/ability_interceptor_executer.cpp index 33c85ee2c9..bad458f555 100644 --- a/services/abilitymgr/src/interceptor/ability_interceptor_executer.cpp +++ b/services/abilitymgr/src/interceptor/ability_interceptor_executer.cpp @@ -44,7 +44,7 @@ bool AbilityInterceptorExecuter::HasInterceptor(std::string interceptorName) return iter != interceptorMap_.end(); } -ErrCode AbilityInterceptorExecuter::DoProcess(AbilityInterceptorParam param) +ErrCode AbilityInterceptorExecuter::DoProcess(const AbilityInterceptorParam ¶m) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); int32_t result = ERR_OK; diff --git a/services/abilitymgr/src/interceptor/ability_jump_interceptor.cpp b/services/abilitymgr/src/interceptor/ability_jump_interceptor.cpp index 54a71941ad..cf883a5149 100644 --- a/services/abilitymgr/src/interceptor/ability_jump_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/ability_jump_interceptor.cpp @@ -31,7 +31,7 @@ constexpr const char* JUMP_DIALOG_CALLER_LABEL_ID = "interceptor_callerLabelId"; constexpr const char* JUMP_DIALOG_TARGET_MODULE_NAME = "interceptor_targetModuleName"; constexpr const char* JUMP_DIALOG_TARGET_LABEL_ID = "interceptor_targetLabelId"; } -ErrCode AbilityJumpInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode AbilityJumpInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { if (!param.isWithUI) { TAG_LOGI(AAFwkTag::ABILITYMGR, "startup not foreground"); @@ -47,12 +47,12 @@ ErrCode AbilityJumpInterceptor::DoProcess(AbilityInterceptorParam param) CHECK_POINTER_AND_RETURN(bundleMgrHelper, ERR_OK); AppExecFwk::AbilityInfo targetAbilityInfo; if (StartAbilityUtils::startAbilityInfo != nullptr && - StartAbilityUtils::startAbilityInfo->abilityInfo.bundleName == param.want.GetBundle() && - StartAbilityUtils::startAbilityInfo->abilityInfo.name == param.want.GetElement().GetAbilityName()) { + StartAbilityUtils::startAbilityInfo->abilityInfo.bundleName == param.want.GetBundleNameRef() && + StartAbilityUtils::startAbilityInfo->abilityInfo.name == param.want.GetAbilityNameRef()) { targetAbilityInfo = StartAbilityUtils::startAbilityInfo->abilityInfo; } else { TAG_LOGD(AAFwkTag::ABILITYMGR, "abilityName: %{public}s, userId: %{public}d", - param.want.GetElement().GetAbilityName().c_str(), param.userId); + param.want.GetAbilityNameRef().c_str(), param.userId); IN_PROCESS_CALL_WITHOUT_RET(bundleMgrHelper->QueryAbilityInfo(param.want, AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, param.userId, targetAbilityInfo)); } @@ -91,7 +91,7 @@ bool AbilityJumpInterceptor::CheckControl(std::shared_ptrGetNameForUid(callerUid, callerBundleName)); - std::string targetBundleName = want.GetBundle(); + const auto &targetBundleName = want.GetBundleNameRef(); controlRule.callerPkg = callerBundleName; controlRule.targetPkg = targetBundleName; if (result != ERR_OK) { diff --git a/services/abilitymgr/src/interceptor/block_all_app_start_interceptor.cpp b/services/abilitymgr/src/interceptor/block_all_app_start_interceptor.cpp index 4242155652..bdb37fcd58 100644 --- a/services/abilitymgr/src/interceptor/block_all_app_start_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/block_all_app_start_interceptor.cpp @@ -19,7 +19,7 @@ namespace OHOS { namespace AAFwk { -ErrCode BlockAllAppStartInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode BlockAllAppStartInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { if (param.shouldBlockAllAppStartFunc_ == nullptr) { TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "shouldBlockAllAppStartFunc_ is nullptr"); diff --git a/services/abilitymgr/src/interceptor/control_interceptor.cpp b/services/abilitymgr/src/interceptor/control_interceptor.cpp index e4edaf133d..6fbb4b9ad8 100644 --- a/services/abilitymgr/src/interceptor/control_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/control_interceptor.cpp @@ -29,7 +29,7 @@ constexpr const char* INTERCEPT_MODULE_NAME = "intercept_moduleName"; constexpr const char* IS_FROM_PARENTCONTROL = "ohos.ability.isFromParentControl"; } -ErrCode ControlInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode ControlInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { AppExecFwk::AppRunningControlRuleResult controlRule; if (CheckControl(param.want, param.userId, controlRule)) { @@ -51,7 +51,7 @@ ErrCode ControlInterceptor::DoProcess(AbilityInterceptorParam param) auto wantEle = param.want.GetElement(); controlWant->SetParam(INTERCEPT_BUNDLE_NAME, wantEle.GetBundleName()); controlWant->SetParam(INTERCEPT_ABILITY_NAME, wantEle.GetAbilityName()); - controlWant->SetParam(INTERCEPT_MODULE_NAME, wantEle.GetModuleName()); + controlWant->SetParam(INTERCEPT_MODULE_NAME, wantEle.GetModuleNameRef()); controlRule.controlWant = controlWant; } int ret = IN_PROCESS_CALL(AbilityManagerClient::GetInstance()->StartAbility(*controlRule.controlWant, @@ -78,7 +78,7 @@ bool ControlInterceptor::CheckControl(const Want &want, int32_t userId, } // get disposed status - std::string bundleName = want.GetBundle(); + const auto &bundleName = want.GetBundleNameRef(); auto appControlMgr = bundleMgrHelper->GetAppControlProxy(); if (appControlMgr == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "null appControlMgr"); diff --git a/services/abilitymgr/src/interceptor/crowd_test_interceptor.cpp b/services/abilitymgr/src/interceptor/crowd_test_interceptor.cpp index 668e7fb29c..5809e51acd 100644 --- a/services/abilitymgr/src/interceptor/crowd_test_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/crowd_test_interceptor.cpp @@ -29,7 +29,7 @@ constexpr const char* MARKET_CROWD_TEST_UIEXTENSION_ABILITY_NAME = "TestAppUseEn constexpr const char* APP_BUNDLE_NAME = "appBundleName"; const std::string UIEXTENSION_SYS_COMMON_UI = "sys/commonUI"; } -ErrCode CrowdTestInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode CrowdTestInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { if (StartAbilityUtils::skipCrowTest) { StartAbilityUtils::skipCrowTest = false; @@ -62,11 +62,11 @@ ErrCode CrowdTestInterceptor::DoProcess(AbilityInterceptorParam param) replaceWant.SetParam(UIEXTENSION_TYPE_KEY, UIEXTENSION_SYS_COMMON_UI); replaceWant.SetElementName(appGalleryBundleName, MARKET_CROWD_TEST_UIEXTENSION_ABILITY_NAME); replaceWant.SetParam(UIEXTENSION_MODAL_TYPE, 1); - replaceWant.SetParam(APP_BUNDLE_NAME, param.want.GetBundle()); + replaceWant.SetParam(APP_BUNDLE_NAME, param.want.GetBundleNameRef()); ret = IN_PROCESS_CALL(systemUIExtension->CreateModalUIExtension(replaceWant)) ? ERR_OK : INNER_ERR; } else { ret = IN_PROCESS_CALL(AbilityUtil::StartAppgallery( - param.want.GetBundle(), param.requestCode, param.userId, ACTION_MARKET_CROWDTEST)); + param.want.GetBundleNameRef(), param.requestCode, param.userId, ACTION_MARKET_CROWDTEST)); } if (ret != ERR_OK) { @@ -84,7 +84,7 @@ bool CrowdTestInterceptor::CheckCrowdtest(const Want &want, int32_t userId) { // get crowdtest status and time AppExecFwk::ApplicationInfo appInfo; - if (!StartAbilityUtils::GetApplicationInfo(want.GetBundle(), userId, appInfo)) { + if (!StartAbilityUtils::GetApplicationInfo(want.GetBundleNameRef(), userId, appInfo)) { TAG_LOGW(AAFwkTag::ABILITYMGR, "GetAppInfo failed"); return false; } diff --git a/services/abilitymgr/src/interceptor/disposed_rule_interceptor.cpp b/services/abilitymgr/src/interceptor/disposed_rule_interceptor.cpp index f16a76c3da..63ac3e1cc0 100644 --- a/services/abilitymgr/src/interceptor/disposed_rule_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/disposed_rule_interceptor.cpp @@ -49,7 +49,7 @@ std::string DisposedRuleInterceptor::GenerateEventTaskName(int32_t uid) return UNREGISTER_EVENT_TASK + std::to_string(uid); } -ErrCode DisposedRuleInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode DisposedRuleInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { TAG_LOGD(AAFwkTag::ABILITYMGR, "Call"); AppExecFwk::DisposedRule disposedRule; @@ -66,7 +66,7 @@ ErrCode DisposedRuleInterceptor::DoProcess(AbilityInterceptorParam param) TAG_LOGE(AAFwkTag::ABILITYMGR, "skip dispose rule"); return AbilityUtil::EdmErrorType(disposedRule.isEdm); } - if (disposedRule.want->GetBundle() == param.want.GetBundle()) { + if (disposedRule.want->GetBundle() == param.want.GetBundleNameRef()) { TAG_LOGE(AAFwkTag::ABILITYMGR, "no dispose want, with same bundleName"); return AbilityUtil::EdmErrorType(disposedRule.isEdm); } @@ -111,7 +111,7 @@ bool DisposedRuleInterceptor::CheckControl(const Want &want, int32_t userId, } // get disposed status - std::string bundleName = want.GetBundle(); + const auto &bundleName = want.GetBundleNameRef(); auto appControlMgr = bundleMgrHelper->GetAppControlProxy(); if (appControlMgr == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "null appControlMgr"); @@ -156,11 +156,11 @@ bool DisposedRuleInterceptor::FindBlockDisposedRule(const Want &want, } continue; } - std::string moduleName = want.GetElement().GetModuleName(); - std::string abilityName = want.GetElement().GetAbilityName(); + const auto &moduleName = want.GetModuleNameRef(); + const auto &abilityName = want.GetAbilityNameRef(); auto iter = std::find_if(rule.elementList.begin(), rule.elementList.end(), [moduleName, abilityName](const AppExecFwk::ElementName &elementName) { - return moduleName == elementName.GetModuleName() && abilityName == elementName.GetAbilityName(); + return moduleName == elementName.GetModuleNameRef() && abilityName == elementName.GetAbilityName(); }); if ((rule.controlType == AppExecFwk::ControlType::ALLOWED_LIST && iter == rule.elementList.end()) || (rule.controlType == AppExecFwk::ControlType::DISALLOWED_LIST && iter != rule.elementList.end())) { @@ -219,7 +219,7 @@ ErrCode DisposedRuleInterceptor::StartNonBlockRule(const Want &want, AppExecFwk: disposedObserver->AddAbilityKey(moduleName, abilityName); std::vector bundleNameList; - bundleNameList.push_back(want.GetBundle()); + bundleNameList.push_back(want.GetBundleNameRef()); int32_t ret = IN_PROCESS_CALL(appManager->RegisterApplicationStateObserver(disposedObserver, bundleNameList)); if (ret != 0) { @@ -252,7 +252,7 @@ bool DisposedRuleInterceptor::ValidateNonBlockRule(const Want &want, const AppEx TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); return false; } - if (disposedRule.want->GetBundle() == want.GetBundle()) { + if (disposedRule.want->GetBundle() == want.GetBundleNameRef()) { TAG_LOGE(AAFwkTag::ABILITYMGR, "no dispose app with same bundleName"); return false; } @@ -310,9 +310,9 @@ void DisposedRuleInterceptor::SetInterceptInfo(const Want &want, AppExecFwk::Dis return; } if (disposedRule.want->GetBoolParam(IS_FROM_PARENTCONTROL, false)) { - disposedRule.want->SetParam(INTERCEPT_BUNDLE_NAME, want.GetElement().GetBundleName()); - disposedRule.want->SetParam(INTERCEPT_ABILITY_NAME, want.GetElement().GetAbilityName()); - disposedRule.want->SetParam(INTERCEPT_MODULE_NAME, want.GetElement().GetModuleName()); + disposedRule.want->SetParam(INTERCEPT_BUNDLE_NAME, want.GetBundleNameRef()); + disposedRule.want->SetParam(INTERCEPT_ABILITY_NAME, want.GetAbilityNameRef()); + disposedRule.want->SetParam(INTERCEPT_MODULE_NAME, want.GetModuleNameRef()); } } diff --git a/services/abilitymgr/src/interceptor/ecological_rule_interceptor.cpp b/services/abilitymgr/src/interceptor/ecological_rule_interceptor.cpp index fad0fb46e3..38968b1823 100644 --- a/services/abilitymgr/src/interceptor/ecological_rule_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/ecological_rule_interceptor.cpp @@ -31,7 +31,7 @@ constexpr const char* BUNDLE_NAME_SCENEBOARD = "com.ohos.sceneboard"; constexpr int32_t ERMS_ISALLOW_RESULTCODE = 10; constexpr int32_t ERMS_ISALLOW_EMBED_RESULTCODE = 1; } -ErrCode EcologicalRuleInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode EcologicalRuleInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); if (NoNeedErms(param)) { @@ -86,7 +86,7 @@ bool EcologicalRuleInterceptor::NoNeedErms(const AbilityInterceptorParam ¶m) return true; } if (param.want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) == - param.want.GetBundle()) { + param.want.GetBundleNameRef()) { TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "same bundle"); StartAbilityUtils::ermsSupportBackToCallerFlag = true; return true; @@ -101,7 +101,7 @@ bool EcologicalRuleInterceptor::NoNeedErms(const AbilityInterceptorParam ¶m) bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - if (want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) == want.GetBundle()) { + if (want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) == want.GetBundleNameRef()) { TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "same bundle"); StartAbilityUtils::ermsSupportBackToCallerFlag = true; return true; @@ -115,7 +115,7 @@ bool EcologicalRuleInterceptor::DoProcess(Want &want, int32_t userId) auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bundleMgrHelper, false); Want launchWant; - auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundle(), launchWant, userId)); + auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundleNameRef(), launchWant, userId)); if (errCode != ERR_OK) { TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "GetLaunchWantForBundle err: %{public}d", errCode); return false; @@ -148,7 +148,7 @@ ErrCode EcologicalRuleInterceptor::QueryAtomicServiceStartupRule(Want &want, spt int32_t userId, AtomicServiceStartupRule &rule, sptr &replaceWant) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); - CHECK_TRUE_RETURN_RET(want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) == want.GetBundle(), + CHECK_TRUE_RETURN_RET(want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) == want.GetBundleNameRef(), ERR_INVALID_CALLER, "same bundle"); std::string supportErms = OHOS::system::GetParameter(ABILITY_SUPPORT_ECOLOGICAL_RULEMGRSERVICE, "true"); CHECK_TRUE_RETURN_RET(supportErms == "false", ERR_CAPABILITY_NOT_SUPPORT, "not support erms"); @@ -156,7 +156,7 @@ ErrCode EcologicalRuleInterceptor::QueryAtomicServiceStartupRule(Want &want, spt auto bundleMgrHelper = AbilityUtil::GetBundleManagerHelper(); CHECK_POINTER_AND_RETURN(bundleMgrHelper, BMS_NOT_CONNECTED); Want launchWant; - auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundle(), launchWant, userId)); + auto errCode = IN_PROCESS_CALL(bundleMgrHelper->GetLaunchWantForBundle(want.GetBundleNameRef(), launchWant, userId)); CHECK_RET_RETURN_RET(errCode, "GetLaunchWantForBundle failed"); want.SetElement(launchWant.GetElement()); @@ -201,8 +201,8 @@ void EcologicalRuleInterceptor::GetEcologicalTargetInfo(const Want &want, callerInfo.targetLinkFeature = want.GetStringParam("send_to_erms_targetLinkFeature"); callerInfo.targetLinkType = want.GetIntParam("send_to_erms_targetLinkType", 0); if (StartAbilityUtils::startAbilityInfo && - StartAbilityUtils::startAbilityInfo->abilityInfo.bundleName == want.GetBundle() && - StartAbilityUtils::startAbilityInfo->abilityInfo.name == want.GetElement().GetAbilityName()) { + StartAbilityUtils::startAbilityInfo->abilityInfo.bundleName == want.GetBundleNameRef() && + StartAbilityUtils::startAbilityInfo->abilityInfo.name == want.GetAbilityNameRef()) { AppExecFwk::AbilityInfo targetAbilityInfo = StartAbilityUtils::startAbilityInfo->abilityInfo; callerInfo.targetAppDistType = targetAbilityInfo.applicationInfo.appDistributionType; callerInfo.targetAppProvisionType = targetAbilityInfo.applicationInfo.appProvisionType; @@ -293,7 +293,7 @@ void EcologicalRuleInterceptor::InitErmsCallerInfo(const Want &want, } callerInfo.userId = userId; - if (want.GetBundle().empty() && abilityInfo != nullptr) { + if (want.GetBundleNameRef().empty() && abilityInfo != nullptr) { callerInfo.targetBundleName = abilityInfo->bundleName; } diff --git a/services/abilitymgr/src/interceptor/extension_control_interceptor.cpp b/services/abilitymgr/src/interceptor/extension_control_interceptor.cpp index 30f157f0ef..db2fe614f1 100644 --- a/services/abilitymgr/src/interceptor/extension_control_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/extension_control_interceptor.cpp @@ -24,7 +24,7 @@ namespace OHOS { namespace AAFwk { -ErrCode ExtensionControlInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode ExtensionControlInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { TAG_LOGD(AAFwkTag::ABILITYMGR, "call."); if (param.callerToken == nullptr) { @@ -124,7 +124,7 @@ bool ExtensionControlInterceptor::GetCallerAbilityInfo(const AbilityInterceptorP if (StartAbilityUtils::GetCallerAbilityInfo(param.callerToken, callerAbilityInfo)) { if (callerAbilityInfo.type != AppExecFwk::AbilityType::EXTENSION || callerAbilityInfo.extensionAbilityType == AppExecFwk::ExtensionAbilityType::SERVICE || - callerAbilityInfo.bundleName == param.want.GetBundle()) { + callerAbilityInfo.bundleName == param.want.GetBundleNameRef()) { TAG_LOGD(AAFwkTag::ABILITYMGR, "not other extension."); return true; } @@ -145,8 +145,8 @@ bool ExtensionControlInterceptor::GetTargetAbilityInfo(const AbilityInterceptorP AppExecFwk::AbilityInfo& targetAbilityInfo) { if (StartAbilityUtils::startAbilityInfo != nullptr && - StartAbilityUtils::startAbilityInfo->abilityInfo.bundleName == param.want.GetBundle() && - StartAbilityUtils::startAbilityInfo->abilityInfo.name == param.want.GetElement().GetAbilityName()) { + StartAbilityUtils::startAbilityInfo->abilityInfo.bundleName == param.want.GetBundleNameRef() && + StartAbilityUtils::startAbilityInfo->abilityInfo.name == param.want.GetAbilityNameRef()) { TAG_LOGD(AAFwkTag::ABILITYMGR, "targetAbilityInfo get from startAbiiltyInfo"); targetAbilityInfo = StartAbilityUtils::startAbilityInfo->abilityInfo; } else { diff --git a/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp b/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp index 41d8e50518..970135e3ed 100644 --- a/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp @@ -22,7 +22,7 @@ namespace OHOS { namespace AAFwk { -int KioskInterceptor::DoProcess(AbilityInterceptorParam param) +int KioskInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { #ifdef SUPPORT_SCREEN if (ImplicitStartProcessor::IsImplicitStartAction(param.want)) { @@ -35,7 +35,7 @@ int KioskInterceptor::DoProcess(AbilityInterceptorParam param) if (!kioskManager.IsInKioskMode()) { return ERR_OK; } - auto bundleName = param.want.GetBundle(); + const auto& bundleName = param.want.GetBundleNameRef(); if (!kioskManager.IsInWhiteList(bundleName)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "intercept ability start, bundle %{public}s not in kiosk whitelist", bundleName.c_str()); diff --git a/services/abilitymgr/src/interceptor/screen_unlock_interceptor.cpp b/services/abilitymgr/src/interceptor/screen_unlock_interceptor.cpp index b4dc5c3cb6..324c3bb49a 100644 --- a/services/abilitymgr/src/interceptor/screen_unlock_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/screen_unlock_interceptor.cpp @@ -53,7 +53,7 @@ std::string ScreenUnlockInterceptor::GetAppIdentifier(const std::string &bundleN return signatureInfo.appIdentifier; } -ErrCode ScreenUnlockInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode ScreenUnlockInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { AppExecFwk::AbilityInfo targetAbilityInfo; if (!GetTargetAbilityInfo(param, targetAbilityInfo)) { @@ -84,7 +84,7 @@ bool ScreenUnlockInterceptor::GetTargetAbilityInfo(const AbilityInterceptorParam } if (param.fromConnect) { - std::string uri = param.want.GetUri().ToString(); + std::string uri = param.want.GetUriRef().ToString(); bool isFileUri = (param.want.GetUri().GetScheme() == "file"); if (!uri.empty() && !isFileUri) { return QueryTargetAbilityInfoByUri(param, targetAbilityInfo); @@ -95,7 +95,7 @@ bool ScreenUnlockInterceptor::GetTargetAbilityInfo(const AbilityInterceptorParam if (targetAbilityInfo.applicationInfo.name.empty() || targetAbilityInfo.applicationInfo.bundleName.empty()) { TAG_LOGD(AAFwkTag::ABILITYMGR, "Cannot find targetAbilityInfo, element uri: %{public}s/%{public}s", - param.want.GetElement().GetBundleName().c_str(), param.want.GetElement().GetAbilityName().c_str()); + param.want.GetBundleNameRef().c_str(), param.want.GetAbilityNameRef().c_str()); return false; } return true; @@ -110,7 +110,7 @@ bool ScreenUnlockInterceptor::QueryTargetAbilityInfoByUri(const AbilityIntercept return false; } - std::string uri = param.want.GetUri().ToString(); + std::string uri = param.want.GetUriRef().ToString(); TAG_LOGD(AAFwkTag::ABILITYMGR, "Query by uri: %{private}s, userId: %{public}d", uri.c_str(), param.userId); AppExecFwk::ExtensionAbilityInfo extensionInfo; bool queryResult = IN_PROCESS_CALL(bundleMgrHelper->QueryExtensionAbilityInfoByUriOptimal( diff --git a/services/abilitymgr/src/interceptor/start_other_app_interceptor.cpp b/services/abilitymgr/src/interceptor/start_other_app_interceptor.cpp index 87c78844dd..d93e877a1d 100644 --- a/services/abilitymgr/src/interceptor/start_other_app_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/start_other_app_interceptor.cpp @@ -32,7 +32,7 @@ constexpr const char* IS_DELEGATOR_CALL = "isDelegatorCall"; constexpr const char* OPEN_LINK_SCENE_IDENTIFICATION = "appLinkingOnly"; } -ErrCode StartOtherAppInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode StartOtherAppInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { if (StartAbilityUtils::skipStartOther) { StartAbilityUtils::skipStartOther = false; @@ -134,7 +134,7 @@ bool StartOtherAppInterceptor::CheckAncoShellCall(const AppExecFwk::ApplicationI bool StartOtherAppInterceptor::CheckStartOtherApp(const Want want) { - return want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) != want.GetBundle(); + return want.GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME) != want.GetBundleNameRef(); } bool StartOtherAppInterceptor::CheckCallerApiBelow12(const AppExecFwk::ApplicationInfo &applicationInfo) diff --git a/services/abilitymgr/src/mission/mission_list.cpp b/services/abilitymgr/src/mission/mission_list.cpp index 8accea3d95..a52c2a1f40 100644 --- a/services/abilitymgr/src/mission/mission_list.cpp +++ b/services/abilitymgr/src/mission/mission_list.cpp @@ -164,8 +164,8 @@ std::shared_ptr MissionList::GetMissionBySpecifiedFlag(const AAFwk::Wan std::string srcAbilityName = ability->GetAbilityInfo().name; std::string srcBundleName = ability->GetApplicationInfo().bundleName; - std::string tarAbilityName = want.GetElement().GetAbilityName(); - std::string tarBundleName = want.GetElement().GetBundleName(); + std::string tarAbilityName = want.GetAbilityNameRef(); + std::string tarBundleName = want.GetBundleNameRef(); if ((srcBundleName == tarBundleName) && (srcAbilityName == tarAbilityName) && (ability->GetSpecifiedFlag() == flag)) { diff --git a/services/abilitymgr/src/mission/mission_list_manager.cpp b/services/abilitymgr/src/mission/mission_list_manager.cpp index 585d3a8abc..d9d9653656 100644 --- a/services/abilitymgr/src/mission/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission/mission_list_manager.cpp @@ -3328,8 +3328,8 @@ void MissionListManager::DumpMission(int missionId, std::vector &in int MissionListManager::ResolveLocked(const AbilityRequest &abilityRequest) { TAG_LOGI(AAFwkTag::ABILITYMGR, "ability_name:%{public}s/%{public}s", - abilityRequest.want.GetElement().GetBundleName().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); if (!abilityRequest.IsCallType(AbilityCallType::CALL_REQUEST_TYPE)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s, resolve ability_name:", __func__); diff --git a/services/abilitymgr/src/modular_object/modular_object_event_receiver.cpp b/services/abilitymgr/src/modular_object/modular_object_event_receiver.cpp index 02b24927af..3cb8dbbe27 100644 --- a/services/abilitymgr/src/modular_object/modular_object_event_receiver.cpp +++ b/services/abilitymgr/src/modular_object/modular_object_event_receiver.cpp @@ -44,7 +44,7 @@ ModularObjectEventReceiver::ModularObjectEventReceiver(const EventFwk::CommonEve void ModularObjectEventReceiver::OnReceiveEvent(const EventFwk::CommonEventData &data) { - const std::string action = data.GetWant().GetAction(); + const std::string action = data.GetWant().GetActionRef(); TAG_LOGI(AAFwkTag::EXT, "received event action: %{public}s", action.c_str()); if (action == EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED) { @@ -135,8 +135,8 @@ void ModularObjectEventReceiver::HandleBundleScanFinished(const EventFwk::Common void ModularObjectEventReceiver::HandleBundleInstall(const EventFwk::CommonEventData &data) { - const AAFwk::Want& want = data.GetWant(); - std::string bundleName = want.GetBundle(); + const auto &want = data.GetWant(); + const auto &bundleName = want.GetBundleNameRef(); TAG_LOGI(AAFwkTag::EXT, "handle common event package add, bundleName: %{public}s", bundleName.c_str()); if (bundleName.empty()) { TAG_LOGE(AAFwkTag::EXT, "bundle name is empty"); @@ -156,8 +156,8 @@ void ModularObjectEventReceiver::HandleBundleInstall(const EventFwk::CommonEvent void ModularObjectEventReceiver::HandleBundleRemoved(const EventFwk::CommonEventData &data) { - const AAFwk::Want& want = data.GetWant(); - std::string bundleName = want.GetBundle(); + const auto &want = data.GetWant(); + const auto &bundleName = want.GetBundleNameRef(); TAG_LOGI(AAFwkTag::EXT, "handle common event package remove, bundleName: %{public}s", bundleName.c_str()); if (bundleName.empty()) { TAG_LOGE(AAFwkTag::EXT, "bundle name is empty"); @@ -177,8 +177,8 @@ void ModularObjectEventReceiver::HandleBundleRemoved(const EventFwk::CommonEvent void ModularObjectEventReceiver::HandleBundleChanged(const EventFwk::CommonEventData &data) { - const AAFwk::Want& want = data.GetWant(); - std::string bundleName = want.GetBundle(); + const auto &want = data.GetWant(); + const auto &bundleName = want.GetBundleNameRef(); TAG_LOGI(AAFwkTag::EXT, "handle common event package changed, bundleName: %{public}s", bundleName.c_str()); if (bundleName.empty()) { TAG_LOGE(AAFwkTag::EXT, "bundle name is empty"); diff --git a/services/abilitymgr/src/pending_want_key.cpp b/services/abilitymgr/src/pending_want_key.cpp index aaa09736e9..e38a20afeb 100644 --- a/services/abilitymgr/src/pending_want_key.cpp +++ b/services/abilitymgr/src/pending_want_key.cpp @@ -147,7 +147,7 @@ void PendingWantKey::GetAllBundleNames(std::vector &bundleNames) { std::lock_guard lock(wantsInfosMutex_); for (const auto &wantInfo : allWantsInfos_) { - bundleNames.emplace_back(wantInfo.want.GetBundle()); + bundleNames.emplace_back(wantInfo.want.GetBundleNameRef()); } } diff --git a/services/abilitymgr/src/pending_want_manager.cpp b/services/abilitymgr/src/pending_want_manager.cpp index e3db89fee6..c034066e4c 100644 --- a/services/abilitymgr/src/pending_want_manager.cpp +++ b/services/abilitymgr/src/pending_want_manager.cpp @@ -65,7 +65,7 @@ sptr PendingWantManager::GetWantSender(int32_t callingUid, int32_t if (wantSenderInfo.type != static_cast(OperationType::SEND_COMMON_EVENT) && !isSystemApp && !AAFwk::PermissionVerification::GetInstance()->IsSACall()) { for (auto it = info.allWants.begin(); it != info.allWants.end();) { - if (info.bundleName != it->want.GetBundle()) { + if (info.bundleName != it->want.GetBundleNameRef()) { it = info.allWants.erase(it); } else { it->want.RemoveParam("ohos.extra.param.key.appCloneIndex"); @@ -403,7 +403,7 @@ int32_t PendingWantManager::DeviceIdDetermine(const Want &want, const sptr::GetInstance()->GetLocalDeviceId(localDeviceId); - if (want.GetElement().GetDeviceID() == "" || want.GetElement().GetDeviceID() == localDeviceId) { + if (want.GetDeviceIdRef() == "" || want.GetDeviceIdRef() == localDeviceId) { if (!startOptions) { result = DelayedSingleton::GetInstance()->StartAbilityWithSpecifyTokenIdInner( want, callerToken, callerTokenId, true, userId, requestCode); @@ -491,9 +491,9 @@ int32_t PendingWantManager::PendingWantPublishCommonEvent( CommonEventPublishInfo eventPublishData; - if (!want.GetBundle().empty()) { - TAG_LOGI(AAFwkTag::WANTAGENT, "eventPublishData set bundleName: %{public}s", want.GetBundle().c_str()); - eventPublishData.SetBundleName(want.GetBundle()); + if (!want.GetBundleNameRef().empty()) { + TAG_LOGI(AAFwkTag::WANTAGENT, "eventPublishData set bundleName: %{public}s", want.GetBundleNameRef().c_str()); + eventPublishData.SetBundleName(want.GetBundleNameRef()); } if (!senderInfo.requiredPermission.empty()) { @@ -913,8 +913,8 @@ void PendingWantManager::Dump(std::vector &info) info.push_back(dumpInfo); auto Wants = pendingKey->GetAllWantsInfos(); for (const auto &Want : Wants) { - dumpInfo = " uri [" + Want.want.GetElement().GetDeviceID() + "//" + - Want.want.GetElement().GetBundleName() + "/" + Want.want.GetElement().GetAbilityName() + "]"; + dumpInfo = " uri [" + Want.want.GetDeviceIdRef() + "//" + + Want.want.GetBundleNameRef() + "/" + Want.want.GetAbilityNameRef() + "]"; info.push_back(dumpInfo); dumpInfo = " resolved types [" + Want.resolvedTypes + "]"; info.push_back(dumpInfo); @@ -948,8 +948,8 @@ void PendingWantManager::DumpByRecordId(std::vector &info, const st info.push_back(dumpInfo); auto Wants = pendingKey->GetAllWantsInfos(); for (const auto& Want : Wants) { - dumpInfo = " uri [" + Want.want.GetElement().GetDeviceID() + "//" + - Want.want.GetElement().GetBundleName() + "/" + Want.want.GetElement().GetAbilityName() + "]"; + dumpInfo = " uri [" + Want.want.GetDeviceIdRef() + "//" + + Want.want.GetBundleNameRef() + "/" + Want.want.GetAbilityNameRef() + "]"; info.push_back(dumpInfo); dumpInfo = " resolved types [" + Want.resolvedTypes + "]"; info.push_back(dumpInfo); diff --git a/services/abilitymgr/src/pending_want_record.cpp b/services/abilitymgr/src/pending_want_record.cpp index f1344423c5..8d2ccd56bd 100644 --- a/services/abilitymgr/src/pending_want_record.cpp +++ b/services/abilitymgr/src/pending_want_record.cpp @@ -33,9 +33,9 @@ void SendTriggerFailedEvent(const Want &want, int32_t appIndex, int32_t userId, int32_t errCode, const std::string errMsg) { EventInfo eventInfo; - eventInfo.bundleName = want.GetElement().GetBundleName(); - eventInfo.moduleName = want.GetElement().GetModuleName(); - eventInfo.abilityName = want.GetElement().GetAbilityName(); + eventInfo.bundleName = want.GetBundleNameRef(); + eventInfo.moduleName = want.GetModuleNameRef(); + eventInfo.abilityName = want.GetAbilityNameRef(); eventInfo.appIndex = appIndex; eventInfo.errCode = errCode; eventInfo.errMsg = errMsg; @@ -131,7 +131,7 @@ int32_t PendingWantRecord::ExecuteOperation( { TAG_LOGI(AAFwkTag::WANTAGENT, "start ability type:%{public}d, bundleName: %{public}s, ability: %{public}s, userId: %{public}d", - key_->GetType(), want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str(), key_->GetUserId()); + key_->GetType(), want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str(), key_->GetUserId()); int32_t res = NO_ERROR; int32_t userId = key_->GetUserId(); if (userId <= 0 || userId > AccountSA::Constants::MAX_USER_ID) { @@ -222,7 +222,7 @@ void PendingWantRecord::BuildSendWant(SenderInfo &senderInfo, Want &want) want.AddFlags(key_->GetFlags()); } WantParams wantParams = want.GetParams(); - auto sendInfoWantParams = senderInfo.want.GetParams().GetParams(); + const auto &sendInfoWantParams = senderInfo.want.GetParams().GetParams(); for (auto mapIter = sendInfoWantParams.begin(); mapIter != sendInfoWantParams.end(); mapIter++) { std::string sendInfoWantParamKey = mapIter->first; if (want.GetParams().GetParam(sendInfoWantParamKey) == nullptr) { @@ -232,15 +232,15 @@ void PendingWantRecord::BuildSendWant(SenderInfo &senderInfo, Want &want) if (!wantParams.HasParam(Want::PARAM_APP_CLONE_INDEX_KEY)) { int32_t appIndex = key_->GetAppIndex(); - if (GetUid() != INVALID_UID && !want.GetBundle().empty()) { - if (GetAppIndexbyUid(GetUid(), want.GetBundle(), appIndex) != ERR_OK) { + if (GetUid() != INVALID_UID && !want.GetBundleNameRef().empty()) { + if (GetAppIndexbyUid(GetUid(), want.GetBundleNameRef(), appIndex) != ERR_OK) { TAG_LOGE(AAFwkTag::WANTAGENT, "getAppIndex failed, srcBundleName: %{public}s, uid: %{public}d", - want.GetBundle().c_str(), GetUid()); + want.GetBundleNameRef().c_str(), GetUid()); } } wantParams.SetParam(Want::PARAM_APP_CLONE_INDEX_KEY, Integer::Box(appIndex)); } - CheckAppInstanceKey(want.GetBundle(), wantParams); + CheckAppInstanceKey(want.GetBundleNameRef(), wantParams); want.SetParams(wantParams); } diff --git a/services/abilitymgr/src/preload_manager_service.cpp b/services/abilitymgr/src/preload_manager_service.cpp index fed84e8966..d9d1a121db 100644 --- a/services/abilitymgr/src/preload_manager_service.cpp +++ b/services/abilitymgr/src/preload_manager_service.cpp @@ -105,7 +105,7 @@ int32_t PreloadManagerService::LaunchGameCustomized(const std::string &bundleNam } StartAbilityWrapParam startAbilityWrapParam; - startAbilityWrapParam.want = launchWant; + startAbilityWrapParam.want = std::move(launchWant); startAbilityWrapParam.userId = userId; startAbilityWrapParam.isGamePrelaunch = true; return DelayedSingleton::GetInstance()->StartAbilityInner(startAbilityWrapParam); diff --git a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp index b585ca38ab..3cc46ca798 100644 --- a/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp +++ b/services/abilitymgr/src/scene_board/ui_ability_lifecycle_manager.cpp @@ -446,7 +446,7 @@ UIAbilityRecordPtr UIAbilityLifecycleManager::GenerateAbilityRecord(AbilityReque (iter->second != nullptr) && (iter->second->IsKillPrecedeStart()); if (iter == sessionAbilityMap_.end() || isLowMemKill) { auto uiAbilityRecord = FindRecordFromTmpMap(abilityRequest); - auto abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; if (uiAbilityRecord == nullptr) { uiAbilityRecord = CreateAbilityRecord(abilityRequest, sessionInfo); bool isUIAbility = (abilityInfo.type == AppExecFwk::AbilityType::PAGE && abilityInfo.isStageBasedModel); @@ -1698,7 +1698,7 @@ int UIAbilityLifecycleManager::PrelaunchAbilityLocked(const AbilityRequest &abil std::lock_guard guard(sessionLock_); // Get target uiAbility record. - const auto& abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; UIAbilityRecordPtr uiAbilityRecord; bool reuse = false; auto persistentId = GetPersistentIdByAbilityRequest(abilityRequest, reuse); @@ -1749,8 +1749,8 @@ int UIAbilityLifecycleManager::PrelaunchAbilityLocked(const AbilityRequest &abil int UIAbilityLifecycleManager::ResolveLocked(const AbilityRequest &abilityRequest, std::string &errMsg) { TAG_LOGI(AAFwkTag::ABILITYMGR, "ByCall, ability:%{public}s/%{public}s", - abilityRequest.want.GetElement().GetBundleName().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); if (!abilityRequest.IsCallType(AbilityCallType::CALL_REQUEST_TYPE)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s, resolve ability_name:", __func__); @@ -1823,7 +1823,7 @@ int UIAbilityLifecycleManager::CallAbilityLocked(const AbilityRequest &abilityRe NotifyAbilityToken(uiAbilityRecord->GetToken(), abilityRequest); // new version started by call type - const auto& abilityInfo = abilityRequest.abilityInfo; + const auto &abilityInfo = abilityRequest.abilityInfo; auto ret = ResolveAbility(uiAbilityRecord, abilityRequest); int32_t requestId = RequestIdUtil::GetRequestId(); if (ret == ResolveResultType::OK_HAS_REMOTE_OBJ || (ret == ResolveResultType::OK_NO_REMOTE_OBJ && @@ -1950,8 +1950,8 @@ void UIAbilityLifecycleManager::CallUIAbilityBySCB(const sptr &sess uiAbilityRecord->lifeCycleStateInfo_.sceneFlagBak = params.sceneFlag; uiAbilityRecord->SetInstanceKey(sessionInfo->instanceKey); - MoreAbilityNumbersSendEventInfo(sessionInfo->userId, sessionInfo->want.GetBundle(), - sessionInfo->want.GetElement().GetAbilityName(), sessionInfo->want.GetModuleName()); + MoreAbilityNumbersSendEventInfo(sessionInfo->userId, sessionInfo->want.GetBundleNameRef(), + sessionInfo->want.GetAbilityNameRef(), sessionInfo->want.GetModuleNameRef()); sessionAbilityMap_.emplace(sessionInfo->persistentId, uiAbilityRecord); uiAbilityRecord->SetSessionInfo(sessionInfo); @@ -2077,7 +2077,7 @@ int UIAbilityLifecycleManager::NotifySCBPendingActivation(sptr &ses TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, NotifySCBPendingActivation for callerSession, target: %{public}s, keyRequestId:%{public}s, " "splitRatio:%{public}d, windowMode:%{public}d, requestId: %{public}d, scbRequestId: %{public}d", - sessionInfo->want.GetElement().GetAbilityName().c_str(), requestId.c_str(), + sessionInfo->want.GetAbilityNameRef().c_str(), requestId.c_str(), sessionInfo->splitRatioPreference, sessionInfo->want.GetIntParam(Want::PARAM_RESV_WINDOW_MODE, AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED), sessionInfo->requestId, sessionInfo->scbRequestId); @@ -2109,7 +2109,7 @@ int UIAbilityLifecycleManager::NotifySCBPendingActivation(sptr &ses TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, NotifySCBPendingActivation for rootSceneSession, target: %{public}s, splitRatio:%{public}d, " "flags:%{public}u, windowMode:%{public}d, requestId: %{public}d, scbRequestId: %{public}d", - sessionInfo->want.GetElement().GetAbilityName().c_str(), + sessionInfo->want.GetAbilityNameRef().c_str(), sessionInfo->splitRatioPreference, sessionInfo->want.GetFlags(), sessionInfo->want.GetIntParam(Want::PARAM_RESV_WINDOW_MODE, AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED), @@ -2399,7 +2399,7 @@ int32_t UIAbilityLifecycleManager::BackToCallerAbilityWithResultLocked(sptrpersistentId = callerSessionInfo->persistentId; newSessionInfo->identityToken = callerSessionInfo->identityToken; - std::string callerBundleName = currentSessionInfo->want.GetBundle(); + const auto &callerBundleName = currentSessionInfo->want.GetBundleNameRef(); std::string currentName = callerAbilityRecord->GetApplicationInfo().bundleName; EventInfo eventInfo = { .bundleName = currentName, .callerBundleName = callerBundleName, .uri = "backToCaller"}; EventReport::SendGrantUriPermissionEvent(EventName::GRANT_URI_PERMISSION, eventInfo); @@ -2940,7 +2940,7 @@ void UIAbilityLifecycleManager::HandleLegacyAcceptWantDone(SpecifiedRequest &spe const std::string &flag, const AAFwk::Want &want) { TAG_LOGI(AAFwkTag::ABILITYMGR, "HandleLegacyAcceptWantDone, ability:%{public}s/%{public}s", - want.GetBundle().c_str(), want.GetElement().GetAbilityName().c_str()); + want.GetBundleNameRef().c_str(), want.GetAbilityNameRef().c_str()); auto &abilityRequest = specifiedRequest.abilityRequest; auto callerAbility = GetAbilityRecordByToken(abilityRequest.callerToken); abilityRequest.specifiedFlag = flag; @@ -3107,7 +3107,7 @@ int32_t UIAbilityLifecycleManager::StartSpecifiedProcessRequest(const AbilityReq abilityInfo.applicationInfo.multiAppMode.multiAppModeType == AppExecFwk::MultiAppModeType::MULTI_INSTANCE && isCreating && sceneSessionManager != nullptr) { std::string instanceKey; - Rosen::WMError ret = sceneSessionManager->CreateNewInstanceKey(abilityRequest.want.GetBundle(), instanceKey); + Rosen::WMError ret = sceneSessionManager->CreateNewInstanceKey(abilityRequest.want.GetBundleNameRef(), instanceKey); if (ret != Rosen::WMError::WM_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "create new instance error:%{public}d", ret); return ERR_CREATE_INSTANCE_KEY_FAILED; @@ -3203,7 +3203,7 @@ int UIAbilityLifecycleManager::SendSessionInfoToSCB(UIAbilityRecordPtr &callerAb sessionInfo->want.RemoveParam(KEY_REQUEST_ID); TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, NotifySCBPendingActivation for callerSession, " "target: %{public}s, splitRatio:%{public}d, windowMode:%{public}d", - sessionInfo->want.GetElement().GetAbilityName().c_str(), sessionInfo->splitRatioPreference, + sessionInfo->want.GetAbilityNameRef().c_str(), sessionInfo->splitRatioPreference, sessionInfo->want.GetIntParam(Want::PARAM_RESV_WINDOW_MODE, AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED)); callerSession->PendingSessionActivation(sessionInfo); @@ -3229,7 +3229,7 @@ int UIAbilityLifecycleManager::SendSessionInfoToSCB(UIAbilityRecordPtr &callerAb } TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, NotifySCBPendingActivation for rootSceneSession, " "target: %{public}s, splitRatio:%{public}d, windowMode:%{public}d", - sessionInfo->want.GetElement().GetAbilityName().c_str(), sessionInfo->splitRatioPreference, + sessionInfo->want.GetAbilityNameRef().c_str(), sessionInfo->splitRatioPreference, sessionInfo->want.GetIntParam(Want::PARAM_RESV_WINDOW_MODE, AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED)); tmpSceneSession->PendingSessionActivation(sessionInfo); @@ -3262,7 +3262,7 @@ int UIAbilityLifecycleManager::SendSessionInfoToSCBInSplitMode(int primaryWindow sessionInfo->canStartAbilityFromBackground = true; } TAG_LOGI(AAFwkTag::ABILITYMGR, "scb call, NotifySCBPendingActivation for rootSceneSession, " - "target: %{public}s, windowMode:%{public}d", sessionInfo->want.GetElement().GetAbilityName().c_str(), + "target: %{public}s, windowMode:%{public}d", sessionInfo->want.GetAbilityNameRef().c_str(), sessionInfo->want.GetIntParam(Want::PARAM_RESV_WINDOW_MODE, AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_UNDEFINED)); tmpSceneSession->BatchPendingSessionsActivation(sessionInfoList, configList); @@ -4504,8 +4504,8 @@ void UIAbilityLifecycleManager::AddSpecifiedRequest(std::shared_ptrabilityRequest; TAG_LOGI(AAFwkTag::ABILITYMGR, "AddSpecifiedRequest: %{public}d, %{public}s/%{public}s", request->requestId, - abilityRequest.want.GetBundle().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); auto instanceKey = abilityRequest.want.GetStringParam(Want::APP_INSTANCE_KEY); auto accessTokenIdStr = std::to_string(abilityRequest.abilityInfo.applicationInfo.accessTokenId); auto &list = specifiedRequestList_[accessTokenIdStr + instanceKey]; @@ -4614,7 +4614,7 @@ void UIAbilityLifecycleManager::RemoveInstanceKey(const AbilityRequest &abilityR } auto sceneSessionManager = Rosen::SessionManagerLite::GetInstance().GetSceneSessionManagerLiteProxy(); if (sceneSessionManager != nullptr) { - Rosen::WMError ret = sceneSessionManager->RemoveInstanceKey(abilityRequest.want.GetBundle(), + Rosen::WMError ret = sceneSessionManager->RemoveInstanceKey(abilityRequest.want.GetBundleNameRef(), abilityRequest.want.GetStringParam(Want::APP_INSTANCE_KEY)); TAG_LOGI(AAFwkTag::ABILITYMGR, "remove instance key ret:%{public}d", ret); } @@ -4896,9 +4896,9 @@ ErrCode UIAbilityLifecycleManager::IsUIAbilityAlreadyExist(const Want &want, std::lock_guard guard(sessionLock_); tempSessionAbilityMap = sessionAbilityMap_; } - std::string moduleName = want.GetModuleName(); - std::string abilityName = want.GetElement().GetAbilityName(); - std::string bundleName = want.GetElement().GetBundleName(); + const auto &moduleName = want.GetModuleNameRef(); + const auto &abilityName = want.GetAbilityNameRef(); + const auto &bundleName = want.GetBundleNameRef(); for (auto it = tempSessionAbilityMap.begin(); it != tempSessionAbilityMap.end(); it++) { if (it->second == nullptr) { diff --git a/services/abilitymgr/src/skill/skill_execute_param.cpp b/services/abilitymgr/src/skill/skill_execute_param.cpp index 60af8d6499..186b3d8bf4 100644 --- a/services/abilitymgr/src/skill/skill_execute_param.cpp +++ b/services/abilitymgr/src/skill/skill_execute_param.cpp @@ -152,7 +152,7 @@ bool SkillExecuteParam::GenerateFromWant(const AAFwk::Want &want, SkillExecutePa bool SkillExecuteParam::RemoveSkillParam(AAFwk::Want &want) { - auto params = want.GetParams(); + const auto ¶ms = want.GetParams(); auto argsKeysStr = params.GetStringParam(SKILL_EXECUTE_PARAM_ARGS_KEYS); auto srcCountStr = params.GetStringParam(SKILL_EXECUTE_PARAM_SRC_ENTRIES_COUNT); diff --git a/services/abilitymgr/src/start_ability_handler.cpp b/services/abilitymgr/src/start_ability_handler.cpp index 4489c1e6ea..3039797b60 100644 --- a/services/abilitymgr/src/start_ability_handler.cpp +++ b/services/abilitymgr/src/start_ability_handler.cpp @@ -99,9 +99,9 @@ EventInfo StartAbilityParams::BuildEventInfo() { EventInfo eventInfo; eventInfo.userId = userId; - eventInfo.bundleName = want.GetElement().GetBundleName(); - eventInfo.moduleName = want.GetElement().GetModuleName(); - eventInfo.abilityName = want.GetElement().GetAbilityName(); + eventInfo.bundleName = want.GetBundleNameRef(); + eventInfo.moduleName = want.GetModuleNameRef(); + eventInfo.abilityName = want.GetAbilityNameRef(); return eventInfo; } } // namespace AAFwk diff --git a/services/abilitymgr/src/start_ability_handler/start_ability_sandbox_savefile.cpp b/services/abilitymgr/src/start_ability_handler/start_ability_sandbox_savefile.cpp index a9bc713174..6989af5bdc 100644 --- a/services/abilitymgr/src/start_ability_handler/start_ability_sandbox_savefile.cpp +++ b/services/abilitymgr/src/start_ability_handler/start_ability_sandbox_savefile.cpp @@ -51,7 +51,7 @@ StartAbilitySandboxSavefile &StartAbilitySandboxSavefile::GetInstance() bool StartAbilitySandboxSavefile::MatchStartRequest(StartAbilityParams ¶ms) { - if (params.IsCallerSandboxApp() && params.want.GetAction() == "ohos.want.action.CREATE_FILE" && + if (params.IsCallerSandboxApp() && params.want.GetActionRef() == "ohos.want.action.CREATE_FILE" && params.want.GetStringParam("startMode") == "save") { return true; } diff --git a/services/abilitymgr/src/system_dialog_scheduler.cpp b/services/abilitymgr/src/system_dialog_scheduler.cpp index 20ab001f0d..300f506d87 100644 --- a/services/abilitymgr/src/system_dialog_scheduler.cpp +++ b/services/abilitymgr/src/system_dialog_scheduler.cpp @@ -154,7 +154,7 @@ Want SystemDialogScheduler::GetJumpInterceptorDialogWant(Want &targetWant) auto wantEle = targetWant.GetElement(); jsonObj["bundleName"] = wantEle.GetBundleName(); jsonObj["abilityName"] = wantEle.GetAbilityName(); - jsonObj["moduleName"] = wantEle.GetModuleName(); + jsonObj["moduleName"] = wantEle.GetModuleNameRef(); const std::string params = jsonObj.dump(); targetWant.SetElementName(BUNDLE_NAME_DIALOG, ABILITY_NAME_JUMP_INTERCEPTOR_DIALOG); @@ -358,7 +358,7 @@ int SystemDialogScheduler::GetPcSelectorDialogWant(const std::vector(dialogAppInfos.size())); - std::string params = GetPcSelectorParams(dialogAppInfos, type, userId, requestWant.GetAction()); + std::string params = GetPcSelectorParams(dialogAppInfos, type, userId, requestWant.GetActionRef()); requestWant.SetElementName(BUNDLE_NAME_DIALOG, ABILITY_NAME_SELECTOR_DIALOG); requestWant.SetParam(DIALOG_POSITION, GetDialogPositionParams(position)); requestWant.SetParam(DIALOG_PARAMS, params); diff --git a/services/abilitymgr/src/ui_extension/ui_extension_ability_manager.cpp b/services/abilitymgr/src/ui_extension/ui_extension_ability_manager.cpp index c25648963d..924057e706 100644 --- a/services/abilitymgr/src/ui_extension/ui_extension_ability_manager.cpp +++ b/services/abilitymgr/src/ui_extension/ui_extension_ability_manager.cpp @@ -613,14 +613,14 @@ int32_t UIExtensionAbilityManager::UnRegisterPreloadUIExtensionHostClient(int32_ int32_t UIExtensionAbilityManager::StartAbilityLocked(const AbilityRequest &abilityRequest) { if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::EXT, "forbid start: %{public}s", abilityRequest.want.GetBundle().c_str()); + TAG_LOGW(AAFwkTag::EXT, "forbid start: %{public}s", abilityRequest.want.GetBundleNameRef().c_str()); return INNER_ERR; } HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); TAG_LOGD(AAFwkTag::EXT, "bundle/ability:%{public}s/%{public}s", - abilityRequest.want.GetElement().GetBundleName().c_str(), - abilityRequest.want.GetElement().GetAbilityName().c_str()); + abilityRequest.want.GetBundleNameRef().c_str(), + abilityRequest.want.GetAbilityNameRef().c_str()); int32_t ret = AbilityPermissionUtil::GetInstance().CheckMultiInstanceKeyForExtension(abilityRequest); if (ret != ERR_OK) { diff --git a/services/abilitymgr/src/utils/ability_permission_util.cpp b/services/abilitymgr/src/utils/ability_permission_util.cpp index bfcf95e4a7..778bd7abff 100644 --- a/services/abilitymgr/src/utils/ability_permission_util.cpp +++ b/services/abilitymgr/src/utils/ability_permission_util.cpp @@ -91,8 +91,8 @@ bool AbilityPermissionUtil::IsDominateScreen(const Want &want, bool isPendingWan return false; } // add temporarily - std::string bundleName = want.GetElement().GetBundleName(); - std::string abilityName = want.GetElement().GetAbilityName(); + const auto &bundleName = want.GetBundleNameRef(); + const auto &abilityName = want.GetAbilityNameRef(); bool withoutSettings = bundleName.find(SETTINGS) == std::string::npos && abilityName.find(SETTINGS) == std::string::npos; if (withoutSettings && AppUtils::GetInstance().IsAllowStartAbilityWithoutCallerToken(bundleName, abilityName)) { @@ -139,7 +139,7 @@ int32_t AbilityPermissionUtil::CheckMultiInstanceAndAppClone(Want &want, int32_t AppExecFwk::ApplicationInfo appInfo; auto isSupportMultiInstance = AppUtils::GetInstance().IsSupportMultiInstance(); if (isSupportMultiInstance) { - if (!StartAbilityUtils::GetApplicationInfo(want.GetBundle(), userId, appInfo)) { + if (!StartAbilityUtils::GetApplicationInfo(want.GetBundleNameRef(), userId, appInfo)) { TAG_LOGI(AAFwkTag::ABILITYMGR, "implicit start"); return ERR_OK; } @@ -177,7 +177,7 @@ int32_t AbilityPermissionUtil::CheckMultiInstance(Want &want, sptr instanceKeyArray; - auto result = IN_PROCESS_CALL(appMgr->GetAllRunningInstanceKeysByBundleName(want.GetBundle(), instanceKeyArray)); + auto result = IN_PROCESS_CALL(appMgr->GetAllRunningInstanceKeysByBundleName(want.GetBundleNameRef(), instanceKeyArray)); if (result != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "Failed to get instance key"); return ERR_INVALID_VALUE; @@ -185,7 +185,7 @@ int32_t AbilityPermissionUtil::CheckMultiInstance(Want &want, sptrGetAbilityInfo().bundleName == want.GetBundle()) || + if ((callerRecord != nullptr && callerRecord->GetAbilityInfo().bundleName == want.GetBundleNameRef()) || IsStartSelfUIAbility()) { if (isCreating) { if (!instanceKey.empty()) { @@ -258,7 +258,7 @@ int32_t AbilityPermissionUtil::CheckMultiInstanceKeyForExtension(const AbilityRe TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid extension type"); return ERR_INVALID_EXTENSION_TYPE; } - if (!MultiInstanceUtils::IsInstanceKeyExist(abilityRequest.want.GetBundle(), instanceKey)) { + if (!MultiInstanceUtils::IsInstanceKeyExist(abilityRequest.want.GetBundleNameRef(), instanceKey)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "key not found"); return ERR_INVALID_APP_INSTANCE_KEY; } diff --git a/services/abilitymgr/src/utils/clone_for_account_util.cpp b/services/abilitymgr/src/utils/clone_for_account_util.cpp index 6ba53115cc..94c655dcb9 100644 --- a/services/abilitymgr/src/utils/clone_for_account_util.cpp +++ b/services/abilitymgr/src/utils/clone_for_account_util.cpp @@ -25,7 +25,7 @@ bool CloneForAccountUtil::ProcessAppIndex(Want &want, int32_t userId, bool isExt { want.RemoveParam(Want::PARAM_APP_CLONE_INDEX_KEY); - if (want.GetElement().GetAbilityName().empty()) { + if (want.GetAbilityNameRef().empty()) { TAG_LOGI(AAFwkTag::ABILITYMGR, "implicit start, skip"); return true; } diff --git a/services/abilitymgr/src/utils/multi_instance_utils.cpp b/services/abilitymgr/src/utils/multi_instance_utils.cpp index fda4095eac..ae652c4376 100644 --- a/services/abilitymgr/src/utils/multi_instance_utils.cpp +++ b/services/abilitymgr/src/utils/multi_instance_utils.cpp @@ -50,7 +50,7 @@ std::string MultiInstanceUtils::GetValidExtensionInstanceKey(const AbilityReques std::string MultiInstanceUtils::GetSelfCallerInstanceKey(const AbilityRequest &abilityRequest) { auto callerRecord = Token::GetAbilityRecordByToken(abilityRequest.callerToken); - if (callerRecord && callerRecord->GetAbilityInfo().bundleName == abilityRequest.want.GetBundle()) { + if (callerRecord && callerRecord->GetAbilityInfo().bundleName == abilityRequest.want.GetBundleNameRef()) { return callerRecord->GetInstanceKey(); } return ""; diff --git a/services/abilitymgr/src/utils/oe_extension_utils.cpp b/services/abilitymgr/src/utils/oe_extension_utils.cpp index 1e087c2b49..ea613951b5 100644 --- a/services/abilitymgr/src/utils/oe_extension_utils.cpp +++ b/services/abilitymgr/src/utils/oe_extension_utils.cpp @@ -60,13 +60,13 @@ int32_t OEExtensionUtils::ValidateCaller( return ERR_INVALID_CALLER; } - if (want.GetBundle() != abilityInfo.bundleName) { + if (want.GetBundleNameRef() != abilityInfo.bundleName) { TAG_LOGE(AAFwkTag::ABILITYMGR, "want bundleName %{public}s does not match caller bundleName %{public}s", - want.GetBundle().c_str(), abilityInfo.bundleName.c_str()); + want.GetBundleNameRef().c_str(), abilityInfo.bundleName.c_str()); return INVALID_PARAMETERS_ERR; } - if (want.GetElement().GetAbilityName().empty()) { + if (want.GetAbilityNameRef().empty()) { TAG_LOGE(AAFwkTag::ABILITYMGR, "want abilityName is empty"); return INVALID_PARAMETERS_ERR; } diff --git a/services/abilitymgr/src/utils/start_ability_utils.cpp b/services/abilitymgr/src/utils/start_ability_utils.cpp index 618af51a41..88dfd6ea6a 100644 --- a/services/abilitymgr/src/utils/start_ability_utils.cpp +++ b/services/abilitymgr/src/utils/start_ability_utils.cpp @@ -56,7 +56,7 @@ thread_local bool StartAbilityUtils::isSandBoxClone = false; bool StartAbilityUtils::GetAppIndex(const Want &want, sptr callerToken, int32_t &appIndex) { auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); - if (abilityRecord && abilityRecord->GetApplicationInfo().bundleName == want.GetBundle() && + if (abilityRecord && abilityRecord->GetApplicationInfo().bundleName == want.GetBundleNameRef() && AbilityRuntime::GlobalConstant::IsDlpIndex(abilityRecord->GetAppIndex())) { appIndex = abilityRecord->GetAppIndex(); return true; @@ -119,7 +119,7 @@ std::vector StartAbilityUtils::GetCloneAppIndexes(const std::string &bu int32_t StartAbilityUtils::CheckAppProvisionMode(const Want& want, int32_t userId, sptr callerToken) { auto abilityInfo = StartAbilityUtils::startAbilityInfo; - if (!abilityInfo || abilityInfo->GetAppBundleName() != want.GetBundle()) { + if (!abilityInfo || abilityInfo->GetAppBundleName() != want.GetBundleNameRef()) { int32_t appIndex = 0; if (!GetAppIndex(want, callerToken, appIndex)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid app clone index"); @@ -253,7 +253,7 @@ std::shared_ptr QueryAbilityInfo(const Want &want, int32_t use TAG_LOGI(AAFwkTag::ABILITYMGR, "hostBundleName: %{public}s", hostBundleName.c_str()); auto element = want.GetElement(); auto pluginRet = IN_PROCESS_CALL(bms->GetPluginAbilityInfo(hostBundleName, element.GetBundleName(), - element.GetModuleName(), element.GetAbilityName(), userId, request->abilityInfo)); + element.GetModuleNameRef(), element.GetAbilityName(), userId, request->abilityInfo)); if (pluginRet != ERR_OK) { TAG_LOGW(AAFwkTag::ABILITYMGR, "GetPluginAbilityInfo failed %{public}d", pluginRet); request->status = RESOLVE_ABILITY_ERR; @@ -438,7 +438,7 @@ void StartAbilityUtils::SetTargetCloneIndexInSameBundle(const Want &want, sptrGetAbilityInfo().bundleName != want.GetBundle()) { + if (callerRecord->GetAbilityInfo().bundleName != want.GetBundleNameRef()) { TAG_LOGD(AAFwkTag::ABILITYMGR, "not the same bundle"); return; } @@ -467,9 +467,9 @@ void StartAbilityUtils::ResolveTargetAppCloneIndex(const Want &want, sptr(want)).SetParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, appIndex); } } diff --git a/services/abilitymgr/src/utils/start_options_utils.cpp b/services/abilitymgr/src/utils/start_options_utils.cpp index 648f715b1d..0fda5622de 100644 --- a/services/abilitymgr/src/utils/start_options_utils.cpp +++ b/services/abilitymgr/src/utils/start_options_utils.cpp @@ -69,7 +69,7 @@ int32_t StartOptionsUtils::CheckProcessOptionsInner(const Want &want, const Star ERR_CAPABILITY_NOT_SUPPORT, "not support process options"); auto element = want.GetElement(); - CHECK_TRUE_RETURN_RET(element.GetAbilityName().empty() || want.GetAction().compare(ACTION_CHOOSE) == 0, + CHECK_TRUE_RETURN_RET(element.GetAbilityName().empty() || want.GetActionRef().compare(ACTION_CHOOSE) == 0, ERR_NOT_ALLOW_IMPLICIT_START, "not allow implicit start"); if (PermissionVerification::GetInstance()->CheckSpecificSystemAbilityAccessPermission(FOUNDATION_PROCESS_NAME) diff --git a/services/abilitymgr/src/utils/update_caller_info_util.cpp b/services/abilitymgr/src/utils/update_caller_info_util.cpp index be7bbadde2..cea0249fe6 100644 --- a/services/abilitymgr/src/utils/update_caller_info_util.cpp +++ b/services/abilitymgr/src/utils/update_caller_info_util.cpp @@ -371,7 +371,7 @@ void UpdateCallerInfoUtil::ClearProtectedWantParam(Want &want) { if (want.HasParameter(HIDE_SENSITIVE_TYPE)) { EventInfo eventInfo; - std::string bundleName = want.GetBundle(); + const auto &bundleName = want.GetBundleNameRef(); int32_t callerUid = IPCSkeleton::GetCallingUid(); std::string callerBundleName; auto bundleMgr = AbilityUtil::GetBundleManagerHelper(); diff --git a/services/abilitymgr/src/utils/uri_utils.cpp b/services/abilitymgr/src/utils/uri_utils.cpp index 2337da69c1..18e8cef5bf 100644 --- a/services/abilitymgr/src/utils/uri_utils.cpp +++ b/services/abilitymgr/src/utils/uri_utils.cpp @@ -231,7 +231,7 @@ std::vector UriUtils::GetPermissionedUriList(const std::vector bool UriUtils::GetUriListFromWant(Want &want, std::vector &uriVec) { // remove uris out of 500 - auto uriStr = want.GetUri().ToString(); + auto uriStr = want.GetUriRef().ToString(); uriVec = want.GetStringArrayParam(AbilityConfig::PARAMS_STREAM); if (uriVec.empty() && uriStr.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "uriVec empty."); diff --git a/services/abilitymgr/src/utils/window_options_utils.cpp b/services/abilitymgr/src/utils/window_options_utils.cpp index 7d2db25ee0..dc3af2493d 100644 --- a/services/abilitymgr/src/utils/window_options_utils.cpp +++ b/services/abilitymgr/src/utils/window_options_utils.cpp @@ -53,7 +53,7 @@ void WindowOptionsUtils::SetWindowPositionAndSize(Want& want, bool withAnimation = startOptions.GetWithAnimation(); auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); if (!withAnimation && abilityRecord != nullptr && - abilityRecord->GetAbilityInfo().bundleName == want.GetBundle()) { + abilityRecord->GetAbilityInfo().bundleName == want.GetBundleNameRef()) { want.SetParam(Want::PARAM_RESV_WITH_ANIMATION, withAnimation); } } diff --git a/test/unittest/ability_manager_service_fourth_test/mock/include/mock_ability_interceptor_executer.h b/test/unittest/ability_manager_service_fourth_test/mock/include/mock_ability_interceptor_executer.h index 5b2569f566..5e9580bdb2 100644 --- a/test/unittest/ability_manager_service_fourth_test/mock/include/mock_ability_interceptor_executer.h +++ b/test/unittest/ability_manager_service_fourth_test/mock/include/mock_ability_interceptor_executer.h @@ -45,7 +45,7 @@ public: /** * Excute the DoProcess of the interceptors. */ - ErrCode DoProcess(AbilityInterceptorParam param); + ErrCode DoProcess(const AbilityInterceptorParam ¶m); void SetTaskHandler(std::shared_ptr taskHandler); private: diff --git a/test/unittest/ability_manager_service_fourth_test/mock/src/mock_ability_interceptor_executer.cpp b/test/unittest/ability_manager_service_fourth_test/mock/src/mock_ability_interceptor_executer.cpp index 2bdf5b1f81..fbf2ad83cf 100644 --- a/test/unittest/ability_manager_service_fourth_test/mock/src/mock_ability_interceptor_executer.cpp +++ b/test/unittest/ability_manager_service_fourth_test/mock/src/mock_ability_interceptor_executer.cpp @@ -18,7 +18,7 @@ namespace OHOS { namespace AAFwk { -ErrCode MockAbilityInterceptorExecuter::DoProcess(AbilityInterceptorParam param) +ErrCode MockAbilityInterceptorExecuter::DoProcess(const AbilityInterceptorParam ¶m) { return ERR_OK; } diff --git a/test/unittest/ability_manager_service_third_test/mock/include/mock_free_install_manager.h b/test/unittest/ability_manager_service_third_test/mock/include/mock_free_install_manager.h index db89beecab..ef68a71d86 100644 --- a/test/unittest/ability_manager_service_third_test/mock/include/mock_free_install_manager.h +++ b/test/unittest/ability_manager_service_third_test/mock/include/mock_free_install_manager.h @@ -228,10 +228,10 @@ private: void PostUpgradeAtomicServiceTask(int resultCode, const Want &want, int32_t userId); - void StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName, std::string &abilityName, - std::string &startTime); - void StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime); + void StartAbilityByFreeInstall(FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime); + void StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime); int32_t UpdateElementName(Want &want, int32_t userId) const; void HandleFreeInstallResult(int32_t recordId, FreeInstallInfo &freeInstallInfo, int resultCode, bool isAsync); void HandleOnFreeInstallSuccess(int32_t recordId, FreeInstallInfo &freeInstallInfo, bool isAsync); diff --git a/test/unittest/ability_manager_service_third_test/mock/src/mock_free_install_manager.cpp b/test/unittest/ability_manager_service_third_test/mock/src/mock_free_install_manager.cpp index 163d6dea75..e2ea027d5b 100644 --- a/test/unittest/ability_manager_service_third_test/mock/src/mock_free_install_manager.cpp +++ b/test/unittest/ability_manager_service_third_test/mock/src/mock_free_install_manager.cpp @@ -85,13 +85,13 @@ void FreeInstallManager::HandleFreeInstallResult(int32_t recordId, FreeInstallIn { } -void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime) +void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime) { } -void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime) +void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, + const std::string &bundleName, const std::string &abilityName, const std::string &startTime) { } diff --git a/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_ecological_rule_interceptor.h b/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_ecological_rule_interceptor.h index f9bd3d54d0..8fcee3f724 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_ecological_rule_interceptor.h +++ b/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_ecological_rule_interceptor.h @@ -35,7 +35,7 @@ class EcologicalRuleInterceptor : public IAbilityInterceptor { public: EcologicalRuleInterceptor() = default; ~EcologicalRuleInterceptor() = default; - ErrCode DoProcess(AbilityInterceptorParam param) override; + ErrCode DoProcess(const AbilityInterceptorParam ¶m) override; bool DoProcess(Want &want, int32_t userId); virtual void SetTaskHandler(std::shared_ptr taskHandler) override { diff --git a/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_free_install_manager.h b/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_free_install_manager.h index b35b6125be..9852e84f8c 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_free_install_manager.h +++ b/test/unittest/ability_manager_service_thirteenth_test/mock/include/mock_free_install_manager.h @@ -228,10 +228,10 @@ private: void PostUpgradeAtomicServiceTask(int resultCode, const Want &want, int32_t userId); - void StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName, std::string &abilityName, - std::string &startTime); - void StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime); + void StartAbilityByFreeInstall(FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime); + void StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime); int32_t UpdateElementName(Want &want, int32_t userId) const; void HandleFreeInstallResult(int32_t recordId, FreeInstallInfo &freeInstallInfo, int resultCode, bool isAsync); void HandleOnFreeInstallSuccess(int32_t recordId, FreeInstallInfo &freeInstallInfo, bool isAsync); diff --git a/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ecological_rule_interceptor.cpp b/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ecological_rule_interceptor.cpp index bdefa2b710..559eeb6acb 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ecological_rule_interceptor.cpp +++ b/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_ecological_rule_interceptor.cpp @@ -19,7 +19,7 @@ namespace OHOS { namespace AAFwk { -ErrCode EcologicalRuleInterceptor::DoProcess(AbilityInterceptorParam param) +ErrCode EcologicalRuleInterceptor::DoProcess(const AbilityInterceptorParam ¶m) { return ERR_OK; } diff --git a/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_free_install_manager.cpp b/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_free_install_manager.cpp index b00e8df3e2..06f054ccae 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_free_install_manager.cpp +++ b/test/unittest/ability_manager_service_thirteenth_test/mock/src/mock_free_install_manager.cpp @@ -75,13 +75,13 @@ void FreeInstallManager::HandleFreeInstallResult(int32_t recordId, FreeInstallIn { } -void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime) +void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, const std::string &bundleName, + const std::string &abilityName, const std::string &startTime) { } -void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName, - std::string &abilityName, std::string &startTime) +void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, + const std::string &bundleName, const std::string &abilityName, const std::string &startTime) { }