From 80aeafc595fd9dd8b45aeefdfa423d0cb8df9e6c Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Tue, 24 May 2022 09:25:43 -0400 Subject: Fix bouncer flicker on lockscreen shade transition Both CentralSurfacesImpl and StatusBarKeyguardViewManager are attempting to control bouncer visibility on shade collapse, leading to potential conflict. Let StatusBarKeyguardViewManager handle this scenario. Fixes: 232948170 Test: From home, power off, power on, swipe down to see notifs, swipe up Change-Id: I1a1ad69b71887052eb208d6d6c1f3b7783a1834a --- .../com/android/systemui/statusbar/phone/CentralSurfacesImpl.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 5c12671726f4..8203987cd7d6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -107,7 +107,6 @@ import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityManager; import android.widget.DateTimeView; -import android.window.SplashScreen; import androidx.annotation.NonNull; import androidx.lifecycle.Lifecycle; @@ -3508,11 +3507,6 @@ public class CentralSurfacesImpl extends CoreStartable implements @Override public void onTrackingStopped(boolean expand) { - if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) { - if (!expand && !mKeyguardStateController.canDismissLockScreen()) { - mStatusBarKeyguardViewManager.showBouncer(false /* scrimmed */); - } - } } // TODO: Figure out way to remove these. -- cgit v1.2.3-59-g8ed1b From 1de979862bcdd1fe8cb78bc210d4165dd561f45b Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Tue, 24 May 2022 11:31:46 -0400 Subject: Run cancelAction if bouncer is canceled The cancelAction was never run on non-UDFPS devices when the bouncer was canceled. The check for bouncerIsOrWillBeShowing() will always be true, so move the call to cancel AFTER the bouncer hide() invocation. Fixes: 233741191 Test: atest StatusBarKeyguardViewManagerTest Change-Id: I0ababa6b69cdc3fea558c063a8d3839172470ee1 --- .../statusbar/phone/StatusBarKeyguardViewManager.java | 2 +- .../statusbar/phone/StatusBarKeyguardViewManagerTest.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 124647b81d4a..61e123a8e42a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -480,12 +480,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (mBouncer == null) { return; } + mBouncer.hide(destroyView); if (mShowing) { // If we were showing the bouncer and then aborting, we need to also clear out any // potential actions unless we actually unlocked. cancelPostAuthActions(); } - mBouncer.hide(destroyView); cancelPendingWakeupAction(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 38e018b42985..4f2abf263a9b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -312,12 +312,27 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mStatusBarKeyguardViewManager.dismissWithAction( action, cancelAction, true /* afterKeyguardGone */); + when(mBouncer.isShowing()).thenReturn(false); mStatusBarKeyguardViewManager.hideBouncer(true); mStatusBarKeyguardViewManager.hide(0, 30); verify(action, never()).onDismiss(); verify(cancelAction).run(); } + @Test + public void testHidingBouncer_cancelsGoneRunnable() { + OnDismissAction action = mock(OnDismissAction.class); + Runnable cancelAction = mock(Runnable.class); + mStatusBarKeyguardViewManager.dismissWithAction( + action, cancelAction, true /* afterKeyguardGone */); + + when(mBouncer.isShowing()).thenReturn(false); + mStatusBarKeyguardViewManager.hideBouncer(true); + + verify(action, never()).onDismiss(); + verify(cancelAction).run(); + } + @Test public void testHiding_doesntCancelWhenShowing() { OnDismissAction action = mock(OnDismissAction.class); -- cgit v1.2.3-59-g8ed1b