Consolidate revokeChallenge methods

Fixes: 181977689
Test: manual
Change-Id: Id26588836535f03566d93f073ef73cde946272b2
This commit is contained in:
Kevin Chyn
2021-03-09 13:13:29 -08:00
parent f70bb15f6c
commit b6d71bb083
2 changed files with 8 additions and 21 deletions

View File

@@ -475,28 +475,11 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
* @hide
*/
@RequiresPermission(MANAGE_BIOMETRIC)
public void revokeChallenge() {
final List<FaceSensorPropertiesInternal> faceSensorProperties =
getSensorPropertiesInternal();
if (faceSensorProperties.isEmpty()) {
Slog.e(TAG, "No sensors during revokeChallenge");
}
revokeChallenge(faceSensorProperties.get(0).sensorId);
}
/**
* Invalidates the current challenge.
*
* TODO(b/171335732): should take userId and challenge
*
* @hide
*/
@RequiresPermission(MANAGE_BIOMETRIC)
public void revokeChallenge(int sensorId) {
public void revokeChallenge(int sensorId, int userId, long challenge) {
if (mService != null) {
try {
mService.revokeChallenge(mToken, sensorId, 0 /* userId */,
mContext.getOpPackageName(), 0 /* challenge */);
mService.revokeChallenge(mToken, sensorId, userId,
mContext.getOpPackageName(), challenge);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -135,7 +135,11 @@ public class BiometricDeferredQueue {
}
sensorIds.remove(sensorId);
faceManager.revokeChallenge(sensorId);
// Challenge is only required for IBiometricsFace@1.0 (and not IFace AIDL). The
// IBiometricsFace@1.0 HAL does not require userId to revokeChallenge, so passing
// in 0 is OK.
final int userId = 0;
faceManager.revokeChallenge(sensorId, userId, challenge);
if (sensorIds.isEmpty()) {
Slog.d(TAG, "Done requesting resetLockout for all face sensors");