From 4786149fe7cc68a449e9b61c5b0c0a60680197cc Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 6 Sep 2021 17:20:44 +0800 Subject: [PATCH] Dispatch organized task info change after committing visibility The activity may belong to a non-organized leaf task. But its root task can be organized. In this case the change of root task should still be sent. Bug: 197787343 Test: CtsActivityManagerDeviceTestCases Change-Id: Id05b1b8eb6720c1c301fb4123cd517e762687dc9 --- .../core/java/com/android/server/wm/ActivityRecord.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 73faca70de6b0..8f777e6306c6d 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4897,7 +4897,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // dispatchTaskInfoChangedIfNeeded() right after ActivityRecord#setVisibility() can report // the stale visible state, because the state will be updated after the app transition. // So tries to report the actual visible state again where the state is changed. - if (task != null) task.dispatchTaskInfoChangedIfNeeded(false /* force */); + if (!mTaskSupervisor.inActivityVisibilityUpdate()) { + final Task task = getOrganizedTask(); + if (task != null) { + task.dispatchTaskInfoChangedIfNeeded(false /* force */); + } + } ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "commitVisibility: %s: visible=%b mVisibleRequested=%b", this, isVisible(), mVisibleRequested);