!10865 新增specifiedId参数

Merge pull request !10865 from liusensen/xuwenze02
This commit is contained in:
openharmony_ci 2024-11-18 13:41:46 +00:00 committed by Gitee
commit 17167a29cf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 27 additions and 11 deletions

View File

@ -349,6 +349,7 @@ struct SessionInfo {
bool isPcOrPadEnableActivation_ = false;
bool canStartAbilityFromBackground_ = false;
bool isFoundationCall_ = false;
int32_t specifiedId = 0;
/**
* UIExtension

View File

@ -3343,8 +3343,9 @@ sptr<SceneSession> JsSceneSession::GenSceneSession(SessionInfo& info)
void JsSceneSession::PendingSessionActivation(SessionInfo& info)
{
TLOGI(WmsLogTag::WMS_LIFE, "[NAPI]bundleName %{public}s, moduleName %{public}s, abilityName %{public}s, "
"appIndex %{public}d, reuse %{public}d", info.bundleName_.c_str(), info.moduleName_.c_str(),
info.abilityName_.c_str(), info.appIndex_, info.reuse);
"appIndex %{public}d, reuse %{public}d, specifiedId %{public}d",
info.bundleName_.c_str(), info.moduleName_.c_str(),
info.abilityName_.c_str(), info.appIndex_, info.reuse, info.specifiedId);
auto sceneSession = GenSceneSession(info);
if (sceneSession == nullptr) {
TLOGE(WmsLogTag::WMS_LIFE, "GenSceneSession failed");
@ -3384,8 +3385,9 @@ void JsSceneSession::PendingSessionActivation(SessionInfo& info)
void JsSceneSession::PendingSessionActivationInner(std::shared_ptr<SessionInfo> sessionInfo)
{
const char* const where = __func__;
auto task = [weakThis = wptr(this), persistentId = persistentId_, weakSession = weakSession_,
sessionInfo, env = env_] {
sessionInfo, env = env_, where] {
auto session = weakSession.promote();
if (session == nullptr) {
TLOGNE(WmsLogTag::WMS_LIFE, "[NAPI]session is nullptr");
@ -3416,8 +3418,9 @@ void JsSceneSession::PendingSessionActivationInner(std::shared_ptr<SessionInfo>
return;
}
napi_value argv[] = {jsSessionInfo};
TLOGNI(WmsLogTag::WMS_LIFE, "[NAPI]PendingSessionActivationInner task success, id:%{public}d",
sessionInfo->persistentId_);
TLOGNI(WmsLogTag::WMS_LIFE, "[NAPI]%{public}s task success, "
"id:%{public}d, specifiedId:%{public}d",
where, sessionInfo->persistentId_, sessionInfo->specifiedId);
napi_call_function(env, NapiGetUndefined(env),
jsCallBack->GetNapiValue(), ArraySize(argv), argv, nullptr);
};

View File

@ -3707,6 +3707,7 @@ WSError SceneSession::ChangeSessionVisibilityWithStatusBar(
info.callerAbilityName_ = abilitySessionInfo->want.GetStringParam(AAFwk::Want::PARAM_RESV_CALLER_ABILITY_NAME);
info.callState_ = static_cast<uint32_t>(abilitySessionInfo->state);
info.uiAbilityId_ = abilitySessionInfo->uiAbilityId;
info.specifiedId = abilitySessionInfo->tmpSpecifiedId;
info.want = std::make_shared<AAFwk::Want>(abilitySessionInfo->want);
info.requestCode = abilitySessionInfo->requestCode;
info.callerToken_ = abilitySessionInfo->callerToken;
@ -3740,6 +3741,7 @@ static SessionInfo MakeSessionInfoDuringPendingActivation(const sptr<AAFwk::Sess
info.callerAbilityName_ = abilitySessionInfo->want.GetStringParam(AAFwk::Want::PARAM_RESV_CALLER_ABILITY_NAME);
info.callState_ = static_cast<uint32_t>(abilitySessionInfo->state);
info.uiAbilityId_ = abilitySessionInfo->uiAbilityId;
info.specifiedId = abilitySessionInfo->tmpSpecifiedId;
info.want = std::make_shared<AAFwk::Want>(abilitySessionInfo->want);
info.requestCode = abilitySessionInfo->requestCode;
info.callerToken_ = abilitySessionInfo->callerToken;
@ -3774,11 +3776,11 @@ static SessionInfo MakeSessionInfoDuringPendingActivation(const sptr<AAFwk::Sess
"appIndex:%{public}d, affinity:%{public}s. callState:%{public}d, want persistentId:%{public}d, "
"uiAbilityId:%{public}" PRIu64 ", windowMode:%{public}d, callerId:%{public}d, "
"needClearInNotShowRecent:%{public}u, appInstanceKey: %{public}s, isFromIcon:%{public}d, "
"supportWindowModes.size:%{public}zu, windowModeSupportType:%{public}u",
"supportWindowModes.size:%{public}zu, windowModeSupportType:%{public}u, specifiedId:%{public}d",
info.bundleName_.c_str(), info.moduleName_.c_str(), info.abilityName_.c_str(), info.appIndex_,
info.sessionAffinity.c_str(), info.callState_, info.persistentId_, info.uiAbilityId_, info.windowMode,
info.callerPersistentId_, info.needClearInNotShowRecent_, info.appInstanceKey_.c_str(), info.isFromIcon_,
info.supportWindowModes.size(), info.windowModeSupportType);
info.supportWindowModes.size(), info.windowModeSupportType, info.specifiedId);
return info;
}

View File

@ -284,6 +284,7 @@ void Session::SetSessionInfo(const SessionInfo& info)
sessionInfo_.callerPersistentId_ = info.callerPersistentId_;
sessionInfo_.callingTokenId_ = info.callingTokenId_;
sessionInfo_.uiAbilityId_ = info.uiAbilityId_;
sessionInfo_.specifiedId = info.specifiedId;
sessionInfo_.startSetting = info.startSetting;
sessionInfo_.continueSessionId_ = info.continueSessionId_;
sessionInfo_.isAtomicService_ = info.isAtomicService_;

View File

@ -45,6 +45,7 @@ bool WriteAbilitySessionInfoBasic(MessageParcel& data, sptr<AAFwk::SessionInfo>
!data.WriteInt32(static_cast<uint32_t>(abilitySessionInfo->state)) ||
!data.WriteInt64(abilitySessionInfo->uiAbilityId) ||
!data.WriteInt32(abilitySessionInfo->callingTokenId) ||
!data.WriteInt32(abilitySessionInfo->tmpSpecifiedId) ||
!data.WriteBool(abilitySessionInfo->reuse) ||
!data.WriteParcelable(abilitySessionInfo->processOptions.get())) {
return false;

View File

@ -66,6 +66,10 @@ int ReadBasicAbilitySessionInfo(MessageParcel& data, sptr<AAFwk::SessionInfo> ab
TLOGE(WmsLogTag::WMS_LIFE, "Read callingTokenId failed.");
return ERR_INVALID_DATA;
}
if (!data.ReadInt32(abilitySessionInfo->tmpSpecifiedId)) {
TLOGE(WmsLogTag::WMS_LIFE, "Read tmpSpecifiedId failed.");
return ERR_INVALID_DATA;
}
if (!data.ReadBool(abilitySessionInfo->reuse)) {
TLOGE(WmsLogTag::WMS_LIFE, "Read reuse failed.");
return ERR_INVALID_DATA;

View File

@ -1827,6 +1827,7 @@ sptr<AAFwk::SessionInfo> SceneSessionManager::SetAbilitySessionInfo(const sptr<S
abilitySessionInfo->userId = currentUserId_;
abilitySessionInfo->isClearSession = sessionInfo.isClearSession;
abilitySessionInfo->processOptions = sessionInfo.processOptions;
abilitySessionInfo->tmpSpecifiedId = sessionInfo.specifiedId;
if (sessionInfo.want != nullptr) {
abilitySessionInfo->want = *sessionInfo.want;
} else {
@ -1902,8 +1903,10 @@ WSError SceneSessionManager::RequestSceneSessionActivation(const sptr<SceneSessi
sceneSession->SetForegroundInteractiveStatus(true);
}
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionActivation(%d )", persistentId);
TLOGNI(WmsLogTag::WMS_MAIN, "Request active id:%{public}d system:%{public}u isNewActive:%{public}d",
persistentId, static_cast<uint32_t>(sceneSession->GetSessionInfo().isSystem_), isNewActive);
TLOGNI(WmsLogTag::WMS_MAIN,
"Request active id:%{public}d, system:%{public}d, isNewActive:%{public}d, specifiedId:%{public}d",
persistentId, sceneSession->GetSessionInfo().isSystem_,
isNewActive, sceneSession->GetSessionInfo().specifiedId);
if (!GetSceneSession(persistentId)) {
TLOGE(WmsLogTag::WMS_MAIN, "Request active session invalid by %{public}d", persistentId);
return WSError::WS_ERROR_INVALID_SESSION;
@ -2019,12 +2022,13 @@ WSError SceneSessionManager::RequestSceneSessionActivationInner(
sceneSessionInfo->collaboratorType = sceneSession->GetCollaboratorType();
}
TLOGI(WmsLogTag::WMS_LIFE, "id %{public}d want-ability: %{public}s, bundle: %{public}s, "
"module: %{public}s, uri: %{public}s, appIndex: %{public}d.", persistentId,
"module: %{public}s, uri: %{public}s, appIndex: %{public}d, tmpSpecifiedId:%{public}d", persistentId,
sceneSessionInfo->want.GetElement().GetAbilityName().c_str(),
sceneSessionInfo->want.GetElement().GetBundleName().c_str(),
sceneSessionInfo->want.GetElement().GetModuleName().c_str(),
sceneSessionInfo->want.GetElement().GetURI().c_str(),
sceneSessionInfo->want.GetIntParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, 0));
sceneSessionInfo->want.GetIntParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, 0),
sceneSessionInfo->tmpSpecifiedId);
int32_t errCode = ERR_OK;
bool isColdStart = false;
bool isAppSupportPhoneInPc = false;