diff options
4 files changed, 47 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java index 2aa89e86d5c8..37b0625b20cf 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java @@ -669,6 +669,17 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks, } /** + * Whether the user's finger is currently on udfps attempting to authenticate. + */ + public boolean isUdfpsFingerDown() { + if (mUdfpsController == null) { + return false; + } + + return mUdfpsController.isFingerDown(); + } + + /** * Whether the passed userId has enrolled face auth. */ public boolean isFaceAuthEnrolled(int userId) { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 81e60f316bbd..710aca038569 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -822,6 +822,10 @@ public class UdfpsController implements DozeReceiver { mIsAodInterruptActive = false; } + public boolean isFingerDown() { + return mOnFingerDown; + } + private void onFingerDown(int x, int y, float minor, float major) { mExecution.assertIsMainThread(); if (mView == null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index 917c79fc6de5..6d5c53609f81 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -39,6 +39,7 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardViewController; import com.android.systemui.Dumpable; +import com.android.systemui.biometrics.AuthController; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; @@ -165,6 +166,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private BiometricModeListener mBiometricModeListener; private final MetricsLogger mMetricsLogger; + private final AuthController mAuthController; private static final class PendingAuthenticated { public final int userId; @@ -254,7 +256,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp PowerManager powerManager, NotificationMediaManager notificationMediaManager, WakefulnessLifecycle wakefulnessLifecycle, - ScreenLifecycle screenLifecycle) { + ScreenLifecycle screenLifecycle, + AuthController authController) { mContext = context; mPowerManager = powerManager; mShadeController = shadeController; @@ -275,6 +278,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController.setUnlockController(this); mMetricsLogger = metricsLogger; + mAuthController = authController; dumpManager.registerDumpable(getClass().getName(), this); } @@ -596,7 +600,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp return MODE_DISMISS_BOUNCER; } } else if (unlockingAllowed) { - return bypass ? MODE_UNLOCK_FADING : MODE_NONE; + return bypass || mAuthController.isUdfpsFingerDown() + ? MODE_UNLOCK_FADING : MODE_NONE; } else { return bypass ? MODE_SHOW_BOUNCER : MODE_NONE; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index b54f9234188f..60f0b68acac3 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -40,6 +40,7 @@ import android.testing.TestableResources; import com.android.internal.logging.MetricsLogger; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; +import com.android.systemui.biometrics.AuthController; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.ScreenLifecycle; @@ -89,6 +90,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Mock private KeyguardBypassController mKeyguardBypassController; @Mock + private AuthController mAuthController; + @Mock private DozeParameters mDozeParameters; @Mock private MetricsLogger mMetricsLogger; @@ -109,6 +112,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true); when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean())) .thenReturn(true); + when(mAuthController.isUdfpsFingerDown()).thenReturn(false); when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true); mContext.addMockSystemService(PowerManager.class, mPowerManager); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); @@ -118,7 +122,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mNotificationShadeWindowController, mKeyguardStateController, mHandler, mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters, mMetricsLogger, mDumpManager, mPowerManager, - mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle); + mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle, + mAuthController); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener); } @@ -229,6 +234,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test + public void onBiometricAuthenticated_whenFace_andNonBypassAndUdfps_dismissKeyguard() { + when(mKeyguardBypassController.getBypassEnabled()).thenReturn(false); + when(mAuthController.isUdfpsFingerDown()).thenReturn(true); + mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); + + when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); + // 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(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(), + anyBoolean(), anyFloat()); + verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); + assertThat(mBiometricUnlockController.getMode()) + .isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING); + } + + @Test public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() { reset(mUpdateMonitor); when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); |