Merge "Respect the expanded amount with AUTH_SCRIMMED_SHADE" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e0629d3667
@@ -674,6 +674,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
}
|
||||
mInFrontAlpha = 0;
|
||||
}
|
||||
} else if (mState == ScrimState.AUTH_SCRIMMED_SHADE) {
|
||||
float behindFraction = getInterpolatedFraction();
|
||||
behindFraction = (float) Math.pow(behindFraction, 0.8f);
|
||||
|
||||
mBehindAlpha = behindFraction * mDefaultScrimAlpha;
|
||||
mNotificationsAlpha = mBehindAlpha;
|
||||
} else if (mState == ScrimState.KEYGUARD || mState == ScrimState.SHADE_LOCKED
|
||||
|| mState == ScrimState.PULSING) {
|
||||
Pair<Integer, Float> result = calculateBackStateForState(mState);
|
||||
|
||||
@@ -87,6 +87,17 @@ public enum ScrimState {
|
||||
}
|
||||
},
|
||||
|
||||
AUTH_SCRIMMED_SHADE {
|
||||
@Override
|
||||
public void prepare(ScrimState previousState) {
|
||||
// notif & behind scrim alpha values are determined by ScrimController#applyState
|
||||
// based on the shade expansion
|
||||
|
||||
mFrontTint = Color.BLACK;
|
||||
mFrontAlpha = .66f;
|
||||
}
|
||||
},
|
||||
|
||||
AUTH_SCRIMMED {
|
||||
@Override
|
||||
public void prepare(ScrimState previousState) {
|
||||
|
||||
@@ -3837,7 +3837,11 @@ public class StatusBar extends SystemUI implements
|
||||
mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
|
||||
|
||||
if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
|
||||
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED);
|
||||
if (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED) {
|
||||
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE);
|
||||
} else {
|
||||
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED);
|
||||
}
|
||||
} else if (mBouncerShowing) {
|
||||
// Bouncer needs the front scrim when it's on top of an activity,
|
||||
// tapping on a notification, editing QS or being dismissed by
|
||||
|
||||
@@ -1063,7 +1063,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
|
||||
ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
|
||||
ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR, ScrimState.UNLOCKED,
|
||||
ScrimState.SHADE_LOCKED, ScrimState.AUTH_SCRIMMED));
|
||||
ScrimState.SHADE_LOCKED, ScrimState.AUTH_SCRIMMED, ScrimState.AUTH_SCRIMMED_SHADE));
|
||||
|
||||
for (ScrimState state : ScrimState.values()) {
|
||||
if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {
|
||||
@@ -1086,6 +1086,44 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
mNotificationsScrim.getViewAlpha(), 1, 0.0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAuthScrim_notifScrimOpaque_whenShadeFullyExpanded() {
|
||||
// GIVEN device has an activity showing ('UNLOCKED' state can occur on the lock screen
|
||||
// with the camera app occluding the keyguard)
|
||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||
mScrimController.setRawPanelExpansionFraction(1);
|
||||
// notifications scrim alpha change require calling setQsPosition
|
||||
mScrimController.setQsPosition(0, 300);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
// WHEN the user triggers the auth bouncer
|
||||
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
assertEquals("Behind scrim should be opaque",
|
||||
mScrimBehind.getViewAlpha(), 1, 0.0);
|
||||
assertEquals("Notifications scrim should be opaque",
|
||||
mNotificationsScrim.getViewAlpha(), 1, 0.0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAuthScrimKeyguard() {
|
||||
// GIVEN device is on the keyguard
|
||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
// WHEN the user triggers the auth bouncer
|
||||
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
// THEN the front scrim is updated and the KEYGUARD scrims are the same as the
|
||||
// KEYGUARD scrim state
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, SEMI_TRANSPARENT,
|
||||
mScrimBehind, SEMI_TRANSPARENT,
|
||||
mNotificationsScrim, TRANSPARENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScrimsVisible_whenShadeVisible() {
|
||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||
|
||||
Reference in New Issue
Block a user