Merge "Respect the expanded amount with AUTH_SCRIMMED_SHADE" into sc-v2-dev am: e0629d3667
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16082403 Change-Id: Ic052142dbafc25ec6db0bec44e88b51fa559d293
This commit is contained in:
@@ -674,6 +674,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
}
|
}
|
||||||
mInFrontAlpha = 0;
|
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
|
} else if (mState == ScrimState.KEYGUARD || mState == ScrimState.SHADE_LOCKED
|
||||||
|| mState == ScrimState.PULSING) {
|
|| mState == ScrimState.PULSING) {
|
||||||
Pair<Integer, Float> result = calculateBackStateForState(mState);
|
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 {
|
AUTH_SCRIMMED {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
|
|||||||
@@ -3838,7 +3838,11 @@ public class StatusBar extends SystemUI implements
|
|||||||
mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
|
mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
|
||||||
|
|
||||||
if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
|
if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
|
||||||
|
if (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED) {
|
||||||
|
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE);
|
||||||
|
} else {
|
||||||
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED);
|
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED);
|
||||||
|
}
|
||||||
} else if (mBouncerShowing) {
|
} else if (mBouncerShowing) {
|
||||||
// Bouncer needs the front scrim when it's on top of an activity,
|
// Bouncer needs the front scrim when it's on top of an activity,
|
||||||
// tapping on a notification, editing QS or being dismissed by
|
// 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(
|
HashSet<ScrimState> regularStates = new HashSet<>(Arrays.asList(
|
||||||
ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
|
ScrimState.UNINITIALIZED, ScrimState.KEYGUARD, ScrimState.BOUNCER,
|
||||||
ScrimState.BOUNCER_SCRIMMED, ScrimState.BRIGHTNESS_MIRROR, ScrimState.UNLOCKED,
|
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()) {
|
for (ScrimState state : ScrimState.values()) {
|
||||||
if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {
|
if (!lowPowerModeStates.contains(state) && !regularStates.contains(state)) {
|
||||||
@@ -1086,6 +1086,44 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
mNotificationsScrim.getViewAlpha(), 1, 0.0);
|
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
|
@Test
|
||||||
public void testScrimsVisible_whenShadeVisible() {
|
public void testScrimsVisible_whenShadeVisible() {
|
||||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||||
|
|||||||
Reference in New Issue
Block a user