Merge "Fixes two bright flashes of the notification scrim" into sc-dev
This commit is contained in:
@@ -111,6 +111,20 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
*/
|
*/
|
||||||
private boolean mTransitioningToFullShade;
|
private boolean mTransitioningToFullShade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is there currently an unocclusion animation running. Used to avoid bright flickers
|
||||||
|
* of the notification scrim.
|
||||||
|
*/
|
||||||
|
private boolean mUnOcclusionAnimationRunning;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether an unocclusion animation is currently running on the notification panel. Used
|
||||||
|
* to avoid bright flickers of the notification scrim.
|
||||||
|
*/
|
||||||
|
public void setUnocclusionAnimationRunning(boolean unocclusionAnimationRunning) {
|
||||||
|
mUnOcclusionAnimationRunning = unocclusionAnimationRunning;
|
||||||
|
}
|
||||||
|
|
||||||
@IntDef(prefix = {"VISIBILITY_"}, value = {
|
@IntDef(prefix = {"VISIBILITY_"}, value = {
|
||||||
TRANSPARENT,
|
TRANSPARENT,
|
||||||
SEMI_TRANSPARENT,
|
SEMI_TRANSPARENT,
|
||||||
@@ -466,6 +480,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
|
|
||||||
public void onExpandingFinished() {
|
public void onExpandingFinished() {
|
||||||
mTracking = false;
|
mTracking = false;
|
||||||
|
setUnocclusionAnimationRunning(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -694,6 +709,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
mNotificationsTint = mState.getNotifTint();
|
mNotificationsTint = mState.getNotifTint();
|
||||||
mBehindTint = behindTint;
|
mBehindTint = behindTint;
|
||||||
}
|
}
|
||||||
|
if (mUnOcclusionAnimationRunning && mState == ScrimState.KEYGUARD) {
|
||||||
|
// We're unoccluding the keyguard and don't want to have a bright flash.
|
||||||
|
mNotificationsAlpha = 0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isNaN(mBehindAlpha) || isNaN(mInFrontAlpha) || isNaN(mNotificationsAlpha)) {
|
if (isNaN(mBehindAlpha) || isNaN(mInFrontAlpha) || isNaN(mNotificationsAlpha)) {
|
||||||
throw new IllegalStateException("Scrim opacity is NaN for state: " + mState
|
throw new IllegalStateException("Scrim opacity is NaN for state: " + mState
|
||||||
|
|||||||
@@ -3579,6 +3579,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
public void animateKeyguardUnoccluding() {
|
public void animateKeyguardUnoccluding() {
|
||||||
mNotificationPanelViewController.setExpandedFraction(0f);
|
mNotificationPanelViewController.setExpandedFraction(0f);
|
||||||
animateExpandNotificationsPanel();
|
animateExpandNotificationsPanel();
|
||||||
|
mScrimController.setUnocclusionAnimationRunning(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4465,10 +4466,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
ScrimState state = mStatusBarKeyguardViewManager.bouncerNeedsScrimming()
|
ScrimState state = mStatusBarKeyguardViewManager.bouncerNeedsScrimming()
|
||||||
? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER;
|
? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER;
|
||||||
mScrimController.transitionTo(state);
|
mScrimController.transitionTo(state);
|
||||||
} else if (isInLaunchTransition()
|
} else if (launchingAffordanceWithPreview) {
|
||||||
|| mLaunchCameraWhenFinishedWaking
|
// We want to avoid animating when launching with a preview.
|
||||||
|| launchingAffordanceWithPreview) {
|
|
||||||
// TODO(b/170133395) Investigate whether Emergency Gesture flag should be included here.
|
|
||||||
mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
|
mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
|
||||||
} else if (mBrightnessMirrorVisible) {
|
} else if (mBrightnessMirrorVisible) {
|
||||||
mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR);
|
mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR);
|
||||||
|
|||||||
@@ -1137,6 +1137,19 @@ public class ScrimControllerTest extends SysuiTestCase {
|
|||||||
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.47f, /* expansion */ 0.2f);
|
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.47f, /* expansion */ 0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNotificationTransparency_unnocclusion() {
|
||||||
|
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||||
|
mScrimController.setUnocclusionAnimationRunning(true);
|
||||||
|
|
||||||
|
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.0f, /* expansion */ 0.0f);
|
||||||
|
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.0f, /* expansion */ 1.0f);
|
||||||
|
|
||||||
|
// Verify normal behavior after
|
||||||
|
mScrimController.setUnocclusionAnimationRunning(false);
|
||||||
|
assertAlphaAfterExpansion(mNotificationsScrim, /* alpha */ 0.2f, /* expansion */ 0.4f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotificationTransparency_inKeyguardState() {
|
public void testNotificationTransparency_inKeyguardState() {
|
||||||
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
mScrimController.transitionTo(ScrimState.KEYGUARD);
|
||||||
|
|||||||
@@ -811,6 +811,30 @@ public class StatusBarTest extends SysuiTestCase {
|
|||||||
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
|
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransitionLaunch_goesToUnlocked() {
|
||||||
|
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
|
||||||
|
mStatusBar.showKeyguardImpl();
|
||||||
|
|
||||||
|
// Starting a pulse should change the scrim controller to the pulsing state
|
||||||
|
when(mNotificationPanelViewController.isLaunchTransitionRunning()).thenReturn(true);
|
||||||
|
when(mNotificationPanelViewController.isLaunchingAffordanceWithPreview()).thenReturn(true);
|
||||||
|
mStatusBar.updateScrimController();
|
||||||
|
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransitionLaunch_noPreview_doesntGoUnlocked() {
|
||||||
|
mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD);
|
||||||
|
mStatusBar.showKeyguardImpl();
|
||||||
|
|
||||||
|
// Starting a pulse should change the scrim controller to the pulsing state
|
||||||
|
when(mNotificationPanelViewController.isLaunchTransitionRunning()).thenReturn(true);
|
||||||
|
when(mNotificationPanelViewController.isLaunchingAffordanceWithPreview()).thenReturn(false);
|
||||||
|
mStatusBar.updateScrimController();
|
||||||
|
verify(mScrimController).transitionTo(eq(ScrimState.KEYGUARD));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetOccluded_propagatesToScrimController() {
|
public void testSetOccluded_propagatesToScrimController() {
|
||||||
mStatusBar.setOccluded(true);
|
mStatusBar.setOccluded(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user