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

Commit db778a5e authored by Joshua Mccloskey's avatar Joshua Mccloskey
Browse files

Added debug parameter to FaceService

Bug: 177244088
Test: Verified debug parameter is correctly sent to the hal.
Change-Id: If71d86528f1bd9c6d0b75cdff36ec9fdbee47fa6
parent 77bb0b72
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -301,7 +301,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
    @RequiresPermission(MANAGE_BIOMETRIC)
    public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
            EnrollmentCallback callback, int[] disabledFeatures) {
        enroll(userId, hardwareAuthToken, cancel, callback, disabledFeatures, null /* surface */);
        enroll(userId, hardwareAuthToken, cancel, callback, disabledFeatures, null /* surface */,
                false /* debugConsent */);
    }

    /**
@@ -313,18 +314,20 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
     * which point the object is no longer valid. The operation can be canceled by using the
     * provided cancel object.
     *
     * @param token    a unique token provided by a recent creation or verification of device
     *                 credentials (e.g. pin, pattern or password).
     * @param hardwareAuthToken a unique token provided by a recent creation or
     *                          verification of device credentials (e.g. pin, pattern or password).
     * @param cancel            an object that can be used to cancel enrollment
     * @param userId            the user to whom this face will belong to
     * @param callback          an object to receive enrollment events
     * @param surface  optional camera preview surface for a single-camera device. Must be null if
     *                 not used.
     * @param surface           optional camera preview surface for a single-camera device.
     *                          Must be null if not used.
     * @param debugConsent      a feature flag that the user has consented to debug.
     * @hide
     */
    @RequiresPermission(MANAGE_BIOMETRIC)
    public void enroll(int userId, byte[] hardwareAuthToken, CancellationSignal cancel,
            EnrollmentCallback callback, int[] disabledFeatures, @Nullable Surface surface) {
            EnrollmentCallback callback, int[] disabledFeatures, @Nullable Surface surface,
            boolean debugConsent) {
        if (callback == null) {
            throw new IllegalArgumentException("Must supply an enrollment callback");
        }
@@ -343,7 +346,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
                mEnrollmentCallback = callback;
                Trace.beginSection("FaceManager#enroll");
                mService.enroll(userId, mToken, hardwareAuthToken, mServiceReceiver,
                        mContext.getOpPackageName(), disabledFeatures, surface);
                        mContext.getOpPackageName(), disabledFeatures, surface, debugConsent);
            } catch (RemoteException e) {
                Slog.w(TAG, "Remote exception in enroll: ", e);
                // Though this may not be a hardware issue, it will cause apps to give up or
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ interface IFaceService {

    // Start face enrollment
    void enroll(int userId, IBinder token, in byte [] hardwareAuthToken, IFaceServiceReceiver receiver,
            String opPackageName, in int [] disabledFeatures, in Surface surface);
            String opPackageName, in int [] disabledFeatures, in Surface surface, boolean debugConsent);

    // Start remote face enrollment
    void enrollRemotely(int userId, IBinder token, in byte [] hardwareAuthToken, IFaceServiceReceiver receiver,
+2 −2
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ public class FaceService extends SystemService implements BiometricServiceCallba
        @Override // Binder call
        public void enroll(int userId, final IBinder token, final byte[] hardwareAuthToken,
                final IFaceServiceReceiver receiver, final String opPackageName,
                final int[] disabledFeatures, Surface surface) {
                final int[] disabledFeatures, Surface surface, boolean debugConsent) {
            Utils.checkPermission(getContext(), MANAGE_BIOMETRIC);

            final Pair<Integer, ServiceProvider> provider = getSingleProvider();
@@ -229,7 +229,7 @@ public class FaceService extends SystemService implements BiometricServiceCallba

            provider.second.scheduleEnroll(provider.first, token, hardwareAuthToken, userId,
                    receiver, opPackageName, disabledFeatures,
                    convertSurfaceToNativeHandle(surface));
                    convertSurfaceToNativeHandle(surface), debugConsent);
        }

        @Override // Binder call
+2 −1
Original line number Diff line number Diff line
@@ -94,7 +94,8 @@ public interface ServiceProvider {

    void scheduleEnroll(int sensorId, @NonNull IBinder token, @NonNull byte[] hardwareAuthToken,
            int userId, @NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName,
            @NonNull int[] disabledFeatures, @Nullable NativeHandle surfaceHandle);
            @NonNull int[] disabledFeatures, @Nullable NativeHandle surfaceHandle,
            boolean debugConsent);

    void cancelEnrollment(int sensorId, @NonNull IBinder token);

+2 −1
Original line number Diff line number Diff line
@@ -142,7 +142,8 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
        Utils.checkPermission(mContext, TEST_BIOMETRIC);

        mProvider.scheduleEnroll(mSensorId, new Binder(), new byte[69], userId, mReceiver,
                mContext.getOpPackageName(), new int[0] /* disabledFeatures */, null /* surface */);
                mContext.getOpPackageName(), new int[0] /* disabledFeatures */, null /* surface */,
                false /* debugConsent */);
    }

    @Override
Loading