Merge "NonBypass - enter device if user is attempting udfps auth" into sc-dev am: ec1a26e36c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15235696

Change-Id: I685d0dcf237a9c8549d42e63d95ce4392d4bb7f1
This commit is contained in:
Beverly Tai
2021-07-08 22:55:51 +00:00
committed by Automerger Merge Worker
4 changed files with 47 additions and 3 deletions

View File

@@ -668,6 +668,17 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
mCurrentDialog = null; mCurrentDialog = null;
} }
/**
* 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. * Whether the passed userId has enrolled face auth.
*/ */

View File

@@ -822,6 +822,10 @@ public class UdfpsController implements DozeReceiver {
mIsAodInterruptActive = false; mIsAodInterruptActive = false;
} }
public boolean isFingerDown() {
return mOnFingerDown;
}
private void onFingerDown(int x, int y, float minor, float major) { private void onFingerDown(int x, int y, float minor, float major) {
mExecution.assertIsMainThread(); mExecution.assertIsMainThread();
if (mView == null) { if (mView == null) {

View File

@@ -39,6 +39,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardViewController; import com.android.keyguard.KeyguardViewController;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
@@ -165,6 +166,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private BiometricModeListener mBiometricModeListener; private BiometricModeListener mBiometricModeListener;
private final MetricsLogger mMetricsLogger; private final MetricsLogger mMetricsLogger;
private final AuthController mAuthController;
private static final class PendingAuthenticated { private static final class PendingAuthenticated {
public final int userId; public final int userId;
@@ -254,7 +256,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
PowerManager powerManager, PowerManager powerManager,
NotificationMediaManager notificationMediaManager, NotificationMediaManager notificationMediaManager,
WakefulnessLifecycle wakefulnessLifecycle, WakefulnessLifecycle wakefulnessLifecycle,
ScreenLifecycle screenLifecycle) { ScreenLifecycle screenLifecycle,
AuthController authController) {
mContext = context; mContext = context;
mPowerManager = powerManager; mPowerManager = powerManager;
mShadeController = shadeController; mShadeController = shadeController;
@@ -275,6 +278,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController = keyguardBypassController;
mKeyguardBypassController.setUnlockController(this); mKeyguardBypassController.setUnlockController(this);
mMetricsLogger = metricsLogger; mMetricsLogger = metricsLogger;
mAuthController = authController;
dumpManager.registerDumpable(getClass().getName(), this); dumpManager.registerDumpable(getClass().getName(), this);
} }
@@ -596,7 +600,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
return MODE_DISMISS_BOUNCER; return MODE_DISMISS_BOUNCER;
} }
} else if (unlockingAllowed) { } else if (unlockingAllowed) {
return bypass ? MODE_UNLOCK_FADING : MODE_NONE; return bypass || mAuthController.isUdfpsFingerDown()
? MODE_UNLOCK_FADING : MODE_NONE;
} else { } else {
return bypass ? MODE_SHOW_BOUNCER : MODE_NONE; return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
} }

View File

@@ -40,6 +40,7 @@ import android.testing.TestableResources;
import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsLogger;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.ScreenLifecycle;
@@ -89,6 +90,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Mock @Mock
private KeyguardBypassController mKeyguardBypassController; private KeyguardBypassController mKeyguardBypassController;
@Mock @Mock
private AuthController mAuthController;
@Mock
private DozeParameters mDozeParameters; private DozeParameters mDozeParameters;
@Mock @Mock
private MetricsLogger mMetricsLogger; private MetricsLogger mMetricsLogger;
@@ -109,6 +112,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true); when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean())) when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean()))
.thenReturn(true); .thenReturn(true);
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true); when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
mContext.addMockSystemService(PowerManager.class, mPowerManager); mContext.addMockSystemService(PowerManager.class, mPowerManager);
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
@@ -118,7 +122,8 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mNotificationShadeWindowController, mKeyguardStateController, mHandler, mNotificationShadeWindowController, mKeyguardStateController, mHandler,
mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters, mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,
mMetricsLogger, mDumpManager, mPowerManager, mMetricsLogger, mDumpManager, mPowerManager,
mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle); mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle,
mAuthController);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener); mBiometricUnlockController.setBiometricModeListener(mBiometricModeListener);
} }
@@ -228,6 +233,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
.isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING); .isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING);
} }
@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 @Test
public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() { public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() {
reset(mUpdateMonitor); reset(mUpdateMonitor);