Merge changes from topic "revert-13630975-revert-13593269-QAPPBSWOVZ-FERZONVHNV" into sc-dev
* changes: Revert^2 "Try to ensure tests run sequentially" Fix NPE during fingerprint removal Revert^2 "Update RemovalClient to support new biometric AIDL"
This commit is contained in:
@@ -237,7 +237,8 @@ public class BiometricManager {
|
|||||||
public BiometricTestSession createTestSession(int sensorId) {
|
public BiometricTestSession createTestSession(int sensorId) {
|
||||||
try {
|
try {
|
||||||
return new BiometricTestSession(mContext, sensorId,
|
return new BiometricTestSession(mContext, sensorId,
|
||||||
mService.createTestSession(sensorId, mContext.getOpPackageName()));
|
(context, sensorId1, callback) -> mService
|
||||||
|
.createTestSession(sensorId1, callback, context.getOpPackageName()));
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package android.hardware.biometrics;
|
|||||||
import static android.Manifest.permission.TEST_BIOMETRIC;
|
import static android.Manifest.permission.TEST_BIOMETRIC;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.annotation.TestApi;
|
import android.annotation.TestApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -27,6 +28,9 @@ import android.os.RemoteException;
|
|||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common set of interfaces to test biometric-related APIs, including {@link BiometricPrompt} and
|
* Common set of interfaces to test biometric-related APIs, including {@link BiometricPrompt} and
|
||||||
* {@link android.hardware.fingerprint.FingerprintManager}.
|
* {@link android.hardware.fingerprint.FingerprintManager}.
|
||||||
@@ -36,22 +40,58 @@ import android.util.Log;
|
|||||||
public class BiometricTestSession implements AutoCloseable {
|
public class BiometricTestSession implements AutoCloseable {
|
||||||
private static final String TAG = "BiometricTestSession";
|
private static final String TAG = "BiometricTestSession";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public interface TestSessionProvider {
|
||||||
|
@NonNull
|
||||||
|
ITestSession createTestSession(@NonNull Context context, int sensorId,
|
||||||
|
@NonNull ITestSessionCallback callback) throws RemoteException;
|
||||||
|
}
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final int mSensorId;
|
private final int mSensorId;
|
||||||
private final ITestSession mTestSession;
|
private final ITestSession mTestSession;
|
||||||
|
|
||||||
// Keep track of users that were tested, which need to be cleaned up when finishing.
|
// Keep track of users that were tested, which need to be cleaned up when finishing.
|
||||||
private final ArraySet<Integer> mTestedUsers;
|
@NonNull private final ArraySet<Integer> mTestedUsers;
|
||||||
|
|
||||||
|
// Track the users currently cleaning up, and provide a latch that gets notified when all
|
||||||
|
// users have finished cleaning up. This is an imperfect system, as there can technically be
|
||||||
|
// multiple cleanups per user. Theoretically we should track the cleanup's BaseClientMonitor's
|
||||||
|
// unique ID, but it's complicated to plumb it through. This should be fine for now.
|
||||||
|
@Nullable private CountDownLatch mCloseLatch;
|
||||||
|
@NonNull private final ArraySet<Integer> mUsersCleaningUp;
|
||||||
|
|
||||||
|
private final ITestSessionCallback mCallback = new ITestSessionCallback.Stub() {
|
||||||
|
@Override
|
||||||
|
public void onCleanupStarted(int userId) {
|
||||||
|
Log.d(TAG, "onCleanupStarted, sensor: " + mSensorId + ", userId: " + userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCleanupFinished(int userId) {
|
||||||
|
Log.d(TAG, "onCleanupFinished, sensor: " + mSensorId
|
||||||
|
+ ", userId: " + userId
|
||||||
|
+ ", remaining users: " + mUsersCleaningUp.size());
|
||||||
|
mUsersCleaningUp.remove(userId);
|
||||||
|
|
||||||
|
if (mUsersCleaningUp.isEmpty() && mCloseLatch != null) {
|
||||||
|
mCloseLatch.countDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public BiometricTestSession(@NonNull Context context, int sensorId,
|
public BiometricTestSession(@NonNull Context context, int sensorId,
|
||||||
@NonNull ITestSession testSession) {
|
@NonNull TestSessionProvider testSessionProvider) throws RemoteException {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorId = sensorId;
|
mSensorId = sensorId;
|
||||||
mTestSession = testSession;
|
mTestSession = testSessionProvider.createTestSession(context, sensorId, mCallback);
|
||||||
mTestedUsers = new ArraySet<>();
|
mTestedUsers = new ArraySet<>();
|
||||||
|
mUsersCleaningUp = new ArraySet<>();
|
||||||
setTestHalEnabled(true);
|
setTestHalEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +216,11 @@ public class BiometricTestSession implements AutoCloseable {
|
|||||||
@RequiresPermission(TEST_BIOMETRIC)
|
@RequiresPermission(TEST_BIOMETRIC)
|
||||||
public void cleanupInternalState(int userId) {
|
public void cleanupInternalState(int userId) {
|
||||||
try {
|
try {
|
||||||
|
if (mUsersCleaningUp.contains(userId)) {
|
||||||
|
Log.w(TAG, "Cleanup already in progress for user: " + userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
mUsersCleaningUp.add(userId);
|
||||||
mTestSession.cleanupInternalState(userId);
|
mTestSession.cleanupInternalState(userId);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
@@ -185,12 +230,24 @@ public class BiometricTestSession implements AutoCloseable {
|
|||||||
@Override
|
@Override
|
||||||
@RequiresPermission(TEST_BIOMETRIC)
|
@RequiresPermission(TEST_BIOMETRIC)
|
||||||
public void close() {
|
public void close() {
|
||||||
// Disable the test HAL first, so that enumerate is run on the real HAL, which should have
|
// Cleanup can be performed using the test HAL, since it always responds to enumerate with
|
||||||
// no enrollments. Test-only framework enrollments will be deleted.
|
// zero enrollments.
|
||||||
setTestHalEnabled(false);
|
if (!mTestedUsers.isEmpty()) {
|
||||||
|
mCloseLatch = new CountDownLatch(1);
|
||||||
|
for (int user : mTestedUsers) {
|
||||||
|
cleanupInternalState(user);
|
||||||
|
}
|
||||||
|
|
||||||
for (int user : mTestedUsers) {
|
try {
|
||||||
cleanupInternalState(user);
|
Log.d(TAG, "Awaiting latch...");
|
||||||
|
mCloseLatch.await(10, TimeUnit.SECONDS);
|
||||||
|
Log.d(TAG, "Finished awaiting");
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Log.e(TAG, "Latch interrupted", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable the test HAL after the sensor becomes idle.
|
||||||
|
setTestHalEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
|
|||||||
import android.hardware.biometrics.IBiometricServiceReceiver;
|
import android.hardware.biometrics.IBiometricServiceReceiver;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.PromptInfo;
|
import android.hardware.biometrics.PromptInfo;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ import android.hardware.biometrics.SensorPropertiesInternal;
|
|||||||
*/
|
*/
|
||||||
interface IAuthService {
|
interface IAuthService {
|
||||||
// Creates a test session with the specified sensorId
|
// Creates a test session with the specified sensorId
|
||||||
ITestSession createTestSession(int sensorId, String opPackageName);
|
ITestSession createTestSession(int sensorId, ITestSessionCallback callback, String opPackageName);
|
||||||
|
|
||||||
// Retrieve static sensor properties for all biometric sensors
|
// Retrieve static sensor properties for all biometric sensors
|
||||||
List<SensorPropertiesInternal> getSensorProperties(String opPackageName);
|
List<SensorPropertiesInternal> getSensorProperties(String opPackageName);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.hardware.biometrics.IBiometricSensorReceiver;
|
|||||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
import android.hardware.face.IFaceServiceReceiver;
|
import android.hardware.face.IFaceServiceReceiver;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
@@ -32,7 +33,7 @@ import android.hardware.face.Face;
|
|||||||
interface IBiometricAuthenticator {
|
interface IBiometricAuthenticator {
|
||||||
|
|
||||||
// Creates a test session
|
// Creates a test session
|
||||||
ITestSession createTestSession(String opPackageName);
|
ITestSession createTestSession(ITestSessionCallback callback, String opPackageName);
|
||||||
|
|
||||||
// Retrieve static sensor properties
|
// Retrieve static sensor properties
|
||||||
SensorPropertiesInternal getSensorProperties(String opPackageName);
|
SensorPropertiesInternal getSensorProperties(String opPackageName);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.hardware.biometrics.IBiometricServiceReceiver;
|
|||||||
import android.hardware.biometrics.IBiometricAuthenticator;
|
import android.hardware.biometrics.IBiometricAuthenticator;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.PromptInfo;
|
import android.hardware.biometrics.PromptInfo;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ import android.hardware.biometrics.SensorPropertiesInternal;
|
|||||||
*/
|
*/
|
||||||
interface IBiometricService {
|
interface IBiometricService {
|
||||||
// Creates a test session with the specified sensorId
|
// Creates a test session with the specified sensorId
|
||||||
ITestSession createTestSession(int sensorId, String opPackageName);
|
ITestSession createTestSession(int sensorId, ITestSessionCallback callback, String opPackageName);
|
||||||
|
|
||||||
// Retrieve static sensor properties for all biometric sensors
|
// Retrieve static sensor properties for all biometric sensors
|
||||||
List<SensorPropertiesInternal> getSensorProperties(String opPackageName);
|
List<SensorPropertiesInternal> getSensorProperties(String opPackageName);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package android.hardware.biometrics;
|
|||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A test service for FingerprintManager and BiometricPrompt.
|
* A test service for FingerprintManager and BiometricManager.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
interface ITestSession {
|
interface ITestSession {
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.hardware.biometrics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ITestSession callback for FingerprintManager and BiometricManager.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
interface ITestSessionCallback {
|
||||||
|
void onCleanupStarted(int userId);
|
||||||
|
void onCleanupFinished(int userId);
|
||||||
|
}
|
||||||
@@ -574,12 +574,23 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
|||||||
mService.remove(mToken, face.getBiometricId(), userId, mServiceReceiver,
|
mService.remove(mToken, face.getBiometricId(), userId, mServiceReceiver,
|
||||||
mContext.getOpPackageName());
|
mContext.getOpPackageName());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Remote exception in remove: ", e);
|
throw e.rethrowFromSystemServer();
|
||||||
if (callback != null) {
|
}
|
||||||
callback.onRemovalError(face, FACE_ERROR_HW_UNAVAILABLE,
|
}
|
||||||
getErrorString(mContext, FACE_ERROR_HW_UNAVAILABLE,
|
}
|
||||||
0 /* vendorCode */));
|
|
||||||
}
|
/**
|
||||||
|
* Removes all face templates for the given user.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(MANAGE_BIOMETRIC)
|
||||||
|
public void removeAll(int userId, @NonNull RemovalCallback callback) {
|
||||||
|
if (mService != null) {
|
||||||
|
try {
|
||||||
|
mRemovalCallback = callback;
|
||||||
|
mService.removeAll(mToken, userId, mServiceReceiver, mContext.getOpPackageName());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import android.hardware.biometrics.IBiometricSensorReceiver;
|
|||||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.face.IFaceServiceReceiver;
|
import android.hardware.face.IFaceServiceReceiver;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||||
@@ -32,7 +33,7 @@ import android.view.Surface;
|
|||||||
interface IFaceService {
|
interface IFaceService {
|
||||||
|
|
||||||
// Creates a test session with the specified sensorId
|
// Creates a test session with the specified sensorId
|
||||||
ITestSession createTestSession(int sensorId, String opPackageName);
|
ITestSession createTestSession(int sensorId, ITestSessionCallback callback, String opPackageName);
|
||||||
|
|
||||||
// Requests a proto dump of the specified sensor
|
// Requests a proto dump of the specified sensor
|
||||||
byte[] dumpSensorServiceStateProto(int sensorId, boolean clearSchedulerBuffer);
|
byte[] dumpSensorServiceStateProto(int sensorId, boolean clearSchedulerBuffer);
|
||||||
@@ -83,10 +84,13 @@ interface IFaceService {
|
|||||||
// Cancel enrollment in progress
|
// Cancel enrollment in progress
|
||||||
void cancelEnrollment(IBinder token);
|
void cancelEnrollment(IBinder token);
|
||||||
|
|
||||||
// Any errors resulting from this call will be returned to the listener
|
// Removes the specified face enrollment for the specified userId.
|
||||||
void remove(IBinder token, int faceId, int userId, IFaceServiceReceiver receiver,
|
void remove(IBinder token, int faceId, int userId, IFaceServiceReceiver receiver,
|
||||||
String opPackageName);
|
String opPackageName);
|
||||||
|
|
||||||
|
// Removes all face enrollments for the specified userId.
|
||||||
|
void removeAll(IBinder token, int userId, IFaceServiceReceiver receiver, String opPackageName);
|
||||||
|
|
||||||
// Get the enrolled face for user.
|
// Get the enrolled face for user.
|
||||||
List<Face> getEnrolledFaces(int sensorId, int userId, String opPackageName);
|
List<Face> getEnrolledFaces(int sensorId, int userId, String opPackageName);
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,21 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
*/
|
*/
|
||||||
public static final int SENSOR_ID_ANY = -1;
|
public static final int SENSOR_ID_ANY = -1;
|
||||||
|
|
||||||
|
private static class RemoveTracker {
|
||||||
|
static final int REMOVE_SINGLE = 1;
|
||||||
|
static final int REMOVE_ALL = 2;
|
||||||
|
@IntDef({REMOVE_SINGLE, REMOVE_ALL})
|
||||||
|
@interface RemoveRequest {}
|
||||||
|
|
||||||
|
final @RemoveRequest int mRemoveRequest;
|
||||||
|
@Nullable final Fingerprint mSingleFingerprint;
|
||||||
|
|
||||||
|
RemoveTracker(@RemoveRequest int request, @Nullable Fingerprint fingerprint) {
|
||||||
|
mRemoveRequest = request;
|
||||||
|
mSingleFingerprint = fingerprint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private IFingerprintService mService;
|
private IFingerprintService mService;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private IBinder mToken = new Binder();
|
private IBinder mToken = new Binder();
|
||||||
@@ -123,10 +138,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
private RemovalCallback mRemovalCallback;
|
private RemovalCallback mRemovalCallback;
|
||||||
private GenerateChallengeCallback mGenerateChallengeCallback;
|
private GenerateChallengeCallback mGenerateChallengeCallback;
|
||||||
private CryptoObject mCryptoObject;
|
private CryptoObject mCryptoObject;
|
||||||
private Fingerprint mRemovalFingerprint;
|
@Nullable private RemoveTracker mRemoveTracker;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of properties for all fingerprint sensors on the device.
|
* Retrieves a list of properties for all fingerprint sensors on the device.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -154,7 +168,8 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
public BiometricTestSession createTestSession(int sensorId) {
|
public BiometricTestSession createTestSession(int sensorId) {
|
||||||
try {
|
try {
|
||||||
return new BiometricTestSession(mContext, sensorId,
|
return new BiometricTestSession(mContext, sensorId,
|
||||||
mService.createTestSession(sensorId, mContext.getOpPackageName()));
|
(context, sensorId1, callback) -> mService
|
||||||
|
.createTestSession(sensorId1, callback, context.getOpPackageName()));
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -735,15 +750,27 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
public void remove(Fingerprint fp, int userId, RemovalCallback callback) {
|
public void remove(Fingerprint fp, int userId, RemovalCallback callback) {
|
||||||
if (mService != null) try {
|
if (mService != null) try {
|
||||||
mRemovalCallback = callback;
|
mRemovalCallback = callback;
|
||||||
mRemovalFingerprint = fp;
|
mRemoveTracker = new RemoveTracker(RemoveTracker.REMOVE_SINGLE, fp);
|
||||||
mService.remove(mToken, fp.getBiometricId(), userId, mServiceReceiver,
|
mService.remove(mToken, fp.getBiometricId(), userId, mServiceReceiver,
|
||||||
mContext.getOpPackageName());
|
mContext.getOpPackageName());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Remote exception in remove: ", e);
|
throw e.rethrowFromSystemServer();
|
||||||
if (callback != null) {
|
}
|
||||||
callback.onRemovalError(fp, FINGERPRINT_ERROR_HW_UNAVAILABLE,
|
}
|
||||||
getErrorString(mContext, FINGERPRINT_ERROR_HW_UNAVAILABLE,
|
|
||||||
0 /* vendorCode */));
|
/**
|
||||||
|
* Removes all face templates for the given user.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(MANAGE_FINGERPRINT)
|
||||||
|
public void removeAll(int userId, @NonNull RemovalCallback callback) {
|
||||||
|
if (mService != null) {
|
||||||
|
try {
|
||||||
|
mRemovalCallback = callback;
|
||||||
|
mRemoveTracker = new RemoveTracker(RemoveTracker.REMOVE_ALL, null /* fp */);
|
||||||
|
mService.removeAll(mToken, userId, mServiceReceiver, mContext.getOpPackageName());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1044,16 +1071,29 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
if (mRemovalCallback == null) {
|
if (mRemovalCallback == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fingerprint == null) {
|
|
||||||
Slog.e(TAG, "Received MSG_REMOVED, but fingerprint is null");
|
if (mRemoveTracker == null) {
|
||||||
|
Slog.w(TAG, "Removal tracker is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fingerId = fingerprint.getBiometricId();
|
if (mRemoveTracker.mRemoveRequest == RemoveTracker.REMOVE_SINGLE) {
|
||||||
int reqFingerId = mRemovalFingerprint.getBiometricId();
|
if (fingerprint == null) {
|
||||||
if (reqFingerId != 0 && fingerId != 0 && fingerId != reqFingerId) {
|
Slog.e(TAG, "Received MSG_REMOVED, but fingerprint is null");
|
||||||
Slog.w(TAG, "Finger id didn't match: " + fingerId + " != " + reqFingerId);
|
return;
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
if (mRemoveTracker.mSingleFingerprint == null) {
|
||||||
|
Slog.e(TAG, "Missing fingerprint");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int fingerId = fingerprint.getBiometricId();
|
||||||
|
int reqFingerId = mRemoveTracker.mSingleFingerprint.getBiometricId();
|
||||||
|
if (reqFingerId != 0 && fingerId != 0 && fingerId != reqFingerId) {
|
||||||
|
Slog.w(TAG, "Finger id didn't match: " + fingerId + " != " + reqFingerId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mRemovalCallback.onRemovalSucceeded(fingerprint, remaining);
|
mRemovalCallback.onRemovalSucceeded(fingerprint, remaining);
|
||||||
@@ -1110,7 +1150,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
mAuthenticationCallback.onAuthenticationError(clientErrMsgId,
|
mAuthenticationCallback.onAuthenticationError(clientErrMsgId,
|
||||||
getErrorString(mContext, errMsgId, vendorCode));
|
getErrorString(mContext, errMsgId, vendorCode));
|
||||||
} else if (mRemovalCallback != null) {
|
} else if (mRemovalCallback != null) {
|
||||||
mRemovalCallback.onRemovalError(mRemovalFingerprint, clientErrMsgId,
|
final Fingerprint fp = mRemoveTracker != null
|
||||||
|
? mRemoveTracker.mSingleFingerprint : null;
|
||||||
|
mRemovalCallback.onRemovalError(fp, clientErrMsgId,
|
||||||
getErrorString(mContext, errMsgId, vendorCode));
|
getErrorString(mContext, errMsgId, vendorCode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import android.hardware.biometrics.IBiometricSensorReceiver;
|
|||||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
|
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
|
||||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||||
@@ -33,7 +34,7 @@ import java.util.List;
|
|||||||
interface IFingerprintService {
|
interface IFingerprintService {
|
||||||
|
|
||||||
// Creates a test session with the specified sensorId
|
// Creates a test session with the specified sensorId
|
||||||
ITestSession createTestSession(int sensorId, String opPackageName);
|
ITestSession createTestSession(int sensorId, ITestSessionCallback callback, String opPackageName);
|
||||||
|
|
||||||
// Requests a proto dump of the specified sensor
|
// Requests a proto dump of the specified sensor
|
||||||
byte[] dumpSensorServiceStateProto(int sensorId, boolean clearSchedulerBuffer);
|
byte[] dumpSensorServiceStateProto(int sensorId, boolean clearSchedulerBuffer);
|
||||||
@@ -87,6 +88,9 @@ interface IFingerprintService {
|
|||||||
void remove(IBinder token, int fingerId, int userId, IFingerprintServiceReceiver receiver,
|
void remove(IBinder token, int fingerId, int userId, IFingerprintServiceReceiver receiver,
|
||||||
String opPackageName);
|
String opPackageName);
|
||||||
|
|
||||||
|
// Removes all face enrollments for the specified userId.
|
||||||
|
void removeAll(IBinder token, int userId, IFingerprintServiceReceiver receiver, String opPackageName);
|
||||||
|
|
||||||
// Rename the fingerprint specified by fingerId and userId to the given name
|
// Rename the fingerprint specified by fingerId and userId to the given name
|
||||||
void rename(int fingerId, int userId, String name);
|
void rename(int fingerId, int userId, String name);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import android.hardware.biometrics.IBiometricService;
|
|||||||
import android.hardware.biometrics.IBiometricServiceReceiver;
|
import android.hardware.biometrics.IBiometricServiceReceiver;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.PromptInfo;
|
import android.hardware.biometrics.PromptInfo;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
import android.hardware.face.IFaceService;
|
import android.hardware.face.IFaceService;
|
||||||
@@ -144,13 +145,14 @@ public class AuthService extends SystemService {
|
|||||||
|
|
||||||
private final class AuthServiceImpl extends IAuthService.Stub {
|
private final class AuthServiceImpl extends IAuthService.Stub {
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName)
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
throws RemoteException {
|
@NonNull String opPackageName) throws RemoteException {
|
||||||
Utils.checkPermission(getContext(), TEST_BIOMETRIC);
|
Utils.checkPermission(getContext(), TEST_BIOMETRIC);
|
||||||
|
|
||||||
final long identity = Binder.clearCallingIdentity();
|
final long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
return mInjector.getBiometricService().createTestSession(sensorId, opPackageName);
|
return mInjector.getBiometricService()
|
||||||
|
.createTestSession(sensorId, callback, opPackageName);
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(identity);
|
Binder.restoreCallingIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import android.hardware.biometrics.IBiometricServiceReceiver;
|
|||||||
import android.hardware.biometrics.IBiometricSysuiReceiver;
|
import android.hardware.biometrics.IBiometricSysuiReceiver;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.PromptInfo;
|
import android.hardware.biometrics.PromptInfo;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
@@ -570,13 +571,13 @@ public class BiometricService extends SystemService {
|
|||||||
*/
|
*/
|
||||||
private final class BiometricServiceWrapper extends IBiometricService.Stub {
|
private final class BiometricServiceWrapper extends IBiometricService.Stub {
|
||||||
@Override // Binder call
|
@Override // Binder call
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName)
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
throws RemoteException {
|
@NonNull String opPackageName) throws RemoteException {
|
||||||
checkInternalPermission();
|
checkInternalPermission();
|
||||||
|
|
||||||
for (BiometricSensor sensor : mSensors) {
|
for (BiometricSensor sensor : mSensors) {
|
||||||
if (sensor.id == sensorId) {
|
if (sensor.id == sensorId) {
|
||||||
return sensor.impl.createTestSession(opPackageName);
|
return sensor.impl.createTestSession(callback, opPackageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,18 +37,16 @@ public abstract class RemovalClient<S extends BiometricAuthenticator.Identifier,
|
|||||||
|
|
||||||
private static final String TAG = "Biometrics/RemovalClient";
|
private static final String TAG = "Biometrics/RemovalClient";
|
||||||
|
|
||||||
protected final int mBiometricId;
|
|
||||||
private final BiometricUtils<S> mBiometricUtils;
|
private final BiometricUtils<S> mBiometricUtils;
|
||||||
private final Map<Integer, Long> mAuthenticatorIds;
|
private final Map<Integer, Long> mAuthenticatorIds;
|
||||||
|
|
||||||
public RemovalClient(@NonNull Context context, @NonNull LazyDaemon<T> lazyDaemon,
|
public RemovalClient(@NonNull Context context, @NonNull LazyDaemon<T> lazyDaemon,
|
||||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
||||||
int biometricId, int userId, @NonNull String owner, @NonNull BiometricUtils<S> utils,
|
int userId, @NonNull String owner, @NonNull BiometricUtils<S> utils, int sensorId,
|
||||||
int sensorId, @NonNull Map<Integer, Long> authenticatorIds, int statsModality) {
|
@NonNull Map<Integer, Long> authenticatorIds, int statsModality) {
|
||||||
super(context, lazyDaemon, token, listener, userId, owner, 0 /* cookie */, sensorId,
|
super(context, lazyDaemon, token, listener, userId, owner, 0 /* cookie */, sensorId,
|
||||||
statsModality, BiometricsProtoEnums.ACTION_REMOVE,
|
statsModality, BiometricsProtoEnums.ACTION_REMOVE,
|
||||||
BiometricsProtoEnums.CLIENT_UNKNOWN);
|
BiometricsProtoEnums.CLIENT_UNKNOWN);
|
||||||
mBiometricId = biometricId;
|
|
||||||
mBiometricUtils = utils;
|
mBiometricUtils = utils;
|
||||||
mAuthenticatorIds = authenticatorIds;
|
mAuthenticatorIds = authenticatorIds;
|
||||||
}
|
}
|
||||||
@@ -68,6 +66,7 @@ public abstract class RemovalClient<S extends BiometricAuthenticator.Identifier,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoved(@Nullable BiometricAuthenticator.Identifier identifier, int remaining) {
|
public void onRemoved(@Nullable BiometricAuthenticator.Identifier identifier, int remaining) {
|
||||||
|
Slog.d(TAG, "onRemoved: " + identifier.getBiometricId() + " remaining: " + remaining);
|
||||||
if (identifier != null) {
|
if (identifier != null) {
|
||||||
mBiometricUtils.removeBiometricForUser(getContext(), getTargetUserId(),
|
mBiometricUtils.removeBiometricForUser(getContext(), getTargetUserId(),
|
||||||
identifier.getBiometricId());
|
identifier.getBiometricId());
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.hardware.biometrics.IBiometricAuthenticator;
|
|||||||
import android.hardware.biometrics.IBiometricSensorReceiver;
|
import android.hardware.biometrics.IBiometricSensorReceiver;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
import android.hardware.face.IFaceService;
|
import android.hardware.face.IFaceService;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -41,8 +42,9 @@ public final class FaceAuthenticator extends IBiometricAuthenticator.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(@NonNull String opPackageName) throws RemoteException {
|
public ITestSession createTestSession(@NonNull ITestSessionCallback callback,
|
||||||
return mFaceService.createTestSession(mSensorId, opPackageName);
|
@NonNull String opPackageName) throws RemoteException {
|
||||||
|
return mFaceService.createTestSession(mSensorId, callback, opPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import android.hardware.biometrics.IBiometricService;
|
|||||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.face.IFace;
|
import android.hardware.biometrics.face.IFace;
|
||||||
import android.hardware.biometrics.face.SensorProps;
|
import android.hardware.biometrics.face.SensorProps;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
@@ -133,7 +134,8 @@ public class FaceService extends SystemService implements BiometricServiceCallba
|
|||||||
*/
|
*/
|
||||||
private final class FaceServiceWrapper extends IFaceService.Stub {
|
private final class FaceServiceWrapper extends IFaceService.Stub {
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName) {
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
|
@NonNull String opPackageName) {
|
||||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||||
|
|
||||||
final ServiceProvider provider = getProviderForSensor(sensorId);
|
final ServiceProvider provider = getProviderForSensor(sensorId);
|
||||||
@@ -143,7 +145,7 @@ public class FaceService extends SystemService implements BiometricServiceCallba
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return provider.createTestSession(sensorId, opPackageName);
|
return provider.createTestSession(sensorId, callback, opPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -386,7 +388,22 @@ public class FaceService extends SystemService implements BiometricServiceCallba
|
|||||||
opPackageName);
|
opPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // Binder call
|
||||||
|
public void removeAll(final IBinder token, final int userId,
|
||||||
|
final IFaceServiceReceiver receiver, final String opPackageName) {
|
||||||
|
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||||
|
|
||||||
|
final Pair<Integer, ServiceProvider> provider = getSingleProvider();
|
||||||
|
if (provider == null) {
|
||||||
|
Slog.w(TAG, "Null provider for removeAll");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
provider.second.scheduleRemoveAll(provider.first, token, userId, receiver,
|
||||||
|
opPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // Binder call
|
||||||
public void addLockoutResetCallback(final IBiometricServiceLockoutResetCallback callback,
|
public void addLockoutResetCallback(final IBiometricServiceLockoutResetCallback callback,
|
||||||
final String opPackageName) {
|
final String opPackageName) {
|
||||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
import android.hardware.face.FaceManager;
|
import android.hardware.face.FaceManager;
|
||||||
import android.hardware.face.FaceSensorPropertiesInternal;
|
import android.hardware.face.FaceSensorPropertiesInternal;
|
||||||
@@ -28,6 +29,7 @@ import android.os.IBinder;
|
|||||||
import android.os.NativeHandle;
|
import android.os.NativeHandle;
|
||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
|
|
||||||
|
import com.android.server.biometrics.sensors.BaseClientMonitor;
|
||||||
import com.android.server.biometrics.sensors.ClientMonitorCallbackConverter;
|
import com.android.server.biometrics.sensors.ClientMonitorCallbackConverter;
|
||||||
import com.android.server.biometrics.sensors.LockoutTracker;
|
import com.android.server.biometrics.sensors.LockoutTracker;
|
||||||
|
|
||||||
@@ -109,6 +111,9 @@ public interface ServiceProvider {
|
|||||||
void scheduleRemove(int sensorId, @NonNull IBinder token, int faceId, int userId,
|
void scheduleRemove(int sensorId, @NonNull IBinder token, int faceId, int userId,
|
||||||
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName);
|
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName);
|
||||||
|
|
||||||
|
void scheduleRemoveAll(int sensorId, @NonNull IBinder token, int userId,
|
||||||
|
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName);
|
||||||
|
|
||||||
void scheduleResetLockout(int sensorId, int userId, @NonNull byte[] hardwareAuthToken);
|
void scheduleResetLockout(int sensorId, int userId, @NonNull byte[] hardwareAuthToken);
|
||||||
|
|
||||||
void scheduleSetFeature(int sensorId, @NonNull IBinder token, int userId, int feature,
|
void scheduleSetFeature(int sensorId, @NonNull IBinder token, int userId, int feature,
|
||||||
@@ -120,7 +125,8 @@ public interface ServiceProvider {
|
|||||||
|
|
||||||
void startPreparedClient(int sensorId, int cookie);
|
void startPreparedClient(int sensorId, int cookie);
|
||||||
|
|
||||||
void scheduleInternalCleanup(int sensorId, int userId);
|
void scheduleInternalCleanup(int sensorId, int userId,
|
||||||
|
@Nullable BaseClientMonitor.Callback callback);
|
||||||
|
|
||||||
void dumpProtoState(int sensorId, @NonNull ProtoOutputStream proto,
|
void dumpProtoState(int sensorId, @NonNull ProtoOutputStream proto,
|
||||||
boolean clearSchedulerBuffer);
|
boolean clearSchedulerBuffer);
|
||||||
@@ -130,7 +136,8 @@ public interface ServiceProvider {
|
|||||||
void dumpInternal(int sensorId, @NonNull PrintWriter pw);
|
void dumpInternal(int sensorId, @NonNull PrintWriter pw);
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
ITestSession createTestSession(int sensorId, @NonNull String opPackageName);
|
ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
|
@NonNull String opPackageName);
|
||||||
|
|
||||||
void dumpHal(int sensorId, @NonNull FileDescriptor fd, @NonNull String[] args);
|
void dumpHal(int sensorId, @NonNull FileDescriptor fd, @NonNull String[] args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static android.Manifest.permission.TEST_BIOMETRIC;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.face.AuthenticationFrame;
|
import android.hardware.biometrics.face.AuthenticationFrame;
|
||||||
import android.hardware.biometrics.face.BaseFrame;
|
import android.hardware.biometrics.face.BaseFrame;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
@@ -28,10 +29,12 @@ import android.hardware.face.FaceAuthenticationFrame;
|
|||||||
import android.hardware.face.FaceEnrollFrame;
|
import android.hardware.face.FaceEnrollFrame;
|
||||||
import android.hardware.face.IFaceServiceReceiver;
|
import android.hardware.face.IFaceServiceReceiver;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.server.biometrics.HardwareAuthTokenUtils;
|
import com.android.server.biometrics.HardwareAuthTokenUtils;
|
||||||
import com.android.server.biometrics.Utils;
|
import com.android.server.biometrics.Utils;
|
||||||
|
import com.android.server.biometrics.sensors.BaseClientMonitor;
|
||||||
import com.android.server.biometrics.sensors.face.FaceUtils;
|
import com.android.server.biometrics.sensors.face.FaceUtils;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -49,6 +52,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
|
|
||||||
@NonNull private final Context mContext;
|
@NonNull private final Context mContext;
|
||||||
private final int mSensorId;
|
private final int mSensorId;
|
||||||
|
@NonNull private final ITestSessionCallback mCallback;
|
||||||
@NonNull private final FaceProvider mProvider;
|
@NonNull private final FaceProvider mProvider;
|
||||||
@NonNull private final Sensor mSensor;
|
@NonNull private final Sensor mSensor;
|
||||||
@NonNull private final Set<Integer> mEnrollmentIds;
|
@NonNull private final Set<Integer> mEnrollmentIds;
|
||||||
@@ -132,9 +136,11 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
||||||
|
@NonNull ITestSessionCallback callback,
|
||||||
@NonNull FaceProvider provider, @NonNull Sensor sensor) {
|
@NonNull FaceProvider provider, @NonNull Sensor sensor) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorId = sensorId;
|
mSensorId = sensorId;
|
||||||
|
mCallback = callback;
|
||||||
mProvider = provider;
|
mProvider = provider;
|
||||||
mSensor = sensor;
|
mSensor = sensor;
|
||||||
mEnrollmentIds = new HashSet<>();
|
mEnrollmentIds = new HashSet<>();
|
||||||
@@ -224,6 +230,25 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
public void cleanupInternalState(int userId) {
|
public void cleanupInternalState(int userId) {
|
||||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||||
|
|
||||||
mProvider.scheduleInternalCleanup(mSensorId, userId);
|
mProvider.scheduleInternalCleanup(mSensorId, userId, new BaseClientMonitor.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupStarted(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClientFinished(@NonNull BaseClientMonitor clientMonitor,
|
||||||
|
boolean success) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupFinished(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class FaceInternalCleanupClient extends InternalCleanupClient<Face, ISession> {
|
|||||||
// Internal remove does not need to send results to anyone. Cleanup (enumerate + remove)
|
// Internal remove does not need to send results to anyone. Cleanup (enumerate + remove)
|
||||||
// is all done internally.
|
// is all done internally.
|
||||||
return new FaceRemovalClient(context, lazyDaemon, token,
|
return new FaceRemovalClient(context, lazyDaemon, token,
|
||||||
null /* ClientMonitorCallbackConverter */, biometricId, userId, owner, utils,
|
null /* ClientMonitorCallbackConverter */, new int[] {biometricId}, userId, owner,
|
||||||
sensorId, authenticatorIds);
|
utils, sensorId, authenticatorIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.face.IFace;
|
import android.hardware.biometrics.face.IFace;
|
||||||
import android.hardware.biometrics.face.SensorProps;
|
import android.hardware.biometrics.face.SensorProps;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
@@ -177,7 +178,8 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
|
|||||||
for (int i = 0; i < mSensors.size(); i++) {
|
for (int i = 0; i < mSensors.size(); i++) {
|
||||||
final int sensorId = mSensors.keyAt(i);
|
final int sensorId = mSensors.keyAt(i);
|
||||||
scheduleLoadAuthenticatorIds(sensorId);
|
scheduleLoadAuthenticatorIds(sensorId);
|
||||||
scheduleInternalCleanup(sensorId, ActivityManager.getCurrentUser());
|
scheduleInternalCleanup(sensorId, ActivityManager.getCurrentUser(),
|
||||||
|
null /* callback */);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mDaemon;
|
return mDaemon;
|
||||||
@@ -468,6 +470,25 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
|
|||||||
@Override
|
@Override
|
||||||
public void scheduleRemove(int sensorId, @NonNull IBinder token, int faceId, int userId,
|
public void scheduleRemove(int sensorId, @NonNull IBinder token, int faceId, int userId,
|
||||||
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName) {
|
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName) {
|
||||||
|
scheduleRemoveSpecifiedIds(sensorId, token, new int[] {faceId}, userId, receiver,
|
||||||
|
opPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scheduleRemoveAll(int sensorId, @NonNull IBinder token, int userId,
|
||||||
|
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName) {
|
||||||
|
final List<Face> faces = FaceUtils.getInstance(sensorId)
|
||||||
|
.getBiometricsForUser(mContext, userId);
|
||||||
|
final int[] faceIds = new int[faces.size()];
|
||||||
|
for (int i = 0; i < faces.size(); i++) {
|
||||||
|
faceIds[i] = faces.get(i).getBiometricId();
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduleRemoveSpecifiedIds(sensorId, token, faceIds, userId, receiver, opPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scheduleRemoveSpecifiedIds(int sensorId, @NonNull IBinder token, int[] faceIds,
|
||||||
|
int userId, @NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName) {
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
final IFace daemon = getHalInstance();
|
final IFace daemon = getHalInstance();
|
||||||
if (daemon == null) {
|
if (daemon == null) {
|
||||||
@@ -485,7 +506,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
|
|||||||
|
|
||||||
final FaceRemovalClient client = new FaceRemovalClient(mContext,
|
final FaceRemovalClient client = new FaceRemovalClient(mContext,
|
||||||
mSensors.get(sensorId).getLazySession(), token,
|
mSensors.get(sensorId).getLazySession(), token,
|
||||||
new ClientMonitorCallbackConverter(receiver), faceId, userId,
|
new ClientMonitorCallbackConverter(receiver), faceIds, userId,
|
||||||
opPackageName, FaceUtils.getInstance(sensorId), sensorId,
|
opPackageName, FaceUtils.getInstance(sensorId), sensorId,
|
||||||
mSensors.get(sensorId).getAuthenticatorIds());
|
mSensors.get(sensorId).getAuthenticatorIds());
|
||||||
|
|
||||||
@@ -543,7 +564,8 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleInternalCleanup(int sensorId, int userId) {
|
public void scheduleInternalCleanup(int sensorId, int userId,
|
||||||
|
@Nullable BaseClientMonitor.Callback callback) {
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
final IFace daemon = getHalInstance();
|
final IFace daemon = getHalInstance();
|
||||||
if (daemon == null) {
|
if (daemon == null) {
|
||||||
@@ -564,7 +586,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
|
|||||||
FaceUtils.getInstance(sensorId),
|
FaceUtils.getInstance(sensorId),
|
||||||
mSensors.get(sensorId).getAuthenticatorIds());
|
mSensors.get(sensorId).getAuthenticatorIds());
|
||||||
|
|
||||||
mSensors.get(sensorId).getScheduler().scheduleClientMonitor(client);
|
mSensors.get(sensorId).getScheduler().scheduleClientMonitor(client, callback);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(getTag(), "Remote exception when scheduling internal cleanup", e);
|
Slog.e(getTag(), "Remote exception when scheduling internal cleanup", e);
|
||||||
}
|
}
|
||||||
@@ -627,8 +649,9 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName) {
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
return mSensors.get(sensorId).createTestSession();
|
@NonNull String opPackageName) {
|
||||||
|
return mSensors.get(sensorId).createTestSession(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -38,19 +38,22 @@ import java.util.Map;
|
|||||||
class FaceRemovalClient extends RemovalClient<Face, ISession> {
|
class FaceRemovalClient extends RemovalClient<Face, ISession> {
|
||||||
private static final String TAG = "FaceRemovalClient";
|
private static final String TAG = "FaceRemovalClient";
|
||||||
|
|
||||||
|
final int[] mBiometricIds;
|
||||||
|
|
||||||
FaceRemovalClient(@NonNull Context context, @NonNull LazyDaemon<ISession> lazyDaemon,
|
FaceRemovalClient(@NonNull Context context, @NonNull LazyDaemon<ISession> lazyDaemon,
|
||||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
||||||
int biometricId, int userId, @NonNull String owner, @NonNull BiometricUtils<Face> utils,
|
int[] biometricIds, int userId, @NonNull String owner,
|
||||||
int sensorId, @NonNull Map<Integer, Long> authenticatorIds) {
|
@NonNull BiometricUtils<Face> utils, int sensorId,
|
||||||
super(context, lazyDaemon, token, listener, biometricId, userId, owner, utils, sensorId,
|
@NonNull Map<Integer, Long> authenticatorIds) {
|
||||||
|
super(context, lazyDaemon, token, listener, userId, owner, utils, sensorId,
|
||||||
authenticatorIds, BiometricsProtoEnums.MODALITY_FACE);
|
authenticatorIds, BiometricsProtoEnums.MODALITY_FACE);
|
||||||
|
mBiometricIds = biometricIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startHalOperation() {
|
protected void startHalOperation() {
|
||||||
try {
|
try {
|
||||||
final int[] ids = new int[]{mBiometricId};
|
getFreshDaemon().removeEnrollments(mSequentialId, mBiometricIds);
|
||||||
getFreshDaemon().removeEnrollments(mSequentialId, ids);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Remote exception when requesting remove", e);
|
Slog.e(TAG, "Remote exception when requesting remove", e);
|
||||||
mCallback.onClientFinished(this, false /* success */);
|
mCallback.onClientFinished(this, false /* success */);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.face.AuthenticationFrame;
|
import android.hardware.biometrics.face.AuthenticationFrame;
|
||||||
import android.hardware.biometrics.face.EnrollmentFrame;
|
import android.hardware.biometrics.face.EnrollmentFrame;
|
||||||
import android.hardware.biometrics.face.Error;
|
import android.hardware.biometrics.face.Error;
|
||||||
@@ -459,8 +460,9 @@ public class Sensor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull ITestSession createTestSession() {
|
@NonNull ITestSession createTestSession(@NonNull ITestSessionCallback callback) {
|
||||||
return new BiometricTestSessionImpl(mContext, mSensorProperties.sensorId, mProvider, this);
|
return new BiometricTestSessionImpl(mContext, mSensorProperties.sensorId, callback,
|
||||||
|
mProvider, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createNewSession(@NonNull IFace daemon, int sensorId, int userId)
|
void createNewSession(@NonNull IFace daemon, int sensorId, int userId)
|
||||||
|
|||||||
@@ -21,14 +21,17 @@ import static android.Manifest.permission.TEST_BIOMETRIC;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
import android.hardware.face.FaceAuthenticationFrame;
|
import android.hardware.face.FaceAuthenticationFrame;
|
||||||
import android.hardware.face.FaceEnrollFrame;
|
import android.hardware.face.FaceEnrollFrame;
|
||||||
import android.hardware.face.IFaceServiceReceiver;
|
import android.hardware.face.IFaceServiceReceiver;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.server.biometrics.Utils;
|
import com.android.server.biometrics.Utils;
|
||||||
|
import com.android.server.biometrics.sensors.BaseClientMonitor;
|
||||||
import com.android.server.biometrics.sensors.face.FaceUtils;
|
import com.android.server.biometrics.sensors.face.FaceUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -43,6 +46,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
|
|
||||||
@NonNull private final Context mContext;
|
@NonNull private final Context mContext;
|
||||||
private final int mSensorId;
|
private final int mSensorId;
|
||||||
|
@NonNull private final ITestSessionCallback mCallback;
|
||||||
@NonNull private final Face10 mFace10;
|
@NonNull private final Face10 mFace10;
|
||||||
@NonNull private final Face10.HalResultController mHalResultController;
|
@NonNull private final Face10.HalResultController mHalResultController;
|
||||||
@NonNull private final Set<Integer> mEnrollmentIds;
|
@NonNull private final Set<Integer> mEnrollmentIds;
|
||||||
@@ -120,10 +124,12 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BiometricTestSessionImpl(@NonNull Context context, int sensorId, @NonNull Face10 face10,
|
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
||||||
|
@NonNull ITestSessionCallback callback, @NonNull Face10 face10,
|
||||||
@NonNull Face10.HalResultController halResultController) {
|
@NonNull Face10.HalResultController halResultController) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorId = sensorId;
|
mSensorId = sensorId;
|
||||||
|
mCallback = callback;
|
||||||
mFace10 = face10;
|
mFace10 = face10;
|
||||||
mHalResultController = halResultController;
|
mHalResultController = halResultController;
|
||||||
mEnrollmentIds = new HashSet<>();
|
mEnrollmentIds = new HashSet<>();
|
||||||
@@ -201,6 +207,25 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
public void cleanupInternalState(int userId) {
|
public void cleanupInternalState(int userId) {
|
||||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||||
|
|
||||||
mFace10.scheduleInternalCleanup(mSensorId, userId);
|
mFace10.scheduleInternalCleanup(mSensorId, userId, new BaseClientMonitor.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupStarted(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClientFinished(@NonNull BaseClientMonitor clientMonitor,
|
||||||
|
boolean success) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupFinished(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.hardware.biometrics.BiometricFaceConstants;
|
|||||||
import android.hardware.biometrics.BiometricManager;
|
import android.hardware.biometrics.BiometricManager;
|
||||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.face.V1_0.IBiometricsFace;
|
import android.hardware.biometrics.face.V1_0.IBiometricsFace;
|
||||||
import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
|
import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
|
||||||
import android.hardware.face.Face;
|
import android.hardware.face.Face;
|
||||||
@@ -123,7 +124,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
|||||||
private final UserSwitchObserver mUserSwitchObserver = new SynchronousUserSwitchObserver() {
|
private final UserSwitchObserver mUserSwitchObserver = new SynchronousUserSwitchObserver() {
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitching(int newUserId) {
|
public void onUserSwitching(int newUserId) {
|
||||||
scheduleInternalCleanup(newUserId);
|
scheduleInternalCleanup(newUserId, null /* callback */);
|
||||||
scheduleGetFeature(mSensorId, new Binder(), newUserId,
|
scheduleGetFeature(mSensorId, new Binder(), newUserId,
|
||||||
BiometricFaceConstants.FEATURE_REQUIRE_ATTENTION,
|
BiometricFaceConstants.FEATURE_REQUIRE_ATTENTION,
|
||||||
null, mContext.getOpPackageName());
|
null, mContext.getOpPackageName());
|
||||||
@@ -437,7 +438,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
|||||||
Slog.d(TAG, "Face HAL ready, HAL ID: " + halId);
|
Slog.d(TAG, "Face HAL ready, HAL ID: " + halId);
|
||||||
if (halId != 0) {
|
if (halId != 0) {
|
||||||
scheduleLoadAuthenticatorIds();
|
scheduleLoadAuthenticatorIds();
|
||||||
scheduleInternalCleanup(ActivityManager.getCurrentUser());
|
scheduleInternalCleanup(ActivityManager.getCurrentUser(), null /* callback */);
|
||||||
scheduleGetFeature(mSensorId, new Binder(),
|
scheduleGetFeature(mSensorId, new Binder(),
|
||||||
ActivityManager.getCurrentUser(),
|
ActivityManager.getCurrentUser(),
|
||||||
BiometricFaceConstants.FEATURE_REQUIRE_ATTENTION, null,
|
BiometricFaceConstants.FEATURE_REQUIRE_ATTENTION, null,
|
||||||
@@ -671,6 +672,20 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scheduleRemoveAll(int sensorId, @NonNull IBinder token, int userId,
|
||||||
|
@NonNull IFaceServiceReceiver receiver, @NonNull String opPackageName) {
|
||||||
|
mHandler.post(() -> {
|
||||||
|
scheduleUpdateActiveUserWithoutHandler(userId);
|
||||||
|
|
||||||
|
// For IBiometricsFace@1.0, remove(0) means remove all enrollments
|
||||||
|
final FaceRemovalClient client = new FaceRemovalClient(mContext, mLazyDaemon, token,
|
||||||
|
new ClientMonitorCallbackConverter(receiver), 0 /* faceId */, userId,
|
||||||
|
opPackageName,
|
||||||
|
FaceUtils.getLegacyInstance(mSensorId), mSensorId, mAuthenticatorIds);
|
||||||
|
mScheduler.scheduleClientMonitor(client);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleResetLockout(int sensorId, int userId, @NonNull byte[] hardwareAuthToken) {
|
public void scheduleResetLockout(int sensorId, int userId, @NonNull byte[] hardwareAuthToken) {
|
||||||
@@ -742,7 +757,8 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleInternalCleanup(int userId) {
|
private void scheduleInternalCleanup(int userId,
|
||||||
|
@Nullable BaseClientMonitor.Callback callback) {
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
scheduleUpdateActiveUserWithoutHandler(userId);
|
scheduleUpdateActiveUserWithoutHandler(userId);
|
||||||
|
|
||||||
@@ -750,13 +766,14 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
|||||||
final FaceInternalCleanupClient client = new FaceInternalCleanupClient(mContext,
|
final FaceInternalCleanupClient client = new FaceInternalCleanupClient(mContext,
|
||||||
mLazyDaemon, userId, mContext.getOpPackageName(), mSensorId, enrolledList,
|
mLazyDaemon, userId, mContext.getOpPackageName(), mSensorId, enrolledList,
|
||||||
FaceUtils.getLegacyInstance(mSensorId), mAuthenticatorIds);
|
FaceUtils.getLegacyInstance(mSensorId), mAuthenticatorIds);
|
||||||
mScheduler.scheduleClientMonitor(client);
|
mScheduler.scheduleClientMonitor(client, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleInternalCleanup(int sensorId, int userId) {
|
public void scheduleInternalCleanup(int sensorId, int userId,
|
||||||
scheduleInternalCleanup(userId);
|
@Nullable BaseClientMonitor.Callback callback) {
|
||||||
|
scheduleInternalCleanup(userId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -930,7 +947,9 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName) {
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
return new BiometricTestSessionImpl(mContext, mSensorId, this, mHalResultController);
|
@NonNull String opPackageName) {
|
||||||
|
return new BiometricTestSessionImpl(mContext, mSensorId, callback, this,
|
||||||
|
mHalResultController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,15 @@ import java.util.Map;
|
|||||||
class FaceRemovalClient extends RemovalClient<Face, IBiometricsFace> {
|
class FaceRemovalClient extends RemovalClient<Face, IBiometricsFace> {
|
||||||
private static final String TAG = "FaceRemovalClient";
|
private static final String TAG = "FaceRemovalClient";
|
||||||
|
|
||||||
|
private final int mBiometricId;
|
||||||
|
|
||||||
FaceRemovalClient(@NonNull Context context, @NonNull LazyDaemon<IBiometricsFace> lazyDaemon,
|
FaceRemovalClient(@NonNull Context context, @NonNull LazyDaemon<IBiometricsFace> lazyDaemon,
|
||||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
||||||
int biometricId, int userId, @NonNull String owner, @NonNull BiometricUtils<Face> utils,
|
int biometricId, int userId, @NonNull String owner, @NonNull BiometricUtils<Face> utils,
|
||||||
int sensorId, @NonNull Map<Integer, Long> authenticatorIds) {
|
int sensorId, @NonNull Map<Integer, Long> authenticatorIds) {
|
||||||
super(context, lazyDaemon, token, listener, biometricId, userId, owner, utils, sensorId,
|
super(context, lazyDaemon, token, listener, userId, owner, utils, sensorId,
|
||||||
authenticatorIds, BiometricsProtoEnums.MODALITY_FACE);
|
authenticatorIds, BiometricsProtoEnums.MODALITY_FACE);
|
||||||
|
mBiometricId = biometricId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.hardware.biometrics.IBiometricAuthenticator;
|
|||||||
import android.hardware.biometrics.IBiometricSensorReceiver;
|
import android.hardware.biometrics.IBiometricSensorReceiver;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
import android.hardware.fingerprint.IFingerprintService;
|
import android.hardware.fingerprint.IFingerprintService;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -42,8 +43,9 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(@NonNull String opPackageName) throws RemoteException {
|
public ITestSession createTestSession(@NonNull ITestSessionCallback callback,
|
||||||
return mFingerprintService.createTestSession(mSensorId, opPackageName);
|
@NonNull String opPackageName) throws RemoteException {
|
||||||
|
return mFingerprintService.createTestSession(mSensorId, callback, opPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import android.hardware.biometrics.IBiometricService;
|
|||||||
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
import android.hardware.biometrics.IBiometricServiceLockoutResetCallback;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||||
import android.hardware.biometrics.fingerprint.SensorProps;
|
import android.hardware.biometrics.fingerprint.SensorProps;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
@@ -109,7 +110,8 @@ public class FingerprintService extends SystemService implements BiometricServic
|
|||||||
*/
|
*/
|
||||||
private final class FingerprintServiceWrapper extends IFingerprintService.Stub {
|
private final class FingerprintServiceWrapper extends IFingerprintService.Stub {
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName) {
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
|
@NonNull String opPackageName) {
|
||||||
Utils.checkPermission(getContext(), TEST_BIOMETRIC);
|
Utils.checkPermission(getContext(), TEST_BIOMETRIC);
|
||||||
|
|
||||||
final ServiceProvider provider = getProviderForSensor(sensorId);
|
final ServiceProvider provider = getProviderForSensor(sensorId);
|
||||||
@@ -119,7 +121,7 @@ public class FingerprintService extends SystemService implements BiometricServic
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return provider.createTestSession(sensorId, opPackageName);
|
return provider.createTestSession(sensorId, callback, opPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -499,7 +501,21 @@ public class FingerprintService extends SystemService implements BiometricServic
|
|||||||
opPackageName);
|
opPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override // Binder call
|
||||||
|
public void removeAll(final IBinder token, final int userId,
|
||||||
|
final IFingerprintServiceReceiver receiver, final String opPackageName) {
|
||||||
|
Utils.checkPermission(getContext(), MANAGE_FINGERPRINT);
|
||||||
|
|
||||||
|
final Pair<Integer, ServiceProvider> provider = getSingleProvider();
|
||||||
|
if (provider == null) {
|
||||||
|
Slog.w(TAG, "Null provider for removeAll");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
provider.second.scheduleRemoveAll(provider.first, token, receiver, userId,
|
||||||
|
opPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // Binder call
|
||||||
public void addLockoutResetCallback(final IBiometricServiceLockoutResetCallback callback,
|
public void addLockoutResetCallback(final IBiometricServiceLockoutResetCallback callback,
|
||||||
final String opPackageName) {
|
final String opPackageName) {
|
||||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||||
@@ -28,6 +29,7 @@ import android.hardware.fingerprint.IUdfpsOverlayController;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.util.proto.ProtoOutputStream;
|
import android.util.proto.ProtoOutputStream;
|
||||||
|
|
||||||
|
import com.android.server.biometrics.sensors.BaseClientMonitor;
|
||||||
import com.android.server.biometrics.sensors.ClientMonitorCallbackConverter;
|
import com.android.server.biometrics.sensors.ClientMonitorCallbackConverter;
|
||||||
import com.android.server.biometrics.sensors.LockoutTracker;
|
import com.android.server.biometrics.sensors.LockoutTracker;
|
||||||
|
|
||||||
@@ -98,7 +100,12 @@ public interface ServiceProvider {
|
|||||||
@NonNull IFingerprintServiceReceiver receiver, int fingerId, int userId,
|
@NonNull IFingerprintServiceReceiver receiver, int fingerId, int userId,
|
||||||
@NonNull String opPackageName);
|
@NonNull String opPackageName);
|
||||||
|
|
||||||
void scheduleInternalCleanup(int sensorId, int userId);
|
void scheduleRemoveAll(int sensorId, @NonNull IBinder token,
|
||||||
|
@NonNull IFingerprintServiceReceiver receiver, int userId,
|
||||||
|
@NonNull String opPackageName);
|
||||||
|
|
||||||
|
void scheduleInternalCleanup(int sensorId, int userId,
|
||||||
|
@Nullable BaseClientMonitor.Callback callback);
|
||||||
|
|
||||||
boolean isHardwareDetected(int sensorId);
|
boolean isHardwareDetected(int sensorId);
|
||||||
|
|
||||||
@@ -133,5 +140,6 @@ public interface ServiceProvider {
|
|||||||
void dumpInternal(int sensorId, @NonNull PrintWriter pw);
|
void dumpInternal(int sensorId, @NonNull PrintWriter pw);
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
ITestSession createTestSession(int sensorId, @NonNull String opPackageName);
|
ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
|
@NonNull String opPackageName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,17 @@ import static android.Manifest.permission.TEST_BIOMETRIC;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.server.biometrics.HardwareAuthTokenUtils;
|
import com.android.server.biometrics.HardwareAuthTokenUtils;
|
||||||
import com.android.server.biometrics.Utils;
|
import com.android.server.biometrics.Utils;
|
||||||
|
import com.android.server.biometrics.sensors.BaseClientMonitor;
|
||||||
import com.android.server.biometrics.sensors.fingerprint.FingerprintUtils;
|
import com.android.server.biometrics.sensors.fingerprint.FingerprintUtils;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -46,6 +49,7 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
|
|
||||||
@NonNull private final Context mContext;
|
@NonNull private final Context mContext;
|
||||||
private final int mSensorId;
|
private final int mSensorId;
|
||||||
|
@NonNull private final ITestSessionCallback mCallback;
|
||||||
@NonNull private final FingerprintProvider mProvider;
|
@NonNull private final FingerprintProvider mProvider;
|
||||||
@NonNull private final Sensor mSensor;
|
@NonNull private final Sensor mSensor;
|
||||||
@NonNull private final Set<Integer> mEnrollmentIds;
|
@NonNull private final Set<Integer> mEnrollmentIds;
|
||||||
@@ -110,9 +114,11 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
||||||
@NonNull FingerprintProvider provider, @NonNull Sensor sensor) {
|
@NonNull ITestSessionCallback callback, @NonNull FingerprintProvider provider,
|
||||||
|
@NonNull Sensor sensor) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorId = sensorId;
|
mSensorId = sensorId;
|
||||||
|
mCallback = callback;
|
||||||
mProvider = provider;
|
mProvider = provider;
|
||||||
mSensor = sensor;
|
mSensor = sensor;
|
||||||
mEnrollmentIds = new HashSet<>();
|
mEnrollmentIds = new HashSet<>();
|
||||||
@@ -192,6 +198,25 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
public void cleanupInternalState(int userId) {
|
public void cleanupInternalState(int userId) {
|
||||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||||
|
|
||||||
mProvider.scheduleInternalCleanup(mSensorId, userId);
|
mProvider.scheduleInternalCleanup(mSensorId, userId, new BaseClientMonitor.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupStarted(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClientFinished(@NonNull BaseClientMonitor clientMonitor,
|
||||||
|
boolean success) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupFinished(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class FingerprintInternalCleanupClient extends InternalCleanupClient<Fingerprint
|
|||||||
String owner, BiometricUtils<Fingerprint> utils, int sensorId,
|
String owner, BiometricUtils<Fingerprint> utils, int sensorId,
|
||||||
Map<Integer, Long> authenticatorIds) {
|
Map<Integer, Long> authenticatorIds) {
|
||||||
return new FingerprintRemovalClient(context, lazyDaemon, token,
|
return new FingerprintRemovalClient(context, lazyDaemon, token,
|
||||||
null /* ClientMonitorCallbackConverter */, biometricId, userId, owner, utils,
|
null /* ClientMonitorCallbackConverter */, new int[] {biometricId}, userId, owner,
|
||||||
sensorId, authenticatorIds);
|
utils, sensorId, authenticatorIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||||
import android.hardware.biometrics.fingerprint.SensorProps;
|
import android.hardware.biometrics.fingerprint.SensorProps;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
@@ -185,7 +186,8 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
for (int i = 0; i < mSensors.size(); i++) {
|
for (int i = 0; i < mSensors.size(); i++) {
|
||||||
final int sensorId = mSensors.keyAt(i);
|
final int sensorId = mSensors.keyAt(i);
|
||||||
scheduleLoadAuthenticatorIds(sensorId);
|
scheduleLoadAuthenticatorIds(sensorId);
|
||||||
scheduleInternalCleanup(sensorId, ActivityManager.getCurrentUser());
|
scheduleInternalCleanup(sensorId, ActivityManager.getCurrentUser(),
|
||||||
|
null /* callback */);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mDaemon;
|
return mDaemon;
|
||||||
@@ -490,6 +492,27 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
public void scheduleRemove(int sensorId, @NonNull IBinder token,
|
public void scheduleRemove(int sensorId, @NonNull IBinder token,
|
||||||
@NonNull IFingerprintServiceReceiver receiver, int fingerId, int userId,
|
@NonNull IFingerprintServiceReceiver receiver, int fingerId, int userId,
|
||||||
@NonNull String opPackageName) {
|
@NonNull String opPackageName) {
|
||||||
|
scheduleRemoveSpecifiedIds(sensorId, token, new int[] {fingerId}, userId, receiver,
|
||||||
|
opPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scheduleRemoveAll(int sensorId, @NonNull IBinder token,
|
||||||
|
@NonNull IFingerprintServiceReceiver receiver, int userId,
|
||||||
|
@NonNull String opPackageName) {
|
||||||
|
final List<Fingerprint> fingers = FingerprintUtils.getInstance(sensorId)
|
||||||
|
.getBiometricsForUser(mContext, userId);
|
||||||
|
final int[] fingerIds = new int[fingers.size()];
|
||||||
|
for (int i = 0; i < fingers.size(); i++) {
|
||||||
|
fingerIds[i] = fingers.get(i).getBiometricId();
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduleRemoveSpecifiedIds(sensorId, token, fingerIds, userId, receiver, opPackageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scheduleRemoveSpecifiedIds(int sensorId, @NonNull IBinder token,
|
||||||
|
int[] fingerprintIds, int userId, @NonNull IFingerprintServiceReceiver receiver,
|
||||||
|
@NonNull String opPackageName) {
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
final IFingerprint daemon = getHalInstance();
|
final IFingerprint daemon = getHalInstance();
|
||||||
if (daemon == null) {
|
if (daemon == null) {
|
||||||
@@ -507,7 +530,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
|
|
||||||
final FingerprintRemovalClient client = new FingerprintRemovalClient(mContext,
|
final FingerprintRemovalClient client = new FingerprintRemovalClient(mContext,
|
||||||
mSensors.get(sensorId).getLazySession(), token,
|
mSensors.get(sensorId).getLazySession(), token,
|
||||||
new ClientMonitorCallbackConverter(receiver), fingerId, userId,
|
new ClientMonitorCallbackConverter(receiver), fingerprintIds, userId,
|
||||||
opPackageName, FingerprintUtils.getInstance(sensorId), sensorId,
|
opPackageName, FingerprintUtils.getInstance(sensorId), sensorId,
|
||||||
mSensors.get(sensorId).getAuthenticatorIds());
|
mSensors.get(sensorId).getAuthenticatorIds());
|
||||||
mSensors.get(sensorId).getScheduler().scheduleClientMonitor(client);
|
mSensors.get(sensorId).getScheduler().scheduleClientMonitor(client);
|
||||||
@@ -518,7 +541,8 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleInternalCleanup(int sensorId, int userId) {
|
public void scheduleInternalCleanup(int sensorId, int userId,
|
||||||
|
@Nullable BaseClientMonitor.Callback callback) {
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
final IFingerprint daemon = getHalInstance();
|
final IFingerprint daemon = getHalInstance();
|
||||||
if (daemon == null) {
|
if (daemon == null) {
|
||||||
@@ -538,7 +562,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
mContext.getOpPackageName(), sensorId, enrolledList,
|
mContext.getOpPackageName(), sensorId, enrolledList,
|
||||||
FingerprintUtils.getInstance(sensorId),
|
FingerprintUtils.getInstance(sensorId),
|
||||||
mSensors.get(sensorId).getAuthenticatorIds());
|
mSensors.get(sensorId).getAuthenticatorIds());
|
||||||
mSensors.get(sensorId).getScheduler().scheduleClientMonitor(client);
|
mSensors.get(sensorId).getScheduler().scheduleClientMonitor(client, callback);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(getTag(), "Remote exception when scheduling internal cleanup", e);
|
Slog.e(getTag(), "Remote exception when scheduling internal cleanup", e);
|
||||||
}
|
}
|
||||||
@@ -683,8 +707,9 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName) {
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
return mSensors.get(sensorId).createTestSession();
|
@NonNull String opPackageName) {
|
||||||
|
return mSensors.get(sensorId).createTestSession(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,20 +39,22 @@ import java.util.Map;
|
|||||||
class FingerprintRemovalClient extends RemovalClient<Fingerprint, ISession> {
|
class FingerprintRemovalClient extends RemovalClient<Fingerprint, ISession> {
|
||||||
private static final String TAG = "FingerprintRemovalClient";
|
private static final String TAG = "FingerprintRemovalClient";
|
||||||
|
|
||||||
|
private final int[] mBiometricIds;
|
||||||
|
|
||||||
FingerprintRemovalClient(@NonNull Context context,
|
FingerprintRemovalClient(@NonNull Context context,
|
||||||
@NonNull LazyDaemon<ISession> lazyDaemon, @NonNull IBinder token,
|
@NonNull LazyDaemon<ISession> lazyDaemon, @NonNull IBinder token,
|
||||||
@Nullable ClientMonitorCallbackConverter listener, int biometricId, int userId,
|
@Nullable ClientMonitorCallbackConverter listener, int[] biometricIds, int userId,
|
||||||
@NonNull String owner, @NonNull BiometricUtils<Fingerprint> utils, int sensorId,
|
@NonNull String owner, @NonNull BiometricUtils<Fingerprint> utils, int sensorId,
|
||||||
@NonNull Map<Integer, Long> authenticatorIds) {
|
@NonNull Map<Integer, Long> authenticatorIds) {
|
||||||
super(context, lazyDaemon, token, listener, biometricId, userId, owner, utils, sensorId,
|
super(context, lazyDaemon, token, listener, userId, owner, utils, sensorId,
|
||||||
authenticatorIds, BiometricsProtoEnums.MODALITY_FINGERPRINT);
|
authenticatorIds, BiometricsProtoEnums.MODALITY_FINGERPRINT);
|
||||||
|
mBiometricIds = biometricIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startHalOperation() {
|
protected void startHalOperation() {
|
||||||
try {
|
try {
|
||||||
final int[] ids = new int[] {mBiometricId};
|
getFreshDaemon().removeEnrollments(mSequentialId, mBiometricIds);
|
||||||
getFreshDaemon().removeEnrollments(mSequentialId, ids);
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Remote exception when requesting remove", e);
|
Slog.e(TAG, "Remote exception when requesting remove", e);
|
||||||
mCallback.onClientFinished(this, false /* success */);
|
mCallback.onClientFinished(this, false /* success */);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.fingerprint.Error;
|
import android.hardware.biometrics.fingerprint.Error;
|
||||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||||
import android.hardware.biometrics.fingerprint.ISession;
|
import android.hardware.biometrics.fingerprint.ISession;
|
||||||
@@ -439,8 +440,9 @@ class Sensor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull ITestSession createTestSession() {
|
@NonNull ITestSession createTestSession(@NonNull ITestSessionCallback callback) {
|
||||||
return new BiometricTestSessionImpl(mContext, mSensorProperties.sensorId, mProvider, this);
|
return new BiometricTestSessionImpl(mContext, mSensorProperties.sensorId, callback,
|
||||||
|
mProvider, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createNewSession(@NonNull IFingerprint daemon, int sensorId, int userId)
|
void createNewSession(@NonNull IFingerprint daemon, int sensorId, int userId)
|
||||||
|
|||||||
@@ -21,13 +21,16 @@ import static android.Manifest.permission.TEST_BIOMETRIC;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
import android.hardware.fingerprint.IFingerprintServiceReceiver;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
import com.android.server.biometrics.Utils;
|
import com.android.server.biometrics.Utils;
|
||||||
|
import com.android.server.biometrics.sensors.BaseClientMonitor;
|
||||||
import com.android.server.biometrics.sensors.fingerprint.FingerprintUtils;
|
import com.android.server.biometrics.sensors.fingerprint.FingerprintUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -47,6 +50,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
|
|
||||||
@NonNull private final Context mContext;
|
@NonNull private final Context mContext;
|
||||||
private final int mSensorId;
|
private final int mSensorId;
|
||||||
|
@NonNull private final ITestSessionCallback mCallback;
|
||||||
@NonNull private final Fingerprint21 mFingerprint21;
|
@NonNull private final Fingerprint21 mFingerprint21;
|
||||||
@NonNull private final Fingerprint21.HalResultController mHalResultController;
|
@NonNull private final Fingerprint21.HalResultController mHalResultController;
|
||||||
@NonNull private final Set<Integer> mEnrollmentIds;
|
@NonNull private final Set<Integer> mEnrollmentIds;
|
||||||
@@ -111,10 +115,12 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
BiometricTestSessionImpl(@NonNull Context context, int sensorId,
|
||||||
|
@NonNull ITestSessionCallback callback,
|
||||||
@NonNull Fingerprint21 fingerprint21,
|
@NonNull Fingerprint21 fingerprint21,
|
||||||
@NonNull Fingerprint21.HalResultController halResultController) {
|
@NonNull Fingerprint21.HalResultController halResultController) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorId = sensorId;
|
mSensorId = sensorId;
|
||||||
|
mCallback = callback;
|
||||||
mFingerprint21 = fingerprint21;
|
mFingerprint21 = fingerprint21;
|
||||||
mHalResultController = halResultController;
|
mHalResultController = halResultController;
|
||||||
mEnrollmentIds = new HashSet<>();
|
mEnrollmentIds = new HashSet<>();
|
||||||
@@ -191,6 +197,25 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
|||||||
public void cleanupInternalState(int userId) {
|
public void cleanupInternalState(int userId) {
|
||||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||||
|
|
||||||
mFingerprint21.scheduleInternalCleanup(mSensorId, userId);
|
mFingerprint21.scheduleInternalCleanup(mSensorId, userId, new BaseClientMonitor.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupStarted(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClientFinished(@NonNull BaseClientMonitor clientMonitor,
|
||||||
|
boolean success) {
|
||||||
|
try {
|
||||||
|
mCallback.onCleanupFinished(clientMonitor.getTargetUserId());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.hardware.biometrics.BiometricManager;
|
|||||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
|
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
|
||||||
import android.hardware.biometrics.fingerprint.V2_2.IBiometricsFingerprintClientCallback;
|
import android.hardware.biometrics.fingerprint.V2_2.IBiometricsFingerprintClientCallback;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
@@ -158,7 +159,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
private final UserSwitchObserver mUserSwitchObserver = new SynchronousUserSwitchObserver() {
|
private final UserSwitchObserver mUserSwitchObserver = new SynchronousUserSwitchObserver() {
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitching(int newUserId) {
|
public void onUserSwitching(int newUserId) {
|
||||||
scheduleInternalCleanup(newUserId);
|
scheduleInternalCleanup(newUserId, null /* callback */);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -437,7 +438,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
Slog.d(TAG, "Fingerprint HAL ready, HAL ID: " + halId);
|
Slog.d(TAG, "Fingerprint HAL ready, HAL ID: " + halId);
|
||||||
if (halId != 0) {
|
if (halId != 0) {
|
||||||
scheduleLoadAuthenticatorIds();
|
scheduleLoadAuthenticatorIds();
|
||||||
scheduleInternalCleanup(ActivityManager.getCurrentUser());
|
scheduleInternalCleanup(ActivityManager.getCurrentUser(), null /* callback */);
|
||||||
} else {
|
} else {
|
||||||
Slog.e(TAG, "Unable to set callback");
|
Slog.e(TAG, "Unable to set callback");
|
||||||
mDaemon = null;
|
mDaemon = null;
|
||||||
@@ -644,7 +645,25 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleInternalCleanup(int userId) {
|
@Override
|
||||||
|
public void scheduleRemoveAll(int sensorId, @NonNull IBinder token,
|
||||||
|
@NonNull IFingerprintServiceReceiver receiver, int userId,
|
||||||
|
@NonNull String opPackageName) {
|
||||||
|
mHandler.post(() -> {
|
||||||
|
scheduleUpdateActiveUserWithoutHandler(userId);
|
||||||
|
|
||||||
|
// For IBiometricsFingerprint@2.1, remove(0) means remove all enrollments
|
||||||
|
final FingerprintRemovalClient client = new FingerprintRemovalClient(mContext,
|
||||||
|
mLazyDaemon, token, new ClientMonitorCallbackConverter(receiver),
|
||||||
|
0 /* fingerprintId */, userId, opPackageName,
|
||||||
|
FingerprintUtils.getLegacyInstance(mSensorId),
|
||||||
|
mSensorProperties.sensorId, mAuthenticatorIds);
|
||||||
|
mScheduler.scheduleClientMonitor(client);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scheduleInternalCleanup(int userId,
|
||||||
|
@Nullable BaseClientMonitor.Callback callback) {
|
||||||
mHandler.post(() -> {
|
mHandler.post(() -> {
|
||||||
scheduleUpdateActiveUserWithoutHandler(userId);
|
scheduleUpdateActiveUserWithoutHandler(userId);
|
||||||
|
|
||||||
@@ -654,13 +673,14 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
mContext, mLazyDaemon, userId, mContext.getOpPackageName(),
|
mContext, mLazyDaemon, userId, mContext.getOpPackageName(),
|
||||||
mSensorProperties.sensorId, enrolledList,
|
mSensorProperties.sensorId, enrolledList,
|
||||||
FingerprintUtils.getLegacyInstance(mSensorId), mAuthenticatorIds);
|
FingerprintUtils.getLegacyInstance(mSensorId), mAuthenticatorIds);
|
||||||
mScheduler.scheduleClientMonitor(client);
|
mScheduler.scheduleClientMonitor(client, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleInternalCleanup(int sensorId, int userId) {
|
public void scheduleInternalCleanup(int sensorId, int userId,
|
||||||
scheduleInternalCleanup(userId);
|
@Nullable BaseClientMonitor.Callback callback) {
|
||||||
|
scheduleInternalCleanup(userId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -840,8 +860,9 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(int sensorId, @NonNull String opPackageName) {
|
public ITestSession createTestSession(int sensorId, @NonNull ITestSessionCallback callback,
|
||||||
return new BiometricTestSessionImpl(mContext, mSensorProperties.sensorId, this,
|
@NonNull String opPackageName) {
|
||||||
|
return new BiometricTestSessionImpl(mContext, mSensorProperties.sensorId, callback, this,
|
||||||
mHalResultController);
|
mHalResultController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ import java.util.Map;
|
|||||||
class FingerprintRemovalClient extends RemovalClient<Fingerprint, IBiometricsFingerprint> {
|
class FingerprintRemovalClient extends RemovalClient<Fingerprint, IBiometricsFingerprint> {
|
||||||
private static final String TAG = "FingerprintRemovalClient";
|
private static final String TAG = "FingerprintRemovalClient";
|
||||||
|
|
||||||
|
private final int mBiometricId;
|
||||||
|
|
||||||
FingerprintRemovalClient(@NonNull Context context,
|
FingerprintRemovalClient(@NonNull Context context,
|
||||||
@NonNull LazyDaemon<IBiometricsFingerprint> lazyDaemon, @NonNull IBinder token,
|
@NonNull LazyDaemon<IBiometricsFingerprint> lazyDaemon, @NonNull IBinder token,
|
||||||
@NonNull ClientMonitorCallbackConverter listener, int biometricId, int userId,
|
@NonNull ClientMonitorCallbackConverter listener, int biometricId, int userId,
|
||||||
@NonNull String owner, @NonNull BiometricUtils<Fingerprint> utils, int sensorId,
|
@NonNull String owner, @NonNull BiometricUtils<Fingerprint> utils, int sensorId,
|
||||||
@NonNull Map<Integer, Long> authenticatorIds) {
|
@NonNull Map<Integer, Long> authenticatorIds) {
|
||||||
super(context, lazyDaemon, token, listener, biometricId, userId, owner, utils, sensorId,
|
super(context, lazyDaemon, token, listener, userId, owner, utils, sensorId,
|
||||||
authenticatorIds, BiometricsProtoEnums.MODALITY_FINGERPRINT);
|
authenticatorIds, BiometricsProtoEnums.MODALITY_FINGERPRINT);
|
||||||
|
mBiometricId = biometricId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.hardware.biometrics.IBiometricAuthenticator;
|
|||||||
import android.hardware.biometrics.IBiometricSensorReceiver;
|
import android.hardware.biometrics.IBiometricSensorReceiver;
|
||||||
import android.hardware.biometrics.IInvalidationCallback;
|
import android.hardware.biometrics.IInvalidationCallback;
|
||||||
import android.hardware.biometrics.ITestSession;
|
import android.hardware.biometrics.ITestSession;
|
||||||
|
import android.hardware.biometrics.ITestSessionCallback;
|
||||||
import android.hardware.biometrics.SensorPropertiesInternal;
|
import android.hardware.biometrics.SensorPropertiesInternal;
|
||||||
import android.hardware.iris.IIrisService;
|
import android.hardware.iris.IIrisService;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -39,7 +40,8 @@ public final class IrisAuthenticator extends IBiometricAuthenticator.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITestSession createTestSession(@NonNull String opPackageName) throws RemoteException {
|
public ITestSession createTestSession(@NonNull ITestSessionCallback callback,
|
||||||
|
@NonNull String opPackageName) throws RemoteException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2902,11 +2902,8 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
FingerprintManager mFingerprintManager = mInjector.getFingerprintManager();
|
FingerprintManager mFingerprintManager = mInjector.getFingerprintManager();
|
||||||
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
|
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
|
||||||
if (mFingerprintManager.hasEnrolledFingerprints(userId)) {
|
if (mFingerprintManager.hasEnrolledFingerprints(userId)) {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
// For the purposes of M and N, groupId is the same as userId.
|
mFingerprintManager.removeAll(userId, fingerprintManagerRemovalCallback(latch));
|
||||||
Fingerprint finger = new Fingerprint(null, userId, 0, 0);
|
|
||||||
mFingerprintManager.remove(finger, userId,
|
|
||||||
fingerprintManagerRemovalCallback(latch));
|
|
||||||
try {
|
try {
|
||||||
latch.await(10000, TimeUnit.MILLISECONDS);
|
latch.await(10000, TimeUnit.MILLISECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -2920,9 +2917,8 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
FaceManager mFaceManager = mInjector.getFaceManager();
|
FaceManager mFaceManager = mInjector.getFaceManager();
|
||||||
if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
|
if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
|
||||||
if (mFaceManager.hasEnrolledTemplates(userId)) {
|
if (mFaceManager.hasEnrolledTemplates(userId)) {
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
Face face = new Face(null, 0, 0);
|
mFaceManager.removeAll(userId, faceManagerRemovalCallback(latch));
|
||||||
mFaceManager.remove(face, userId, faceManagerRemovalCallback(latch));
|
|
||||||
try {
|
try {
|
||||||
latch.await(10000, TimeUnit.MILLISECONDS);
|
latch.await(10000, TimeUnit.MILLISECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@@ -2936,10 +2932,8 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
CountDownLatch latch) {
|
CountDownLatch latch) {
|
||||||
return new FingerprintManager.RemovalCallback() {
|
return new FingerprintManager.RemovalCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onRemovalError(Fingerprint fp, int errMsgId, CharSequence err) {
|
public void onRemovalError(@Nullable Fingerprint fp, int errMsgId, CharSequence err) {
|
||||||
Slog.e(TAG, String.format(
|
Slog.e(TAG, "Unable to remove fingerprint, error: " + err);
|
||||||
"Can't remove fingerprint %d in group %d. Reason: %s",
|
|
||||||
fp.getBiometricId(), fp.getGroupId(), err));
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2955,9 +2949,8 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
private FaceManager.RemovalCallback faceManagerRemovalCallback(CountDownLatch latch) {
|
private FaceManager.RemovalCallback faceManagerRemovalCallback(CountDownLatch latch) {
|
||||||
return new FaceManager.RemovalCallback() {
|
return new FaceManager.RemovalCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onRemovalError(Face face, int errMsgId, CharSequence err) {
|
public void onRemovalError(@Nullable Face face, int errMsgId, CharSequence err) {
|
||||||
Slog.e(TAG, String.format("Can't remove face %d. Reason: %s",
|
Slog.e(TAG, "Unable to remove face, error: " + err);
|
||||||
face.getBiometricId(), err));
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -339,11 +339,11 @@ public class LockSettingsServiceTests extends BaseLockSettingsServiceTests {
|
|||||||
mService.setLockCredential(nonePassword(), newPattern("123654"), PRIMARY_USER_ID);
|
mService.setLockCredential(nonePassword(), newPattern("123654"), PRIMARY_USER_ID);
|
||||||
|
|
||||||
// Verify fingerprint is removed
|
// Verify fingerprint is removed
|
||||||
verify(mFingerprintManager).remove(any(), eq(PRIMARY_USER_ID), any());
|
verify(mFingerprintManager).removeAll(eq(PRIMARY_USER_ID), any());
|
||||||
verify(mFaceManager).remove(any(), eq(PRIMARY_USER_ID), any());
|
verify(mFaceManager).removeAll(eq(PRIMARY_USER_ID), any());
|
||||||
|
|
||||||
verify(mFingerprintManager).remove(any(), eq(MANAGED_PROFILE_USER_ID), any());
|
verify(mFingerprintManager).removeAll(eq(MANAGED_PROFILE_USER_ID), any());
|
||||||
verify(mFaceManager).remove(any(), eq(MANAGED_PROFILE_USER_ID), any());
|
verify(mFaceManager).removeAll(eq(MANAGED_PROFILE_USER_ID), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user