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

Commit 4d41a203 authored by Andres Morales's avatar Andres Morales
Browse files

Expose getAuthenticatorId API

Change-Id: I112c45d596c66e3f6ebd94fecffcb6bb7c3a335a
parent b5665c99
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -587,6 +587,25 @@ public class FingerprintManager {
        return false;
    }

    /**
     * Retrieves the authenticator token for binding keys to the lifecycle
     * of the current set of fingerprints. Used only by internal clients.
     *
     * @hide
     */
    public long getAuthenticatorId() {
        if (mService != null) {
            try {
                return mService.getAuthenticatorId();
            } catch (RemoteException e) {
                Log.v(TAG, "Remote exception in getAuthenticatorId(): ", e);
            }
        } else {
            Log.w(TAG, "getAuthenticatorId(): Service not connected!");
        }
        return 0;
    }

    private Handler mHandler = new Handler() {
        public void handleMessage(android.os.Message msg) {
            switch(msg.what) {
@@ -793,3 +812,4 @@ public class FingerprintManager {
    };

}
+2 −0
Original line number Diff line number Diff line
@@ -63,4 +63,6 @@ interface IFingerprintService {
    // Gets the unique device id for hardware enumerated at i
    // long getHardwareDevice(int i);

    // Gets the authenticator ID for fingerprint
    long getAuthenticatorId();
}
+7 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class FingerprintService extends SystemService {
    static native int nativeOpenHal();
    static native int nativeCloseHal();
    static native void nativeInit(MessageQueue queue, FingerprintService service);
    static native long nativeGetAuthenticatorId();

    static final class FpHalMsg {
        int type; // Type of the message. One of the constants in fingerprint.h
@@ -595,6 +596,12 @@ public class FingerprintService extends SystemService {
            checkPermission(USE_FINGERPRINT);
            return FingerprintService.this.hasEnrolledFingerprints(groupId);
        }

        @Override
        public long getAuthenticatorId() {
            checkPermission(USE_FINGERPRINT);
            return nativeGetAuthenticatorId();
        }
    }

    @Override
+6 −0
Original line number Diff line number Diff line
@@ -177,6 +177,10 @@ static jint nativeRemove(JNIEnv* env, jobject clazz, jint fingerId, jint groupId
    return reinterpret_cast<jint>(ret);
}

static jlong nativeGetAuthenticatorId(JNIEnv *, jobject clazz) {
    return gContext.device->get_authenticator_id(gContext.device);
}

static jint nativeOpenHal(JNIEnv* env, jobject clazz) {
    ALOG(LOG_VERBOSE, LOG_TAG, "nativeOpenHal()\n");
    int err;
@@ -229,6 +233,7 @@ static jint nativeCloseHal(JNIEnv* env, jobject clazz) {
    return -ENOSYS; // TODO
}


// ----------------------------------------------------------------------------


@@ -240,6 +245,7 @@ static const JNINativeMethod g_methods[] = {
    { "nativePreEnroll", "()J", (void*)nativePreEnroll },
    { "nativeStopEnrollment", "()I", (void*)nativeStopEnrollment },
    { "nativeRemove", "(II)I", (void*)nativeRemove },
    { "nativeGetAuthenticatorId", "()J", (void*)nativeGetAuthenticatorId },
    { "nativeOpenHal", "()I", (void*)nativeOpenHal },
    { "nativeCloseHal", "()I", (void*)nativeCloseHal },
    { "nativeInit","(Landroid/os/MessageQueue;"