From b26efb47f920d33c23f6e878d059acb756ab6c4c Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 29 Apr 2020 23:24:41 +0800 Subject: Avoid ignoring turning on screen requested by slow activity If an activity is slow and has set the flags turn-screen-on and show-when-locked, once it triggers pause timeout, the activity will be stopped, so the relayout invisible won't apply the flags. Then it relies on an additional transaction item to be visible again to request relayout with visible state. Since commit b9faa03, it no longer send a visibility change item (makeClientVisible) for a visible activity, but attempts to resume the activity (makeActiveIfNeeded). That falls to the condition that doesn't check if the activity can turn on screen and just skip the resume, so the activity won't have relayout visible to apply the flags. Bug: 148145248 Test: atest ActivityVisibilityTests#testTurnScreenOnActivity_slowLaunch Change-Id: I0220451e61dcc1e18fbea505e02a2c5dca6a96cb --- services/core/java/com/android/server/wm/ActivityStack.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 2ab03ce058b2..1af722dd84e9 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -1687,6 +1687,8 @@ class ActivityStack extends Task { ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); nothingToResume = shouldSleepActivities(); + } else if (next.currentLaunchCanTurnScreenOn() && next.canTurnScreenOn()) { + nothingToResume = false; } } if (nothingToResume) { -- cgit v1.2.3-59-g8ed1b