From a58b55052f6e8d17a11d394ce2d16ac433ace95f Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 30 Jun 2021 14:53:58 +0800 Subject: [PATCH] Skip task snapshot if display has not been enabled Otherwise if keyguard changes to be showing when booting and keyguard secured state has not been updated yet, it will cause allowSnapshotHome to be true. And then take snapshot for FallbackHome, that is useless and wasteful. Bug: 192400758 Test: "adb shell dumpsys window w | grep -A5 SnapshotCache" should show zero entry after device is booted. Change-Id: Ia4afe69a70065fc3972fb9cb3dccc1e4b3b35a79 --- .../core/java/com/android/server/wm/TaskSnapshotController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java index 0000f95e7849d..e743710366192 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotController.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java @@ -644,7 +644,7 @@ class TaskSnapshotController { /** Called when the device is going to sleep (e.g. screen off, AOD without screen off). */ void snapshotForSleeping(int displayId) { - if (shouldDisableSnapshots()) { + if (shouldDisableSnapshots() || !mService.mDisplayEnabled) { return; } final DisplayContent displayContent = mService.mRoot.getDisplayContent(displayId);