From a3d09db2abdaf5f49d5cf5129878a740fc9cccad Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Tue, 29 Aug 2017 14:06:37 -0700 Subject: [PATCH] Fixes TaskStackLayoutAlgorithm log errors when window rect is empty On boot, it will try to load recents and setup some rects but window rect is empty initializing invalid task rects and logging an error. Do not initialize till window rect is not empty. Test: manual - boot Change-Id: I2ecdc8aa514d7d32d449e6c510de5c433116ae99 Fixes: 65157592 --- .../src/com/android/systemui/recents/RecentsImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java index 79558a33fc4e2..1ff9437362a50 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java @@ -132,6 +132,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener // Preloads the next task RecentsConfiguration config = Recents.getConfiguration(); if (config.svelteLevel == RecentsConfiguration.SVELTE_NONE) { + Rect windowRect = getWindowRect(null /* windowRectOverride */); + if (windowRect.isEmpty()) { + return; + } + // Load the next task only if we aren't svelte SystemServicesProxy ssp = Recents.getSystemServices(); ActivityManager.RunningTaskInfo runningTaskInfo = ssp.getRunningTask(); @@ -146,8 +151,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener // This callback is made when a new activity is launched and the old one is // paused so ignore the current activity and try and preload the thumbnail for // the previous one. - updateDummyStackViewLayout(mBackgroundLayoutAlgorithm, stack, - getWindowRect(null /* windowRectOverride */)); + updateDummyStackViewLayout(mBackgroundLayoutAlgorithm, stack, windowRect); // Launched from app is always the worst case (in terms of how many // thumbnails/tasks visible)