From 590051205d6ca952b9306b0bf1ce1ffe15f60d4c Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 15 Sep 2022 14:23:56 -0700 Subject: [PATCH] [Bouncer] reset bouncer visibility with doze state. When doze state is no longer dozing, we were not resetting the bouncer view. Here, regardless of set to doze or set to not doze, we reset the bouncer view. Fixes: 237822716 Test: Added a unit test and test manually. Change-Id: Ia58356827ffbc96c5467369dc1e00ed9e4535e5e --- .../phone/StatusBarKeyguardViewManager.java | 4 +--- .../StatusBarKeyguardViewManagerTest.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) 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 4c5c23cd3b2fd..7867147165962 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -667,9 +667,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private void setDozing(boolean dozing) { if (mDozing != dozing) { mDozing = dozing; - if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) { - reset(dozing /* hideBouncerWhenShowing */); - } + reset(true /* hideBouncerWhenShowing */); updateStates(); if (!dozing) { 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 e790d85763d03..a4453f854ce5a 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 @@ -26,6 +26,7 @@ import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -505,4 +506,21 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mBouncerExpansionCallback.onVisibilityChanged(false); verify(mCentralSurfaces).setBouncerShowingOverDream(false); } + + @Test + public void testSetDozing_Dozing() { + clearInvocations(mBouncer); + mStatusBarKeyguardViewManager.onDozingChanged(true); + // Once when shown and once with dozing changed. + verify(mBouncer, times(1)).hide(false); + } + + @Test + public void testSetDozing_notDozing() { + mStatusBarKeyguardViewManager.onDozingChanged(true); + clearInvocations(mBouncer); + mStatusBarKeyguardViewManager.onDozingChanged(false); + // Once when shown and twice with dozing changed. + verify(mBouncer, times(1)).hide(false); + } }