From 853d17d838ca53dcafabaf62f45518bbf58622c7 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Fri, 19 May 2017 14:53:55 +0200 Subject: [PATCH] Fix underdraw during resizing Since we hide the navigation bar background during resizing, we need to fill it with the fallback background. This was always an issue but somehow in OC we are displaying garbage instead of black. Test: Open Contacts/Dialer, resize, make sure no underdraw is happening. Also test a couple of other apps. Fixes: 36206155 Change-Id: I6b02060ef4acf36c2529d49063a61034f9261696 --- core/java/com/android/internal/policy/DecorView.java | 6 +++++- .../com/android/internal/widget/BackgroundFallback.java | 14 +++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 1b83708559ed..9823431270d4 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -296,7 +296,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void onDraw(Canvas c) { super.onDraw(c); - mBackgroundFallback.draw(mContentRoot, c, mWindow.mContentParent); + + // When we are resizing, we need the fallback background to cover the area where we have our + // system bar background views as the navigation bar will be hidden during resizing. + mBackgroundFallback.draw(isResizing() ? this : mContentRoot, mContentRoot, c, + mWindow.mContentParent); } @Override diff --git a/core/java/com/android/internal/widget/BackgroundFallback.java b/core/java/com/android/internal/widget/BackgroundFallback.java index 4adba4db4f2e..309f80cb0d52 100644 --- a/core/java/com/android/internal/widget/BackgroundFallback.java +++ b/core/java/com/android/internal/widget/BackgroundFallback.java @@ -39,14 +39,22 @@ public class BackgroundFallback { return mBackgroundFallback != null; } - public void draw(ViewGroup root, Canvas c, View content) { + /** + * Draws the fallback background. + * + * @param boundsView The view determining with which bounds the background should be drawn. + * @param root The view group containing the content. + * @param c The canvas to draw the background onto. + * @param content The view where the actual app content is contained in. + */ + public void draw(ViewGroup boundsView, ViewGroup root, Canvas c, View content) { if (!hasFallback()) { return; } // Draw the fallback in the padding. - final int width = root.getWidth(); - final int height = root.getHeight(); + final int width = boundsView.getWidth(); + final int height = boundsView.getHeight(); int left = width; int top = height; int right = 0; -- 2.11.0