summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorKevin Chyn <kchyn@google.com>2020-04-27 18:16:32 -0700
committerKevin Chyn <kchyn@google.com>2020-05-08 13:46:41 -0700
commite6bdee20a0acd56ecaa9a7e69cc26feb3a9a5aed (patch)
tree75ad8995d9c153ff80c70689f9ab86e0abdc42d6 /core/java/android
parent2cec4c4a7832d812c50a8b0d96b7f701bc27c32b (diff)
Stop using halDeviceId
The deviceId currently returned by the HAL is only used to determine if the callback has successfully been set. Any state that it's being used to track is currently redundant with the pointer to the actual HAL (e.g. determing if the HAL is found, if it has crashed, etc). Remove this information to reduce confusion. Also removed enumerate callback, since only system server handles enumeration results (upper layers never touch this) Bug: 149067920 Test: Enroll, auth on fingerprint and face devices Test: atest com.android.server.biometrics Change-Id: I1275a91da6f773934be663731ddf1802e0161090
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl2
-rw-r--r--core/java/android/hardware/face/FaceManager.java41
-rw-r--r--core/java/android/hardware/face/IFaceServiceReceiver.aidl14
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintManager.java78
-rw-r--r--core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl14
5 files changed, 43 insertions, 106 deletions
diff --git a/core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl b/core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl
index ee033bfa0a8b..aa5ac035f4ee 100644
--- a/core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl
+++ b/core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl
@@ -26,5 +26,5 @@ oneway interface IBiometricServiceLockoutResetCallback {
/**
* A wakelock will be held until the reciever calls back into {@param callback}
*/
- void onLockoutReset(long deviceId, IRemoteCallback callback);
+ void onLockoutReset(IRemoteCallback callback);
}
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index bd05d5c86ec3..9fdd7b044297 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -84,42 +84,34 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
private IFaceServiceReceiver mServiceReceiver = new IFaceServiceReceiver.Stub() {
@Override // binder call
- public void onEnrollResult(long deviceId, int faceId, int remaining) {
- mHandler.obtainMessage(MSG_ENROLL_RESULT, remaining, 0,
- new Face(null, faceId, deviceId)).sendToTarget();
+ public void onEnrollResult(Face face, int remaining) {
+ mHandler.obtainMessage(MSG_ENROLL_RESULT, remaining, 0, face).sendToTarget();
}
@Override // binder call
- public void onAcquired(long deviceId, int acquireInfo, int vendorCode) {
- mHandler.obtainMessage(MSG_ACQUIRED, acquireInfo, vendorCode, deviceId).sendToTarget();
+ public void onAcquired(int acquireInfo, int vendorCode) {
+ mHandler.obtainMessage(MSG_ACQUIRED, acquireInfo, vendorCode).sendToTarget();
}
@Override // binder call
- public void onAuthenticationSucceeded(long deviceId, Face face, int userId,
- boolean isStrongBiometric) {
+ public void onAuthenticationSucceeded(Face face, int userId, boolean isStrongBiometric) {
mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, isStrongBiometric ? 1 : 0,
face).sendToTarget();
}
@Override // binder call
- public void onAuthenticationFailed(long deviceId) {
+ public void onAuthenticationFailed() {
mHandler.obtainMessage(MSG_AUTHENTICATION_FAILED).sendToTarget();
}
@Override // binder call
- public void onError(long deviceId, int error, int vendorCode) {
- mHandler.obtainMessage(MSG_ERROR, error, vendorCode, deviceId).sendToTarget();
+ public void onError(int error, int vendorCode) {
+ mHandler.obtainMessage(MSG_ERROR, error, vendorCode).sendToTarget();
}
@Override // binder call
- public void onRemoved(long deviceId, int faceId, int remaining) {
- mHandler.obtainMessage(MSG_REMOVED, remaining, 0,
- new Face(null, faceId, deviceId)).sendToTarget();
- }
-
- @Override
- public void onEnumerated(long deviceId, int faceId, int remaining) {
- // TODO: Finish. Low priority since it's not used.
+ public void onRemoved(Face face, int remaining) {
+ mHandler.obtainMessage(MSG_REMOVED, remaining, 0, face).sendToTarget();
}
@Override
@@ -593,8 +585,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
new IBiometricServiceLockoutResetCallback.Stub() {
@Override
- public void onLockoutReset(long deviceId,
- IRemoteCallback serverCallback)
+ public void onLockoutReset(IRemoteCallback serverCallback)
throws RemoteException {
try {
final PowerManager.WakeLock wakeLock = powerManager.newWakeLock(
@@ -1043,8 +1034,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
sendEnrollResult((Face) msg.obj, msg.arg1 /* remaining */);
break;
case MSG_ACQUIRED:
- sendAcquiredResult((Long) msg.obj /* deviceId */, msg.arg1 /* acquire info */,
- msg.arg2 /* vendorCode */);
+ sendAcquiredResult(msg.arg1 /* acquire info */, msg.arg2 /* vendorCode */);
break;
case MSG_AUTHENTICATION_SUCCEEDED:
sendAuthenticatedSucceeded((Face) msg.obj, msg.arg1 /* userId */,
@@ -1054,8 +1044,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
sendAuthenticatedFailed();
break;
case MSG_ERROR:
- sendErrorResult((Long) msg.obj /* deviceId */, msg.arg1 /* errMsgId */,
- msg.arg2 /* vendorCode */);
+ sendErrorResult(msg.arg1 /* errMsgId */, msg.arg2 /* vendorCode */);
break;
case MSG_REMOVED:
sendRemovedResult((Face) msg.obj, msg.arg1 /* remaining */);
@@ -1103,7 +1092,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
mRemovalCallback.onRemovalSucceeded(face, remaining);
}
- private void sendErrorResult(long deviceId, int errMsgId, int vendorCode) {
+ private void sendErrorResult(int errMsgId, int vendorCode) {
// emulate HAL 2.1 behavior and send real errMsgId
final int clientErrMsgId = errMsgId == FACE_ERROR_VENDOR
? (vendorCode + FACE_ERROR_VENDOR_BASE) : errMsgId;
@@ -1139,7 +1128,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
}
}
- private void sendAcquiredResult(long deviceId, int acquireInfo, int vendorCode) {
+ private void sendAcquiredResult(int acquireInfo, int vendorCode) {
if (mAuthenticationCallback != null) {
mAuthenticationCallback.onAuthenticationAcquired(acquireInfo);
}
diff --git a/core/java/android/hardware/face/IFaceServiceReceiver.aidl b/core/java/android/hardware/face/IFaceServiceReceiver.aidl
index 7582308e8016..ff3f6f39586e 100644
--- a/core/java/android/hardware/face/IFaceServiceReceiver.aidl
+++ b/core/java/android/hardware/face/IFaceServiceReceiver.aidl
@@ -22,14 +22,12 @@ import android.hardware.face.Face;
* @hide
*/
oneway interface IFaceServiceReceiver {
- void onEnrollResult(long deviceId, int faceId, int remaining);
- void onAcquired(long deviceId, int acquiredInfo, int vendorCode);
- void onAuthenticationSucceeded(long deviceId, in Face face, int userId,
- boolean isStrongBiometric);
- void onAuthenticationFailed(long deviceId);
- void onError(long deviceId, int error, int vendorCode);
- void onRemoved(long deviceId, int faceId, int remaining);
- void onEnumerated(long deviceId, int faceId, int remaining);
+ void onEnrollResult(in Face face, int remaining);
+ void onAcquired(int acquiredInfo, int vendorCode);
+ void onAuthenticationSucceeded(in Face face, int userId, boolean isStrongBiometric);
+ void onAuthenticationFailed();
+ void onError(int error, int vendorCode);
+ void onRemoved(in Face face, int remaining);
void onFeatureSet(boolean success, int feature);
void onFeatureGet(boolean success, int feature, boolean value);
}
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index ee736b012b3b..185fe41ed9cd 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -75,7 +75,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
private static final int MSG_AUTHENTICATION_FAILED = 103;
private static final int MSG_ERROR = 104;
private static final int MSG_REMOVED = 105;
- private static final int MSG_ENUMERATED = 106;
private IFingerprintService mService;
private Context mContext;
@@ -83,7 +82,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
private AuthenticationCallback mAuthenticationCallback;
private EnrollmentCallback mEnrollmentCallback;
private RemovalCallback mRemovalCallback;
- private EnumerateCallback mEnumerateCallback;
private CryptoObject mCryptoObject;
private Fingerprint mRemovalFingerprint;
private Handler mHandler;
@@ -611,29 +609,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
}
/**
- * Enumerate all fingerprint templates stored in hardware and/or protected storage.
- * @param userId the user who this fingerprint belongs to
- * @param callback an optional callback to verify that fingerprint templates have been
- * successfully removed. May be null of no callback is required.
- *
- * @hide
- */
- @RequiresPermission(MANAGE_FINGERPRINT)
- public void enumerate(int userId, @NonNull EnumerateCallback callback) {
- if (mService != null) try {
- mEnumerateCallback = callback;
- mService.enumerate(mToken, userId, mServiceReceiver);
- } catch (RemoteException e) {
- Slog.w(TAG, "Remote exception in enumerate: ", e);
- if (callback != null) {
- callback.onEnumerateError(FINGERPRINT_ERROR_HW_UNAVAILABLE,
- getErrorString(mContext, FINGERPRINT_ERROR_HW_UNAVAILABLE,
- 0 /* vendorCode */));
- }
- }
- }
-
- /**
* Renames the given fingerprint template
* @param fpId the fingerprint id
* @param userId the user who this fingerprint belongs to
@@ -768,7 +743,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
new IBiometricServiceLockoutResetCallback.Stub() {
@Override
- public void onLockoutReset(long deviceId, IRemoteCallback serverCallback)
+ public void onLockoutReset(IRemoteCallback serverCallback)
throws RemoteException {
try {
final PowerManager.WakeLock wakeLock = powerManager.newWakeLock(
@@ -810,7 +785,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
sendEnrollResult((Fingerprint) msg.obj, msg.arg1 /* remaining */);
break;
case MSG_ACQUIRED:
- sendAcquiredResult((Long) msg.obj /* deviceId */, msg.arg1 /* acquire info */,
+ sendAcquiredResult(msg.arg1 /* acquire info */,
msg.arg2 /* vendorCode */);
break;
case MSG_AUTHENTICATION_SUCCEEDED:
@@ -821,16 +796,11 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
sendAuthenticatedFailed();
break;
case MSG_ERROR:
- sendErrorResult((Long) msg.obj /* deviceId */, msg.arg1 /* errMsgId */,
- msg.arg2 /* vendorCode */);
+ sendErrorResult(msg.arg1 /* errMsgId */, msg.arg2 /* vendorCode */);
break;
case MSG_REMOVED:
sendRemovedResult((Fingerprint) msg.obj, msg.arg1 /* remaining */);
break;
- case MSG_ENUMERATED:
- sendEnumeratedResult((Long) msg.obj /* deviceId */, msg.arg1 /* fingerId */,
- msg.arg2 /* groupId */);
- break;
}
}
};
@@ -860,12 +830,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
mRemovalCallback.onRemovalSucceeded(fingerprint, remaining);
}
- private void sendEnumeratedResult(long deviceId, int fingerId, int groupId) {
- if (mEnumerateCallback != null) {
- mEnumerateCallback.onEnumerate(new Fingerprint(null, groupId, fingerId, deviceId));
- }
- }
-
private void sendEnrollResult(Fingerprint fp, int remaining) {
if (mEnrollmentCallback != null) {
mEnrollmentCallback.onEnrollmentProgress(remaining);
@@ -886,7 +850,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
}
}
- private void sendAcquiredResult(long deviceId, int acquireInfo, int vendorCode) {
+ private void sendAcquiredResult(int acquireInfo, int vendorCode) {
if (mAuthenticationCallback != null) {
mAuthenticationCallback.onAuthenticationAcquired(acquireInfo);
}
@@ -906,7 +870,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
}
}
- private void sendErrorResult(long deviceId, int errMsgId, int vendorCode) {
+ private void sendErrorResult(int errMsgId, int vendorCode) {
// emulate HAL 2.1 behavior and send real errMsgId
final int clientErrMsgId = errMsgId == FINGERPRINT_ERROR_VENDOR
? (vendorCode + FINGERPRINT_ERROR_VENDOR_BASE) : errMsgId;
@@ -919,9 +883,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
} else if (mRemovalCallback != null) {
mRemovalCallback.onRemovalError(mRemovalFingerprint, clientErrMsgId,
getErrorString(mContext, errMsgId, vendorCode));
- } else if (mEnumerateCallback != null) {
- mEnumerateCallback.onEnumerateError(clientErrMsgId,
- getErrorString(mContext, errMsgId, vendorCode));
}
}
@@ -1048,44 +1009,35 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
private IFingerprintServiceReceiver mServiceReceiver = new IFingerprintServiceReceiver.Stub() {
@Override // binder call
- public void onEnrollResult(long deviceId, int fingerId, int groupId, int remaining) {
- mHandler.obtainMessage(MSG_ENROLL_RESULT, remaining, 0,
- new Fingerprint(null, groupId, fingerId, deviceId)).sendToTarget();
+ public void onEnrollResult(Fingerprint fp, int remaining) {
+ mHandler.obtainMessage(MSG_ENROLL_RESULT, remaining, 0, fp).sendToTarget();
}
@Override // binder call
- public void onAcquired(long deviceId, int acquireInfo, int vendorCode) {
- mHandler.obtainMessage(MSG_ACQUIRED, acquireInfo, vendorCode,
- deviceId).sendToTarget();
+ public void onAcquired(int acquireInfo, int vendorCode) {
+ mHandler.obtainMessage(MSG_ACQUIRED, acquireInfo, vendorCode).sendToTarget();
}
@Override // binder call
- public void onAuthenticationSucceeded(long deviceId, Fingerprint fp, int userId,
+ public void onAuthenticationSucceeded(Fingerprint fp, int userId,
boolean isStrongBiometric) {
mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, isStrongBiometric ? 1 : 0,
fp).sendToTarget();
}
@Override // binder call
- public void onAuthenticationFailed(long deviceId) {
+ public void onAuthenticationFailed() {
mHandler.obtainMessage(MSG_AUTHENTICATION_FAILED).sendToTarget();
}
@Override // binder call
- public void onError(long deviceId, int error, int vendorCode) {
- mHandler.obtainMessage(MSG_ERROR, error, vendorCode, deviceId).sendToTarget();
- }
-
- @Override // binder call
- public void onRemoved(long deviceId, int fingerId, int groupId, int remaining) {
- mHandler.obtainMessage(MSG_REMOVED, remaining, 0,
- new Fingerprint(null, groupId, fingerId, deviceId)).sendToTarget();
+ public void onError(int error, int vendorCode) {
+ mHandler.obtainMessage(MSG_ERROR, error, vendorCode).sendToTarget();
}
@Override // binder call
- public void onEnumerated(long deviceId, int fingerId, int groupId, int remaining) {
- // TODO: propagate remaining
- mHandler.obtainMessage(MSG_ENUMERATED, fingerId, groupId, deviceId).sendToTarget();
+ public void onRemoved(Fingerprint fp, int remaining) {
+ mHandler.obtainMessage(MSG_REMOVED, remaining, 0, fp).sendToTarget();
}
};
diff --git a/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl b/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl
index 4412cee31bb0..87748a32b40b 100644
--- a/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl
+++ b/core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl
@@ -22,12 +22,10 @@ import android.hardware.fingerprint.Fingerprint;
* @hide
*/
oneway interface IFingerprintServiceReceiver {
- void onEnrollResult(long deviceId, int fingerId, int groupId, int remaining);
- void onAcquired(long deviceId, int acquiredInfo, int vendorCode);
- void onAuthenticationSucceeded(long deviceId, in Fingerprint fp, int userId,
- boolean isStrongBiometric);
- void onAuthenticationFailed(long deviceId);
- void onError(long deviceId, int error, int vendorCode);
- void onRemoved(long deviceId, int fingerId, int groupId, int remaining);
- void onEnumerated(long deviceId, int fingerId, int groupId, int remaining);
+ void onEnrollResult(in Fingerprint fp, int remaining);
+ void onAcquired(int acquiredInfo, int vendorCode);
+ void onAuthenticationSucceeded(in Fingerprint fp, int userId, boolean isStrongBiometric);
+ void onAuthenticationFailed();
+ void onError(int error, int vendorCode);
+ void onRemoved(in Fingerprint fp, int remaining);
}