Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abe78cd3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "biometrics-face"

* changes:
  5/n: Move FaceService to biometrics directory
  4/n: Add face authentication framework
parents 1d488311 2ffadb38
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -152,6 +152,9 @@ java_library {
        "core/java/android/hardware/display/IDisplayManagerCallback.aidl",
        "core/java/android/hardware/display/IVirtualDisplayCallback.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintClientActiveCallback.aidl",
        "core/java/android/hardware/face/IFaceService.aidl",
        "core/java/android/hardware/face/IFaceServiceLockoutResetCallback.aidl",
        "core/java/android/hardware/face/IFaceServiceReceiver.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintService.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl",
+16 −1
Original line number Diff line number Diff line
@@ -350,8 +350,10 @@ public class AppOpsManager {
    public static final int OP_START_FOREGROUND = 76;
    /** @hide */
    public static final int OP_BLUETOOTH_SCAN = 77;
    /** @hide Use the face authentication API. */
    public static final int OP_USE_FACE = 78;
    /** @hide */
    public static final int _NUM_OP = 78;
    public static final int _NUM_OP = 79;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -596,6 +598,11 @@ public class AppOpsManager {
    /** @hide */
    public static final String OPSTR_BLUETOOTH_SCAN = "android:bluetooth_scan";

    /** @hide Use the face authentication API. */
    public static final String OPSTR_USE_FACE = "android:use_FACE";



    // Warning: If an permission is added here it also has to be added to
    // com.android.packageinstaller.permission.utils.EventLogger
    private static final int[] RUNTIME_AND_APPOP_PERMISSIONS_OPS = {
@@ -733,6 +740,7 @@ public class AppOpsManager {
            OP_MANAGE_IPSEC_TUNNELS,            // MANAGE_IPSEC_HANDOVERS
            OP_START_FOREGROUND,                // START_FOREGROUND
            OP_COARSE_LOCATION,                 // BLUETOOTH_SCAN
            OP_USE_FACE,                        // FACE
    };

    /**
@@ -817,6 +825,7 @@ public class AppOpsManager {
            OPSTR_MANAGE_IPSEC_TUNNELS,
            OPSTR_START_FOREGROUND,
            OPSTR_BLUETOOTH_SCAN,
            OPSTR_USE_FACE,
    };

    /**
@@ -902,6 +911,7 @@ public class AppOpsManager {
            "MANAGE_IPSEC_TUNNELS",
            "START_FOREGROUND",
            "BLUETOOTH_SCAN",
            "USE_FACE",
    };

    /**
@@ -987,6 +997,7 @@ public class AppOpsManager {
            null, // no permission for OP_MANAGE_IPSEC_TUNNELS
            Manifest.permission.FOREGROUND_SERVICE,
            null, // no permission for OP_BLUETOOTH_SCAN
            Manifest.permission.USE_BIOMETRIC,
    };

    /**
@@ -1073,6 +1084,7 @@ public class AppOpsManager {
            null, // MANAGE_IPSEC_TUNNELS
            null, // START_FOREGROUND
            null, // maybe should be UserManager.DISALLOW_SHARE_LOCATION, //BLUETOOTH_SCAN
            null, // USE_FACE
    };

    /**
@@ -1158,6 +1170,7 @@ public class AppOpsManager {
            false, // MANAGE_IPSEC_HANDOVERS
            false, // START_FOREGROUND
            true, // BLUETOOTH_SCAN
            false, // USE_FACE
    };

    /**
@@ -1242,6 +1255,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ERRORED,  // MANAGE_IPSEC_TUNNELS
            AppOpsManager.MODE_ALLOWED,  // OP_START_FOREGROUND
            AppOpsManager.MODE_ALLOWED,  // OP_BLUETOOTH_SCAN
            AppOpsManager.MODE_ALLOWED,  // USE_FACE
    };

    /**
@@ -1330,6 +1344,7 @@ public class AppOpsManager {
            false, // MANAGE_IPSEC_TUNNELS
            false, // START_FOREGROUND
            false, // BLUETOOTH_SCAN
            false, // USE_FACE
    };

    /**
+18 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ import android.hardware.SerialManager;
import android.hardware.SystemSensorManager;
import android.hardware.camera2.CameraManager;
import android.hardware.display.DisplayManager;
import android.hardware.face.FaceManager;
import android.hardware.face.IFaceService;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.IFingerprintService;
import android.hardware.hdmi.HdmiControlManager;
@@ -791,6 +793,22 @@ final class SystemServiceRegistry {
                return new FingerprintManager(ctx.getOuterContext(), service);
            }});

        registerService(Context.FACE_SERVICE, FaceManager.class,
                new CachedServiceFetcher<FaceManager>() {
                    @Override
                    public FaceManager createService(ContextImpl ctx)
                            throws ServiceNotFoundException {
                        final IBinder binder;
                        if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.O) {
                            binder = ServiceManager.getServiceOrThrow(Context.FACE_SERVICE);
                        } else {
                            binder = ServiceManager.getService(Context.FACE_SERVICE);
                        }
                        IFaceService service = IFaceService.Stub.asInterface(binder);
                        return new FaceManager(ctx.getOuterContext(), service);
                    }
                });

        registerService(Context.TV_INPUT_SERVICE, TvInputManager.class,
                new CachedServiceFetcher<TvInputManager>() {
            @Override
+6 −7
Original line number Diff line number Diff line
@@ -3237,8 +3237,8 @@ public class DevicePolicyManager {

    /**
     * Called by a device/profile owner to set the timeout after which unlocking with secondary, non
     * strong auth (e.g. fingerprint, trust agents) times out, i.e. the user has to use a strong
     * authentication method like password, pin or pattern.
     * strong auth (e.g. fingerprint, face, trust agents) times out, i.e. the user has to use a
     * strong authentication method like password, pin or pattern.
     *
     * <p>This timeout is used internally to reset the timer to require strong auth again after
     * specified timeout each time it has been successfully used.
@@ -3710,7 +3710,6 @@ public class DevicePolicyManager {
            | DevicePolicyManager.KEYGUARD_DISABLE_IRIS
            | DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT;


    /**
     * Disable all current and future keyguard customizations.
     */
@@ -4898,10 +4897,10 @@ public class DevicePolicyManager {
    /**
     * @hide
     */
    public void reportFailedFingerprintAttempt(int userHandle) {
    public void reportFailedBiometricAttempt(int userHandle) {
        if (mService != null) {
            try {
                mService.reportFailedFingerprintAttempt(userHandle);
                mService.reportFailedBiometricAttempt(userHandle);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
@@ -4911,10 +4910,10 @@ public class DevicePolicyManager {
    /**
     * @hide
     */
    public void reportSuccessfulFingerprintAttempt(int userHandle) {
    public void reportSuccessfulBiometricAttempt(int userHandle) {
        if (mService != null) {
            try {
                mService.reportSuccessfulFingerprintAttempt(userHandle);
                mService.reportSuccessfulBiometricAttempt(userHandle);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
+2 −2
Original line number Diff line number Diff line
@@ -132,8 +132,8 @@ interface IDevicePolicyManager {
    void reportPasswordChanged(int userId);
    void reportFailedPasswordAttempt(int userHandle);
    void reportSuccessfulPasswordAttempt(int userHandle);
    void reportFailedFingerprintAttempt(int userHandle);
    void reportSuccessfulFingerprintAttempt(int userHandle);
    void reportFailedBiometricAttempt(int userHandle);
    void reportSuccessfulBiometricAttempt(int userHandle);
    void reportKeyguardDismissed(int userHandle);
    void reportKeyguardSecured(int userHandle);

Loading