Merge "Hide wallpaper when backdrop arrives" into pi-dev
am: 78c941d063
Change-Id: I82f13ea6a3ecde7f91899f23da45479ece97ac7d
This commit is contained in:
@@ -892,6 +892,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
|
|||||||
for (ScrimState state : ScrimState.values()) {
|
for (ScrimState state : ScrimState.values()) {
|
||||||
state.setHasBackdrop(hasBackdrop);
|
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) {
|
public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) {
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public enum ScrimState {
|
|||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
|
final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
|
||||||
mBlankScreen = mDisplayRequiresBlanking;
|
mBlankScreen = mDisplayRequiresBlanking;
|
||||||
mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
|
|
||||||
mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
|
mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
|
||||||
mCurrentInFrontTint = Color.BLACK;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mCurrentBehindTint = Color.BLACK;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
@@ -115,6 +114,11 @@ public enum ScrimState {
|
|||||||
mAnimateChange = mDozeParameters.shouldControlScreenOff();
|
mAnimateChange = mDozeParameters.shouldControlScreenOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getBehindAlpha(float busyness) {
|
||||||
|
return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLowPowerState() {
|
public boolean isLowPowerState() {
|
||||||
return true;
|
return true;
|
||||||
@@ -129,10 +133,14 @@ public enum ScrimState {
|
|||||||
public void prepare(ScrimState previousState) {
|
public void prepare(ScrimState previousState) {
|
||||||
mCurrentInFrontAlpha = 0;
|
mCurrentInFrontAlpha = 0;
|
||||||
mCurrentInFrontTint = Color.BLACK;
|
mCurrentInFrontTint = Color.BLACK;
|
||||||
mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
|
|
||||||
mCurrentBehindTint = Color.BLACK;
|
mCurrentBehindTint = Color.BLACK;
|
||||||
mBlankScreen = mDisplayRequiresBlanking;
|
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 */);
|
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
|
@Test
|
||||||
public void transitionToAod_withFrontAlphaUpdates() {
|
public void transitionToAod_withFrontAlphaUpdates() {
|
||||||
// Assert that setting the AOD front scrim alpha doesn't take effect in a non-AOD state.
|
// Assert that setting the AOD front scrim alpha doesn't take effect in a non-AOD state.
|
||||||
|
|||||||
Reference in New Issue
Block a user