Fixed an issue where using UDFPS always dismissed the shade

Because we were only checking for the bouncer to be shown and not
the alternative auth interceptor, the unlock mode always ended up
being unlock_collapse instead of dismiss_bouncer.
The isBouncerShowing() was already taking into account the alternative
auth path, but the bouncerIsOrWillBeShowing() didn't

Fixes: 204049350
Test: atest packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
Change-Id: Id8bf8460bff26ec5694c82466ea63e3cdf61216e
This commit is contained in:
Selim Cinek
2021-10-28 12:01:45 +02:00
parent a9efae988e
commit 703c9e5c42
2 changed files with 22 additions and 1 deletions

View File

@@ -907,7 +907,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override @Override
public boolean bouncerIsOrWillBeShowing() { public boolean bouncerIsOrWillBeShowing() {
return mBouncer.isShowing() || mBouncer.getShowingSoon(); return isBouncerShowing() || mBouncer.getShowingSoon();
} }
public boolean isFullscreenBouncer() { public boolean isFullscreenBouncer() {

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.phone; package com.android.systemui.statusbar.phone;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyFloat;
@@ -97,6 +98,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
@Mock @Mock
private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController; private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
@Mock @Mock
private StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor;
@Mock
private KeyguardMessageArea mKeyguardMessageArea; private KeyguardMessageArea mKeyguardMessageArea;
@Mock @Mock
private Lazy<ShadeController> mShadeController; private Lazy<ShadeController> mShadeController;
@@ -286,6 +289,24 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
verify(cancelAction, never()).run(); verify(cancelAction, never()).run();
} }
@Test
public void testShowing_whenAlternateAuthShowing() {
mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor);
when(mBouncer.isShowing()).thenReturn(false);
when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true);
assertTrue("Is showing not accurate when alternative auth showing",
mStatusBarKeyguardViewManager.isShowing());
}
@Test
public void testWillBeShowing_whenAlternateAuthShowing() {
mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor);
when(mBouncer.isShowing()).thenReturn(false);
when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true);
assertTrue("Is or will be showing not accurate when alternative auth showing",
mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing());
}
@Test @Test
public void testUpdateResources_delegatesToBouncer() { public void testUpdateResources_delegatesToBouncer() {
mStatusBarKeyguardViewManager.updateResources(); mStatusBarKeyguardViewManager.updateResources();