Skip to content
Snippets Groups Projects
Commit 7160b74b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check KeyguardTransitionInteractor for the current keyguard state" into main

parents 849d1be1 3f4b04b8
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,8 @@ import com.android.systemui.util.time.SystemClock;
import dagger.Lazy;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
......@@ -77,8 +79,6 @@ import java.util.Set;
import javax.inject.Inject;
import kotlinx.coroutines.ExperimentalCoroutinesApi;
/**
* Controller which coordinates all the biometric unlocking actions with the UI.
*/
......@@ -183,6 +183,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private final SystemClock mSystemClock;
private final boolean mOrderUnlockAndWake;
private final Lazy<SelectedUserInteractor> mSelectedUserInteractor;
private final KeyguardTransitionInteractor mKeyguardTransitionInteractor;
private long mLastFpFailureUptimeMillis;
private int mNumConsecutiveFpFailures;
......@@ -323,6 +324,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mOrderUnlockAndWake = resources.getBoolean(
com.android.internal.R.bool.config_orderUnlockAndWake);
mSelectedUserInteractor = selectedUserInteractor;
mKeyguardTransitionInteractor = keyguardTransitionInteractor;
javaAdapter.alwaysCollectFlow(
keyguardTransitionInteractor.getStartedKeyguardTransitionStep(),
this::consumeTransitionStepOnStartedKeyguardState);
......@@ -665,7 +667,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
}
if (isKeyguardShowing) {
if ((mKeyguardViewController.primaryBouncerIsOrWillBeShowing()
|| mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) {
|| mKeyguardTransitionInteractor.getCurrentState()
== KeyguardState.ALTERNATE_BOUNCER) && unlockingAllowed) {
return MODE_DISMISS_BOUNCER;
} else if (unlockingAllowed && bypass) {
return MODE_UNLOCK_COLLAPSING;
......
......@@ -131,6 +131,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
private SelectedUserInteractor mSelectedUserInteractor;
@Mock
private BiometricUnlockInteractor mBiometricUnlockInteractor;
@Mock
private KeyguardTransitionInteractor mKeyguardTransitionInteractor;
private final FakeSystemClock mSystemClock = new FakeSystemClock();
private BiometricUnlockController mBiometricUnlockController;
......@@ -167,7 +169,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
() -> mSelectedUserInteractor,
mBiometricUnlockInteractor,
mock(JavaAdapter.class),
mock(KeyguardTransitionInteractor.class)
mKeyguardTransitionInteractor
);
biometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
biometricUnlockController.addListener(mBiometricUnlockEventsListener);
......@@ -373,6 +375,24 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
.isEqualTo(BiometricSourceType.FACE);
}
@Test
public void onBiometricAuthenticated_whenFaceOnAlternateBouncer_dismissBouncer() {
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
when(mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()).thenReturn(false);
when(mKeyguardTransitionInteractor.getCurrentState())
.thenReturn(KeyguardState.ALTERNATE_BOUNCER);
// the value of isStrongBiometric doesn't matter here since we only care about the returned
// value of isUnlockingWithBiometricAllowed()
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE, true /* isStrongBiometric */);
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_DISMISS_BOUNCER);
assertThat(mBiometricUnlockController.getBiometricType())
.isEqualTo(BiometricSourceType.FACE);
}
@Test
public void onBiometricAuthenticated_whenBypassOnBouncer_dismissBouncer() {
reset(mKeyguardBypassController);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment