From b88ba47ce3c8cbeca131307686316f91b5eb74e2 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Wed, 23 Nov 2022 17:19:54 +0800 Subject: [PATCH] Fix gmail flicker issue in split screen This issue is caused by surface invisible before transition. And this symptom caused by we got wrong resume callback by another side split activity. Fix this by change prioirty in TaskFragment#resumeTopActivity. We should check non activities are pausing before checking top activity resumed. Fix: 257008620 Test: manual Test: pass existing tests Change-Id: I6ef987bf694678b8422f3e7526944ee9004c61e1 --- .../com/android/server/wm/TaskFragment.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 7cac01faf1a0c..08b5d7ca82b56 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -1165,8 +1165,16 @@ class TaskFragment extends WindowContainer { } next.delayedResume = false; - final TaskDisplayArea taskDisplayArea = getDisplayArea(); + // If we are currently pausing an activity, then don't do anything until that is done. + final boolean allPausedComplete = mRootWindowContainer.allPausedActivitiesComplete(); + if (!allPausedComplete) { + ProtoLog.v(WM_DEBUG_STATES, + "resumeTopActivity: Skip resume: some activity pausing."); + return false; + } + + final TaskDisplayArea taskDisplayArea = getDisplayArea(); // If the top activity is the resumed one, nothing to do. if (mResumedActivity == next && next.isState(RESUMED) && taskDisplayArea.allResumedActivitiesComplete()) { @@ -1189,14 +1197,6 @@ class TaskFragment extends WindowContainer { return false; } - // If we are currently pausing an activity, then don't do anything until that is done. - final boolean allPausedComplete = mRootWindowContainer.allPausedActivitiesComplete(); - if (!allPausedComplete) { - ProtoLog.v(WM_DEBUG_STATES, - "resumeTopActivity: Skip resume: some activity pausing."); - return false; - } - // If we are sleeping, and there is no resumed activity, and the top activity is paused, // well that is the state we want. if (mLastPausedActivity == next && shouldSleepOrShutDownActivities()) {