Merge "Isolate DPM and SIM PIN states from UX" into qt-r1-dev

This commit is contained in:
Lucas Dupin
2019-07-24 01:15:39 +00:00
committed by Android (Google) Code Review
8 changed files with 31 additions and 14 deletions

View File

@@ -269,7 +269,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
*/ */
private void updateBiometricRetry() { private void updateBiometricRetry() {
SecurityMode securityMode = getSecurityMode(); SecurityMode securityMode = getSecurityMode();
mSwipeUpToRetry = mUnlockMethodCache.isUnlockingWithFacePossible() mSwipeUpToRetry = mUnlockMethodCache.isFaceAuthEnabled()
&& securityMode != SecurityMode.SimPin && securityMode != SecurityMode.SimPin
&& securityMode != SecurityMode.SimPuk && securityMode != SecurityMode.SimPuk
&& securityMode != SecurityMode.None; && securityMode != SecurityMode.None;

View File

@@ -1783,13 +1783,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
&& mFpm.getEnrolledFingerprints(userId).size() > 0; && mFpm.getEnrolledFingerprints(userId).size() > 0;
} }
private boolean isUnlockWithFacePossible(int userId) {
return isFaceAuthEnabledForUser(userId) && !isFaceDisabled(userId);
}
/** /**
* If face hardware is available, user has enrolled and enabled auth via setting. * If face hardware is available, user has enrolled and enabled auth via setting.
* Not considering encryption or lock down state.
*/ */
public boolean isUnlockWithFacePossible(int userId) { public boolean isFaceAuthEnabledForUser(int userId) {
return mFaceManager != null && mFaceManager.isHardwareDetected() return mFaceManager != null && mFaceManager.isHardwareDetected()
&& !isFaceDisabled(userId)
&& mFaceManager.hasEnrolledTemplates(userId) && mFaceManager.hasEnrolledTemplates(userId)
&& mFaceSettingEnabledForUser.get(userId); && mFaceSettingEnabledForUser.get(userId);
} }

View File

@@ -170,7 +170,7 @@ public class KeyguardBouncer {
// Split up the work over multiple frames. // Split up the work over multiple frames.
DejankUtils.removeCallbacks(mResetRunnable); DejankUtils.removeCallbacks(mResetRunnable);
if (mUnlockMethodCache.isUnlockingWithFacePossible() && !needsFullscreenBouncer() if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
&& !mKeyguardUpdateMonitor.userNeedsStrongAuth()) { && !mKeyguardUpdateMonitor.userNeedsStrongAuth()) {
mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY); mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
} else { } else {

View File

@@ -47,7 +47,7 @@ class KeyguardBypassController {
* If face unlock dismisses the lock screen or keeps user on keyguard for the current user. * If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
*/ */
var bypassEnabled: Boolean = false var bypassEnabled: Boolean = false
get() = field && unlockMethodCache.isUnlockingWithFacePossible get() = field && unlockMethodCache.isFaceAuthEnabled
private set private set
var bouncerShowing: Boolean = false var bouncerShowing: Boolean = false

View File

@@ -2390,6 +2390,10 @@ public class StatusBar extends SystemUI implements DemoMode,
mLightBarController.dump(fd, pw, args); mLightBarController.dump(fd, pw, args);
} }
if (mUnlockMethodCache != null) {
mUnlockMethodCache.dump(pw);
}
if (mKeyguardBypassController != null) { if (mKeyguardBypassController != null) {
mKeyguardBypassController.dump(pw); mKeyguardBypassController.dump(pw);
} }

View File

@@ -28,6 +28,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
@@ -51,7 +52,7 @@ public class UnlockMethodCache {
private boolean mTrustManaged; private boolean mTrustManaged;
private boolean mTrusted; private boolean mTrusted;
private boolean mDebugUnlocked = false; private boolean mDebugUnlocked = false;
private boolean mIsUnlockingWithFacePossible; private boolean mFaceAuthEnabled;
private UnlockMethodCache(Context ctx) { private UnlockMethodCache(Context ctx) {
mLockPatternUtils = new LockPatternUtils(ctx); mLockPatternUtils = new LockPatternUtils(ctx);
@@ -110,8 +111,8 @@ public class UnlockMethodCache {
/** /**
* If there are faces enrolled and user enabled face auth on keyguard. * If there are faces enrolled and user enabled face auth on keyguard.
*/ */
public boolean isUnlockingWithFacePossible() { public boolean isFaceAuthEnabled() {
return mIsUnlockingWithFacePossible; return mFaceAuthEnabled;
} }
private void update(boolean updateAlways) { private void update(boolean updateAlways) {
@@ -122,16 +123,16 @@ public class UnlockMethodCache {
|| (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked); || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user); boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user); boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
boolean isUnlockingWithFacePossible = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user); boolean faceAuthEnabled = mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(user);
boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer
|| trustManaged != mTrustManaged || trustManaged != mTrustManaged
|| mIsUnlockingWithFacePossible != isUnlockingWithFacePossible; || mFaceAuthEnabled != faceAuthEnabled;
if (changed || updateAlways) { if (changed || updateAlways) {
mSecure = secure; mSecure = secure;
mCanSkipBouncer = canSkipBouncer; mCanSkipBouncer = canSkipBouncer;
mTrusted = trusted; mTrusted = trusted;
mTrustManaged = trustManaged; mTrustManaged = trustManaged;
mIsUnlockingWithFacePossible = isUnlockingWithFacePossible; mFaceAuthEnabled = faceAuthEnabled;
notifyListeners(); notifyListeners();
} }
Trace.endSection(); Trace.endSection();
@@ -143,6 +144,16 @@ public class UnlockMethodCache {
} }
} }
public void dump(PrintWriter pw) {
pw.println("UnlockMethodCache");
pw.println(" mSecure: " + mSecure);
pw.println(" mCanSkipBouncer: " + mCanSkipBouncer);
pw.println(" mTrustManaged: " + mTrustManaged);
pw.println(" mTrusted: " + mTrusted);
pw.println(" mDebugUnlocked: " + mDebugUnlocked);
pw.println(" mFaceAuthEnabled: " + mFaceAuthEnabled);
}
private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() { private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
@Override @Override
public void onUserSwitchComplete(int userId) { public void onUserSwitchComplete(int userId) {

View File

@@ -82,7 +82,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true); when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true); when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true);
when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true); when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
mContext.addMockSystemService(PowerManager.class, mPowerManager); mContext.addMockSystemService(PowerManager.class, mPowerManager);

View File

@@ -379,7 +379,7 @@ public class KeyguardBouncerTest extends SysuiTestCase {
@Test @Test
public void testShow_delaysIfFaceAuthIsRunning() { public void testShow_delaysIfFaceAuthIsRunning() {
when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true); when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
mBouncer.show(true /* reset */); mBouncer.show(true /* reset */);
ArgumentCaptor<Runnable> showRunnable = ArgumentCaptor.forClass(Runnable.class); ArgumentCaptor<Runnable> showRunnable = ArgumentCaptor.forClass(Runnable.class);