Merge "Don't animate scrim changes to UNLOCKED if we're occluding." into tm-qpr-dev
This commit is contained in:
@@ -796,6 +796,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
|
|
||||||
public void setOccludeAnimationPlaying(boolean occludeAnimationPlaying) {
|
public void setOccludeAnimationPlaying(boolean occludeAnimationPlaying) {
|
||||||
mOccludeAnimationPlaying = occludeAnimationPlaying;
|
mOccludeAnimationPlaying = occludeAnimationPlaying;
|
||||||
|
|
||||||
|
for (ScrimState state : ScrimState.values()) {
|
||||||
|
state.setOccludeAnimationPlaying(occludeAnimationPlaying);
|
||||||
|
}
|
||||||
|
|
||||||
applyAndDispatchState();
|
applyAndDispatchState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,7 +845,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
if (mState == ScrimState.UNLOCKED || mState == ScrimState.DREAMING) {
|
if (mState == ScrimState.UNLOCKED || mState == ScrimState.DREAMING) {
|
||||||
final boolean occluding =
|
final boolean occluding =
|
||||||
mOccludeAnimationPlaying || mState.mLaunchingAffordanceWithPreview;
|
mOccludeAnimationPlaying || mState.mLaunchingAffordanceWithPreview;
|
||||||
|
|
||||||
// Darken scrim as it's pulled down while unlocked. If we're unlocked but playing the
|
// 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
|
// screen off/occlusion animations, ignore expansion changes while those animations
|
||||||
// play.
|
// play.
|
||||||
|
|||||||
@@ -243,7 +243,12 @@ public enum ScrimState {
|
|||||||
: CentralSurfaces.FADE_KEYGUARD_DURATION;
|
: CentralSurfaces.FADE_KEYGUARD_DURATION;
|
||||||
|
|
||||||
boolean fromAod = previousState == AOD || previousState == PULSING;
|
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;
|
mFrontTint = Color.TRANSPARENT;
|
||||||
mBehindTint = Color.BLACK;
|
mBehindTint = Color.BLACK;
|
||||||
@@ -308,6 +313,7 @@ public enum ScrimState {
|
|||||||
boolean mWallpaperSupportsAmbientMode;
|
boolean mWallpaperSupportsAmbientMode;
|
||||||
boolean mHasBackdrop;
|
boolean mHasBackdrop;
|
||||||
boolean mLaunchingAffordanceWithPreview;
|
boolean mLaunchingAffordanceWithPreview;
|
||||||
|
boolean mOccludeAnimationPlaying;
|
||||||
boolean mWakeLockScreenSensorActive;
|
boolean mWakeLockScreenSensorActive;
|
||||||
boolean mKeyguardFadingAway;
|
boolean mKeyguardFadingAway;
|
||||||
long mKeyguardFadingAwayDuration;
|
long mKeyguardFadingAwayDuration;
|
||||||
@@ -411,6 +417,10 @@ public enum ScrimState {
|
|||||||
mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview;
|
mLaunchingAffordanceWithPreview = launchingAffordanceWithPreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOccludeAnimationPlaying(boolean occludeAnimationPlaying) {
|
||||||
|
mOccludeAnimationPlaying = occludeAnimationPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLowPowerState() {
|
public boolean isLowPowerState() {
|
||||||
return false;
|
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 com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
@@ -1163,8 +1164,8 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testScrimFocus() {
|
public void testScrimFocus() {
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
mScrimController.transitionTo(ScrimState.AOD);
|
||||||
Assert.assertFalse("Should not be focusable on AOD", mScrimBehind.isFocusable());
|
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", mScrimInFront.isFocusable());
|
||||||
|
|
||||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||||
Assert.assertTrue("Should be focusable on keyguard", mScrimBehind.isFocusable());
|
Assert.assertTrue("Should be focusable on keyguard", mScrimBehind.isFocusable());
|
||||||
@@ -1224,7 +1225,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
public void testAnimatesTransitionToAod() {
|
public void testAnimatesTransitionToAod() {
|
||||||
when(mDozeParameters.shouldControlScreenOff()).thenReturn(false);
|
when(mDozeParameters.shouldControlScreenOff()).thenReturn(false);
|
||||||
ScrimState.AOD.prepare(ScrimState.KEYGUARD);
|
ScrimState.AOD.prepare(ScrimState.KEYGUARD);
|
||||||
Assert.assertFalse("No animation when ColorFade kicks in",
|
assertFalse("No animation when ColorFade kicks in",
|
||||||
ScrimState.AOD.getAnimateChange());
|
ScrimState.AOD.getAnimateChange());
|
||||||
|
|
||||||
reset(mDozeParameters);
|
reset(mDozeParameters);
|
||||||
@@ -1236,9 +1237,9 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testViewsDontHaveFocusHighlight() {
|
public void testViewsDontHaveFocusHighlight() {
|
||||||
Assert.assertFalse("Scrim shouldn't have focus highlight",
|
assertFalse("Scrim shouldn't have focus highlight",
|
||||||
mScrimInFront.getDefaultFocusHighlightEnabled());
|
mScrimInFront.getDefaultFocusHighlightEnabled());
|
||||||
Assert.assertFalse("Scrim shouldn't have focus highlight",
|
assertFalse("Scrim shouldn't have focus highlight",
|
||||||
mScrimBehind.getDefaultFocusHighlightEnabled());
|
mScrimBehind.getDefaultFocusHighlightEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1738,7 +1739,7 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void aodStateSetsFrontScrimToNotBlend() {
|
public void aodStateSetsFrontScrimToNotBlend() {
|
||||||
mScrimController.transitionTo(ScrimState.AOD);
|
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());
|
mScrimInFront.shouldBlendWithMainColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1773,6 +1774,14 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
verify(mStatusBarKeyguardViewManager).onKeyguardFadedAway();
|
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) {
|
private void assertAlphaAfterExpansion(ScrimView scrim, float expectedAlpha, float expansion) {
|
||||||
mScrimController.setRawPanelExpansionFraction(expansion);
|
mScrimController.setRawPanelExpansionFraction(expansion);
|
||||||
finishAnimationsImmediately();
|
finishAnimationsImmediately();
|
||||||
|
|||||||
Reference in New Issue
Block a user