Merge "Don't animate depth when changing brightness" into sc-dev

This commit is contained in:
Lucas Dupin
2021-04-27 15:25:17 +00:00
committed by Android (Google) Code Review
3 changed files with 0 additions and 41 deletions

View File

@@ -98,15 +98,6 @@ class NotificationShadeDepthController @Inject constructor(
var globalActionsSpring = DepthAnimation()
var showingHomeControls: Boolean = false
@VisibleForTesting
var brightnessMirrorSpring = DepthAnimation()
var brightnessMirrorVisible: Boolean = false
set(value) {
field = value
brightnessMirrorSpring.animateTo(if (value) blurUtils.blurRadiusOfRatio(1f)
else 0)
}
var qsPanelExpansion = 0f
set(value) {
if (field == value) return
@@ -169,7 +160,6 @@ class NotificationShadeDepthController @Inject constructor(
normalizedBlurRadius * ANIMATION_BLUR_FRACTION).toInt()
combinedBlur = max(combinedBlur, blurUtils.blurRadiusOfRatio(qsPanelExpansion))
var shadeRadius = max(combinedBlur, wakeAndUnlockBlurRadius).toFloat()
shadeRadius *= 1f - brightnessMirrorSpring.ratio
val launchProgress = notificationLaunchAnimationParams?.linearProgress ?: 0f
shadeRadius *= (1f - launchProgress) * (1f - launchProgress)
@@ -263,7 +253,6 @@ class NotificationShadeDepthController @Inject constructor(
shadeSpring.finishIfRunning()
shadeAnimation.finishIfRunning()
globalActionsSpring.finishIfRunning()
brightnessMirrorSpring.finishIfRunning()
}
}
@@ -425,7 +414,6 @@ class NotificationShadeDepthController @Inject constructor(
it.println("shadeRadius: ${shadeSpring.radius}")
it.println("shadeAnimation: ${shadeAnimation.radius}")
it.println("globalActionsRadius: ${globalActionsSpring.radius}")
it.println("brightnessMirrorRadius: ${brightnessMirrorSpring.radius}")
it.println("wakeAndUnlockBlur: $wakeAndUnlockBlurRadius")
it.println("notificationLaunchAnimationProgress: " +
"${notificationLaunchAnimationParams?.linearProgress}")

View File

@@ -74,13 +74,11 @@ public class BrightnessMirrorController
mBrightnessMirror.setVisibility(View.VISIBLE);
mVisibilityCallback.accept(true);
mNotificationPanel.setPanelAlpha(0, true /* animate */);
mDepthController.setBrightnessMirrorVisible(true);
}
public void hideMirror() {
mVisibilityCallback.accept(false);
mNotificationPanel.setPanelAlpha(255, true /* animate */);
mDepthController.setBrightnessMirrorVisible(false);
}
/**

View File

@@ -69,7 +69,6 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
@Mock private lateinit var shadeSpring: NotificationShadeDepthController.DepthAnimation
@Mock private lateinit var shadeAnimation: NotificationShadeDepthController.DepthAnimation
@Mock private lateinit var globalActionsSpring: NotificationShadeDepthController.DepthAnimation
@Mock private lateinit var brightnessSpring: NotificationShadeDepthController.DepthAnimation
@Mock private lateinit var listener: NotificationShadeDepthController.DepthListener
@Mock private lateinit var dozeParameters: DozeParameters
@JvmField @Rule val mockitoRule = MockitoJUnit.rule()
@@ -97,7 +96,6 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
notificationShadeWindowController, dozeParameters, dumpManager)
notificationShadeDepthController.shadeSpring = shadeSpring
notificationShadeDepthController.shadeAnimation = shadeAnimation
notificationShadeDepthController.brightnessMirrorSpring = brightnessSpring
notificationShadeDepthController.globalActionsSpring = globalActionsSpring
notificationShadeDepthController.root = root
@@ -244,31 +242,6 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
verify(wallpaperManager).setWallpaperZoomOut(any(), anyFloat())
}
@Test
fun brightnessMirrorVisible_whenVisible() {
notificationShadeDepthController.brightnessMirrorVisible = true
verify(brightnessSpring).animateTo(eq(maxBlur), any())
}
@Test
fun brightnessMirrorVisible_whenHidden() {
notificationShadeDepthController.brightnessMirrorVisible = false
verify(brightnessSpring).animateTo(eq(0), any())
}
@Test
fun brightnessMirror_hidesShadeBlur() {
// Brightness mirror is fully visible
`when`(brightnessSpring.ratio).thenReturn(1f)
// And shade is blurred
`when`(shadeSpring.radius).thenReturn(maxBlur)
`when`(shadeAnimation.radius).thenReturn(maxBlur)
notificationShadeDepthController.updateBlurCallback.doFrame(0)
verify(notificationShadeWindowController).setBackgroundBlurRadius(0)
verify(blurUtils).applyBlur(eq(viewRootImpl), eq(0))
}
@Test
fun setNotificationLaunchAnimationParams_schedulesFrame() {
val animProgress = ExpandAnimationParameters()