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:
@@ -668,6 +668,17 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -228,6 +233,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
.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
|
||||
public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() {
|
||||
reset(mUpdateMonitor);
|
||||
|
||||
Reference in New Issue
Block a user