Loading core/java/android/app/SystemServiceRegistry.java +11 −5 Original line number Diff line number Diff line Loading @@ -857,11 +857,17 @@ final class SystemServiceRegistry { @Override public BiometricManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (BiometricManager.hasBiometrics(ctx)) { final IBinder binder = ServiceManager.getServiceOrThrow(Context.BIOMETRIC_SERVICE); final IBiometricService service = IBiometricService.Stub.asInterface(binder); return new BiometricManager(ctx.getOuterContext(), service); } else { // Allow access to the manager when service is null. This saves memory // on devices without biometric hardware. return new BiometricManager(ctx.getOuterContext(), null); } } }); Loading core/java/android/hardware/biometrics/BiometricManager.java +22 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL; import android.annotation.IntDef; import android.annotation.RequiresPermission; import android.content.Context; import android.content.pm.PackageManager; import android.os.RemoteException; import android.util.Slog; Loading Loading @@ -64,6 +65,19 @@ public class BiometricManager { private final Context mContext; private final IBiometricService mService; private final boolean mHasHardware; /** * @param context * @return * @hide */ public static boolean hasBiometrics(Context context) { final PackageManager pm = context.getPackageManager(); return pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) || pm.hasSystemFeature(PackageManager.FEATURE_IRIS) || pm.hasSystemFeature(PackageManager.FEATURE_FACE); } /** * @hide Loading @@ -73,6 +87,8 @@ public class BiometricManager { public BiometricManager(Context context, IBiometricService service) { mContext = context; mService = service; mHasHardware = hasBiometrics(context); } /** Loading @@ -92,11 +108,15 @@ public class BiometricManager { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { if (!mHasHardware) { return BIOMETRIC_ERROR_NO_HARDWARE; } else { Slog.w(TAG, "hasEnrolledBiometrics(): Service not connected"); return BIOMETRIC_ERROR_UNAVAILABLE; } } } /** * Listens for changes to biometric eligibility on keyguard from user settings. Loading services/java/com/android/server/SystemServer.java +1 −1 Original line number Diff line number Diff line Loading @@ -1627,7 +1627,7 @@ public final class SystemServer { if (hasFeatureFace || hasFeatureIris || hasFeatureFingerprint) { // Start this service after all biometric services. traceBeginAndSlog("StartBiometricPromptService"); traceBeginAndSlog("StartBiometricService"); mSystemServiceManager.startService(BiometricService.class); traceEnd(); } Loading Loading
core/java/android/app/SystemServiceRegistry.java +11 −5 Original line number Diff line number Diff line Loading @@ -857,11 +857,17 @@ final class SystemServiceRegistry { @Override public BiometricManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (BiometricManager.hasBiometrics(ctx)) { final IBinder binder = ServiceManager.getServiceOrThrow(Context.BIOMETRIC_SERVICE); final IBiometricService service = IBiometricService.Stub.asInterface(binder); return new BiometricManager(ctx.getOuterContext(), service); } else { // Allow access to the manager when service is null. This saves memory // on devices without biometric hardware. return new BiometricManager(ctx.getOuterContext(), null); } } }); Loading
core/java/android/hardware/biometrics/BiometricManager.java +22 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL; import android.annotation.IntDef; import android.annotation.RequiresPermission; import android.content.Context; import android.content.pm.PackageManager; import android.os.RemoteException; import android.util.Slog; Loading Loading @@ -64,6 +65,19 @@ public class BiometricManager { private final Context mContext; private final IBiometricService mService; private final boolean mHasHardware; /** * @param context * @return * @hide */ public static boolean hasBiometrics(Context context) { final PackageManager pm = context.getPackageManager(); return pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) || pm.hasSystemFeature(PackageManager.FEATURE_IRIS) || pm.hasSystemFeature(PackageManager.FEATURE_FACE); } /** * @hide Loading @@ -73,6 +87,8 @@ public class BiometricManager { public BiometricManager(Context context, IBiometricService service) { mContext = context; mService = service; mHasHardware = hasBiometrics(context); } /** Loading @@ -92,11 +108,15 @@ public class BiometricManager { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { if (!mHasHardware) { return BIOMETRIC_ERROR_NO_HARDWARE; } else { Slog.w(TAG, "hasEnrolledBiometrics(): Service not connected"); return BIOMETRIC_ERROR_UNAVAILABLE; } } } /** * Listens for changes to biometric eligibility on keyguard from user settings. Loading
services/java/com/android/server/SystemServer.java +1 −1 Original line number Diff line number Diff line Loading @@ -1627,7 +1627,7 @@ public final class SystemServer { if (hasFeatureFace || hasFeatureIris || hasFeatureFingerprint) { // Start this service after all biometric services. traceBeginAndSlog("StartBiometricPromptService"); traceBeginAndSlog("StartBiometricService"); mSystemServiceManager.startService(BiometricService.class); traceEnd(); } Loading