diff options
author | Sasha Levitskiy <sanek@google.com> | 2015-05-08 14:31:48 -0700 |
---|---|---|
committer | Sasha Levitskiy <sanek@google.com> | 2015-05-11 13:42:19 -0700 |
commit | 80db9baf9766dc40f9d1b6bf60797ee5cc64a48c (patch) | |
tree | 58b8d76e2b0b3b0aefd8717638e62e43624f6bb5 /services | |
parent | faf55219877416c1bdfbdfe5b7d24e35e9971a03 (diff) | |
download | frameworks_base-80db9baf9766dc40f9d1b6bf60797ee5cc64a48c.zip frameworks_base-80db9baf9766dc40f9d1b6bf60797ee5cc64a48c.tar.gz frameworks_base-80db9baf9766dc40f9d1b6bf60797ee5cc64a48c.tar.bz2 |
Fingerprint: Add Set Active Group
Change-Id: Ie9d63c5f948c9610bd6b19a76bffab5ae0070620
Signed-off-by: Sasha Levitskiy <sanek@google.com>
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/fingerprint/FingerprintService.java | 9 | ||||
-rw-r--r-- | services/core/jni/com_android_server_fingerprint_FingerprintService.cpp | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index ed8519a..0faccc6 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -16,10 +16,12 @@ package com.android.server.fingerprint; +import android.app.ActivityManager; import android.app.AppOpsManager; import android.content.ContentResolver; import android.content.Context; import android.os.Binder; +import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Looper; @@ -38,6 +40,7 @@ import android.hardware.fingerprint.IFingerprintServiceReceiver; import static android.Manifest.permission.MANAGE_FINGERPRINT; import static android.Manifest.permission.USE_FINGERPRINT; +import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -116,6 +119,7 @@ public class FingerprintService extends SystemService { static native int nativeCloseHal(); static native void nativeInit(MessageQueue queue, FingerprintService service); static native long nativeGetAuthenticatorId(); + static native int nativeSetActiveGroup(int gid, byte[] storePath); static final class FpHalMsg { int type; // Type of the message. One of the constants in fingerprint.h @@ -628,6 +632,11 @@ public class FingerprintService extends SystemService { public void onStart() { publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper()); mHalDeviceId = nativeOpenHal(); + if (mHalDeviceId != 0) { + int userId = ActivityManager.getCurrentUser(); + File path = Environment.getUserSystemDirectory(userId); + nativeSetActiveGroup(0, path.getAbsolutePath().getBytes()); + } if (DEBUG) Slog.v(TAG, "Fingerprint HAL id: " + mHalDeviceId); } diff --git a/services/core/jni/com_android_server_fingerprint_FingerprintService.cpp b/services/core/jni/com_android_server_fingerprint_FingerprintService.cpp index 7dbfaf6..39474ec 100644 --- a/services/core/jni/com_android_server_fingerprint_FingerprintService.cpp +++ b/services/core/jni/com_android_server_fingerprint_FingerprintService.cpp @@ -181,6 +181,21 @@ static jlong nativeGetAuthenticatorId(JNIEnv *, jobject clazz) { return gContext.device->get_authenticator_id(gContext.device); } +static jint nativeSetActiveGroup(JNIEnv *env, jobject clazz, jint gid, jbyteArray path) { + const int pathSize = env->GetArrayLength(path); + jbyte* pathData = env->GetByteArrayElements(path, 0); + if (pathSize >= PATH_MAX) { + ALOGE("Path name is too long\n"); + return -1; + } + char path_name[PATH_MAX] = {0}; + memcpy(path_name, pathData, pathSize); + ALOG(LOG_VERBOSE, LOG_TAG, "nativeSetActiveGroup() path: %s, gid: %d\n", path_name, gid); + int result = gContext.device->set_active_group(gContext.device, gid, path_name); + env->ReleaseByteArrayElements(path, pathData, 0); + return result; +} + static jint nativeOpenHal(JNIEnv* env, jobject clazz) { ALOG(LOG_VERBOSE, LOG_TAG, "nativeOpenHal()\n"); int err; @@ -242,6 +257,7 @@ static const JNINativeMethod g_methods[] = { { "nativeAuthenticate", "(JI)I", (void*)nativeAuthenticate }, { "nativeStopAuthentication", "()I", (void*)nativeStopAuthentication }, { "nativeEnroll", "([BII)I", (void*)nativeEnroll }, + { "nativeSetActiveGroup", "(I[B)I", (void*)nativeSetActiveGroup }, { "nativePreEnroll", "()J", (void*)nativePreEnroll }, { "nativeStopEnrollment", "()I", (void*)nativeStopEnrollment }, { "nativeRemove", "(II)I", (void*)nativeRemove }, |