Merge "Don't animate scrim changes to UNLOCKED if we're occluding." into tm-qpr-dev am: 3f5a0847cd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22075752 Change-Id: I7f8c336e9e70ddefeb9630fbc77ba34295e4712b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -796,6 +796,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
|
||||
public void setOccludeAnimationPlaying(boolean occludeAnimationPlaying) {
|
||||
mOccludeAnimationPlaying = occludeAnimationPlaying;
|
||||
|
||||
for (ScrimState state : ScrimState.values()) {
|
||||
state.setOccludeAnimationPlaying(occludeAnimationPlaying);
|
||||
}
|
||||
|
||||
applyAndDispatchState();
|
||||
}
|
||||
|
||||
@@ -840,7 +845,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
if (mState == ScrimState.UNLOCKED || mState == ScrimState.DREAMING) {
|
||||
final boolean occluding =
|
||||
mOccludeAnimationPlaying || mState.mLaunchingAffordanceWithPreview;
|
||||
|
||||
// Darken scrim as it's pulled down while unlocked. If we're unlocked but playing the
|
||||
// screen off/occlusion animations, ignore expansion changes while those animations
|
||||
// play.
|
||||
|
||||
@@ -243,7 +243,12 @@ public enum ScrimState {
|
||||
: CentralSurfaces.FADE_KEYGUARD_DURATION;
|
||||
|
||||
boolean fromAod = previousState == AOD || previousState == PULSING;
|
||||
mAnimateChange = !mLaunchingAffordanceWithPreview && !fromAod;
|
||||
// If launch/occlude animations were playing, they already animated the scrim
|
||||
// alpha to 0f as part of the animation. If we animate it now, we'll set it back
|
||||
// to 1f and animate it back to 0f, causing an unwanted scrim flash.
|
||||
mAnimateChange = !mLaunchingAffordanceWithPreview
|
||||
&& !mOccludeAnimationPlaying
|
||||
&& !fromAod;
|
||||
|
||||
mFrontTint = Color.TRANSPARENT;
|
||||
mBehindTint = Color.BLACK;
|
||||
@@ -308,6 +313,7 @@ public enum ScrimState {
|
||||
boolean mWallpaperSupportsAmbientMode;
|
||||
boolean mHasBackdrop;
|
||||
boolean mLaunchingAffordanceWithPreview;
|
||||
boolean mOccludeAnimationPlaying;
|
||||
boolean mWakeLockScreenSensorActive;
|
||||
boolean mKeyguardFadingAway;
|
||||
long mKeyguardFadingAwayDuration;
|
||||
@@ -411,6 +417,10 @@ public enum ScrimState {
|
||||
mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview;
|
||||
}
|
||||
|
||||
public void setOccludeAnimationPlaying(boolean occludeAnimationPlaying) {
|
||||
mOccludeAnimationPlaying = occludeAnimationPlaying;
|
||||
}
|
||||
|
||||
public boolean isLowPowerState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import static com.android.systemui.statusbar.phone.ScrimState.SHADE_LOCKED;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
@@ -1163,8 +1164,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testScrimFocus() {
|
||||
mScrimController.transitionTo(ScrimState.AOD);
|
||||
Assert.assertFalse("Should not be focusable on AOD", mScrimBehind.isFocusable());
|
||||
Assert.assertFalse("Should not be focusable on AOD", mScrimInFront.isFocusable());
|
||||
assertFalse("Should not be focusable on AOD", mScrimBehind.isFocusable());
|
||||
assertFalse("Should not be focusable on AOD", mScrimInFront.isFocusable());
|
||||
|
||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||
Assert.assertTrue("Should be focusable on keyguard", mScrimBehind.isFocusable());
|
||||
@@ -1224,7 +1225,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
public void testAnimatesTransitionToAod() {
|
||||
when(mDozeParameters.shouldControlScreenOff()).thenReturn(false);
|
||||
ScrimState.AOD.prepare(ScrimState.KEYGUARD);
|
||||
Assert.assertFalse("No animation when ColorFade kicks in",
|
||||
assertFalse("No animation when ColorFade kicks in",
|
||||
ScrimState.AOD.getAnimateChange());
|
||||
|
||||
reset(mDozeParameters);
|
||||
@@ -1236,9 +1237,9 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testViewsDontHaveFocusHighlight() {
|
||||
Assert.assertFalse("Scrim shouldn't have focus highlight",
|
||||
assertFalse("Scrim shouldn't have focus highlight",
|
||||
mScrimInFront.getDefaultFocusHighlightEnabled());
|
||||
Assert.assertFalse("Scrim shouldn't have focus highlight",
|
||||
assertFalse("Scrim shouldn't have focus highlight",
|
||||
mScrimBehind.getDefaultFocusHighlightEnabled());
|
||||
}
|
||||
|
||||
@@ -1738,7 +1739,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void aodStateSetsFrontScrimToNotBlend() {
|
||||
mScrimController.transitionTo(ScrimState.AOD);
|
||||
Assert.assertFalse("Front scrim should not blend with main color",
|
||||
assertFalse("Front scrim should not blend with main color",
|
||||
mScrimInFront.shouldBlendWithMainColor());
|
||||
}
|
||||
|
||||
@@ -1773,6 +1774,14 @@ public class ScrimControllerTest extends SysuiTestCase {
|
||||
verify(mStatusBarKeyguardViewManager).onKeyguardFadedAway();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoNotAnimateChangeIfOccludeAnimationPlaying() {
|
||||
mScrimController.setOccludeAnimationPlaying(true);
|
||||
mScrimController.transitionTo(ScrimState.UNLOCKED);
|
||||
|
||||
assertFalse(ScrimState.UNLOCKED.mAnimateChange);
|
||||
}
|
||||
|
||||
private void assertAlphaAfterExpansion(ScrimView scrim, float expectedAlpha, float expansion) {
|
||||
mScrimController.setRawPanelExpansionFraction(expansion);
|
||||
finishAnimationsImmediately();
|
||||
|
||||
Reference in New Issue
Block a user