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() {
SecurityMode securityMode = getSecurityMode();
mSwipeUpToRetry = mUnlockMethodCache.isUnlockingWithFacePossible()
mSwipeUpToRetry = mUnlockMethodCache.isFaceAuthEnabled()
&& securityMode != SecurityMode.SimPin
&& securityMode != SecurityMode.SimPuk
&& securityMode != SecurityMode.None;

View File

@@ -1783,13 +1783,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
&& 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.
* Not considering encryption or lock down state.
*/
public boolean isUnlockWithFacePossible(int userId) {
public boolean isFaceAuthEnabledForUser(int userId) {
return mFaceManager != null && mFaceManager.isHardwareDetected()
&& !isFaceDisabled(userId)
&& mFaceManager.hasEnrolledTemplates(userId)
&& mFaceSettingEnabledForUser.get(userId);
}

View File

@@ -170,7 +170,7 @@ public class KeyguardBouncer {
// Split up the work over multiple frames.
DejankUtils.removeCallbacks(mResetRunnable);
if (mUnlockMethodCache.isUnlockingWithFacePossible() && !needsFullscreenBouncer()
if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
&& !mKeyguardUpdateMonitor.userNeedsStrongAuth()) {
mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
} 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.
*/
var bypassEnabled: Boolean = false
get() = field && unlockMethodCache.isUnlockingWithFacePossible
get() = field && unlockMethodCache.isFaceAuthEnabled
private set
var bouncerShowing: Boolean = false

View File

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

View File

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

View File

@@ -82,7 +82,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
MockitoAnnotations.initMocks(this);
when(mStatusBarKeyguardViewManager.isShowing()).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.canPlaySubtleWindowAnimations()).thenReturn(true);
mContext.addMockSystemService(PowerManager.class, mPowerManager);

View File

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