@@ -256,6 +256,8 @@ public void setUnocclusionAnimationRunning(boolean unocclusionAnimationRunning)
256256 private boolean mWallpaperSupportsAmbientMode ;
257257 private boolean mScreenOn ;
258258 private boolean mTransparentScrimBackground ;
259+ private float mTransparentBehindScrimAmount ;
260+ private float mTransparentNotifScrimAmount ;
259261
260262 // Scrim blanking callbacks
261263 private Runnable mPendingFrameCallback ;
@@ -349,8 +351,6 @@ public void attachViews(ScrimView behindScrim, ScrimView notificationsScrim,
349351 mScrimBehind .setDefaultFocusHighlightEnabled (false );
350352 mNotificationsScrim .setDefaultFocusHighlightEnabled (false );
351353 mScrimInFront .setDefaultFocusHighlightEnabled (false );
352- mTransparentScrimBackground = notificationsScrim .getResources ()
353- .getBoolean (R .bool .notification_scrim_transparent );
354354 updateScrims ();
355355 mKeyguardUpdateMonitor .registerCallback (mKeyguardVisibilityCallback );
356356
@@ -795,16 +795,21 @@ private void applyState() {
795795 float behindFraction = getInterpolatedFraction ();
796796 behindFraction = (float ) Math .pow (behindFraction , 0.8f );
797797 if (mClipsQsScrim ) {
798- mBehindAlpha = mTransparentScrimBackground ? 0 : 1 ;
798+ mBehindAlpha = mTransparentScrimBackground ?
799+ mTransparentBehindScrimAmount : 1 ;
799800 mNotificationsAlpha =
800- mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha ;
801+ mTransparentScrimBackground ? behindFraction * mTransparentNotifScrimAmount
802+ : behindFraction * mDefaultScrimAlpha ;
801803 } else {
802804 mBehindAlpha =
803- mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha ;
805+ mTransparentScrimBackground ? behindFraction * mTransparentBehindScrimAmount
806+ : behindFraction * mDefaultScrimAlpha ;
804807 // Delay fade-in of notification scrim a bit further, to coincide with the
805808 // view fade in. Otherwise the empty panel can be quite jarring.
806809 mNotificationsAlpha = mTransparentScrimBackground
807- ? 0 : MathUtils .constrainedMap (0f , 1f , 0.3f , 0.75f ,
810+ ? MathUtils .constrainedMap (0f , mTransparentNotifScrimAmount ,
811+ mTransparentNotifScrimAmount * 0.3f , mTransparentNotifScrimAmount * 0.75f ,
812+ mPanelExpansionFraction ) : MathUtils .constrainedMap (0f , 1f , 0.3f , 0.75f ,
808813 mPanelExpansionFraction );
809814 }
810815 mBehindTint = mState .getBehindTint ();
@@ -1026,6 +1031,14 @@ protected void scheduleUpdate() {
10261031 }
10271032
10281033 protected void updateScrims () {
1034+ // Let's update this resources after setting the overlays
1035+ mTransparentScrimBackground = mNotificationsScrim .getResources ()
1036+ .getBoolean (R .bool .notification_scrim_transparent );
1037+ mTransparentBehindScrimAmount = mNotificationsScrim .getResources ()
1038+ .getFloat (R .dimen .config_behind_scrim_transparency_amount );
1039+ mTransparentNotifScrimAmount = mNotificationsScrim .getResources ()
1040+ .getFloat (R .dimen .config_notification_scrim_transparency_amount );
1041+
10291042 // Make sure we have the right gradients and their opacities will satisfy GAR.
10301043 if (mNeedsDrawableColorUpdate ) {
10311044 mNeedsDrawableColorUpdate = false ;
@@ -1421,6 +1434,7 @@ private void updateThemeColors() {
14211434
14221435 private void onThemeChanged () {
14231436 updateThemeColors ();
1437+ updateScrims ();
14241438 scheduleUpdate ();
14251439 }
14261440
0 commit comments