From 5c22e453642fb3a8ddae1a69004ea23607e061bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=A0=91=E5=B1=B1?= Date: Sat, 13 Sep 2025 17:49:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=9C=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=A2=91=E7=B9=81=E8=A7=A6=E5=8F=91IPC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈树山 --- window_scene/session/host/src/scene_session.cpp | 10 ++++++++-- window_scene/test/unittest/scene_session_test3.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 0e2db2ae87..148501cbaf 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -1219,14 +1219,20 @@ void SceneSession::NotifyUpdateAppUseControl(ControlAppType type, const ControlI session->appUseControlMap_[type] = controlInfo; if (session->onUpdateAppUseControlFunc_) { bool isAppUseControl = (controlInfo.isNeedControl && !controlInfo.isControlRecentOnly); + bool isAppUseControlChanged = (session->isAppUseControl_ != isAppUseControl); session->isAppUseControl_ = isAppUseControl; session->onUpdateAppUseControlFunc_(type, controlInfo.isNeedControl, controlInfo.isControlRecentOnly); if (session->sessionStage_ == nullptr || type == ControlAppType::PRIVACY_WINDOW) { TLOGNW(WmsLogTag::WMS_LIFE, "%{public}s sessionStage is nullptr or privacy mode control", where); return; } - TLOGNI(WmsLogTag::WMS_LIFE, "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d", where, - isAppUseControl, session->GetPersistentId()); + TLOGNI(WmsLogTag::WMS_LIFE, + "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d, state: %{public}d", + "isAppUseControlChanged: %{public}d", where, isAppUseControl, session->GetPersistentId(), state, + isAppUseControlChanged); + if (state == SessionState::STATE_BACKGROUND && !isAppUseControlChanged) { + return; + } session->sessionStage_->NotifyAppUseControlStatus(isAppUseControl); } }, __func__); diff --git a/window_scene/test/unittest/scene_session_test3.cpp b/window_scene/test/unittest/scene_session_test3.cpp index 0c05c9b33d..188c74a6a6 100644 --- a/window_scene/test/unittest/scene_session_test3.cpp +++ b/window_scene/test/unittest/scene_session_test3.cpp @@ -1216,7 +1216,14 @@ HWTEST_F(SceneSessionTest3, NotifyUpdateAppUseControl, Function | SmallTest | Le .isControlRecentOnly = false }; sceneSession->NotifyUpdateAppUseControl(type, controlInfoSec); - EXPECT_TRUE(logMsg.find("begin call pause") == std::string::npos); + sceneSession->Session::SetSessionState(SessionState::STATE_BACKGROUND); + sceneSession->NotifyUpdateAppUseControl(type, controlInfoSec); + ControlInfo controlInfoThd = { + .isNeedControl = true, + .isControlRecentOnly = false + }; + sceneSession->NotifyUpdateAppUseControl(type, controlInfoThd); + EXPECT_TRUE(logMsg.find("isAppUseControl:") != std::string::npos); LOG_SetCallback(nullptr); } -- Gitee From 423c051cdbd3ee67c76f1233bd3cfc0f32e6fbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=A0=91=E5=B1=B1?= Date: Sat, 13 Sep 2025 17:53:11 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=9C=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=A2=91=E7=B9=81=E8=A7=A6=E5=8F=91IPC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈树山 --- window_scene/session/host/src/scene_session.cpp | 1 + window_scene/test/unittest/scene_session_test3.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 148501cbaf..fc99baee37 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -1226,6 +1226,7 @@ void SceneSession::NotifyUpdateAppUseControl(ControlAppType type, const ControlI TLOGNW(WmsLogTag::WMS_LIFE, "%{public}s sessionStage is nullptr or privacy mode control", where); return; } + auto state = session->GetSessionState(); TLOGNI(WmsLogTag::WMS_LIFE, "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d, state: %{public}d", "isAppUseControlChanged: %{public}d", where, isAppUseControl, session->GetPersistentId(), state, diff --git a/window_scene/test/unittest/scene_session_test3.cpp b/window_scene/test/unittest/scene_session_test3.cpp index 188c74a6a6..d15d6818eb 100644 --- a/window_scene/test/unittest/scene_session_test3.cpp +++ b/window_scene/test/unittest/scene_session_test3.cpp @@ -1216,6 +1216,7 @@ HWTEST_F(SceneSessionTest3, NotifyUpdateAppUseControl, Function | SmallTest | Le .isControlRecentOnly = false }; sceneSession->NotifyUpdateAppUseControl(type, controlInfoSec); + sceneSession->Session::SetSessionState(SessionState::STATE_BACKGROUND); sceneSession->NotifyUpdateAppUseControl(type, controlInfoSec); ControlInfo controlInfoThd = { -- Gitee From 16ba1a16b4e2d4bdd52b8053dda5efb016f70577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=A0=91=E5=B1=B1?= Date: Sat, 13 Sep 2025 18:29:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=9C=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=A2=91=E7=B9=81=E8=A7=A6=E5=8F=91IPC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈树山 --- window_scene/session/host/src/scene_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index fc99baee37..c896b150df 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -1228,7 +1228,7 @@ void SceneSession::NotifyUpdateAppUseControl(ControlAppType type, const ControlI } auto state = session->GetSessionState(); TLOGNI(WmsLogTag::WMS_LIFE, - "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d, state: %{public}d", + "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d, state: %{public}d" "isAppUseControlChanged: %{public}d", where, isAppUseControl, session->GetPersistentId(), state, isAppUseControlChanged); if (state == SessionState::STATE_BACKGROUND && !isAppUseControlChanged) { -- Gitee From 8b6fd7e527bd9bfc17309717e46b5de2e9bb87e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=A0=91=E5=B1=B1?= Date: Sat, 13 Sep 2025 18:30:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=9C=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=A2=91=E7=B9=81=E8=A7=A6=E5=8F=91IPC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈树山 --- window_scene/session/host/src/scene_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index c896b150df..c17ce02301 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -1228,7 +1228,7 @@ void SceneSession::NotifyUpdateAppUseControl(ControlAppType type, const ControlI } auto state = session->GetSessionState(); TLOGNI(WmsLogTag::WMS_LIFE, - "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d, state: %{public}d" + "%{public}s isAppUseControl: %{public}d, persistentId: %{public}d, state: %{public}d, " "isAppUseControlChanged: %{public}d", where, isAppUseControl, session->GetPersistentId(), state, isAppUseControlChanged); if (state == SessionState::STATE_BACKGROUND && !isAppUseControlChanged) { -- Gitee