Co-Authored-By: Agent

Signed-off-by: wangzhen <wangzhen416@huawei.com>

🤖 AI[0%] 🔧 Human Fixed[0%] 🧑 Human[100%] 👌 AI Adopted[0%]

Change-Id: Ib81fc41ac313075bbb89425580fa08bfdd67cc0f
This commit is contained in:
wangzhen
2026-07-16 16:40:34 +08:00
parent 045ca0f293
commit 5641b0194c
73 changed files with 424 additions and 426 deletions
@@ -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);
@@ -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);
@@ -50,7 +50,7 @@ public:
/**
* Excute the DoProcess of the interceptors.
*/
ErrCode DoProcess(AbilityInterceptorParam param);
ErrCode DoProcess(const AbilityInterceptorParam &param);
void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler);
private:
@@ -60,7 +60,7 @@ public:
/**
* Excute interception processing.
*/
virtual ErrCode DoProcess(AbilityInterceptorParam param) = 0;
virtual ErrCode DoProcess(const AbilityInterceptorParam &param) = 0;
/**
* Set handler for async task executing.
@@ -28,7 +28,7 @@ class AbilityJumpInterceptor : public IAbilityInterceptor {
public:
AbilityJumpInterceptor() = default;
~AbilityJumpInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
return;
@@ -24,7 +24,7 @@ class BlockAllAppStartInterceptor : public IAbilityInterceptor {
public:
BlockAllAppStartInterceptor() = default;
~BlockAllAppStartInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
return;
@@ -27,7 +27,7 @@ class ControlInterceptor : public IAbilityInterceptor {
public:
ControlInterceptor() = default;
~ControlInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
return;
@@ -24,7 +24,7 @@ class CrowdTestInterceptor : public IAbilityInterceptor {
public:
CrowdTestInterceptor() = default;
~CrowdTestInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
return;
@@ -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 &param) override;
void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
taskHandler_ = taskHandler;
@@ -35,7 +35,7 @@ class EcologicalRuleInterceptor : public IAbilityInterceptor {
public:
EcologicalRuleInterceptor() = default;
~EcologicalRuleInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
bool DoProcess(Want &want, int32_t userId);
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
@@ -26,7 +26,7 @@ class ExtensionControlInterceptor : public IAbilityInterceptor {
public:
ExtensionControlInterceptor() = default;
~ExtensionControlInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
private:
bool IsExtensionStartThirdPartyAppEnable(std::string extensionTypeName, std::string targetBundleName);
bool IsExtensionStartServiceEnable(std::string extensionTypeName, std::string targetUri);
@@ -22,7 +22,7 @@ namespace OHOS {
namespace AAFwk {
class KioskInterceptor : public IAbilityInterceptor {
public:
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
};
} // namespace AAFwk
} // namespace OHOS
@@ -24,7 +24,7 @@ class ScreenUnlockInterceptor : public IAbilityInterceptor {
public:
ScreenUnlockInterceptor() = default;
~ScreenUnlockInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
return;
@@ -26,7 +26,7 @@ class StartOtherAppInterceptor : public IAbilityInterceptor {
public:
StartOtherAppInterceptor() = default;
~StartOtherAppInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
return;
@@ -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 {
@@ -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<uint32_t>(want.GetIntParam(KEY_TOKEN, 0));
int uid = want.GetIntParam(KEY_UID, 0);
auto bundleType = want.GetIntParam(BUNDLE_TYPE, 0);
@@ -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<BaseExtensionRecord> AbilityCacheManager::GetAbilityRecInProcList(const AbilityRequest &abilityRequest)
@@ -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<BaseExtensionRe
auto findRestartResidentTask = [&srcElement](const AbilityRequest &abilityRequest) {
auto dstElement = abilityRequest.want.GetElement();
return (srcElement.GetBundleName() == dstElement.GetBundleName() &&
srcElement.GetModuleName() == dstElement.GetModuleName() &&
srcElement.GetModuleNameRef() == dstElement.GetModuleNameRef() &&
srcElement.GetAbilityName() == dstElement.GetAbilityName());
};
auto findIter = find_if(restartResidentTaskList_.begin(), restartResidentTaskList_.end(),
@@ -88,7 +88,7 @@ AbilityScreenUnlockEventSubscriber::AbilityScreenUnlockEventSubscriber(
void AbilityScreenUnlockEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &data)
{
const AAFwk::Want &want = data.GetWant();
std::string action = want.GetAction();
const auto &action = want.GetActionRef();
TAG_LOGD(AAFwkTag::ABILITYMGR, "The action: %{public}s.", action.c_str());
if (action != EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED) {
return;
@@ -119,7 +119,7 @@ AbilityUserUnlockEventSubscriber::AbilityUserUnlockEventSubscriber(
void AbilityUserUnlockEventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &data)
{
const AAFwk::Want &want = data.GetWant();
std::string action = want.GetAction();
const auto &action = want.GetActionRef();
TAG_LOGD(AAFwkTag::ABILITYMGR, "The action: %{public}s.", action.c_str());
if (action != EventFwk::CommonEventSupport::COMMON_EVENT_USER_UNLOCKED) {
return;
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -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
@@ -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);
@@ -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) {
@@ -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());
@@ -272,7 +272,7 @@ void BaseExtensionRecord::DumpUIExtensionRootHostInfo(std::vector<std::string> &
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);
@@ -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());
@@ -121,7 +121,7 @@ int FreeInstallManager::StartFreeInstall(const Want &want, int32_t userId, int r
sptr<IRemoteObject> callerToken, std::shared_ptr<FreeInstallParams> 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<FreeInstallObserverManager>::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<AppExecFwk::ExtensionAbilityInfo> 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<ffrt::mutex> lock(freeInstallManager->timestampMapLock_);
@@ -730,8 +730,8 @@ void FreeInstallManager::RemoveFreeInstallInfo(const std::string &bundleName, co
{
std::lock_guard<ffrt::mutex> 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<int>(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<ffrt::mutex> 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<ffrt::mutex> 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<ffrt::mutex> 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<ffrt::mutex> 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<AppExecFwk::ExecuteMode>(
it->want.GetIntParam(AppExecFwk::INSIGHT_INTENT_EXECUTE_PARAM_MODE, 0));
@@ -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<DialogAppInfo> &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<AppExecFwk::AbilityInfo> implicitAbilityInfos;
std::vector<AppExecFwk::ExtensionAbilityInfo> implicitExtensionInfos;
@@ -628,7 +628,7 @@ int ImplicitStartProcessor::GenerateAbilityRequestByAction(int32_t userId, Abili
int ImplicitStartProcessor::GenerateAbilityRequestByAppIndexes(int32_t userId, AbilityRequest &request,
std::vector<DialogAppInfo> &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<std::string> 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<AppExecFwk::Ski
if (want.GetBoolParam(OPEN_LINK_APP_LINKING_ONLY, false)) {
want.SetParam("send_to_erms_targetLinkType", AbilityCallerInfo::LINK_TYPE_UNIVERSAL_LINK);
} else if ((iter.scheme == "https" || iter.scheme == "http") &&
want.GetAction().compare(ACTION_VIEW) == 0) {
want.GetActionRef().compare(ACTION_VIEW) == 0) {
want.SetParam("send_to_erms_targetLinkType", AbilityCallerInfo::LINK_TYPE_WEB_LINK);
} else {
want.SetParam("send_to_erms_targetLinkType", AbilityCallerInfo::LINK_TYPE_DEEP_LINK);
@@ -1079,7 +1079,7 @@ bool ImplicitStartProcessor::IsActionImplicitStart(const Want &want, bool findDe
return false;
}
if (want.GetBundle() != "") {
if (want.GetBundleNameRef() != "") {
return false;
}
@@ -55,7 +55,7 @@ void InsightIntentEventMgr::DeleteInsightIntent(const std::string &bundleName, c
void InsightIntentEventMgr::UpdateInsightIntentEvent(const AppExecFwk::ElementName &elementName, int32_t userId)
{
auto bundleName = elementName.GetBundleName();
auto moduleName = elementName.GetModuleName();
auto moduleName = elementName.GetModuleNameRef();
if (bundleName.empty() || moduleName.empty()) {
TAG_LOGW(AAFwkTag::INTENT, "input param empty, bundleName: %{public}s", bundleName.c_str());
return;
@@ -158,7 +158,7 @@ void InsightIntentEventMgr::DeleteInsightIntentEvent(const AppExecFwk::ElementNa
{
ErrCode ret;
auto bundleName = elementName.GetBundleName();
auto moduleName = elementName.GetModuleName();
auto moduleName = elementName.GetModuleNameRef();
if (bundleName.empty()) {
TAG_LOGE(AAFwkTag::INTENT, "input bundleName empty, bundleName: %{public}s, moduleName: %{public}s",
bundleName.c_str(), moduleName.c_str());
@@ -191,7 +191,7 @@ int32_t InsightIntentExecuteManager::CheckAndUpdateWant(Want &want, ExecuteMode
}
uint64_t intentId = 0;
ElementName elementName = want.GetElement();
result = AddRecord(0, nullptr, want.GetBundle(), intentId, callerBundleName);
result = AddRecord(0, nullptr, want.GetBundleNameRef(), intentId, callerBundleName);
if (result != ERR_OK) {
return result;
}
@@ -228,7 +228,7 @@ int32_t InsightIntentExecuteManager::UpdateEntryDecoratorParams(Want &want, Exec
userId = IPCSkeleton::GetCallingUid() / AppExecFwk::Constants::BASE_USER_RANGE;
}
DelayedSingleton<AbilityRuntime::InsightIntentDbCache>::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<InsightIntentEntryInfo>().abilityName) {
if (want.GetAbilityNameRef() != info.genericInfo.get<InsightIntentEntryInfo>().abilityName) {
TAG_LOGE(AAFwkTag::INTENT, "ability name mismatch");
return ERR_INVALID_VALUE;
}
@@ -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;
@@ -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) {
@@ -44,7 +44,7 @@ bool AbilityInterceptorExecuter::HasInterceptor(std::string interceptorName)
return iter != interceptorMap_.end();
}
ErrCode AbilityInterceptorExecuter::DoProcess(AbilityInterceptorParam param)
ErrCode AbilityInterceptorExecuter::DoProcess(const AbilityInterceptorParam &param)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
int32_t result = ERR_OK;
@@ -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 &param)
{
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_ptr<AppExecFwk::BundleMgrH
int callerUid = IPCSkeleton::GetCallingUid();
std::string callerBundleName;
auto result = IN_PROCESS_CALL(bundleMgrHelper->GetNameForUid(callerUid, callerBundleName));
std::string targetBundleName = want.GetBundle();
const auto &targetBundleName = want.GetBundleNameRef();
controlRule.callerPkg = callerBundleName;
controlRule.targetPkg = targetBundleName;
if (result != ERR_OK) {
@@ -19,7 +19,7 @@
namespace OHOS {
namespace AAFwk {
ErrCode BlockAllAppStartInterceptor::DoProcess(AbilityInterceptorParam param)
ErrCode BlockAllAppStartInterceptor::DoProcess(const AbilityInterceptorParam &param)
{
if (param.shouldBlockAllAppStartFunc_ == nullptr) {
TAG_LOGE(AAFwkTag::ECOLOGICAL_RULE, "shouldBlockAllAppStartFunc_ is nullptr");
@@ -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 &param)
{
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");
@@ -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 &param)
{
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;
}
@@ -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 &param)
{
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<std::string> 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());
}
}
@@ -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 &param)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
if (NoNeedErms(param)) {
@@ -86,7 +86,7 @@ bool EcologicalRuleInterceptor::NoNeedErms(const AbilityInterceptorParam &param)
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 &param)
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<Want> &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;
}
@@ -24,7 +24,7 @@
namespace OHOS {
namespace AAFwk {
ErrCode ExtensionControlInterceptor::DoProcess(AbilityInterceptorParam param)
ErrCode ExtensionControlInterceptor::DoProcess(const AbilityInterceptorParam &param)
{
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 {
@@ -22,7 +22,7 @@
namespace OHOS {
namespace AAFwk {
int KioskInterceptor::DoProcess(AbilityInterceptorParam param)
int KioskInterceptor::DoProcess(const AbilityInterceptorParam &param)
{
#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());
@@ -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 &param)
{
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(
@@ -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 &param)
{
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)
@@ -164,8 +164,8 @@ std::shared_ptr<Mission> 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)) {
@@ -3328,8 +3328,8 @@ void MissionListManager::DumpMission(int missionId, std::vector<std::string> &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__);
@@ -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");
+1 -1
View File
@@ -147,7 +147,7 @@ void PendingWantKey::GetAllBundleNames(std::vector<std::string> &bundleNames)
{
std::lock_guard<std::mutex> lock(wantsInfosMutex_);
for (const auto &wantInfo : allWantsInfos_) {
bundleNames.emplace_back(wantInfo.want.GetBundle());
bundleNames.emplace_back(wantInfo.want.GetBundleNameRef());
}
}
@@ -65,7 +65,7 @@ sptr<IWantSender> PendingWantManager::GetWantSender(int32_t callingUid, int32_t
if (wantSenderInfo.type != static_cast<int32_t>(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<Start
int32_t result = ERR_OK;
std::string localDeviceId;
DelayedSingleton<AbilityManagerService>::GetInstance()->GetLocalDeviceId(localDeviceId);
if (want.GetElement().GetDeviceID() == "" || want.GetElement().GetDeviceID() == localDeviceId) {
if (want.GetDeviceIdRef() == "" || want.GetDeviceIdRef() == localDeviceId) {
if (!startOptions) {
result = DelayedSingleton<AbilityManagerService>::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<std::string> &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<std::string> &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);
@@ -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);
}
@@ -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<AbilityManagerService>::GetInstance()->StartAbilityInner(startAbilityWrapParam);
@@ -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<ffrt::mutex> 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<SessionInfo> &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<SessionInfo> &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<SessionInfo> &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(sptr<Sess
newSessionInfo->persistentId = 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_ptr<SpecifiedReq
auto &abilityRequest = request->abilityRequest;
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<ffrt::mutex> 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) {
@@ -152,7 +152,7 @@ bool SkillExecuteParam::GenerateFromWant(const AAFwk::Want &want, SkillExecutePa
bool SkillExecuteParam::RemoveSkillParam(AAFwk::Want &want)
{
auto params = want.GetParams();
const auto &params = want.GetParams();
auto argsKeysStr = params.GetStringParam(SKILL_EXECUTE_PARAM_ARGS_KEYS);
auto srcCountStr = params.GetStringParam(SKILL_EXECUTE_PARAM_SRC_ENTRIES_COUNT);
@@ -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
@@ -51,7 +51,7 @@ StartAbilitySandboxSavefile &StartAbilitySandboxSavefile::GetInstance()
bool StartAbilitySandboxSavefile::MatchStartRequest(StartAbilityParams &params)
{
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;
}
@@ -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<DialogAppIn
DialogPosition position;
GetDialogPositionAndSize(DialogType::DIALOG_SELECTOR, position, static_cast<int>(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);
@@ -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) {
@@ -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<IRemoteObject
}
auto callerRecord = Token::GetAbilityRecordByToken(callerToken);
std::vector<std::string> 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, sptr<IRemoteObject
auto instanceKey = want.GetStringParam(Want::APP_INSTANCE_KEY);
auto isCreating = want.GetBoolParam(Want::CREATE_APP_INSTANCE_KEY, false);
// in-app launch
if ((callerRecord != nullptr && callerRecord->GetAbilityInfo().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;
}
@@ -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;
}
@@ -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 "";
@@ -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;
}
@@ -56,7 +56,7 @@ thread_local bool StartAbilityUtils::isSandBoxClone = false;
bool StartAbilityUtils::GetAppIndex(const Want &want, sptr<IRemoteObject> 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<int32_t> StartAbilityUtils::GetCloneAppIndexes(const std::string &bu
int32_t StartAbilityUtils::CheckAppProvisionMode(const Want& want, int32_t userId, sptr<IRemoteObject> 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<StartAbilityInfo> 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, sptr<I
{
auto callerRecord = Token::GetAbilityRecordByToken(callerToken);
CHECK_POINTER(callerRecord);
if (callerRecord->GetAbilityInfo().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<IRemot
}
int32_t appIndex = 0;
if (MultiAppUtils::GetPreferredAppCloneIndex(want.GetBundle(), userId, appIndex)) {
if (MultiAppUtils::GetPreferredAppCloneIndex(want.GetBundleNameRef(), userId, appIndex)) {
TAG_LOGI(AAFwkTag::ABILITYMGR, "resolve app clone preference, bundle:%{public}s appIndex:%{public}d",
want.GetBundle().c_str(), appIndex);
want.GetBundleNameRef().c_str(), appIndex);
(const_cast<Want &>(want)).SetParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, appIndex);
}
}
@@ -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)
@@ -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();
+1 -1
View File
@@ -231,7 +231,7 @@ std::vector<Uri> UriUtils::GetPermissionedUriList(const std::vector<std::string>
bool UriUtils::GetUriListFromWant(Want &want, std::vector<std::string> &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.");
@@ -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);
}
}
@@ -45,7 +45,7 @@ public:
/**
* Excute the DoProcess of the interceptors.
*/
ErrCode DoProcess(AbilityInterceptorParam param);
ErrCode DoProcess(const AbilityInterceptorParam &param);
void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler);
private:
@@ -18,7 +18,7 @@
namespace OHOS {
namespace AAFwk {
ErrCode MockAbilityInterceptorExecuter::DoProcess(AbilityInterceptorParam param)
ErrCode MockAbilityInterceptorExecuter::DoProcess(const AbilityInterceptorParam &param)
{
return ERR_OK;
}
@@ -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);
@@ -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)
{
}
@@ -35,7 +35,7 @@ class EcologicalRuleInterceptor : public IAbilityInterceptor {
public:
EcologicalRuleInterceptor() = default;
~EcologicalRuleInterceptor() = default;
ErrCode DoProcess(AbilityInterceptorParam param) override;
ErrCode DoProcess(const AbilityInterceptorParam &param) override;
bool DoProcess(Want &want, int32_t userId);
virtual void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler) override
{
@@ -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);
@@ -19,7 +19,7 @@
namespace OHOS {
namespace AAFwk {
ErrCode EcologicalRuleInterceptor::DoProcess(AbilityInterceptorParam param)
ErrCode EcologicalRuleInterceptor::DoProcess(const AbilityInterceptorParam &param)
{
return ERR_OK;
}
@@ -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)
{
}