Merge "Hide wallpaper when backdrop arrives" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
78c941d063
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user