From 7a14ec2cf3026abe8785b3041846f455daccf702 Mon Sep 17 00:00:00 2001 From: w00887908 Date: Sat, 2 Aug 2025 16:11:48 +0800 Subject: [PATCH 1/3] add freeze pid check Change-Id: I19ef33f43afb401519f92ae45a6a4c78170cd1d3 Signed-off-by: w00887908 --- .../appmgr/src/modal_system_app_freeze_uiextension.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/appmgr/src/modal_system_app_freeze_uiextension.cpp b/services/appmgr/src/modal_system_app_freeze_uiextension.cpp index 4641a1463e5..5d6cdb4e4ba 100644 --- a/services/appmgr/src/modal_system_app_freeze_uiextension.cpp +++ b/services/appmgr/src/modal_system_app_freeze_uiextension.cpp @@ -139,6 +139,7 @@ bool ModalSystemAppFreezeUIExtension::CreateSystemDialogWant( } want.SetParam(APP_FREEZE_TOKEN, token); + int32_t focusPid = -1; int32_t posX = 0; int32_t posY = 0; int32_t width = 10; @@ -158,6 +159,7 @@ bool ModalSystemAppFreezeUIExtension::CreateSystemDialogWant( width = info->rect_.width_; height = info->rect_.height_; infoReady = true; + focusPid = info->pid_; break; } } @@ -166,11 +168,14 @@ bool ModalSystemAppFreezeUIExtension::CreateSystemDialogWant( TAG_LOGE(AAFwkTag::ABILITYMGR, "No fucused window!"); return false; } + if (std::to_string(focusPid) != pid) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "fucused window pid is %{public}d, not freeze pid!", focusPid); + return false; + } want.SetParam(FREEZE_WINDOW_POSX, std::to_string(posX)); want.SetParam(FREEZE_WINDOW_POSY, std::to_string(posY)); want.SetParam(FREEZE_WINDOW_WIDTH, std::to_string(width)); want.SetParam(FREEZE_WINDOW_HEIGHT, std::to_string(height)); - return true; } -- Gitee From c59b0251c1c9f71c3868951f8dab3a05ef0c08ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=B5=A9?= Date: Sat, 2 Aug 2025 08:23:30 +0000 Subject: [PATCH 2/3] update services/appmgr/src/modal_system_app_freeze_uiextension.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴浩 --- .../src/modal_system_app_freeze_uiextension.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/appmgr/src/modal_system_app_freeze_uiextension.cpp b/services/appmgr/src/modal_system_app_freeze_uiextension.cpp index 5d6cdb4e4ba..172b61494d2 100644 --- a/services/appmgr/src/modal_system_app_freeze_uiextension.cpp +++ b/services/appmgr/src/modal_system_app_freeze_uiextension.cpp @@ -138,19 +138,19 @@ bool ModalSystemAppFreezeUIExtension::CreateSystemDialogWant( return false; } want.SetParam(APP_FREEZE_TOKEN, token); - - int32_t focusPid = -1; - int32_t posX = 0; - int32_t posY = 0; - int32_t width = 10; - int32_t height = 10; std::vector> infos; ret = static_cast(sceneSessionManager->GetVisibilityWindowInfo(infos)); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "Get visibility window info err: %{public}d", ret); return false; } + + int32_t posX = 0; + int32_t posY = 0; + int32_t width = 10; + int32_t height = 10; bool infoReady = false; + int32_t focusPid = -1; for (const auto &info : infos) { if (info != nullptr) { if (info->IsFocused()) { -- Gitee From b6380bd8e443d2f4838e38a09921c4db5a02428a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=B5=A9?= Date: Sat, 2 Aug 2025 09:11:39 +0000 Subject: [PATCH 3/3] update services/appmgr/src/modal_system_app_freeze_uiextension.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴浩 --- .../appmgr/src/modal_system_app_freeze_uiextension.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/services/appmgr/src/modal_system_app_freeze_uiextension.cpp b/services/appmgr/src/modal_system_app_freeze_uiextension.cpp index 172b61494d2..76b91a12c07 100644 --- a/services/appmgr/src/modal_system_app_freeze_uiextension.cpp +++ b/services/appmgr/src/modal_system_app_freeze_uiextension.cpp @@ -149,7 +149,6 @@ bool ModalSystemAppFreezeUIExtension::CreateSystemDialogWant( int32_t posY = 0; int32_t width = 10; int32_t height = 10; - bool infoReady = false; int32_t focusPid = -1; for (const auto &info : infos) { if (info != nullptr) { @@ -158,17 +157,12 @@ bool ModalSystemAppFreezeUIExtension::CreateSystemDialogWant( posY = info->rect_.posY_; width = info->rect_.width_; height = info->rect_.height_; - infoReady = true; focusPid = info->pid_; break; } } } - if (!infoReady) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "No fucused window!"); - return false; - } - if (std::to_string(focusPid) != pid) { + if ((focusPid == -1) || (std::to_string(focusPid) != pid)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "fucused window pid is %{public}d, not freeze pid!", focusPid); return false; } -- Gitee