From 894d3b161932e6cd8f5534623deaf45abf004743 Mon Sep 17 00:00:00 2001 From: imp9527 Date: Fri, 5 Sep 2025 10:22:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E6=81=A2=E5=A4=8D=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=BA=94=E7=94=A8=E5=88=86=E8=BA=AB=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: imp9527 --- .../common/include/window_session_property.h | 11 +++++++++++ .../common/src/window_session_property.cpp | 16 +++++++++++++++- window_scene/session/host/src/session.cpp | 1 + .../session/host/src/zidl/session_proxy.cpp | 1 + .../session/host/src/zidl/session_stub.cpp | 1 + .../src/scene_session_manager.cpp | 7 ++++--- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/window_scene/common/include/window_session_property.h b/window_scene/common/include/window_session_property.h index 89adc5b4dc..6c19c37f27 100755 --- a/window_scene/common/include/window_session_property.h +++ b/window_scene/common/include/window_session_property.h @@ -298,6 +298,12 @@ public: void SetAppInstanceKey(const std::string& appInstanceKey); std::string GetAppInstanceKey() const; + /* + * App Clone + */ + void SetAppIndex(int32_t appIndex); + int32_t GetAppIndex() const; + /* * PC Window */ @@ -538,6 +544,11 @@ private: */ std::string appInstanceKey_; + /* + * App Clone + */ + int32_t appIndex_ = 0; + /* * PC Window */ diff --git a/window_scene/common/src/window_session_property.cpp b/window_scene/common/src/window_session_property.cpp index 25141bd691..f55d5127ba 100755 --- a/window_scene/common/src/window_session_property.cpp +++ b/window_scene/common/src/window_session_property.cpp @@ -1351,7 +1351,9 @@ bool WindowSessionProperty::Marshalling(Parcel& parcel) const parcel.WriteParcelable(&keyboardLayoutParams_) && parcel.WriteBool(isAppSupportPhoneInPc_) && parcel.WriteBool(isPcAppInLargeScreenDevice_) && - parcel.WriteString(appInstanceKey_) && parcel.WriteBool(isSystemKeyboard_) && + parcel.WriteString(appInstanceKey_) && + parcel.WriteInt32(appIndex_) && + parcel.WriteBool(isSystemKeyboard_) && parcel.WriteUint32(avoidAreaOption_) && parcel.WriteBool(isWindowDelayRaiseEnabled_) && parcel.WriteUint8(backgroundAlpha_) && parcel.WriteParcelable(&keyboardEffectOption_) && parcel.WriteFloat(cornerRadius_) && parcel.WriteBool(isExclusivelyHighlighted_) && @@ -1453,6 +1455,7 @@ WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel) property->SetIsAppSupportPhoneInPc(parcel.ReadBool()); property->SetIsPcAppInPad(parcel.ReadBool()); property->SetAppInstanceKey(parcel.ReadString()); + property->SetAppIndex(parcel.ReadInt32()); property->SetIsSystemKeyboard(parcel.ReadBool()); property->SetAvoidAreaOption(parcel.ReadUint32()); property->SetWindowDelayRaiseEnabled(parcel.ReadBool()); @@ -1569,6 +1572,7 @@ void WindowSessionProperty::CopyFrom(const sptr& property isUIExtAnySubWindow_ = property->isUIExtAnySubWindow_; parentWindowType_ = property->parentWindowType_; appInstanceKey_ = property->appInstanceKey_; + appIndex_ = property->appIndex_; isSystemKeyboard_ = property->isSystemKeyboard_; avoidAreaOption_ = property->avoidAreaOption_; isWindowDelayRaiseEnabled_ = property->isWindowDelayRaiseEnabled_; @@ -2130,6 +2134,16 @@ std::string WindowSessionProperty::GetAppInstanceKey() const return appInstanceKey_; } +void WindowSessionProperty::SetAppIndex(int32_t appIndex) +{ + appIndex_ = appIndex; +} + +int32_t WindowSessionProperty::GetAppIndex() const +{ + return appIndex_; +} + void WindowSessionProperty::SetIsSystemKeyboard(bool isSystemKeyboard) { isSystemKeyboard_ = isSystemKeyboard; diff --git a/window_scene/session/host/src/session.cpp b/window_scene/session/host/src/session.cpp index 4807652d08..d667c468ae 100644 --- a/window_scene/session/host/src/session.cpp +++ b/window_scene/session/host/src/session.cpp @@ -1320,6 +1320,7 @@ void Session::InitSessionPropertyWhenConnect(const sptr& static_cast(winRect.height_)}; property->SetWindowRect(rect); property->SetPersistentId(GetPersistentId()); + property->SetAppIndex(GetSessionInfo().appIndex_); property->SetFullScreenStart(GetSessionInfo().fullScreenStart_); property->SetSupportedWindowModes(GetSessionInfo().supportedWindowModes); property->SetWindowSizeLimits(GetSessionInfo().windowSizeLimits); diff --git a/window_scene/session/host/src/zidl/session_proxy.cpp b/window_scene/session/host/src/zidl/session_proxy.cpp index 15b4334421..f906d9d4ff 100644 --- a/window_scene/session/host/src/zidl/session_proxy.cpp +++ b/window_scene/session/host/src/zidl/session_proxy.cpp @@ -328,6 +328,7 @@ WSError SessionProxy::Connect(const sptr& sessionStage, const spt property->SetRequestedOrientation(static_cast(reply.ReadUint32())); property->SetUserRequestedOrientation(static_cast(reply.ReadUint32())); property->SetAppInstanceKey(reply.ReadString()); + property->SetAppIndex(reply.ReadInt32()); property->SetDragEnabled(reply.ReadBool()); property->SetIsAtomicService(reply.ReadBool()); property->SetIsAbilityHook(reply.ReadBool()); diff --git a/window_scene/session/host/src/zidl/session_stub.cpp b/window_scene/session/host/src/zidl/session_stub.cpp index 226277bfdf..0a32f677f6 100644 --- a/window_scene/session/host/src/zidl/session_stub.cpp +++ b/window_scene/session/host/src/zidl/session_stub.cpp @@ -494,6 +494,7 @@ int SessionStub::HandleConnect(MessageParcel& data, MessageParcel& reply) reply.WriteUint32(static_cast(property->GetRequestedOrientation())); reply.WriteUint32(static_cast(property->GetUserRequestedOrientation())); reply.WriteString(property->GetAppInstanceKey()); + reply.WriteInt32(property->GetAppIndex()); reply.WriteBool(property->GetDragEnabled()); reply.WriteBool(property->GetIsAtomicService()); reply.WriteBool(property->GetIsAbilityHook()); diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index 8d9d3c9230..a604c4faa7 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -4166,6 +4166,7 @@ void SceneSessionManager::RecoverSessionInfo(const sptr& : SessionState::STATE_BACKGROUND; sessionInfo.isPersistentRecover_ = true; sessionInfo.appInstanceKey_ = property->GetAppInstanceKey(); + sessionInfo.appIndex_ = property->GetAppIndex(); sessionInfo.screenId_ = property->GetDisplayId(); sessionInfo.isAbilityHook_ = property->GetIsAbilityHook(); sessionInfo.supportedWindowModes = @@ -4173,11 +4174,11 @@ void SceneSessionManager::RecoverSessionInfo(const sptr& TLOGI(WmsLogTag::WMS_RECOVER, "Recover and reconnect session with: bundleName=%{public}s, moduleName=%{public}s, " "abilityName=%{public}s, windowMode=%{public}d, windowType=%{public}u, persistentId=%{public}d, " - "windowState=%{public}u, appInstanceKey=%{public}s, isFollowParentMultiScreenPolicy=%{public}d, " - "screenId=%{public}" PRIu64 ", isAbilityHook=%{public}d", + "windowState=%{public}u, appInstanceKey=%{public}s, appIndex=%{public}d, " + "isFollowParentMultiScreenPolicy=%{public}d, screenId=%{public}" PRIu64 ", isAbilityHook=%{public}d", sessionInfo.bundleName_.c_str(), sessionInfo.moduleName_.c_str(), sessionInfo.abilityName_.c_str(), sessionInfo.windowMode, sessionInfo.windowType_, sessionInfo.persistentId_, sessionInfo.sessionState_, - sessionInfo.appInstanceKey_.c_str(), sessionInfo.isFollowParentMultiScreenPolicy, + sessionInfo.appInstanceKey_.c_str(), sessionInfo.appIndex_, sessionInfo.isFollowParentMultiScreenPolicy, sessionInfo.screenId_, sessionInfo.isAbilityHook_); } -- Gitee