From f0b4f9617a611df85d05fe3c2acaa757ae7b86d8 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 25 May 2017 11:53:11 -0700 Subject: [PATCH] AOD: Fix AOD background bug There are certain conditions where the onDraw is still called even though willNotDraw is set to true. Make sure we do not draw the background then in ambient mode. Change-Id: I63db1232434d9e8a80dc4c8a6dcacf726d8873ad Fixes: 62090100 Test: receive notification / trigger ambient display, verify notification background is not showing --- .../stack/NotificationStackScrollLayout.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 61fed2dfdcfbb..486035ec86655 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -120,7 +120,7 @@ public class NotificationStackScrollLayout extends ViewGroup private boolean mSwipingInProgress; private int mCurrentStackHeight = Integer.MAX_VALUE; private final Paint mBackgroundPaint = new Paint(); - private boolean mShouldDrawNotificationBackground; + private final boolean mShouldDrawNotificationBackground; private float mExpandedHeight; private int mOwnScrollY; @@ -451,7 +451,8 @@ public class NotificationStackScrollLayout extends ViewGroup } protected void onDraw(Canvas canvas) { - if (mShouldDrawNotificationBackground && mCurrentBounds.top < mCurrentBounds.bottom) { + if (mShouldDrawNotificationBackground && !mAmbientState.isDark() + && mCurrentBounds.top < mCurrentBounds.bottom) { canvas.drawRect(0, mCurrentBounds.top, getWidth(), mCurrentBounds.bottom, mBackgroundPaint); } @@ -3688,11 +3689,8 @@ public class NotificationStackScrollLayout extends ViewGroup * {@link #mAmbientState}'s dark mode is toggled. */ private void updateWillNotDraw() { - if (mAmbientState.isDark()) { - setWillNotDraw(!DEBUG); - } else { - setWillNotDraw(!mShouldDrawNotificationBackground && !DEBUG); - } + boolean willDraw = !mAmbientState.isDark() && mShouldDrawNotificationBackground || DEBUG; + setWillNotDraw(!willDraw); } private void setBackgroundFadeAmount(float fadeAmount) {