[DO NOT MERGE] Remove MODE_WAKE_AND_UNLOCK_PULSING from stopDozing am: ddc1437ca0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19903005

Change-Id: I772277c7f4978035da86e8e5c33415cebe69f4d4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Matt Pietal
2022-09-09 17:45:09 +00:00
committed by Automerger Merge Worker
6 changed files with 32 additions and 67 deletions

View File

@@ -81,7 +81,6 @@ class NotificationShadeDepthController @Inject constructor(
} }
lateinit var root: View lateinit var root: View
private var blurRoot: View? = null
private var keyguardAnimator: Animator? = null private var keyguardAnimator: Animator? = null
private var notificationAnimator: Animator? = null private var notificationAnimator: Animator? = null
private var updateScheduled: Boolean = false private var updateScheduled: Boolean = false
@@ -235,7 +234,7 @@ class NotificationShadeDepthController @Inject constructor(
val opaque = scrimsVisible && !blursDisabledForAppLaunch val opaque = scrimsVisible && !blursDisabledForAppLaunch
Trace.traceCounter(Trace.TRACE_TAG_APP, "shade_blur_radius", blur) Trace.traceCounter(Trace.TRACE_TAG_APP, "shade_blur_radius", blur)
blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur, opaque) blurUtils.applyBlur(root.viewRootImpl, blur, opaque)
lastAppliedBlur = blur lastAppliedBlur = blur
wallpaperController.setNotificationShadeZoom(zoomOut) wallpaperController.setNotificationShadeZoom(zoomOut)
listeners.forEach { listeners.forEach {
@@ -271,7 +270,6 @@ class NotificationShadeDepthController @Inject constructor(
override fun onAnimationEnd(animation: Animator?) { override fun onAnimationEnd(animation: Animator?) {
keyguardAnimator = null keyguardAnimator = null
wakeAndUnlockBlurRadius = 0f wakeAndUnlockBlurRadius = 0f
scheduleUpdate()
} }
}) })
start() start()
@@ -302,7 +300,6 @@ class NotificationShadeDepthController @Inject constructor(
override fun onDozeAmountChanged(linear: Float, eased: Float) { override fun onDozeAmountChanged(linear: Float, eased: Float) {
wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased) wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased)
scheduleUpdate()
} }
} }
@@ -439,12 +436,11 @@ class NotificationShadeDepthController @Inject constructor(
shadeAnimation.animateTo(blurUtils.blurRadiusOfRatio(targetBlurNormalized).toInt()) shadeAnimation.animateTo(blurUtils.blurRadiusOfRatio(targetBlurNormalized).toInt())
} }
private fun scheduleUpdate(viewToBlur: View? = null) { private fun scheduleUpdate() {
if (updateScheduled) { if (updateScheduled) {
return return
} }
updateScheduled = true updateScheduled = true
blurRoot = viewToBlur
choreographer.postFrameCallback(updateBlurCallback) choreographer.postFrameCallback(updateBlurCallback)
} }
@@ -495,16 +491,11 @@ class NotificationShadeDepthController @Inject constructor(
*/ */
private var pendingRadius = -1 private var pendingRadius = -1
/**
* View on {@link Surface} that wants depth.
*/
private var view: View? = null
private var springAnimation = SpringAnimation(this, object : private var springAnimation = SpringAnimation(this, object :
FloatPropertyCompat<DepthAnimation>("blurRadius") { FloatPropertyCompat<DepthAnimation>("blurRadius") {
override fun setValue(rect: DepthAnimation?, value: Float) { override fun setValue(rect: DepthAnimation?, value: Float) {
radius = value radius = value
scheduleUpdate(view) scheduleUpdate()
} }
override fun getValue(rect: DepthAnimation?): Float { override fun getValue(rect: DepthAnimation?): Float {
@@ -519,11 +510,10 @@ class NotificationShadeDepthController @Inject constructor(
springAnimation.addEndListener { _, _, _, _ -> pendingRadius = -1 } springAnimation.addEndListener { _, _, _, _ -> pendingRadius = -1 }
} }
fun animateTo(newRadius: Int, viewToBlur: View? = null) { fun animateTo(newRadius: Int) {
if (pendingRadius == newRadius && view == viewToBlur) { if (pendingRadius == newRadius) {
return return
} }
view = viewToBlur
pendingRadius = newRadius pendingRadius = newRadius
springAnimation.animateToFinalPosition(newRadius.toFloat()) springAnimation.animateToFinalPosition(newRadius.toFloat())
} }

View File

@@ -394,8 +394,6 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn
void fadeKeyguardAfterLaunchTransition(Runnable beforeFading, void fadeKeyguardAfterLaunchTransition(Runnable beforeFading,
Runnable endRunnable, Runnable cancelRunnable); Runnable endRunnable, Runnable cancelRunnable);
void fadeKeyguardWhilePulsing();
void animateKeyguardUnoccluding(); void animateKeyguardUnoccluding();
void startLaunchTransitionTimeout(); void startLaunchTransitionTimeout();

View File

@@ -3024,19 +3024,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
mLaunchTransitionCancelRunnable = null; mLaunchTransitionCancelRunnable = null;
} }
/**
* Fades the content of the Keyguard while we are dozing and makes it invisible when finished
* fading.
*/
@Override
public void fadeKeyguardWhilePulsing() {
mNotificationPanelViewController.fadeOut(0, FADE_KEYGUARD_DURATION_PULSING,
()-> {
hideKeyguard();
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
}).start();
}
/** /**
* Plays the animation when an activity that was occluding Keyguard goes away. * Plays the animation when an activity that was occluding Keyguard goes away.
*/ */

View File

@@ -209,12 +209,8 @@ public final class DozeServiceHost implements DozeHost {
void updateDozing() { void updateDozing() {
Assert.isMainThread(); Assert.isMainThread();
// When in wake-and-unlock while pulsing, keep dozing state until fully unlocked. boolean dozing =
boolean mDozingRequested && mStatusBarStateController.getState() == StatusBarState.KEYGUARD;
dozing =
mDozingRequested && mStatusBarStateController.getState() == StatusBarState.KEYGUARD
|| mBiometricUnlockControllerLazy.get().getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
// When in wake-and-unlock we may not have received a change to StatusBarState // When in wake-and-unlock we may not have received a change to StatusBarState
// but we still should not be dozing, manually set to false. // but we still should not be dozing, manually set to false.
if (mBiometricUnlockControllerLazy.get().getMode() if (mBiometricUnlockControllerLazy.get().getMode()

View File

@@ -838,15 +838,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}); });
} else { } else {
executeAfterKeyguardGoneAction(); executeAfterKeyguardGoneAction();
boolean wakeUnlockPulsing =
mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
mCentralSurfaces.setKeyguardFadingAway(startTime, delay, fadeoutDuration); mCentralSurfaces.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
mBiometricUnlockController.startKeyguardFadingAway(); mBiometricUnlockController.startKeyguardFadingAway();
hideBouncer(true /* destroyView */); hideBouncer(true /* destroyView */);
if (wakeUnlockPulsing) {
mCentralSurfaces.fadeKeyguardWhilePulsing();
wakeAndUnlockDejank();
} else {
boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
if (!staying) { if (!staying) {
mNotificationShadeWindowController.setKeyguardFadingAway(true); mNotificationShadeWindowController.setKeyguardFadingAway(true);
@@ -862,7 +857,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mCentralSurfaces.finishKeyguardFadingAway(); mCentralSurfaces.finishKeyguardFadingAway();
mBiometricUnlockController.finishKeyguardFadingAway(); mBiometricUnlockController.finishKeyguardFadingAway();
} }
}
updateStates(); updateStates();
mNotificationShadeWindowController.setKeyguardShowing(false); mNotificationShadeWindowController.setKeyguardShowing(false);

View File

@@ -48,7 +48,6 @@ import org.mockito.ArgumentMatchers.floatThat
import org.mockito.Captor import org.mockito.Captor
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito import org.mockito.Mockito
import org.mockito.Mockito.`when`
import org.mockito.Mockito.any import org.mockito.Mockito.any
import org.mockito.Mockito.anyFloat import org.mockito.Mockito.anyFloat
import org.mockito.Mockito.anyString import org.mockito.Mockito.anyString
@@ -56,6 +55,7 @@ import org.mockito.Mockito.clearInvocations
import org.mockito.Mockito.never import org.mockito.Mockito.never
import org.mockito.Mockito.reset import org.mockito.Mockito.reset
import org.mockito.Mockito.verify import org.mockito.Mockito.verify
import org.mockito.Mockito.`when`
import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoJUnit
@RunWith(AndroidTestingRunner::class) @RunWith(AndroidTestingRunner::class)
@@ -139,7 +139,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
notificationShadeDepthController.onPanelExpansionChanged( notificationShadeDepthController.onPanelExpansionChanged(
PanelExpansionChangeEvent( PanelExpansionChangeEvent(
fraction = 1f, expanded = true, tracking = false, dragDownPxAmount = 0f)) fraction = 1f, expanded = true, tracking = false, dragDownPxAmount = 0f))
verify(shadeAnimation).animateTo(eq(maxBlur), any()) verify(shadeAnimation).animateTo(eq(maxBlur))
} }
@Test @Test
@@ -147,7 +147,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
notificationShadeDepthController.onPanelExpansionChanged( notificationShadeDepthController.onPanelExpansionChanged(
PanelExpansionChangeEvent( PanelExpansionChangeEvent(
fraction = 0.01f, expanded = false, tracking = false, dragDownPxAmount = 0f)) fraction = 0.01f, expanded = false, tracking = false, dragDownPxAmount = 0f))
verify(shadeAnimation).animateTo(eq(maxBlur), any()) verify(shadeAnimation).animateTo(eq(maxBlur))
} }
@Test @Test
@@ -157,7 +157,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
notificationShadeDepthController.onPanelExpansionChanged( notificationShadeDepthController.onPanelExpansionChanged(
PanelExpansionChangeEvent( PanelExpansionChangeEvent(
fraction = 0f, expanded = false, tracking = false, dragDownPxAmount = 0f)) fraction = 0f, expanded = false, tracking = false, dragDownPxAmount = 0f))
verify(shadeAnimation).animateTo(eq(0), any()) verify(shadeAnimation).animateTo(eq(0))
} }
@Test @Test
@@ -168,15 +168,15 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
onPanelExpansionChanged_apliesBlur_ifShade() onPanelExpansionChanged_apliesBlur_ifShade()
clearInvocations(shadeAnimation) clearInvocations(shadeAnimation)
notificationShadeDepthController.onPanelExpansionChanged(event) notificationShadeDepthController.onPanelExpansionChanged(event)
verify(shadeAnimation, never()).animateTo(anyInt(), any()) verify(shadeAnimation, never()).animateTo(anyInt())
notificationShadeDepthController.onPanelExpansionChanged( notificationShadeDepthController.onPanelExpansionChanged(
event.copy(fraction = 0.9f, tracking = true)) event.copy(fraction = 0.9f, tracking = true))
verify(shadeAnimation, never()).animateTo(anyInt(), any()) verify(shadeAnimation, never()).animateTo(anyInt())
notificationShadeDepthController.onPanelExpansionChanged( notificationShadeDepthController.onPanelExpansionChanged(
event.copy(fraction = 0.8f, tracking = false)) event.copy(fraction = 0.8f, tracking = false))
verify(shadeAnimation).animateTo(eq(0), any()) verify(shadeAnimation).animateTo(eq(0))
} }
@Test @Test
@@ -186,7 +186,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
notificationShadeDepthController.onPanelExpansionChanged( notificationShadeDepthController.onPanelExpansionChanged(
PanelExpansionChangeEvent( PanelExpansionChangeEvent(
fraction = 0.6f, expanded = true, tracking = true, dragDownPxAmount = 0f)) fraction = 0.6f, expanded = true, tracking = true, dragDownPxAmount = 0f))
verify(shadeAnimation).animateTo(eq(maxBlur), any()) verify(shadeAnimation).animateTo(eq(maxBlur))
} }
@Test @Test
@@ -212,7 +212,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
statusBarState = StatusBarState.KEYGUARD statusBarState = StatusBarState.KEYGUARD
statusBarStateListener.onStateChanged(statusBarState) statusBarStateListener.onStateChanged(statusBarState)
verify(shadeAnimation).animateTo(eq(0), any()) verify(shadeAnimation).animateTo(eq(0))
} }
@Test @Test
@@ -395,13 +395,13 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
@Test @Test
fun brightnessMirrorVisible_whenVisible() { fun brightnessMirrorVisible_whenVisible() {
notificationShadeDepthController.brightnessMirrorVisible = true notificationShadeDepthController.brightnessMirrorVisible = true
verify(brightnessSpring).animateTo(eq(maxBlur), any()) verify(brightnessSpring).animateTo(eq(maxBlur))
} }
@Test @Test
fun brightnessMirrorVisible_whenHidden() { fun brightnessMirrorVisible_whenHidden() {
notificationShadeDepthController.brightnessMirrorVisible = false notificationShadeDepthController.brightnessMirrorVisible = false
verify(brightnessSpring).animateTo(eq(0), any()) verify(brightnessSpring).animateTo(eq(0))
} }
@Test @Test
@@ -424,7 +424,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
fun ignoreShadeBlurUntilHidden_whennNull_ignoresIfShadeHasNoBlur() { fun ignoreShadeBlurUntilHidden_whennNull_ignoresIfShadeHasNoBlur() {
`when`(shadeAnimation.radius).thenReturn(0f) `when`(shadeAnimation.radius).thenReturn(0f)
notificationShadeDepthController.blursDisabledForAppLaunch = true notificationShadeDepthController.blursDisabledForAppLaunch = true
verify(shadeAnimation, never()).animateTo(anyInt(), any()) verify(shadeAnimation, never()).animateTo(anyInt())
} }
private fun enableSplitShade() { private fun enableSplitShade() {