Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +10 −0 Original line number Diff line number Diff line Loading @@ -892,6 +892,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo for (ScrimState state : ScrimState.values()) { state.setHasBackdrop(hasBackdrop); } // Backdrop event may arrive after state was already applied, // in this case, back-scrim needs to be re-evaluated if (mState == ScrimState.AOD || mState == ScrimState.PULSING) { float newBehindAlpha = mState.getBehindAlpha(mNotificationDensity); if (mCurrentBehindAlpha != newBehindAlpha) { mCurrentBehindAlpha = newBehindAlpha; updateScrims(); } } } public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +10 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn(); mBlankScreen = mDisplayRequiresBlanking; mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f; mCurrentInFrontTint = Color.BLACK; mCurrentBehindTint = Color.BLACK; Loading @@ -115,6 +114,11 @@ public enum ScrimState { mAnimateChange = mDozeParameters.shouldControlScreenOff(); } @Override public float getBehindAlpha(float busyness) { return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; } @Override public boolean isLowPowerState() { return true; Loading @@ -129,10 +133,14 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mCurrentInFrontAlpha = 0; mCurrentInFrontTint = Color.BLACK; mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; mCurrentBehindTint = Color.BLACK; mBlankScreen = mDisplayRequiresBlanking; } @Override public float getBehindAlpha(float busyness) { return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; } }, /** Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,20 @@ public class ScrimControllerTest extends SysuiTestCase { assertScrimTint(mScrimInFront, true /* tinted */); } @Test public void setHasBackdrop_withAodWallpaperAndAlbumArt() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.AOD); mScrimController.finishAnimationsImmediately(); mScrimController.setHasBackdrop(true); mScrimController.finishAnimationsImmediately(); // Front scrim should be transparent // Back scrim should be visible with tint assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE); assertScrimTint(mScrimBehind, true /* tinted */); assertScrimTint(mScrimInFront, true /* tinted */); } @Test public void transitionToAod_withFrontAlphaUpdates() { // Assert that setting the AOD front scrim alpha doesn't take effect in a non-AOD state. Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +10 −0 Original line number Diff line number Diff line Loading @@ -892,6 +892,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo for (ScrimState state : ScrimState.values()) { state.setHasBackdrop(hasBackdrop); } // Backdrop event may arrive after state was already applied, // in this case, back-scrim needs to be re-evaluated if (mState == ScrimState.AOD || mState == ScrimState.PULSING) { float newBehindAlpha = mState.getBehindAlpha(mNotificationDensity); if (mCurrentBehindAlpha != newBehindAlpha) { mCurrentBehindAlpha = newBehindAlpha; updateScrims(); } } } public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +10 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,6 @@ public enum ScrimState { public void prepare(ScrimState previousState) { final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn(); mBlankScreen = mDisplayRequiresBlanking; mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f; mCurrentInFrontTint = Color.BLACK; mCurrentBehindTint = Color.BLACK; Loading @@ -115,6 +114,11 @@ public enum ScrimState { mAnimateChange = mDozeParameters.shouldControlScreenOff(); } @Override public float getBehindAlpha(float busyness) { return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; } @Override public boolean isLowPowerState() { return true; Loading @@ -129,10 +133,14 @@ public enum ScrimState { public void prepare(ScrimState previousState) { mCurrentInFrontAlpha = 0; mCurrentInFrontTint = Color.BLACK; mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; mCurrentBehindTint = Color.BLACK; mBlankScreen = mDisplayRequiresBlanking; } @Override public float getBehindAlpha(float busyness) { return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f; } }, /** Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,20 @@ public class ScrimControllerTest extends SysuiTestCase { assertScrimTint(mScrimInFront, true /* tinted */); } @Test public void setHasBackdrop_withAodWallpaperAndAlbumArt() { mScrimController.setWallpaperSupportsAmbientMode(true); mScrimController.transitionTo(ScrimState.AOD); mScrimController.finishAnimationsImmediately(); mScrimController.setHasBackdrop(true); mScrimController.finishAnimationsImmediately(); // Front scrim should be transparent // Back scrim should be visible with tint assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE); assertScrimTint(mScrimBehind, true /* tinted */); assertScrimTint(mScrimInFront, true /* tinted */); } @Test public void transitionToAod_withFrontAlphaUpdates() { // Assert that setting the AOD front scrim alpha doesn't take effect in a non-AOD state. Loading