Merge "Check whether udfps is supported instead of enrolled" into sc-v2-dev am: 51f3c67088
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16230363 Change-Id: Icc956458ac8269e02e362c15d6bf4b9bd4ab239f
This commit is contained in:
@@ -2044,17 +2044,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if there's at least one udfps enrolled
|
* @return true if there's at least one udfps enrolled for the current user.
|
||||||
*/
|
*/
|
||||||
public boolean isUdfpsEnrolled() {
|
public boolean isUdfpsEnrolled() {
|
||||||
return mIsUdfpsEnrolled;
|
return mIsUdfpsEnrolled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if udfps is available on this device. will return true even if the user hasn't
|
* @return true if udfps HW is supported on this device. Can return true even if the user has
|
||||||
* enrolled udfps. This may be false if called before onAllAuthenticatorsRegistered.
|
* not enrolled udfps. This may be false if called before onAllAuthenticatorsRegistered.
|
||||||
*/
|
*/
|
||||||
public boolean isUdfpsAvailable() {
|
public boolean isUdfpsSupported() {
|
||||||
return mAuthController.getUdfpsProps() != null
|
return mAuthController.getUdfpsProps() != null
|
||||||
&& !mAuthController.getUdfpsProps().isEmpty();
|
&& !mAuthController.getUdfpsProps().isEmpty();
|
||||||
}
|
}
|
||||||
@@ -2102,7 +2102,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateUdfpsEnrolled(getCurrentUser());
|
updateUdfpsEnrolled(getCurrentUser());
|
||||||
final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsEnrolled());
|
final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsSupported());
|
||||||
final boolean runningOrRestarting = mFingerprintRunningState == BIOMETRIC_STATE_RUNNING
|
final boolean runningOrRestarting = mFingerprintRunningState == BIOMETRIC_STATE_RUNNING
|
||||||
|| mFingerprintRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING;
|
|| mFingerprintRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING;
|
||||||
if (runningOrRestarting && !shouldListenForFingerprint) {
|
if (runningOrRestarting && !shouldListenForFingerprint) {
|
||||||
@@ -3388,11 +3388,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
+ " expected=" + (shouldListenForFingerprint(isUdfpsEnrolled()) ? 1 : 0));
|
+ " expected=" + (shouldListenForFingerprint(isUdfpsEnrolled()) ? 1 : 0));
|
||||||
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
|
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
|
||||||
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
|
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
|
||||||
pw.println(" udfpsEnrolled=" + isUdfpsEnrolled());
|
|
||||||
pw.println(" mFingerprintLockedOut=" + mFingerprintLockedOut);
|
pw.println(" mFingerprintLockedOut=" + mFingerprintLockedOut);
|
||||||
pw.println(" mFingerprintLockedOutPermanent=" + mFingerprintLockedOutPermanent);
|
pw.println(" mFingerprintLockedOutPermanent=" + mFingerprintLockedOutPermanent);
|
||||||
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));
|
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));
|
||||||
if (isUdfpsEnrolled()) {
|
if (isUdfpsSupported()) {
|
||||||
|
pw.println(" udfpsEnrolled=" + isUdfpsEnrolled());
|
||||||
pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true));
|
pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true));
|
||||||
pw.println(" bouncerVisible=" + mBouncer);
|
pw.println(" bouncerVisible=" + mBouncer);
|
||||||
pw.println(" mStatusBarState="
|
pw.println(" mStatusBarState="
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
|||||||
boolean wasUdfpsSupported = mUdfpsSupported;
|
boolean wasUdfpsSupported = mUdfpsSupported;
|
||||||
boolean wasUdfpsEnrolled = mUdfpsEnrolled;
|
boolean wasUdfpsEnrolled = mUdfpsEnrolled;
|
||||||
|
|
||||||
mUdfpsSupported = mAuthController.getUdfpsSensorLocation() != null;
|
mUdfpsSupported = mKeyguardUpdateMonitor.isUdfpsSupported();
|
||||||
mView.setUseBackground(mUdfpsSupported);
|
mView.setUseBackground(mUdfpsSupported);
|
||||||
|
|
||||||
mUdfpsEnrolled = mKeyguardUpdateMonitor.isUdfpsEnrolled();
|
mUdfpsEnrolled = mKeyguardUpdateMonitor.isUdfpsEnrolled();
|
||||||
|
|||||||
@@ -818,7 +818,7 @@ public class KeyguardIndicationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showTryFingerprintMsg(int msgId, String a11yString) {
|
private void showTryFingerprintMsg(int msgId, String a11yString) {
|
||||||
if (mKeyguardUpdateMonitor.isUdfpsAvailable()) {
|
if (mKeyguardUpdateMonitor.isUdfpsSupported()) {
|
||||||
// if udfps available, there will always be a tappable affordance to unlock
|
// if udfps available, there will always be a tappable affordance to unlock
|
||||||
// For example, the lock icon
|
// For example, the lock icon
|
||||||
if (mKeyguardBypassController.getUserHasDeviceEntryIntent()) {
|
if (mKeyguardBypassController.getUserHasDeviceEntryIntent()) {
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ public class LockIconViewControllerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testUpdateFingerprintLocationOnAuthenticatorsRegistered() {
|
public void testUpdateFingerprintLocationOnAuthenticatorsRegistered() {
|
||||||
// GIVEN fp sensor location is not available pre-init
|
// GIVEN fp sensor location is not available pre-init
|
||||||
|
when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false);
|
||||||
when(mAuthController.getFingerprintSensorLocation()).thenReturn(null);
|
when(mAuthController.getFingerprintSensorLocation()).thenReturn(null);
|
||||||
when(mAuthController.getUdfpsProps()).thenReturn(null);
|
when(mAuthController.getUdfpsProps()).thenReturn(null);
|
||||||
mLockIconViewController.init();
|
mLockIconViewController.init();
|
||||||
@@ -232,7 +233,7 @@ public class LockIconViewControllerTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLockIconViewBackgroundEnabledWhenUdfpsIsAvailable() {
|
public void testLockIconViewBackgroundEnabledWhenUdfpsIsSupported() {
|
||||||
// GIVEN Udpfs sensor location is available
|
// GIVEN Udpfs sensor location is available
|
||||||
setupUdfps();
|
setupUdfps();
|
||||||
|
|
||||||
@@ -247,9 +248,9 @@ public class LockIconViewControllerTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLockIconViewBackgroundDisabledWhenUdfpsIsUnavailable() {
|
public void testLockIconViewBackgroundDisabledWhenUdfpsIsNotSupported() {
|
||||||
// GIVEN Udfps sensor location is not available
|
// GIVEN Udfps sensor location is not supported
|
||||||
when(mAuthController.getUdfpsSensorLocation()).thenReturn(null);
|
when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false);
|
||||||
|
|
||||||
mLockIconViewController.init();
|
mLockIconViewController.init();
|
||||||
captureAttachListener();
|
captureAttachListener();
|
||||||
@@ -365,6 +366,7 @@ public class LockIconViewControllerTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Pair<Integer, PointF> setupUdfps() {
|
private Pair<Integer, PointF> setupUdfps() {
|
||||||
|
when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(true);
|
||||||
final PointF udfpsLocation = new PointF(50, 75);
|
final PointF udfpsLocation = new PointF(50, 75);
|
||||||
final int radius = 33;
|
final int radius = 33;
|
||||||
final FingerprintSensorPropertiesInternal fpProps =
|
final FingerprintSensorPropertiesInternal fpProps =
|
||||||
|
|||||||
@@ -701,7 +701,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// GIVEN fingerprint is also running (not udfps)
|
// GIVEN fingerprint is also running (not udfps)
|
||||||
when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true);
|
when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true);
|
||||||
when(mKeyguardUpdateMonitor.isUdfpsAvailable()).thenReturn(false);
|
when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false);
|
||||||
|
|
||||||
mController.setVisible(true);
|
mController.setVisible(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user