From 08b372f71ad24ce29b86ace726bd12d2326ae87e Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Wed, 27 Jan 2016 01:01:06 -0800 Subject: [PATCH] Fix flicker when dismissing non-docked stack Because the right/bottom side of divider moves offscreen when dismissing non docked stack, it results in empty bounds which then results in window manager thinking the just dismissed activity is fullscreen, which leads to a black flicker. Make sure not to calculate garbage when calculating the bounds for the non-docked stack. Bug: 26070457 Change-Id: I65ce9a23dc216971a3ae4df8058d5b86b1b792a5 --- .../internal/policy/DockedDividerUtils.java | 20 +++++++++++-------- .../java/com/android/server/wm/TaskStack.java | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/java/com/android/internal/policy/DockedDividerUtils.java b/core/java/com/android/internal/policy/DockedDividerUtils.java index f7f5f15cc6065..00c65bd13e509 100644 --- a/core/java/com/android/internal/policy/DockedDividerUtils.java +++ b/core/java/com/android/internal/policy/DockedDividerUtils.java @@ -48,17 +48,21 @@ public class DockedDividerUtils { outRect.top = position + dividerSize; break; } - if (outRect.left >= outRect.right) { - outRect.left = outRect.right - 1; + sanitizeStackBounds(outRect); + } + + public static void sanitizeStackBounds(Rect bounds) { + if (bounds.left >= bounds.right) { + bounds.left = bounds.right - 1; } - if (outRect.top >= outRect.bottom) { - outRect.top = outRect.bottom - 1; + if (bounds.top >= bounds.bottom) { + bounds.top = bounds.bottom - 1; } - if (outRect.right <= outRect.left) { - outRect.right = outRect.left + 1; + if (bounds.right <= bounds.left) { + bounds.right = bounds.left + 1; } - if (outRect.bottom <= outRect.top) { - outRect.bottom = outRect.top + 1; + if (bounds.bottom <= bounds.top) { + bounds.bottom = bounds.top + 1; } } diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index 2833b35c5c9c2..f02e49e21977e 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -587,6 +587,7 @@ public class TaskStack implements DimLayer.DimLayerUser { outBounds.top = dockedBounds.bottom + dockDividerWidth; } } + DockedDividerUtils.sanitizeStackBounds(outBounds); } /** Resizes all non-docked stacks in the system to either fullscreen or the appropriate size