[Bouncer] ensure bouncer not shown with doze state.
When doze state is no longer dozing, we were not resetting the bouncer view. Here, when dozing state changes, we want to ensure that the bouncer is not shown. Fixes: 237822716 Test: Added a unit test and test manually. Change-Id: If085851b5e3c8b15cdd4b0a2fce8cbb5e8f48035
This commit is contained in:
@@ -733,6 +733,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) {
|
||||
reset(dozing /* hideBouncerWhenShowing */);
|
||||
}
|
||||
|
||||
if (bouncerIsOrWillBeShowing()) {
|
||||
// Ensure bouncer is not shown when dozing state changes.
|
||||
hideBouncer(false);
|
||||
}
|
||||
updateStates();
|
||||
|
||||
if (!dozing) {
|
||||
|
||||
@@ -23,9 +23,11 @@ import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.clearInvocations;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
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;
|
||||
|
||||
@@ -525,4 +527,26 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
mBouncerExpansionCallback.onVisibilityChanged(false);
|
||||
verify(mCentralSurfaces).setBouncerShowingOverDream(false);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSetDozing_bouncerShowing_Dozing() {
|
||||
clearInvocations(mBouncer);
|
||||
when(mBouncer.isShowing()).thenReturn(true);
|
||||
doAnswer(invocation -> {
|
||||
when(mBouncer.isShowing()).thenReturn(false);
|
||||
return null;
|
||||
}).when(mBouncer).hide(false);
|
||||
mStatusBarKeyguardViewManager.onDozingChanged(true);
|
||||
verify(mBouncer, times(1)).hide(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetDozing_bouncerShowing_notDozing() {
|
||||
mStatusBarKeyguardViewManager.onDozingChanged(true);
|
||||
when(mBouncer.isShowing()).thenReturn(true);
|
||||
clearInvocations(mBouncer);
|
||||
mStatusBarKeyguardViewManager.onDozingChanged(false);
|
||||
verify(mBouncer, times(1)).hide(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user