diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index d1ab96d196fc9..cc3c7db62d9ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -182,6 +182,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView private int mStartTint; private int mOverrideTint; private float mOverrideAmount; + private boolean mShadowHidden; public ActivatableNotificationView(Context context, AttributeSet attrs) { super(context, attrs); @@ -210,6 +211,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView super.onFinishInflate(); mBackgroundNormal = (NotificationBackgroundView) findViewById(R.id.backgroundNormal); mFakeShadow = (FakeShadowView) findViewById(R.id.fake_shadow); + mShadowHidden = mFakeShadow.getVisibility() != VISIBLE; mBackgroundDimmed = (NotificationBackgroundView) findViewById(R.id.backgroundDimmed); mBackgroundNormal.setCustomBackground(R.drawable.notification_material_bg); mBackgroundDimmed.setCustomBackground(R.drawable.notification_material_bg_dim); @@ -1020,9 +1022,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView @Override public void setFakeShadowIntensity(float shadowIntensity, float outlineAlpha, int shadowYEnd, int outlineTranslation) { - mFakeShadow.setFakeShadowTranslationZ(shadowIntensity * (getTranslationZ() - + FakeShadowView.SHADOW_SIBLING_TRESHOLD), outlineAlpha, shadowYEnd, - outlineTranslation); + boolean hiddenBefore = mShadowHidden; + mShadowHidden = shadowIntensity == 0.0f; + if (!mShadowHidden || !hiddenBefore) { + mFakeShadow.setFakeShadowTranslationZ(shadowIntensity * (getTranslationZ() + + FakeShadowView.SHADOW_SIBLING_TRESHOLD), outlineAlpha, shadowYEnd, + outlineTranslation); + } } public int getBackgroundColorWithoutTint() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java index b5358a187d5a3..593edf3b14f9c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarController.java @@ -43,7 +43,18 @@ public class LightBarController implements BatteryController.BatteryStateChangeC private boolean mDockedLight; private int mLastStatusBarMode; private int mLastNavigationBarMode; + + /** + * Whether the navigation bar should be light factoring in already how much alpha the scrim has + */ private boolean mNavigationLight; + + /** + * Whether the flags indicate that a light status bar is requested. This doesn't factor in the + * scrim alpha yet. + */ + private boolean mHasLightNavigationBar; + private boolean mScrimAlphaBelowThreshold; private float mScrimAlpha; private final Rect mLastFullscreenBounds = new Rect(); @@ -90,7 +101,9 @@ public class LightBarController implements BatteryController.BatteryStateChangeC if ((diffVis & View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) != 0 || nbModeChanged) { boolean last = mNavigationLight; - mNavigationLight = isNavigationLight(newVis, navigationBarMode); + mHasLightNavigationBar = isLight(vis, navigationBarMode, + View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + mNavigationLight = mHasLightNavigationBar && mScrimAlphaBelowThreshold; if (mNavigationLight != last) { updateNavigation(); } @@ -113,12 +126,11 @@ public class LightBarController implements BatteryController.BatteryStateChangeC public void setScrimAlpha(float alpha) { mScrimAlpha = alpha; - reevaluate(); - } - - private boolean isNavigationLight(int vis, int barMode) { - return isLight(vis, barMode, View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) - && mScrimAlpha < NAV_BAR_INVERSION_SCRIM_ALPHA_THRESHOLD; + boolean belowThresholdBefore = mScrimAlphaBelowThreshold; + mScrimAlphaBelowThreshold = mScrimAlpha < NAV_BAR_INVERSION_SCRIM_ALPHA_THRESHOLD; + if (mHasLightNavigationBar && belowThresholdBefore != mScrimAlphaBelowThreshold) { + reevaluate(); + } } private boolean isLight(int vis, int barMode, int flag) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 517551d003d19..8fcbf38db2dff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -338,13 +338,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, private void setCurrentScrimAlpha(View scrim, float alpha) { if (scrim == mScrimBehind) { mCurrentBehindAlpha = alpha; + mLightBarController.setScrimAlpha(mCurrentBehindAlpha); } else if (scrim == mScrimInFront) { mCurrentInFrontAlpha = alpha; } else { alpha = Math.max(0.0f, Math.min(1.0f, alpha)); mCurrentHeadsUpAlpha = alpha; } - mLightBarController.setScrimAlpha(mCurrentBehindAlpha); } protected void updateScrimColor(View scrim) { 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 06cd769ed73d8..9545fd8677860 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -359,6 +359,7 @@ public class NotificationStackScrollLayout extends ViewGroup private boolean mInHeadsUpPinnedMode; private boolean mHeadsUpAnimatingAway; private int mStatusBarState; + private int mCachedBackgroundColor; public NotificationStackScrollLayout(Context context) { this(context, null); @@ -445,8 +446,11 @@ public class NotificationStackScrollLayout extends ViewGroup + alphaInv * Color.green(scrimColor)), (int) (mBackgroundFadeAmount * Color.blue(mBgColor) + alphaInv * Color.blue(scrimColor))); - mBackgroundPaint.setColor(color); - invalidate(); + if (mCachedBackgroundColor != color) { + mCachedBackgroundColor = color; + mBackgroundPaint.setColor(color); + invalidate(); + } } private void initView(Context context) { @@ -2092,9 +2096,14 @@ public class NotificationStackScrollLayout extends ViewGroup * Update the background bounds to the new desired bounds */ private void updateBackgroundBounds() { - getLocationInWindow(mTempInt2); - mBackgroundBounds.left = mTempInt2[0]; - mBackgroundBounds.right = mTempInt2[0] + getWidth(); + if (mAmbientState.isPanelFullWidth()) { + mBackgroundBounds.left = 0; + mBackgroundBounds.right = getWidth(); + } else { + getLocationInWindow(mTempInt2); + mBackgroundBounds.left = mTempInt2[0]; + mBackgroundBounds.right = mTempInt2[0] + getWidth(); + } if (!mIsExpanded) { mBackgroundBounds.top = 0; mBackgroundBounds.bottom = 0;