From d980e51c7232624ee69d937077faaa3b178649f8 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 12 Jul 2021 17:51:41 +0800 Subject: [PATCH] Sync client visibility if activity is stopped While activity resumed and stopped without transition, there may not have an animation callback to commit client visibility. Though the main window of activity can be updated according to activity lifecycle callback, if there are other windows attached to the activity, those windows may keep in visible state. Bug: 193125596 Test: 1. Enable secured lock. 2. Launch an activity with attaching another window. 3. Lock device and launch a show-when-locked activity. 4. Finish the show-when-locked activity. 5. Check all windows of the current top activity should be invisible by command "adb shell dumpsys window w". 6. There should be no delay when turning off/on display "Timeout waiting for drawn". Change-Id: Ib48b0509c328567302318689c565191cac8019b1 --- services/core/java/com/android/server/wm/ActivityRecord.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index dd545290c3774..50b5bfee8da19 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -5016,6 +5016,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // Reset the last saved PiP snap fraction on app stop. mDisplayContent.mPinnedTaskController.onActivityHidden(mActivityComponent); mDisplayContent.mUnknownAppVisibilityController.appRemovedOrHidden(this); + if (isClientVisible()) { + // Though this is usually unlikely to happen, still make sure the client is invisible. + setClientVisible(false); + } destroySurfaces(); // Remove any starting window that was added for this app if they are still around. removeStartingWindow();