Fix AOD scrim excluded area

Excluded scrim area wasn't being updated properly,
we should also update it whenever we enter or
leave "dark mode."

Fixes: 72456250
Test: Expand notification shade, lock device
Test: Receive notification in AOD
Change-Id: I85fdd77fa70c5ee55a6af3cbe997e9c5bc47b322
This commit is contained in:
Lucas Dupin
2018-01-29 15:36:35 -08:00
parent 1f73477d78
commit 8e9fa2da2e

View File

@@ -365,7 +365,7 @@ public class NotificationStackScrollLayout extends ViewGroup
private boolean mGroupExpandedForMeasure;
private boolean mScrollable;
private View mForcedScroll;
private float mDarkAmount = 1.0f;
private float mDarkAmount = 0f;
private static final Property<NotificationStackScrollLayout, Float> DARK_AMOUNT =
new FloatProperty<NotificationStackScrollLayout>("darkAmount") {
@Override
@@ -523,9 +523,9 @@ public class NotificationStackScrollLayout extends ViewGroup
setClipBounds(null);
} else {
float animProgress = Interpolators.FAST_OUT_SLOW_IN
.getInterpolation(mDarkAmount);
.getInterpolation(1f - mDarkAmount);
float sidePaddingsProgress = Interpolators.FAST_OUT_SLOW_IN
.getInterpolation(mDarkAmount * 2);
.getInterpolation((1f - mDarkAmount) * 2);
mTmpRect.set((int) MathUtils.lerp(darkLeft, lockScreenLeft, sidePaddingsProgress),
(int) MathUtils.lerp(darkTop, lockScreenTop, animProgress),
(int) MathUtils.lerp(darkRight, lockScreenRight, sidePaddingsProgress),
@@ -548,7 +548,7 @@ public class NotificationStackScrollLayout extends ViewGroup
} else {
float alpha =
BACKGROUND_ALPHA_DIMMED + (1 - BACKGROUND_ALPHA_DIMMED) * (1.0f - mDimAmount);
alpha *= mDarkAmount;
alpha *= 1f - mDarkAmount;
// We need to manually blend in the background color
int scrimColor = mScrimController.getBackgroundColor();
color = ColorUtils.blendARGB(scrimColor, mBgColor, alpha);
@@ -2304,8 +2304,9 @@ public class NotificationStackScrollLayout extends ViewGroup
return;
}
final boolean awake = mDarkAmount != 0 || mAmbientState.isDark();
mScrimController.setExcludedBackgroundArea(
mFadingOut || mParentNotFullyVisible || mDarkAmount != 1 || mIsClipped ? null
mFadingOut || mParentNotFullyVisible || awake || mIsClipped ? null
: mCurrentBounds);
invalidate();
}
@@ -3858,17 +3859,12 @@ public class NotificationStackScrollLayout extends ViewGroup
mDarkNeedsAnimation = true;
mDarkAnimationOriginIndex = findDarkAnimationOriginIndex(touchWakeUpScreenLocation);
mNeedsAnimation = true;
setDarkAmount(0.0f);
} else if (!dark) {
setDarkAmount(1.0f);
}
requestChildrenUpdate();
if (dark) {
mScrimController.setExcludedBackgroundArea(null);
} else {
setDarkAmount(dark ? 1f : 0f);
updateBackground();
}
requestChildrenUpdate();
applyCurrentBackgroundBounds();
updateWillNotDraw();
updateContentHeight();
notifyHeightChangeListener(mShelf);
@@ -3894,7 +3890,7 @@ public class NotificationStackScrollLayout extends ViewGroup
}
private void startBackgroundFadeIn() {
ObjectAnimator fadeAnimator = ObjectAnimator.ofFloat(this, DARK_AMOUNT, 0f, 1f);
ObjectAnimator fadeAnimator = ObjectAnimator.ofFloat(this, DARK_AMOUNT, mDarkAmount, 0f);
fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_WAKEUP);
fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
fadeAnimator.start();