Update opacity of LightRevealScrim
So when the motion sense 'reach' sensor is triggered, the wallpaper is visible behind a semi-transparent LightRevealScrim. BehindScrim is no longer used for its opaque black background on AOD. Instead, we rely on the light reveal scrim. Update tests to reflect this Test: manual, atest ScrimControllerTest Fixes: 187670193 Change-Id: I33cf27e12fa74aea80f3e2363c49253f1632baed
This commit is contained in:
@@ -1242,6 +1242,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
pw.println(mDefaultScrimAlpha);
|
||||
pw.print(" mExpansionFraction=");
|
||||
pw.println(mPanelExpansion);
|
||||
|
||||
pw.print(" mState.getMaxLightRevealScrimAlpha=");
|
||||
pw.println(mState.getMaxLightRevealScrimAlpha());
|
||||
}
|
||||
|
||||
public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
|
||||
|
||||
@@ -197,7 +197,7 @@ public enum ScrimState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBehindAlpha() {
|
||||
public float getMaxLightRevealScrimAlpha() {
|
||||
return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
|
||||
}
|
||||
|
||||
@@ -220,18 +220,11 @@ public enum ScrimState {
|
||||
mBlankScreen = mDisplayRequiresBlanking;
|
||||
mAnimationDuration = mWakeLockScreenSensorActive
|
||||
? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION;
|
||||
|
||||
// Wake sensor will show the wallpaper, let's fade from black. Otherwise it will
|
||||
// feel like the screen is flashing if the wallpaper is light.
|
||||
if (mWakeLockScreenSensorActive && previousState == AOD) {
|
||||
updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBehindAlpha() {
|
||||
public float getMaxLightRevealScrimAlpha() {
|
||||
return mWakeLockScreenSensorActive ? ScrimController.WAKE_SENSOR_SCRIM_ALPHA
|
||||
: AOD.getBehindAlpha();
|
||||
: AOD.getMaxLightRevealScrimAlpha();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -351,6 +344,10 @@ public enum ScrimState {
|
||||
return mBehindAlpha;
|
||||
}
|
||||
|
||||
public float getMaxLightRevealScrimAlpha() {
|
||||
return 1f;
|
||||
}
|
||||
|
||||
public float getNotifAlpha() {
|
||||
return mNotifAlpha;
|
||||
}
|
||||
|
||||
@@ -4444,6 +4444,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
} else {
|
||||
mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
|
||||
}
|
||||
updateLightRevealScrimVisibility();
|
||||
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@@ -4894,6 +4896,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
return;
|
||||
}
|
||||
|
||||
mLightRevealScrim.setAlpha(mScrimController.getState().getMaxLightRevealScrimAlpha());
|
||||
if (mFeatureFlags.useNewLockscreenAnimations()
|
||||
&& (mDozeParameters.getAlwaysOn() || mDozeParameters.isQuickPickupEnabled())) {
|
||||
mLightRevealScrim.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -312,6 +312,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
mScrimBehind, true,
|
||||
mScrimForBubble, false
|
||||
));
|
||||
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -321,8 +323,9 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, OPAQUE,
|
||||
mScrimBehind, TRANSPARENT,
|
||||
mNotificationsScrim, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
assertScrimTinted(Map.of(
|
||||
mScrimInFront, true,
|
||||
@@ -340,6 +343,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(0f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// Pulsing notification should conserve AOD wallpaper.
|
||||
mScrimController.transitionTo(ScrimState.PULSING);
|
||||
@@ -348,6 +352,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(0f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -359,7 +364,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
assertScrimTinted(Map.of(
|
||||
mScrimInFront, true,
|
||||
@@ -378,7 +384,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
assertScrimTinted(Map.of(
|
||||
mScrimInFront, true,
|
||||
@@ -403,13 +410,15 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
finishAnimationsImmediately();
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, SEMI_TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// ... and that if we set it while we're in AOD, it does take immediate effect.
|
||||
mScrimController.setAodFrontScrimAlpha(1f);
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, OPAQUE,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// ... and make sure we recall the previous front scrim alpha even if we transition away
|
||||
// for a bit.
|
||||
@@ -418,7 +427,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
finishAnimationsImmediately();
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, OPAQUE,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// ... and alpha updates should be completely ignored if always_on is off.
|
||||
// Passing it forward would mess up the wake-up transition.
|
||||
@@ -448,23 +458,28 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
finishAnimationsImmediately();
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, OPAQUE,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// ... but will take effect after docked
|
||||
when(mDockManager.isDocked()).thenReturn(true);
|
||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||
mScrimController.setAodFrontScrimAlpha(0.5f);
|
||||
mScrimController.transitionTo(ScrimState.AOD);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, SEMI_TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// ... and that if we set it while we're in AOD, it does take immediate effect after docked.
|
||||
mScrimController.setAodFrontScrimAlpha(1f);
|
||||
finishAnimationsImmediately();
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, OPAQUE,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// Reset value since enums are static.
|
||||
mScrimController.setAodFrontScrimAlpha(0f);
|
||||
@@ -480,7 +495,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
finishAnimationsImmediately();
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
mScrimController.transitionTo(ScrimState.PULSING);
|
||||
finishAnimationsImmediately();
|
||||
@@ -489,7 +505,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
// Pulse callback should have been invoked
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
assertScrimTinted(Map.of(
|
||||
mScrimInFront, true,
|
||||
@@ -503,13 +520,16 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
// Front scrim should be semi-transparent
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, SEMI_TRANSPARENT,
|
||||
mScrimBehind, OPAQUE));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(1f, mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
mScrimController.setWakeLockScreenSensorActive(true);
|
||||
finishAnimationsImmediately();
|
||||
assertScrimAlpha(Map.of(
|
||||
mScrimInFront, SEMI_TRANSPARENT,
|
||||
mScrimBehind, SEMI_TRANSPARENT));
|
||||
mScrimBehind, TRANSPARENT));
|
||||
assertEquals(ScrimController.WAKE_SENSOR_SCRIM_ALPHA,
|
||||
mScrimController.getState().getMaxLightRevealScrimAlpha(), 0f);
|
||||
|
||||
// Reset value since enums are static.
|
||||
mScrimController.setAodFrontScrimAlpha(0f);
|
||||
|
||||
Reference in New Issue
Block a user