Merge "Add flags to enable QS clipping / Scrim transparency." into tm-qpr-dev

This commit is contained in:
Ben Lin
2022-10-18 18:11:39 +00:00
committed by Android (Google) Code Review
3 changed files with 24 additions and 6 deletions

View File

@@ -18,6 +18,13 @@
<resources> <resources>
<!-- Whether to show the user switcher in quick settings when only a single user is present. --> <!-- Whether to show the user switcher in quick settings when only a single user is present. -->
<bool name="qs_show_user_switcher_for_single_user">false</bool> <bool name="qs_show_user_switcher_for_single_user">false</bool>
<!-- Whether to show a custom biometric prompt size--> <!-- Whether to show a custom biometric prompt size-->
<bool name="use_custom_bp_size">false</bool> <bool name="use_custom_bp_size">false</bool>
<!-- Whether to enable clipping on Quick Settings -->
<bool name="qs_enable_clipping">true</bool>
<!-- Whether to enable transparent background for notification scrims -->
<bool name="notification_scrim_transparent">false</bool>
</resources> </resources>

View File

@@ -689,6 +689,7 @@ public final class NotificationPanelViewController {
private int mScreenCornerRadius; private int mScreenCornerRadius;
private boolean mQSAnimatingHiddenFromCollapsed; private boolean mQSAnimatingHiddenFromCollapsed;
private boolean mUseLargeScreenShadeHeader; private boolean mUseLargeScreenShadeHeader;
private boolean mEnableQsClipping;
private int mQsClipTop; private int mQsClipTop;
private int mQsClipBottom; private int mQsClipBottom;
@@ -1298,6 +1299,8 @@ public final class NotificationPanelViewController {
mSplitShadeFullTransitionDistance = mSplitShadeFullTransitionDistance =
mResources.getDimensionPixelSize(R.dimen.split_shade_full_transition_distance); mResources.getDimensionPixelSize(R.dimen.split_shade_full_transition_distance);
mEnableQsClipping = mResources.getBoolean(R.bool.qs_enable_clipping);
} }
private void onSplitShadeEnabledChanged() { private void onSplitShadeEnabledChanged() {
@@ -2952,8 +2955,10 @@ public final class NotificationPanelViewController {
mQsTranslationForFullShadeTransition = qsTranslation; mQsTranslationForFullShadeTransition = qsTranslation;
updateQsFrameTranslation(); updateQsFrameTranslation();
float currentTranslation = mQsFrame.getTranslationY(); float currentTranslation = mQsFrame.getTranslationY();
mQsClipTop = (int) (top - currentTranslation - mQsFrame.getTop()); mQsClipTop = mEnableQsClipping
mQsClipBottom = (int) (bottom - currentTranslation - mQsFrame.getTop()); ? (int) (top - currentTranslation - mQsFrame.getTop()) : 0;
mQsClipBottom = mEnableQsClipping
? (int) (bottom - currentTranslation - mQsFrame.getTop()) : 0;
mQsVisible = qsVisible; mQsVisible = qsVisible;
mQs.setQsVisible(mQsVisible); mQs.setQsVisible(mQsVisible);
mQs.setFancyClipping( mQs.setFancyClipping(

View File

@@ -249,6 +249,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
private Callback mCallback; private Callback mCallback;
private boolean mWallpaperSupportsAmbientMode; private boolean mWallpaperSupportsAmbientMode;
private boolean mScreenOn; private boolean mScreenOn;
private boolean mTransparentScrimBackground;
// Scrim blanking callbacks // Scrim blanking callbacks
private Runnable mPendingFrameCallback; private Runnable mPendingFrameCallback;
@@ -341,6 +342,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
mScrimBehind.setDefaultFocusHighlightEnabled(false); mScrimBehind.setDefaultFocusHighlightEnabled(false);
mNotificationsScrim.setDefaultFocusHighlightEnabled(false); mNotificationsScrim.setDefaultFocusHighlightEnabled(false);
mScrimInFront.setDefaultFocusHighlightEnabled(false); mScrimInFront.setDefaultFocusHighlightEnabled(false);
mTransparentScrimBackground = notificationsScrim.getResources()
.getBoolean(R.bool.notification_scrim_transparent);
updateScrims(); updateScrims();
mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback); mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);
} }
@@ -777,13 +780,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
float behindFraction = getInterpolatedFraction(); float behindFraction = getInterpolatedFraction();
behindFraction = (float) Math.pow(behindFraction, 0.8f); behindFraction = (float) Math.pow(behindFraction, 0.8f);
if (mClipsQsScrim) { if (mClipsQsScrim) {
mBehindAlpha = 1; mBehindAlpha = mTransparentScrimBackground ? 0 : 1;
mNotificationsAlpha = behindFraction * mDefaultScrimAlpha; mNotificationsAlpha =
mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha;
} else { } else {
mBehindAlpha = behindFraction * mDefaultScrimAlpha; mBehindAlpha =
mTransparentScrimBackground ? 0 : behindFraction * mDefaultScrimAlpha;
// Delay fade-in of notification scrim a bit further, to coincide with the // Delay fade-in of notification scrim a bit further, to coincide with the
// view fade in. Otherwise the empty panel can be quite jarring. // view fade in. Otherwise the empty panel can be quite jarring.
mNotificationsAlpha = MathUtils.constrainedMap(0f, 1f, 0.3f, 0.75f, mNotificationsAlpha = mTransparentScrimBackground
? 0 : MathUtils.constrainedMap(0f, 1f, 0.3f, 0.75f,
mPanelExpansionFraction); mPanelExpansionFraction);
} }
mBehindTint = mState.getBehindTint(); mBehindTint = mState.getBehindTint();