Switch fingerprint setup to biometric setup instead
* Generic, handles both face and fingerprint * Works the same as before for fingerprint * Works the same as fingerprint for face * What else could one ask for? Change-Id: I9ddd7b46548c8107239fdec457bbaae6b12876e6
This commit is contained in:
committed by
Alessandro Astone
parent
da1355a5c5
commit
e372bc0542
@@ -42,6 +42,7 @@ import android.content.pm.ComponentInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Binder;
|
||||
import android.os.SystemProperties;
|
||||
@@ -55,7 +56,7 @@ import android.util.Log;
|
||||
|
||||
import org.lineageos.setupwizard.BluetoothSetupActivity;
|
||||
import org.lineageos.setupwizard.ChooseDataSimActivity;
|
||||
import org.lineageos.setupwizard.FingerprintActivity;
|
||||
import org.lineageos.setupwizard.BiometricActivity;
|
||||
import org.lineageos.setupwizard.MobileDataActivity;
|
||||
import org.lineageos.setupwizard.SetupWizardApp;
|
||||
import org.lineageos.setupwizard.SimMissingActivity;
|
||||
@@ -227,6 +228,10 @@ public class SetupWizardUtils {
|
||||
return packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
|
||||
public static boolean hasBiometric(Context context) {
|
||||
return hasFingerprint(context) || hasFace(context);
|
||||
}
|
||||
|
||||
public static boolean hasFingerprint(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if (packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
|
||||
@@ -238,6 +243,17 @@ public class SetupWizardUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasFace(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if (packageManager.hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
FaceManager faceManager = (FaceManager)
|
||||
context.getSystemService(Context.FACE_SERVICE);
|
||||
return faceManager.isHardwareDetected();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean simMissing() {
|
||||
return PhoneMonitor.getInstance().simMissing();
|
||||
}
|
||||
@@ -246,8 +262,8 @@ public class SetupWizardUtils {
|
||||
if (!hasLeanback(context)) {
|
||||
disableComponent(context, BluetoothSetupActivity.class);
|
||||
}
|
||||
if (!hasFingerprint(context)) {
|
||||
disableComponent(context, FingerprintActivity.class);
|
||||
if (!hasBiometric(context)) {
|
||||
disableComponent(context, BiometricActivity.class);
|
||||
}
|
||||
if (!hasTelephony(context)) {
|
||||
disableComponent(context, MobileDataActivity.class);
|
||||
|
Reference in New Issue
Block a user