From 60ed09f4d8d4157dd5550182ae0c4b959f341c7f Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Fri, 2 Jun 2023 16:43:32 +0200 Subject: [PATCH] Remove flicker when unlocking + turning off screen As soon as the screen starts turning off, powerManager.isInteractive() becomes false. This forces the home wallpaper leash back to completely invisible again, which creates a noticeable flicker. Since the wallpaper is controlled through a leash, we don't have a problem leaving it at some intermediate opacity. It will get cleaned up and removed later. Test: manual (unlock, power off during unlock animation) Change-Id: I8e8cf659b1f72dd183825f3f0d27c12ddf3c59b2 --- .../systemui/keyguard/KeyguardUnlockAnimationController.kt | 5 +---- .../keyguard/KeyguardUnlockAnimationControllerTest.kt | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index 57c7b09759a5f..40db84756c175 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -902,10 +902,7 @@ class KeyguardUnlockAnimationController @Inject constructor( } fun setWallpaperAppearAmount(amount: Float) { - val animationAlpha = when { - !powerManager.isInteractive -> 0f - else -> amount - } + val animationAlpha = amount wallpaperTargets?.forEach { wallpaper -> // SyncRtSurfaceTransactionApplier cannot apply transaction when the target view is diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt index 001f81af5c2bb..81592f02b5b44 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt @@ -343,8 +343,6 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { // We expect that we've set the surface behind to alpha = 0f since we're not interactive. assertEquals(0f, params.alpha) assertTrue(params.matrix.isIdentity) - assertEquals("Wallpaper surface was expected to have opacity 0", - 0f, captorWp.getLastValue().alpha) verifyNoMoreInteractions(surfaceTransactionApplier) }