Support face unlock for PS if class2 biometric and above
With this change it is checked if face unlock is supported as a class2 or class3 biometrics on the device. If face is convenience biometrics then face unlock for private space controller is not added. Bug: 329044103 Test: atest UtilsTest and verified Face unlock is not added if face is convenience Change-Id: I6e1a6557774be1173ad3ee7ff7b14d51f9fe1716
This commit is contained in:
@@ -54,8 +54,10 @@ import android.graphics.drawable.AdaptiveIconDrawable;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.VectorDrawable;
|
||||
import android.hardware.biometrics.SensorProperties;
|
||||
import android.hardware.face.Face;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.net.ConnectivityManager;
|
||||
@@ -927,6 +929,23 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return hasFingerprintHardware(context) && hasFaceHardware(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if face is supported as Class 2 biometrics and above on the device, false
|
||||
* otherwise.
|
||||
*/
|
||||
public static boolean isFaceNotConvenienceBiometric(@NonNull Context context) {
|
||||
FaceManager faceManager = getFaceManagerOrNull(context);
|
||||
if (faceManager != null) {
|
||||
final List<FaceSensorPropertiesInternal> faceProperties =
|
||||
faceManager.getSensorPropertiesInternal();
|
||||
if (!faceProperties.isEmpty()) {
|
||||
final FaceSensorPropertiesInternal props = faceProperties.get(0);
|
||||
return props.sensorStrength != SensorProperties.STRENGTH_CONVENIENCE;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches an intent which may optionally have a user id defined.
|
||||
* @param fragment Fragment to use to launch the activity.
|
||||
|
Reference in New Issue
Block a user