summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/hardware/face/FaceSensorPropertiesInternal.java3
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java10
-rw-r--r--services/core/java/com/android/server/biometrics/BiometricSensor.java18
-rw-r--r--services/core/java/com/android/server/biometrics/BiometricService.java11
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/BiometricScheduler.java22
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/DetectionConsumer.java24
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/FaceService.java18
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/ServiceProvider.java7
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceDetectClient.java102
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java26
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/aidl/Sensor.java12
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/hidl/Face10.java16
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java6
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java5
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java4
-rw-r--r--services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java4
-rw-r--r--services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java4
-rw-r--r--services/tests/servicestests/src/com/android/server/biometrics/InvalidationTrackerTest.java25
-rw-r--r--services/tests/servicestests/src/com/android/server/biometrics/sensors/BiometricSchedulerTest.java4
19 files changed, 46 insertions, 275 deletions
diff --git a/core/java/android/hardware/face/FaceSensorPropertiesInternal.java b/core/java/android/hardware/face/FaceSensorPropertiesInternal.java
index 9936b885707e..44dffb207731 100644
--- a/core/java/android/hardware/face/FaceSensorPropertiesInternal.java
+++ b/core/java/android/hardware/face/FaceSensorPropertiesInternal.java
@@ -96,7 +96,6 @@ public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {
@Override
public String toString() {
- return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType
- + ", SupportsFaceDetection: " + supportsFaceDetection;
+ return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType;
}
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 4c9a941a694b..b4c6321fe191 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -2137,14 +2137,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// Scan even when encrypted or timeout to show a preemptive bouncer when bypassing.
// Lock-down mode shouldn't scan, since it is more explicit.
- boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass && !mBouncer);
-
- // If the device supports face detection (without authentication), allow it to happen
- // if the device is in lockdown mode. Otherwise, prevent scanning.
- boolean supportsDetectOnly = mFaceSensorProperties.get(0).supportsFaceDetection;
- if (isLockDown && !supportsDetectOnly) {
- strongAuthAllowsScanning = false;
- }
+ boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass && !mBouncer)
+ && !isLockDown;
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
diff --git a/services/core/java/com/android/server/biometrics/BiometricSensor.java b/services/core/java/com/android/server/biometrics/BiometricSensor.java
index 8a842b53d8e8..c9e148f9b6ff 100644
--- a/services/core/java/com/android/server/biometrics/BiometricSensor.java
+++ b/services/core/java/com/android/server/biometrics/BiometricSensor.java
@@ -19,13 +19,10 @@ package com.android.server.biometrics;
import static android.hardware.biometrics.BiometricManager.Authenticators;
import android.annotation.IntDef;
-import android.annotation.NonNull;
-import android.content.Context;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.IBiometricAuthenticator;
import android.hardware.biometrics.IBiometricSensorReceiver;
-import android.hardware.biometrics.SensorPropertiesInternal;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Slog;
@@ -65,7 +62,6 @@ public abstract class BiometricSensor {
@Retention(RetentionPolicy.SOURCE)
@interface SensorState {}
- @NonNull private final Context mContext;
public final int id;
public final @Authenticators.Types int oemStrength; // strength as configured by the OEM
public final int modality;
@@ -88,9 +84,8 @@ public abstract class BiometricSensor {
*/
abstract boolean confirmationSupported();
- BiometricSensor(@NonNull Context context, int id, int modality,
- @Authenticators.Types int strength, IBiometricAuthenticator impl) {
- this.mContext = context;
+ BiometricSensor(int id, int modality, @Authenticators.Types int strength,
+ IBiometricAuthenticator impl) {
this.id = id;
this.modality = modality;
this.oemStrength = strength;
@@ -174,19 +169,12 @@ public abstract class BiometricSensor {
@Override
public String toString() {
- SensorPropertiesInternal properties = null;
- try {
- properties = impl.getSensorProperties(mContext.getOpPackageName());
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
- }
-
return "ID(" + id + ")"
+ ", oemStrength: " + oemStrength
+ ", updatedStrength: " + mUpdatedStrength
+ ", modality " + modality
+ ", state: " + mSensorState
+ ", cookie: " + mCookie
- + ", props: " + properties;
+ + ", authenticator: " + impl;
}
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java
index cb7c568757e5..70f26aca3f63 100644
--- a/services/core/java/com/android/server/biometrics/BiometricService.java
+++ b/services/core/java/com/android/server/biometrics/BiometricService.java
@@ -725,7 +725,7 @@ public class BiometricService extends SystemService {
}
}
- mSensors.add(new BiometricSensor(getContext(), id, modality, strength, authenticator) {
+ mSensors.add(new BiometricSensor(id, modality, strength, authenticator) {
@Override
boolean confirmationAlwaysRequired(int userId) {
return mSettingObserver.getConfirmationAlwaysRequired(modality, userId);
@@ -1351,8 +1351,13 @@ public class BiometricService extends SystemService {
for (BiometricSensor sensor : mSensors) {
pw.println(" " + sensor);
}
- pw.println();
pw.println("CurrentSession: " + mCurrentAuthSession);
- pw.println();
+
+ final List<FingerprintSensorPropertiesInternal> fpProps =
+ mInjector.getFingerprintSensorProperties(getContext());
+ pw.println("FingerprintSensorProperties: " + fpProps.size());
+ for (FingerprintSensorPropertiesInternal prop : fpProps) {
+ pw.println(" " + prop);
+ }
}
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/BiometricScheduler.java b/services/core/java/com/android/server/biometrics/sensors/BiometricScheduler.java
index cc27127ac58f..2fe275288f3b 100644
--- a/services/core/java/com/android/server/biometrics/sensors/BiometricScheduler.java
+++ b/services/core/java/com/android/server/biometrics/sensors/BiometricScheduler.java
@@ -559,21 +559,22 @@ public class BiometricScheduler {
}
/**
- * Requests to cancel authentication or detection.
+ * Requests to cancel authentication.
* @param token from the caller, should match the token passed in when requesting authentication
*/
- public void cancelAuthenticationOrDetection(IBinder token) {
+ public void cancelAuthentication(IBinder token) {
if (mCurrentOperation == null) {
Slog.e(getTag(), "Unable to cancel authentication, null operation");
return;
}
- final boolean isCorrectClient = isAuthenticationOrDetectionOperation(mCurrentOperation);
+ final boolean isAuthenticating =
+ mCurrentOperation.mClientMonitor instanceof AuthenticationConsumer;
final boolean tokenMatches = mCurrentOperation.mClientMonitor.getToken() == token;
- if (isCorrectClient && tokenMatches) {
- Slog.d(getTag(), "Cancelling: " + mCurrentOperation);
+ if (isAuthenticating && tokenMatches) {
+ Slog.d(getTag(), "Cancelling authentication: " + mCurrentOperation);
cancelInternal(mCurrentOperation);
- } else if (!isCorrectClient) {
+ } else if (!isAuthenticating) {
// Look through the current queue for all authentication clients for the specified
// token, and mark them as STATE_WAITING_IN_QUEUE_CANCELING. Note that we're marking
// all of them, instead of just the first one, since the API surface currently doesn't
@@ -581,7 +582,7 @@ public class BiometricScheduler {
// process. However, this generally does not happen anyway, and would be a class of
// bugs on its own.
for (Operation operation : mPendingOperations) {
- if (isAuthenticationOrDetectionOperation(operation)
+ if (operation.mClientMonitor instanceof AuthenticationConsumer
&& operation.mClientMonitor.getToken() == token) {
Slog.d(getTag(), "Marking " + operation
+ " as STATE_WAITING_IN_QUEUE_CANCELING");
@@ -591,13 +592,6 @@ public class BiometricScheduler {
}
}
- private boolean isAuthenticationOrDetectionOperation(@NonNull Operation operation) {
- final boolean isAuthentication = operation.mClientMonitor
- instanceof AuthenticationConsumer;
- final boolean isDetection = operation.mClientMonitor instanceof DetectionConsumer;
- return isAuthentication || isDetection;
- }
-
/**
* @return the current operation
*/
diff --git a/services/core/java/com/android/server/biometrics/sensors/DetectionConsumer.java b/services/core/java/com/android/server/biometrics/sensors/DetectionConsumer.java
deleted file mode 100644
index c71c954f0234..000000000000
--- a/services/core/java/com/android/server/biometrics/sensors/DetectionConsumer.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.server.biometrics.sensors;
-
-/**
- * Interface that clients interested/eligible for interaction detection events should implement.
- */
-public interface DetectionConsumer {
- void onInteractionDetected();
-}
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java b/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
index ada84769b9ef..34a86d3e6398 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/FaceService.java
@@ -296,15 +296,7 @@ public class FaceService extends SystemService implements BiometricServiceCallba
return;
}
- final Pair<Integer, ServiceProvider> provider = getSingleProvider();
- if (provider == null) {
- Slog.w(TAG, "Null provider for detectFace");
- return;
- }
-
- provider.second.scheduleFaceDetect(provider.first, token, userId,
- new ClientMonitorCallbackConverter(receiver), opPackageName,
- BiometricsProtoEnums.CLIENT_KEYGUARD);
+ // TODO(b/152413782): Implement this once it's supported in the HAL
}
@Override // Binder call
@@ -361,13 +353,7 @@ public class FaceService extends SystemService implements BiometricServiceCallba
return;
}
- final Pair<Integer, ServiceProvider> provider = getSingleProvider();
- if (provider == null) {
- Slog.w(TAG, "Null provider for cancelFaceDetect");
- return;
- }
-
- provider.second.cancelFaceDetect(provider.first, token);
+ // TODO(b/152413782): Implement this once it's supported in the HAL
}
@Override // Binder call
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/ServiceProvider.java b/services/core/java/com/android/server/biometrics/sensors/face/ServiceProvider.java
index 6d6c2e9e975f..9b6fb0b75c57 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/ServiceProvider.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/ServiceProvider.java
@@ -101,17 +101,12 @@ public interface ServiceProvider {
void cancelEnrollment(int sensorId, @NonNull IBinder token);
- void scheduleFaceDetect(int sensorId, @NonNull IBinder token, int userId,
- @NonNull ClientMonitorCallbackConverter callback, @NonNull String opPackageName,
- int statsClient);
-
- void cancelFaceDetect(int sensorId, @NonNull IBinder token);
-
void scheduleAuthenticate(int sensorId, @NonNull IBinder token, long operationId, int userId,
int cookie, @NonNull ClientMonitorCallbackConverter callback,
@NonNull String opPackageName, boolean restricted, int statsClient,
boolean allowBackgroundAuthentication);
+
void cancelAuthentication(int sensorId, @NonNull IBinder token);
void scheduleRemove(int sensorId, @NonNull IBinder token, int faceId, int userId,
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceDetectClient.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceDetectClient.java
deleted file mode 100644
index 0ba731ee8b4b..000000000000
--- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceDetectClient.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.server.biometrics.sensors.face.aidl;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.hardware.biometrics.BiometricsProtoEnums;
-import android.hardware.biometrics.common.ICancellationSignal;
-import android.hardware.biometrics.face.ISession;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Slog;
-
-import com.android.server.biometrics.BiometricsProto;
-import com.android.server.biometrics.sensors.AcquisitionClient;
-import com.android.server.biometrics.sensors.ClientMonitorCallbackConverter;
-import com.android.server.biometrics.sensors.DetectionConsumer;
-
-/**
- * Performs face detection without exposing any matching information (e.g. accept/reject have the
- * same haptic, lockout counter is not increased).
- */
-public class FaceDetectClient extends AcquisitionClient<ISession> implements DetectionConsumer {
-
- private static final String TAG = "FaceDetectClient";
-
- private final boolean mIsStrongBiometric;
- @Nullable private ICancellationSignal mCancellationSignal;
-
- public FaceDetectClient(@NonNull Context context, @NonNull LazyDaemon<ISession> lazyDaemon,
- @NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener, int userId,
- @NonNull String owner, int sensorId, boolean isStrongBiometric, int statsClient) {
- super(context, lazyDaemon, token, listener, userId, owner, 0 /* cookie */, sensorId,
- BiometricsProtoEnums.MODALITY_FACE, BiometricsProtoEnums.ACTION_AUTHENTICATE,
- statsClient);
- mIsStrongBiometric = isStrongBiometric;
- }
-
- @Override
- public void start(@NonNull Callback callback) {
- super.start(callback);
- startHalOperation();
- }
-
- @Override
- protected void stopHalOperation() {
- try {
- mCancellationSignal.cancel();
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
- mCallback.onClientFinished(this, false /* success */);
- }
- }
-
- @Override
- protected void startHalOperation() {
- try {
- mCancellationSignal = getFreshDaemon().detectInteraction();
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception when requesting face detect", e);
- mCallback.onClientFinished(this, false /* success */);
- }
- }
-
- @Override
- public void onInteractionDetected() {
- vibrateSuccess();
-
- try {
- getListener().onDetected(getSensorId(), getTargetUserId(), mIsStrongBiometric);
- mCallback.onClientFinished(this, true /* success */);
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception when sending onDetected", e);
- mCallback.onClientFinished(this, false /* success */);
- }
- }
-
- @Override
- public int getProtoEnum() {
- return BiometricsProto.CM_DETECT_INTERACTION;
- }
-
- @Override
- public boolean interruptsPrecedingClients() {
- return true;
- }
-}
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java
index b8bac402f430..4fb71ffdaab0 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java
@@ -110,7 +110,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
Slog.e(getTag(), "Stopping background authentication, top: "
+ topPackage + " currentClient: " + client);
mSensors.valueAt(i).getScheduler()
- .cancelAuthenticationOrDetection(client.getToken());
+ .cancelAuthentication(client.getToken());
}
}
}
@@ -145,7 +145,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
final FaceSensorPropertiesInternal internalProp = new FaceSensorPropertiesInternal(
prop.commonProps.sensorId, prop.commonProps.sensorStrength,
prop.commonProps.maxEnrollmentsPerUser, componentInfo, prop.sensorType,
- prop.supportsDetectInteraction, prop.halControlsPreview,
+ false /* supportsFaceDetection */, prop.halControlsPreview,
false /* resetLockoutRequiresChallenge */);
final Sensor sensor = new Sensor(getTag() + "/" + sensorId, this, mContext, mHandler,
internalProp);
@@ -346,25 +346,6 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
}
@Override
- public void scheduleFaceDetect(int sensorId, @NonNull IBinder token,
- int userId, @NonNull ClientMonitorCallbackConverter callback,
- @NonNull String opPackageName, int statsClient) {
- mHandler.post(() -> {
- final boolean isStrongBiometric = Utils.isStrongBiometric(sensorId);
- final FaceDetectClient client = new FaceDetectClient(mContext,
- mSensors.get(sensorId).getLazySession(), token, callback, userId, opPackageName,
- sensorId, isStrongBiometric, statsClient);
- scheduleForSensor(sensorId, client);
- });
- }
-
- @Override
- public void cancelFaceDetect(int sensorId, @NonNull IBinder token) {
- mHandler.post(() -> mSensors.get(sensorId).getScheduler()
- .cancelAuthenticationOrDetection(token));
- }
-
- @Override
public void scheduleAuthenticate(int sensorId, @NonNull IBinder token, long operationId,
int userId, int cookie, @NonNull ClientMonitorCallbackConverter callback,
@NonNull String opPackageName, boolean restricted, int statsClient,
@@ -383,8 +364,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider {
@Override
public void cancelAuthentication(int sensorId, @NonNull IBinder token) {
- mHandler.post(() -> mSensors.get(sensorId).getScheduler()
- .cancelAuthenticationOrDetection(token));
+ mHandler.post(() -> mSensors.get(sensorId).getScheduler().cancelAuthentication(token));
}
@Override
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/Sensor.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/Sensor.java
index d56fd1221aa9..4627a9ddf76a 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/Sensor.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/Sensor.java
@@ -338,17 +338,7 @@ public class Sensor {
@Override
public void onInteractionDetected() {
- mHandler.post(() -> {
- final BaseClientMonitor client = mScheduler.getCurrentClient();
- if (!(client instanceof FaceDetectClient)) {
- Slog.e(mTag, "onInteractionDetected for wrong client: "
- + Utils.getClientName(client));
- return;
- }
-
- final FaceDetectClient detectClient = (FaceDetectClient) client;
- detectClient.onInteractionDetected();
- });
+ // no-op
}
@Override
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/hidl/Face10.java b/services/core/java/com/android/server/biometrics/sensors/face/hidl/Face10.java
index 2cb2939cde1d..56fad94640f1 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/hidl/Face10.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/hidl/Face10.java
@@ -639,20 +639,6 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
}
@Override
- public void scheduleFaceDetect(int sensorId, @NonNull IBinder token,
- int userId, @NonNull ClientMonitorCallbackConverter callback,
- @NonNull String opPackageName, int statsClient) {
- throw new IllegalStateException("Face detect not supported by IBiometricsFace@1.0. Did you"
- + "forget to check the supportsFaceDetection flag?");
- }
-
- @Override
- public void cancelFaceDetect(int sensorId, @NonNull IBinder token) {
- throw new IllegalStateException("Face detect not supported by IBiometricsFace@1.0. Did you"
- + "forget to check the supportsFaceDetection flag?");
- }
-
- @Override
public void scheduleAuthenticate(int sensorId, @NonNull IBinder token, long operationId,
int userId, int cookie, @NonNull ClientMonitorCallbackConverter receiver,
@NonNull String opPackageName, boolean restricted, int statsClient,
@@ -672,7 +658,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
@Override
public void cancelAuthentication(int sensorId, @NonNull IBinder token) {
mHandler.post(() -> {
- mScheduler.cancelAuthenticationOrDetection(token);
+ mScheduler.cancelAuthentication(token);
});
}
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java
index 45e93a096550..9e9d0eec74ab 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java
@@ -58,12 +58,6 @@ class FingerprintDetectClient extends AcquisitionClient<ISession> {
}
@Override
- public void start(@NonNull Callback callback) {
- super.start(callback);
- startHalOperation();
- }
-
- @Override
protected void stopHalOperation() {
UdfpsHelper.hideUdfpsOverlay(getSensorId(), mUdfpsOverlayController);
try {
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java
index 9851ae08ac3a..01fd6419aee0 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java
@@ -115,7 +115,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
Slog.e(getTag(), "Stopping background authentication, top: "
+ topPackage + " currentClient: " + client);
mSensors.valueAt(i).getScheduler()
- .cancelAuthenticationOrDetection(client.getToken());
+ .cancelAuthentication(client.getToken());
}
}
}
@@ -383,8 +383,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
@Override
public void cancelAuthentication(int sensorId, @NonNull IBinder token) {
- mHandler.post(() -> mSensors.get(sensorId).getScheduler()
- .cancelAuthenticationOrDetection(token));
+ mHandler.post(() -> mSensors.get(sensorId).getScheduler().cancelAuthentication(token));
}
@Override
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java
index eb78245b0df5..7353cc7ab12c 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java
@@ -144,7 +144,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
&& !client.isAlreadyDone()) {
Slog.e(TAG, "Stopping background authentication, top: "
+ topPackage + " currentClient: " + client);
- mScheduler.cancelAuthenticationOrDetection(client.getToken());
+ mScheduler.cancelAuthentication(client.getToken());
}
}
});
@@ -645,7 +645,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
@Override
public void cancelAuthentication(int sensorId, @NonNull IBinder token) {
- mHandler.post(() -> mScheduler.cancelAuthenticationOrDetection(token));
+ mHandler.post(() -> mScheduler.cancelAuthentication(token));
}
@Override
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java b/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java
index e322ce551372..3cbc22654292 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java
@@ -279,7 +279,7 @@ public class AuthSessionTest {
IBiometricAuthenticator fingerprintAuthenticator = mock(IBiometricAuthenticator.class);
when(fingerprintAuthenticator.isHardwareDetected(any())).thenReturn(true);
when(fingerprintAuthenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
- mSensors.add(new BiometricSensor(mContext, id,
+ mSensors.add(new BiometricSensor(id,
TYPE_FINGERPRINT /* modality */,
Authenticators.BIOMETRIC_STRONG /* strength */,
fingerprintAuthenticator) {
@@ -314,7 +314,7 @@ public class AuthSessionTest {
IBiometricAuthenticator authenticator) throws RemoteException {
when(authenticator.isHardwareDetected(any())).thenReturn(true);
when(authenticator.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
- mSensors.add(new BiometricSensor(mContext, id,
+ mSensors.add(new BiometricSensor(id,
TYPE_FACE /* modality */,
Authenticators.BIOMETRIC_STRONG /* strength */,
authenticator) {
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
index a5fbab519aaa..abc873766de1 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java
@@ -1278,10 +1278,10 @@ public class BiometricServiceTest {
for (int i = 0; i < testCases.length; i++) {
final BiometricSensor sensor =
- new BiometricSensor(mContext, 0 /* id */,
+ new BiometricSensor(0 /* id */,
BiometricAuthenticator.TYPE_FINGERPRINT,
testCases[i][0],
- mock(IBiometricAuthenticator.class)) {
+ null /* impl */) {
@Override
boolean confirmationAlwaysRequired(int userId) {
return false;
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/InvalidationTrackerTest.java b/services/tests/servicestests/src/com/android/server/biometrics/InvalidationTrackerTest.java
index ee5ab92065ee..bb2b1c2fb0db 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/InvalidationTrackerTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/InvalidationTrackerTest.java
@@ -24,7 +24,6 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.annotation.NonNull;
import android.content.Context;
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.BiometricManager.Authenticators;
@@ -36,10 +35,7 @@ import androidx.test.filters.SmallTest;
import com.android.server.biometrics.BiometricService.InvalidationTracker;
-import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
import java.util.ArrayList;
@@ -47,37 +43,29 @@ import java.util.ArrayList;
@SmallTest
public class InvalidationTrackerTest {
- @Mock
- private Context mContext;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
-
@Test
public void testCallbackReceived_whenAllStrongSensorsInvalidated() throws Exception {
final IBiometricAuthenticator authenticator1 = mock(IBiometricAuthenticator.class);
when(authenticator1.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
- final TestSensor sensor1 = new TestSensor(mContext, 0 /* id */,
+ final TestSensor sensor1 = new TestSensor(0 /* id */,
BiometricAuthenticator.TYPE_FINGERPRINT, Authenticators.BIOMETRIC_STRONG,
authenticator1);
final IBiometricAuthenticator authenticator2 = mock(IBiometricAuthenticator.class);
when(authenticator2.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
- final TestSensor sensor2 = new TestSensor(mContext, 1 /* id */,
+ final TestSensor sensor2 = new TestSensor(1 /* id */,
BiometricAuthenticator.TYPE_FINGERPRINT, Authenticators.BIOMETRIC_STRONG,
authenticator2);
final IBiometricAuthenticator authenticator3 = mock(IBiometricAuthenticator.class);
when(authenticator3.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
- final TestSensor sensor3 = new TestSensor(mContext, 2 /* id */,
+ final TestSensor sensor3 = new TestSensor(2 /* id */,
BiometricAuthenticator.TYPE_FACE, Authenticators.BIOMETRIC_STRONG,
authenticator3);
final IBiometricAuthenticator authenticator4 = mock(IBiometricAuthenticator.class);
when(authenticator4.hasEnrolledTemplates(anyInt(), any())).thenReturn(true);
- final TestSensor sensor4 = new TestSensor(mContext, 3 /* id */,
+ final TestSensor sensor4 = new TestSensor(3 /* id */,
BiometricAuthenticator.TYPE_FACE, Authenticators.BIOMETRIC_WEAK,
authenticator4);
@@ -113,9 +101,8 @@ public class InvalidationTrackerTest {
private static class TestSensor extends BiometricSensor {
- TestSensor(@NonNull Context context, int id, int modality, int strength,
- @NonNull IBiometricAuthenticator impl) {
- super(context, id, modality, strength, impl);
+ TestSensor(int id, int modality, int strength, IBiometricAuthenticator impl) {
+ super(id, modality, strength, impl);
}
@Override
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/BiometricSchedulerTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/BiometricSchedulerTest.java
index c5ed20afacec..7dd073499c73 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/BiometricSchedulerTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/BiometricSchedulerTest.java
@@ -188,7 +188,7 @@ public class BiometricSchedulerTest {
// Request it to be canceled. The operation can be canceled immediately, and the scheduler
// should go back to idle, since in this case the framework has not even requested the HAL
// to authenticate yet.
- mScheduler.cancelAuthenticationOrDetection(mToken);
+ mScheduler.cancelAuthentication(mToken);
assertNull(mScheduler.mCurrentOperation);
}
@@ -298,7 +298,7 @@ public class BiometricSchedulerTest {
mScheduler.mPendingOperations.getFirst().mState);
// Request cancel before the authentication client has started
- mScheduler.cancelAuthenticationOrDetection(mToken);
+ mScheduler.cancelAuthentication(mToken);
waitForIdle();
assertEquals(Operation.STATE_WAITING_IN_QUEUE_CANCELING,
mScheduler.mPendingOperations.getFirst().mState);