Fix keyguard -> shade_locked scrim transition
A recent fix to not apply the bouncer scrim exposed this bug, where pulling down the shade over the lockscreen was not correctly setting the notif scrim. Remove the hardcoded BLACK value, and align with all other ScrimStates to use conditional logic for mClipsQsScrim. Fixes: 259684978 Test: atest ScrimControllerTest Test: manual pull down shade and use bouncer over lockscreen, in regular and split shade modes Change-Id: I057fad9149523e418f909bade90490effdc26eb5
This commit is contained in:
@@ -352,6 +352,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
.getBoolean(R.bool.notification_scrim_transparent);
|
||||
updateScrims();
|
||||
mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);
|
||||
|
||||
// prepare() sets proper initial values for most states
|
||||
for (ScrimState state : ScrimState.values()) {
|
||||
state.prepare(state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -641,10 +646,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
private void setTransitionToFullShade(boolean transitioning) {
|
||||
if (transitioning != mTransitioningToFullShade) {
|
||||
mTransitioningToFullShade = transitioning;
|
||||
if (transitioning) {
|
||||
// Let's make sure the shade locked is ready
|
||||
ScrimState.SHADE_LOCKED.prepare(mState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,18 +146,12 @@ public enum ScrimState {
|
||||
mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha;
|
||||
mNotifAlpha = 1f;
|
||||
mFrontAlpha = 0f;
|
||||
mBehindTint = Color.BLACK;
|
||||
mBehindTint = mClipQsScrim ? Color.TRANSPARENT : Color.BLACK;
|
||||
|
||||
if (mClipQsScrim) {
|
||||
updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
// to make sure correct color is returned before "prepare" is called
|
||||
@Override
|
||||
public int getBehindTint() {
|
||||
return Color.BLACK;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1442,16 +1442,30 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testNotificationTransparency_followsTransitionToFullShade() {
|
||||
mScrimController.setClipsQsScrim(true);
|
||||
|
||||
mScrimController.transitionTo(SHADE_LOCKED);
|
||||
mScrimController.setRawPanelExpansionFraction(1.0f);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
assertScrimTinted(Map.of(
|
||||
mScrimInFront, false,
|
||||
mScrimBehind, true,
|
||||
mNotificationsScrim, false
|
||||
));
|
||||
|
||||
float shadeLockedAlpha = mNotificationsScrim.getViewAlpha();
|
||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||
mScrimController.setRawPanelExpansionFraction(1.0f);
|
||||
finishAnimationsImmediately();
|
||||
float keyguardAlpha = mNotificationsScrim.getViewAlpha();
|
||||
|
||||
mScrimController.setClipsQsScrim(true);
|
||||
assertScrimTinted(Map.of(
|
||||
mScrimInFront, true,
|
||||
mScrimBehind, true,
|
||||
mNotificationsScrim, true
|
||||
));
|
||||
|
||||
float progress = 0.5f;
|
||||
float lsNotifProgress = 0.3f;
|
||||
mScrimController.setTransitionToFullShadeProgress(progress, lsNotifProgress);
|
||||
|
||||
Reference in New Issue
Block a user