Use new context HAL methods for all biometric operations.
Bug: 204584403 Bug: 204585936 Test: manual (via BP test app) Test: atest com.android.server.biometrics.sensors Change-Id: I653cc16595ffbc3346ad5009b4b742cd14aecc12
This commit is contained in:
@@ -54,11 +54,6 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
|
||||
private boolean mShouldSendErrorToClient = true;
|
||||
private boolean mAlreadyCancelled;
|
||||
|
||||
/**
|
||||
* Stops the HAL operation specific to the ClientMonitor subclass.
|
||||
*/
|
||||
protected abstract void stopHalOperation();
|
||||
|
||||
public AcquisitionClient(@NonNull Context context, @NonNull Supplier<T> lazyDaemon,
|
||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull String owner, int cookie, int sensorId, boolean shouldVibrate,
|
||||
@@ -69,6 +64,11 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
|
||||
mShouldVibrate = shouldVibrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the HAL operation specific to the ClientMonitor subclass.
|
||||
*/
|
||||
protected abstract void stopHalOperation();
|
||||
|
||||
@Override
|
||||
public void unableToStart() {
|
||||
try {
|
||||
|
||||
@@ -90,22 +90,6 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T>
|
||||
// the state. We should think of a way to improve this in the future.
|
||||
protected @State int mState = STATE_NEW;
|
||||
|
||||
/**
|
||||
* Handles lifecycle, e.g. {@link BiometricScheduler},
|
||||
* {@link ClientMonitorCallback} after authentication
|
||||
* results are known. Note that this happens asynchronously from (but shortly after)
|
||||
* {@link #onAuthenticated(BiometricAuthenticator.Identifier, boolean, ArrayList)} and allows
|
||||
* {@link CoexCoordinator} a chance to invoke/delay this event.
|
||||
* @param authenticated
|
||||
*/
|
||||
protected abstract void handleLifecycleAfterAuth(boolean authenticated);
|
||||
|
||||
/**
|
||||
* @return true if a user was detected (i.e. face was found, fingerprint sensor was touched.
|
||||
* etc)
|
||||
*/
|
||||
public abstract boolean wasUserDetected();
|
||||
|
||||
public AuthenticationClient(@NonNull Context context, @NonNull Supplier<T> lazyDaemon,
|
||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
||||
int targetUserId, long operationId, boolean restricted, @NonNull String owner,
|
||||
@@ -475,6 +459,22 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles lifecycle, e.g. {@link BiometricScheduler},
|
||||
* {@link com.android.server.biometrics.sensors.BaseClientMonitor.Callback} after authentication
|
||||
* results are known. Note that this happens asynchronously from (but shortly after)
|
||||
* {@link #onAuthenticated(BiometricAuthenticator.Identifier, boolean, ArrayList)} and allows
|
||||
* {@link CoexCoordinator} a chance to invoke/delay this event.
|
||||
* @param authenticated
|
||||
*/
|
||||
protected abstract void handleLifecycleAfterAuth(boolean authenticated);
|
||||
|
||||
/**
|
||||
* @return true if a user was detected (i.e. face was found, fingerprint sensor was touched.
|
||||
* etc)
|
||||
*/
|
||||
public abstract boolean wasUserDetected();
|
||||
|
||||
public @State int getState() {
|
||||
return mState;
|
||||
}
|
||||
|
||||
@@ -29,19 +29,7 @@ import java.util.function.Supplier;
|
||||
* @param <T> HAL template
|
||||
*/
|
||||
public abstract class HalClientMonitor<T> extends BaseClientMonitor {
|
||||
|
||||
/**
|
||||
* Starts the HAL operation specific to the ClientMonitor subclass.
|
||||
*/
|
||||
protected abstract void startHalOperation();
|
||||
|
||||
/**
|
||||
* Invoked if the scheduler is unable to start the ClientMonitor (for example the HAL is null).
|
||||
* If such a problem is detected, the scheduler will not invoke
|
||||
* {@link #start(ClientMonitorCallback)}.
|
||||
*/
|
||||
public abstract void unableToStart();
|
||||
|
||||
|
||||
@NonNull
|
||||
protected final Supplier<T> mLazyDaemon;
|
||||
|
||||
@@ -71,4 +59,16 @@ public abstract class HalClientMonitor<T> extends BaseClientMonitor {
|
||||
public T getFreshDaemon() {
|
||||
return mLazyDaemon.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the HAL operation specific to the ClientMonitor subclass.
|
||||
*/
|
||||
protected abstract void startHalOperation();
|
||||
|
||||
/**
|
||||
* Invoked if the scheduler is unable to start the ClientMonitor (for example the HAL is null).
|
||||
* If such a problem is detected, the scheduler will not invoke
|
||||
* {@link #start(ClientMonitorCallback)}.
|
||||
*/
|
||||
public abstract void unableToStart();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public abstract class StartUserClient<T, U> extends HalClientMonitor<T> {
|
||||
* @param <U> New user object.
|
||||
*/
|
||||
public interface UserStartedCallback<U> {
|
||||
void onUserStarted(int newUserId, U newUser);
|
||||
void onUserStarted(int newUserId, U newUser, int halInterfaceVersion);
|
||||
}
|
||||
|
||||
@NonNull @VisibleForTesting
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.hardware.biometrics.face.ISession;
|
||||
|
||||
import static com.android.server.biometrics.sensors.face.aidl.Sensor.HalSessionCallback;
|
||||
|
||||
/**
|
||||
* A holder for an AIDL {@link ISession} with additional metadata about the current user
|
||||
* and the backend.
|
||||
*/
|
||||
public class AidlSession {
|
||||
|
||||
private final int mHalInterfaceVersion;
|
||||
@NonNull
|
||||
private final ISession mSession;
|
||||
private final int mUserId;
|
||||
@NonNull private final HalSessionCallback mHalSessionCallback;
|
||||
|
||||
public AidlSession(int halInterfaceVersion, @NonNull ISession session, int userId,
|
||||
HalSessionCallback halSessionCallback) {
|
||||
mHalInterfaceVersion = halInterfaceVersion;
|
||||
mSession = session;
|
||||
mUserId = userId;
|
||||
mHalSessionCallback = halSessionCallback;
|
||||
}
|
||||
|
||||
/** The underlying {@link ISession}. */
|
||||
@NonNull public ISession getSession() {
|
||||
return mSession;
|
||||
}
|
||||
|
||||
/** The user id associated with the session. */
|
||||
public int getUserId() {
|
||||
return mUserId;
|
||||
}
|
||||
|
||||
/** The HAL callback, which should only be used in tests {@See BiometricTestSessionImpl}. */
|
||||
HalSessionCallback getHalSessionCallback() {
|
||||
return mHalSessionCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this backend implements the *WithContext methods for enroll, authenticate, and
|
||||
* detectInteraction. These variants should always be called if they are available.
|
||||
*/
|
||||
public boolean hasContextMethods() {
|
||||
return mHalInterfaceVersion >= 2;
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
}
|
||||
|
||||
mEnrollmentIds.add(nextRandomId);
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback()
|
||||
.onEnrollmentProgress(nextRandomId, 0 /* remaining */);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
return;
|
||||
}
|
||||
final int fid = faces.get(0).getBiometricId();
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onAuthenticationSucceeded(fid,
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onAuthenticationSucceeded(fid,
|
||||
HardwareAuthTokenUtils.toHardwareAuthToken(new byte[69]));
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
public void rejectAuthentication(int userId) {
|
||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onAuthenticationFailed();
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onAuthenticationFailed();
|
||||
}
|
||||
|
||||
// TODO(b/178414967): replace with notifyAuthenticationFrame and notifyEnrollmentFrame.
|
||||
@@ -205,7 +205,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
|
||||
// TODO(b/178414967): Currently onAuthenticationFrame and onEnrollmentFrame are the same.
|
||||
// This will need to call the correct callback once the onAcquired callback is removed.
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onAuthenticationFrame(
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onAuthenticationFrame(
|
||||
authenticationFrame);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
public void notifyError(int userId, int errorCode) {
|
||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onError((byte) errorCode,
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onError((byte) errorCode,
|
||||
0 /* vendorCode */);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@ import android.hardware.biometrics.BiometricConstants;
|
||||
import android.hardware.biometrics.BiometricFaceConstants;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.common.ICancellationSignal;
|
||||
import android.hardware.biometrics.common.OperationContext;
|
||||
import android.hardware.biometrics.common.OperationReason;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.face.FaceAuthenticationFrame;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.os.IBinder;
|
||||
@@ -53,7 +54,8 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific authentication client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
class FaceAuthenticationClient extends AuthenticationClient<ISession> implements LockoutConsumer {
|
||||
class FaceAuthenticationClient extends AuthenticationClient<AidlSession>
|
||||
implements LockoutConsumer {
|
||||
private static final String TAG = "FaceAuthenticationClient";
|
||||
|
||||
@NonNull private final UsageStats mUsageStats;
|
||||
@@ -70,7 +72,7 @@ class FaceAuthenticationClient extends AuthenticationClient<ISession> implements
|
||||
@FaceManager.FaceAcquired private int mLastAcquire = FaceManager.FACE_ACQUIRED_UNKNOWN;
|
||||
|
||||
FaceAuthenticationClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, long requestId,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int targetUserId, long operationId,
|
||||
boolean restricted, String owner, int cookie, boolean requireConfirmation, int sensorId,
|
||||
@@ -123,7 +125,7 @@ class FaceAuthenticationClient extends AuthenticationClient<ISession> implements
|
||||
0 /* vendorCode */);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
} else {
|
||||
mCancellationSignal = getFreshDaemon().authenticate(mOperationId);
|
||||
mCancellationSignal = doAuthenticate();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting auth", e);
|
||||
@@ -132,6 +134,22 @@ class FaceAuthenticationClient extends AuthenticationClient<ISession> implements
|
||||
}
|
||||
}
|
||||
|
||||
private ICancellationSignal doAuthenticate() throws RemoteException {
|
||||
final AidlSession session = getFreshDaemon();
|
||||
|
||||
if (session.hasContextMethods()) {
|
||||
final OperationContext context = new OperationContext();
|
||||
// TODO: add reason, id, and isAoD
|
||||
context.id = 0;
|
||||
context.reason = OperationReason.UNKNOWN;
|
||||
context.isAoD = false;
|
||||
context.isCrypto = isCryptoOperation();
|
||||
return session.getSession().authenticateWithContext(mOperationId, context);
|
||||
} else {
|
||||
return session.getSession().authenticate(mOperationId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stopHalOperation() {
|
||||
if (mCancellationSignal != null) {
|
||||
|
||||
@@ -23,7 +23,8 @@ import android.hardware.SensorPrivacyManager;
|
||||
import android.hardware.biometrics.BiometricConstants;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.common.ICancellationSignal;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.biometrics.common.OperationContext;
|
||||
import android.hardware.biometrics.common.OperationReason;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -40,7 +41,7 @@ import java.util.function.Supplier;
|
||||
* 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 {
|
||||
public class FaceDetectClient extends AcquisitionClient<AidlSession> implements DetectionConsumer {
|
||||
|
||||
private static final String TAG = "FaceDetectClient";
|
||||
|
||||
@@ -48,7 +49,7 @@ public class FaceDetectClient extends AcquisitionClient<ISession> implements Det
|
||||
@Nullable private ICancellationSignal mCancellationSignal;
|
||||
@Nullable private SensorPrivacyManager mSensorPrivacyManager;
|
||||
|
||||
public FaceDetectClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FaceDetectClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, long requestId,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull String owner, int sensorId, boolean isStrongBiometric, int statsClient) {
|
||||
@@ -89,13 +90,29 @@ public class FaceDetectClient extends AcquisitionClient<ISession> implements Det
|
||||
}
|
||||
|
||||
try {
|
||||
mCancellationSignal = getFreshDaemon().detectInteraction();
|
||||
mCancellationSignal = doDetectInteraction();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting face detect", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
}
|
||||
}
|
||||
|
||||
private ICancellationSignal doDetectInteraction() throws RemoteException {
|
||||
final AidlSession session = getFreshDaemon();
|
||||
|
||||
if (session.hasContextMethods()) {
|
||||
final OperationContext context = new OperationContext();
|
||||
// TODO: add reason, id, and isAoD
|
||||
context.id = 0;
|
||||
context.reason = OperationReason.UNKNOWN;
|
||||
context.isAoD = false;
|
||||
context.isCrypto = isCryptoOperation();
|
||||
return session.getSession().detectInteractionWithContext(context);
|
||||
} else {
|
||||
return session.getSession().detectInteraction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInteractionDetected() {
|
||||
vibrateSuccess();
|
||||
|
||||
@@ -22,14 +22,16 @@ import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricFaceConstants;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.common.ICancellationSignal;
|
||||
import android.hardware.biometrics.common.OperationContext;
|
||||
import android.hardware.biometrics.common.OperationReason;
|
||||
import android.hardware.biometrics.face.EnrollmentType;
|
||||
import android.hardware.biometrics.face.Feature;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.common.NativeHandle;
|
||||
import android.hardware.face.Face;
|
||||
import android.hardware.face.FaceEnrollFrame;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.keymaster.HardwareAuthToken;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -56,7 +58,7 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific enroll client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
public class FaceEnrollClient extends EnrollClient<ISession> {
|
||||
public class FaceEnrollClient extends EnrollClient<AidlSession> {
|
||||
|
||||
private static final String TAG = "FaceEnrollClient";
|
||||
|
||||
@@ -83,7 +85,7 @@ public class FaceEnrollClient extends EnrollClient<ISession> {
|
||||
}
|
||||
};
|
||||
|
||||
FaceEnrollClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FaceEnrollClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull byte[] hardwareAuthToken, @NonNull String opPackageName, long requestId,
|
||||
@NonNull BiometricUtils<Face> utils, @NonNull int[] disabledFeatures, int timeoutSec,
|
||||
@@ -178,14 +180,12 @@ public class FaceEnrollClient extends EnrollClient<ISession> {
|
||||
featureList.add(Feature.REQUIRE_DIVERSE_POSES);
|
||||
}
|
||||
|
||||
byte[] features = new byte[featureList.size()];
|
||||
final byte[] features = new byte[featureList.size()];
|
||||
for (int i = 0; i < featureList.size(); i++) {
|
||||
features[i] = featureList.get(i);
|
||||
}
|
||||
|
||||
mCancellationSignal = getFreshDaemon().enroll(
|
||||
HardwareAuthTokenUtils.toHardwareAuthToken(mHardwareAuthToken),
|
||||
EnrollmentType.DEFAULT, features, mHwPreviewHandle);
|
||||
mCancellationSignal = doEnroll(features);
|
||||
} catch (RemoteException | IllegalArgumentException e) {
|
||||
Slog.e(TAG, "Exception when requesting enroll", e);
|
||||
onError(BiometricFaceConstants.FACE_ERROR_UNABLE_TO_PROCESS, 0 /* vendorCode */);
|
||||
@@ -193,6 +193,26 @@ public class FaceEnrollClient extends EnrollClient<ISession> {
|
||||
}
|
||||
}
|
||||
|
||||
private ICancellationSignal doEnroll(byte[] features) throws RemoteException {
|
||||
final AidlSession session = getFreshDaemon();
|
||||
final HardwareAuthToken hat =
|
||||
HardwareAuthTokenUtils.toHardwareAuthToken(mHardwareAuthToken);
|
||||
|
||||
if (session.hasContextMethods()) {
|
||||
final OperationContext context = new OperationContext();
|
||||
// TODO: add reason, id, and isAoD
|
||||
context.id = 0;
|
||||
context.reason = OperationReason.UNKNOWN;
|
||||
context.isAoD = false;
|
||||
context.isCrypto = isCryptoOperation();
|
||||
return session.getSession().enrollWithContext(
|
||||
hat, EnrollmentType.DEFAULT, features, mHwPreviewHandle, context);
|
||||
} else {
|
||||
return session.getSession().enroll(hat, EnrollmentType.DEFAULT, features,
|
||||
mHwPreviewHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stopHalOperation() {
|
||||
if (mCancellationSignal != null) {
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.face.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -32,11 +31,11 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific generateChallenge client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
public class FaceGenerateChallengeClient extends GenerateChallengeClient<ISession> {
|
||||
public class FaceGenerateChallengeClient extends GenerateChallengeClient<AidlSession> {
|
||||
private static final String TAG = "FaceGenerateChallengeClient";
|
||||
|
||||
FaceGenerateChallengeClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int userId, @NonNull String owner,
|
||||
int sensorId) {
|
||||
super(context, lazyDaemon, token, listener, userId, owner, sensorId);
|
||||
@@ -45,7 +44,7 @@ public class FaceGenerateChallengeClient extends GenerateChallengeClient<ISessio
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().generateChallenge();
|
||||
getFreshDaemon().getSession().generateChallenge();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to generateChallenge", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.face.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
|
||||
@@ -30,13 +29,14 @@ import com.android.server.biometrics.sensors.HalClientMonitor;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class FaceGetAuthenticatorIdClient extends HalClientMonitor<ISession> {
|
||||
class FaceGetAuthenticatorIdClient extends HalClientMonitor<AidlSession> {
|
||||
|
||||
private static final String TAG = "FaceGetAuthenticatorIdClient";
|
||||
|
||||
private final Map<Integer, Long> mAuthenticatorIds;
|
||||
|
||||
FaceGetAuthenticatorIdClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FaceGetAuthenticatorIdClient(@NonNull Context context,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon,
|
||||
int userId, @NonNull String opPackageName, int sensorId,
|
||||
Map<Integer, Long> authenticatorIds) {
|
||||
super(context, lazyDaemon, null /* token */, null /* listener */, userId, opPackageName,
|
||||
@@ -58,7 +58,7 @@ class FaceGetAuthenticatorIdClient extends HalClientMonitor<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().getAuthenticatorId();
|
||||
getFreshDaemon().getSession().getAuthenticatorId();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricFaceConstants;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
@@ -41,13 +40,13 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific get feature client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
public class FaceGetFeatureClient extends HalClientMonitor<ISession> implements ErrorConsumer {
|
||||
public class FaceGetFeatureClient extends HalClientMonitor<AidlSession> implements ErrorConsumer {
|
||||
|
||||
private static final String TAG = "FaceGetFeatureClient";
|
||||
|
||||
private final int mUserId;
|
||||
|
||||
FaceGetFeatureClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FaceGetFeatureClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, @Nullable ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull String owner, int sensorId) {
|
||||
super(context, lazyDaemon, token, listener, userId, owner, 0 /* cookie */, sensorId,
|
||||
@@ -70,7 +69,7 @@ public class FaceGetFeatureClient extends HalClientMonitor<ISession> implements
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().getFeatures();
|
||||
getFreshDaemon().getSession().getFeatures();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to getFeature", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.face.Face;
|
||||
import android.os.IBinder;
|
||||
|
||||
@@ -36,10 +35,10 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific internal cleanup client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
class FaceInternalCleanupClient extends InternalCleanupClient<Face, ISession> {
|
||||
class FaceInternalCleanupClient extends InternalCleanupClient<Face, AidlSession> {
|
||||
|
||||
FaceInternalCleanupClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, @NonNull String owner,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, @NonNull String owner,
|
||||
int sensorId, @NonNull List<Face> enrolledList, @NonNull BiometricUtils<Face> utils,
|
||||
@NonNull Map<Integer, Long> authenticatorIds) {
|
||||
super(context, lazyDaemon, userId, owner, sensorId, BiometricsProtoEnums.MODALITY_FACE,
|
||||
@@ -47,16 +46,16 @@ class FaceInternalCleanupClient extends InternalCleanupClient<Face, ISession> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InternalEnumerateClient<ISession> getEnumerateClient(Context context,
|
||||
Supplier<ISession> lazyDaemon, IBinder token, int userId, String owner,
|
||||
protected InternalEnumerateClient<AidlSession> getEnumerateClient(Context context,
|
||||
Supplier<AidlSession> lazyDaemon, IBinder token, int userId, String owner,
|
||||
List<Face> enrolledList, BiometricUtils<Face> utils, int sensorId) {
|
||||
return new FaceInternalEnumerateClient(context, lazyDaemon, token, userId, owner,
|
||||
enrolledList, utils, sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RemovalClient<Face, ISession> getRemovalClient(Context context,
|
||||
Supplier<ISession> lazyDaemon, IBinder token,
|
||||
protected RemovalClient<Face, AidlSession> getRemovalClient(Context context,
|
||||
Supplier<AidlSession> lazyDaemon, IBinder token,
|
||||
int biometricId, int userId, String owner, BiometricUtils<Face> utils, int sensorId,
|
||||
Map<Integer, Long> authenticatorIds) {
|
||||
// Internal remove does not need to send results to anyone. Cleanup (enumerate + remove)
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.face.Face;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -35,11 +34,11 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific internal enumerate client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
class FaceInternalEnumerateClient extends InternalEnumerateClient<ISession> {
|
||||
class FaceInternalEnumerateClient extends InternalEnumerateClient<AidlSession> {
|
||||
private static final String TAG = "FaceInternalEnumerateClient";
|
||||
|
||||
FaceInternalEnumerateClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token, int userId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token, int userId,
|
||||
@NonNull String owner, @NonNull List<Face> enrolledList,
|
||||
@NonNull BiometricUtils<Face> utils, int sensorId) {
|
||||
super(context, lazyDaemon, token, userId, owner, enrolledList, utils, sensorId,
|
||||
@@ -49,7 +48,7 @@ class FaceInternalEnumerateClient extends InternalEnumerateClient<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().enumerateEnrollments();
|
||||
getFreshDaemon().getSession().enumerateEnrollments();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting enumerate", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.face.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.IInvalidationCallback;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.face.Face;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -29,11 +28,11 @@ import com.android.server.biometrics.sensors.InvalidationClient;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FaceInvalidationClient extends InvalidationClient<Face, ISession> {
|
||||
public class FaceInvalidationClient extends InvalidationClient<Face, AidlSession> {
|
||||
private static final String TAG = "FaceInvalidationClient";
|
||||
|
||||
public FaceInvalidationClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, int sensorId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, int sensorId,
|
||||
@NonNull Map<Integer, Long> authenticatorIds, @NonNull IInvalidationCallback callback) {
|
||||
super(context, lazyDaemon, userId, sensorId, authenticatorIds, callback);
|
||||
}
|
||||
@@ -41,7 +40,7 @@ public class FaceInvalidationClient extends InvalidationClient<Face, ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().invalidateAuthenticatorId();
|
||||
getFreshDaemon().getSession().invalidateAuthenticatorId();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.face.Face;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -36,12 +35,12 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific removal client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
class FaceRemovalClient extends RemovalClient<Face, ISession> {
|
||||
class FaceRemovalClient extends RemovalClient<Face, AidlSession> {
|
||||
private static final String TAG = "FaceRemovalClient";
|
||||
|
||||
final int[] mBiometricIds;
|
||||
|
||||
FaceRemovalClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FaceRemovalClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener,
|
||||
int[] biometricIds, int userId, @NonNull String owner,
|
||||
@NonNull BiometricUtils<Face> utils, int sensorId,
|
||||
@@ -54,7 +53,7 @@ class FaceRemovalClient extends RemovalClient<Face, ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().removeEnrollments(mBiometricIds);
|
||||
getFreshDaemon().getSession().removeEnrollments(mBiometricIds);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting remove", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.keymaster.HardwareAuthToken;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -41,7 +40,7 @@ import java.util.function.Supplier;
|
||||
* Updates the framework's lockout cache and notifies clients such as Keyguard when lockout is
|
||||
* cleared.
|
||||
*/
|
||||
public class FaceResetLockoutClient extends HalClientMonitor<ISession> implements ErrorConsumer {
|
||||
public class FaceResetLockoutClient extends HalClientMonitor<AidlSession> implements ErrorConsumer {
|
||||
|
||||
private static final String TAG = "FaceResetLockoutClient";
|
||||
|
||||
@@ -50,7 +49,7 @@ public class FaceResetLockoutClient extends HalClientMonitor<ISession> implement
|
||||
private final LockoutResetDispatcher mLockoutResetDispatcher;
|
||||
|
||||
FaceResetLockoutClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, String owner, int sensorId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, String owner, int sensorId,
|
||||
@NonNull byte[] hardwareAuthToken, @NonNull LockoutCache lockoutTracker,
|
||||
@NonNull LockoutResetDispatcher lockoutResetDispatcher) {
|
||||
super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
|
||||
@@ -75,7 +74,7 @@ public class FaceResetLockoutClient extends HalClientMonitor<ISession> implement
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().resetLockout(mHardwareAuthToken);
|
||||
getFreshDaemon().getSession().resetLockout(mHardwareAuthToken);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to reset lockout", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.face.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -31,14 +30,14 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific revokeChallenge client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
public class FaceRevokeChallengeClient extends RevokeChallengeClient<ISession> {
|
||||
public class FaceRevokeChallengeClient extends RevokeChallengeClient<AidlSession> {
|
||||
|
||||
private static final String TAG = "FaceRevokeChallengeClient";
|
||||
|
||||
private final long mChallenge;
|
||||
|
||||
FaceRevokeChallengeClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token,
|
||||
int userId, @NonNull String owner, int sensorId, long challenge) {
|
||||
super(context, lazyDaemon, token, userId, owner, sensorId);
|
||||
mChallenge = challenge;
|
||||
@@ -47,7 +46,7 @@ public class FaceRevokeChallengeClient extends RevokeChallengeClient<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().revokeChallenge(mChallenge);
|
||||
getFreshDaemon().getSession().revokeChallenge(mChallenge);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to revokeChallenge", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.face.IFace;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.hardware.keymaster.HardwareAuthToken;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -38,7 +37,7 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Face-specific get feature client for the {@link IFace} AIDL HAL interface.
|
||||
*/
|
||||
public class FaceSetFeatureClient extends HalClientMonitor<ISession> implements ErrorConsumer {
|
||||
public class FaceSetFeatureClient extends HalClientMonitor<AidlSession> implements ErrorConsumer {
|
||||
|
||||
private static final String TAG = "FaceSetFeatureClient";
|
||||
|
||||
@@ -46,7 +45,7 @@ public class FaceSetFeatureClient extends HalClientMonitor<ISession> implements
|
||||
private final boolean mEnabled;
|
||||
private final HardwareAuthToken mHardwareAuthToken;
|
||||
|
||||
FaceSetFeatureClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FaceSetFeatureClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, @NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull String owner, int sensorId, int feature, boolean enabled,
|
||||
byte[] hardwareAuthToken) {
|
||||
@@ -76,8 +75,7 @@ public class FaceSetFeatureClient extends HalClientMonitor<ISession> implements
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon()
|
||||
.setFeature(mHardwareAuthToken,
|
||||
getFreshDaemon().getSession().setFeature(mHardwareAuthToken,
|
||||
AidlConversionUtils.convertFrameworkToAidlFeature(mFeature), mEnabled);
|
||||
} catch (RemoteException | IllegalArgumentException e) {
|
||||
Slog.e(TAG, "Unable to set feature: " + mFeature + " to enabled: " + mEnabled, e);
|
||||
|
||||
@@ -37,7 +37,8 @@ public class FaceStartUserClient extends StartUserClient<IFace, ISession> {
|
||||
|
||||
@NonNull private final ISessionCallback mSessionCallback;
|
||||
|
||||
public FaceStartUserClient(@NonNull Context context, @NonNull Supplier<IFace> lazyDaemon,
|
||||
public FaceStartUserClient(@NonNull Context context,
|
||||
@NonNull Supplier<IFace> lazyDaemon,
|
||||
@Nullable IBinder token, int userId, int sensorId,
|
||||
@NonNull ISessionCallback sessionCallback,
|
||||
@NonNull UserStartedCallback<ISession> callback) {
|
||||
@@ -54,10 +55,12 @@ public class FaceStartUserClient extends StartUserClient<IFace, ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
final ISession newSession = getFreshDaemon().createSession(getSensorId(),
|
||||
final IFace hal = getFreshDaemon();
|
||||
final int version = hal.getInterfaceVersion();
|
||||
final ISession newSession = hal.createSession(getSensorId(),
|
||||
getTargetUserId(), mSessionCallback);
|
||||
Binder.allowBlocking(newSession.asBinder());
|
||||
mUserStartedCallback.onUserStarted(getTargetUserId(), newSession);
|
||||
mUserStartedCallback.onUserStarted(getTargetUserId(), newSession, version);
|
||||
getCallback().onClientFinished(this, true /* success */);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
@@ -67,6 +70,5 @@ public class FaceStartUserClient extends StartUserClient<IFace, ISession> {
|
||||
|
||||
@Override
|
||||
public void unableToStart() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.face.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.face.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -29,10 +28,10 @@ import com.android.server.biometrics.sensors.StopUserClient;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FaceStopUserClient extends StopUserClient<ISession> {
|
||||
public class FaceStopUserClient extends StopUserClient<AidlSession> {
|
||||
private static final String TAG = "FaceStopUserClient";
|
||||
|
||||
public FaceStopUserClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
public FaceStopUserClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@Nullable IBinder token, int userId, int sensorId,
|
||||
@NonNull UserStoppedCallback callback) {
|
||||
super(context, lazyDaemon, token, userId, sensorId, callback);
|
||||
@@ -47,7 +46,7 @@ public class FaceStopUserClient extends StopUserClient<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().close();
|
||||
getFreshDaemon().getSession().close();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
getCallback().onClientFinished(this, false /* success */);
|
||||
@@ -56,6 +55,5 @@ public class FaceStopUserClient extends StopUserClient<ISession> {
|
||||
|
||||
@Override
|
||||
public void unableToStart() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,24 +84,9 @@ public class Sensor {
|
||||
@NonNull private final UserAwareBiometricScheduler mScheduler;
|
||||
@NonNull private final LockoutCache mLockoutCache;
|
||||
@NonNull private final Map<Integer, Long> mAuthenticatorIds;
|
||||
@NonNull private final Supplier<ISession> mLazySession;
|
||||
@Nullable private Session mCurrentSession;
|
||||
|
||||
static class Session {
|
||||
@NonNull final HalSessionCallback mHalSessionCallback;
|
||||
@NonNull private final String mTag;
|
||||
@NonNull private final ISession mSession;
|
||||
private final int mUserId;
|
||||
|
||||
Session(@NonNull String tag, @NonNull ISession session, int userId,
|
||||
@NonNull HalSessionCallback halSessionCallback) {
|
||||
mTag = tag;
|
||||
mSession = session;
|
||||
mUserId = userId;
|
||||
mHalSessionCallback = halSessionCallback;
|
||||
Slog.d(mTag, "New session created for user: " + userId);
|
||||
}
|
||||
}
|
||||
@NonNull private final Supplier<AidlSession> mLazySession;
|
||||
@Nullable private AidlSession mCurrentSession;
|
||||
|
||||
static class HalSessionCallback extends ISessionCallback.Stub {
|
||||
/**
|
||||
@@ -496,7 +481,7 @@ public class Sensor {
|
||||
mSensorProperties = sensorProperties;
|
||||
mScheduler = new UserAwareBiometricScheduler(tag,
|
||||
BiometricScheduler.SENSOR_TYPE_FACE, null /* gestureAvailabilityDispatcher */,
|
||||
() -> mCurrentSession != null ? mCurrentSession.mUserId : UserHandle.USER_NULL,
|
||||
() -> mCurrentSession != null ? mCurrentSession.getUserId() : UserHandle.USER_NULL,
|
||||
new UserAwareBiometricScheduler.UserSwitchCallback() {
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -508,21 +493,22 @@ public class Sensor {
|
||||
@NonNull
|
||||
@Override
|
||||
public StartUserClient<?, ?> getStartUserClient(int newUserId) {
|
||||
final HalSessionCallback.Callback callback = () -> {
|
||||
Slog.e(mTag, "Got ERROR_HW_UNAVAILABLE");
|
||||
mCurrentSession = null;
|
||||
};
|
||||
|
||||
final int sensorId = mSensorProperties.sensorId;
|
||||
|
||||
final HalSessionCallback resultController = new HalSessionCallback(mContext,
|
||||
mHandler, mTag, mScheduler, sensorId, newUserId, mLockoutCache,
|
||||
lockoutResetDispatcher, callback);
|
||||
lockoutResetDispatcher, () -> {
|
||||
Slog.e(mTag, "Got ERROR_HW_UNAVAILABLE");
|
||||
mCurrentSession = null;
|
||||
});
|
||||
|
||||
final StartUserClient.UserStartedCallback<ISession> userStartedCallback =
|
||||
(userIdStarted, newSession) -> {
|
||||
mCurrentSession = new Session(mTag, newSession, userIdStarted,
|
||||
resultController);
|
||||
(userIdStarted, newSession, halInterfaceVersion) -> {
|
||||
Slog.d(mTag, "New session created for user: "
|
||||
+ userIdStarted + " with hal version: "
|
||||
+ halInterfaceVersion);
|
||||
mCurrentSession = new AidlSession(halInterfaceVersion,
|
||||
newSession, userIdStarted, resultController);
|
||||
if (FaceUtils.getLegacyInstance(sensorId)
|
||||
.isInvalidationInProgress(mContext, userIdStarted)) {
|
||||
Slog.w(mTag,
|
||||
@@ -542,10 +528,10 @@ public class Sensor {
|
||||
});
|
||||
mLockoutCache = new LockoutCache();
|
||||
mAuthenticatorIds = new HashMap<>();
|
||||
mLazySession = () -> mCurrentSession != null ? mCurrentSession.mSession : null;
|
||||
mLazySession = () -> mCurrentSession != null ? mCurrentSession : null;
|
||||
}
|
||||
|
||||
@NonNull Supplier<ISession> getLazySession() {
|
||||
@NonNull Supplier<AidlSession> getLazySession() {
|
||||
return mLazySession;
|
||||
}
|
||||
|
||||
@@ -553,8 +539,8 @@ public class Sensor {
|
||||
return mSensorProperties;
|
||||
}
|
||||
|
||||
@Nullable Session getSessionForUser(int userId) {
|
||||
if (mCurrentSession != null && mCurrentSession.mUserId == userId) {
|
||||
@Nullable AidlSession getSessionForUser(int userId) {
|
||||
if (mCurrentSession != null && mCurrentSession.getUserId() == userId) {
|
||||
return mCurrentSession;
|
||||
} else {
|
||||
return null;
|
||||
@@ -583,10 +569,10 @@ public class Sensor {
|
||||
if (enabled != mTestHalEnabled) {
|
||||
// The framework should retrieve a new session from the HAL.
|
||||
try {
|
||||
if (mCurrentSession != null && mCurrentSession.mSession != null) {
|
||||
if (mCurrentSession != null) {
|
||||
// TODO(181984005): This should be scheduled instead of directly invoked
|
||||
Slog.d(mTag, "Closing old session");
|
||||
mCurrentSession.mSession.close();
|
||||
mCurrentSession.getSession().close();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(mTag, "RemoteException", e);
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.fingerprint.aidl;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
|
||||
import static com.android.server.biometrics.sensors.fingerprint.aidl.Sensor.HalSessionCallback;
|
||||
|
||||
/**
|
||||
* A holder for an AIDL {@link ISession} with additional metadata about the current user
|
||||
* and the backend.
|
||||
*/
|
||||
public class AidlSession {
|
||||
|
||||
private final int mHalInterfaceVersion;
|
||||
@NonNull private final ISession mSession;
|
||||
private final int mUserId;
|
||||
@NonNull private final HalSessionCallback mHalSessionCallback;
|
||||
|
||||
public AidlSession(int halInterfaceVersion, @NonNull ISession session, int userId,
|
||||
HalSessionCallback halSessionCallback) {
|
||||
mHalInterfaceVersion = halInterfaceVersion;
|
||||
mSession = session;
|
||||
mUserId = userId;
|
||||
mHalSessionCallback = halSessionCallback;
|
||||
}
|
||||
|
||||
/** The underlying {@link ISession}. */
|
||||
@NonNull public ISession getSession() {
|
||||
return mSession;
|
||||
}
|
||||
|
||||
/** The user id associated with the session. */
|
||||
public int getUserId() {
|
||||
return mUserId;
|
||||
}
|
||||
|
||||
/** The HAL callback, which should only be used in tests {@See BiometricTestSessionImpl}. */
|
||||
HalSessionCallback getHalSessionCallback() {
|
||||
return mHalSessionCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this backend implements the *WithContext methods for enroll, authenticate, and
|
||||
* detectInteraction. These variants should always be called if they are available.
|
||||
*/
|
||||
public boolean hasContextMethods() {
|
||||
return mHalInterfaceVersion >= 2;
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
}
|
||||
|
||||
mEnrollmentIds.add(nextRandomId);
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback()
|
||||
.onEnrollmentProgress(nextRandomId, 0 /* remaining */);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
return;
|
||||
}
|
||||
final int fid = fingerprints.get(0).getBiometricId();
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onAuthenticationSucceeded(fid,
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onAuthenticationSucceeded(fid,
|
||||
HardwareAuthTokenUtils.toHardwareAuthToken(new byte[69]));
|
||||
}
|
||||
|
||||
@@ -181,14 +181,14 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
public void rejectAuthentication(int userId) {
|
||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onAuthenticationFailed();
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onAuthenticationFailed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAcquired(int userId, int acquireInfo) {
|
||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback()
|
||||
.onAcquired((byte) acquireInfo, 0 /* vendorCode */);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class BiometricTestSessionImpl extends ITestSession.Stub {
|
||||
public void notifyError(int userId, int errorCode) {
|
||||
Utils.checkPermission(mContext, TEST_BIOMETRIC);
|
||||
|
||||
mSensor.getSessionForUser(userId).mHalSessionCallback.onError((byte) errorCode,
|
||||
mSensor.getSessionForUser(userId).getHalSessionCallback().onError((byte) errorCode,
|
||||
0 /* vendorCode */);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@ import android.hardware.biometrics.BiometricFingerprintConstants;
|
||||
import android.hardware.biometrics.BiometricFingerprintConstants.FingerprintAcquired;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.common.ICancellationSignal;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.biometrics.common.OperationContext;
|
||||
import android.hardware.biometrics.common.OperationReason;
|
||||
import android.hardware.biometrics.fingerprint.PointerContext;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.ISidefpsController;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
@@ -53,7 +55,7 @@ import java.util.function.Supplier;
|
||||
* Fingerprint-specific authentication client supporting the
|
||||
* {@link android.hardware.biometrics.fingerprint.IFingerprint} AIDL interface.
|
||||
*/
|
||||
class FingerprintAuthenticationClient extends AuthenticationClient<ISession> implements
|
||||
class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> implements
|
||||
Udfps, LockoutConsumer {
|
||||
private static final String TAG = "FingerprintAuthenticationClient";
|
||||
|
||||
@@ -66,7 +68,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
private boolean mIsPointerDown;
|
||||
|
||||
FingerprintAuthenticationClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, long requestId,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int targetUserId, long operationId,
|
||||
boolean restricted, @NonNull String owner, int cookie, boolean requireConfirmation,
|
||||
@@ -159,7 +161,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
mSensorOverlays.show(getSensorId(), getShowOverlayReason(), this);
|
||||
|
||||
try {
|
||||
mCancellationSignal = getFreshDaemon().authenticate(mOperationId);
|
||||
mCancellationSignal = doAuthenticate();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
onError(BiometricFingerprintConstants.FINGERPRINT_ERROR_HW_UNAVAILABLE,
|
||||
@@ -169,6 +171,22 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
}
|
||||
}
|
||||
|
||||
private ICancellationSignal doAuthenticate() throws RemoteException {
|
||||
final AidlSession session = getFreshDaemon();
|
||||
|
||||
if (session.hasContextMethods()) {
|
||||
final OperationContext context = new OperationContext();
|
||||
// TODO: add reason, id, and isAoD
|
||||
context.id = 0;
|
||||
context.reason = OperationReason.UNKNOWN;
|
||||
context.isAoD = false;
|
||||
context.isCrypto = isCryptoOperation();
|
||||
return session.getSession().authenticateWithContext(mOperationId, context);
|
||||
} else {
|
||||
return session.getSession().authenticate(mOperationId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stopHalOperation() {
|
||||
mSensorOverlays.hide(getSensorId());
|
||||
@@ -192,7 +210,20 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
mIsPointerDown = true;
|
||||
mState = STATE_STARTED;
|
||||
mALSProbeCallback.getProbe().enable();
|
||||
getFreshDaemon().onPointerDown(0 /* pointerId */, x, y, minor, major);
|
||||
|
||||
final AidlSession session = getFreshDaemon();
|
||||
if (session.hasContextMethods()) {
|
||||
final PointerContext context = new PointerContext();
|
||||
context.pointerId = 0;
|
||||
context.x = x;
|
||||
context.y = y;
|
||||
context.minor = minor;
|
||||
context.major = major;
|
||||
context.isAoD = false; // TODO; get value
|
||||
session.getSession().onPointerDownWithContext(context);
|
||||
} else {
|
||||
session.getSession().onPointerDown(0 /* pointerId */, x, y, minor, major);
|
||||
}
|
||||
|
||||
if (getListener() != null) {
|
||||
getListener().onUdfpsPointerDown(getSensorId());
|
||||
@@ -208,7 +239,15 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
mIsPointerDown = false;
|
||||
mState = STATE_STARTED_PAUSED_ATTEMPTED;
|
||||
mALSProbeCallback.getProbe().disable();
|
||||
getFreshDaemon().onPointerUp(0 /* pointerId */);
|
||||
|
||||
final AidlSession session = getFreshDaemon();
|
||||
if (session.hasContextMethods()) {
|
||||
final PointerContext context = new PointerContext();
|
||||
context.pointerId = 0;
|
||||
session.getSession().onPointerUpWithContext(context);
|
||||
} else {
|
||||
session.getSession().onPointerUp(0 /* pointerId */);
|
||||
}
|
||||
|
||||
if (getListener() != null) {
|
||||
getListener().onUdfpsPointerUp(getSensorId());
|
||||
@@ -226,7 +265,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
@Override
|
||||
public void onUiReady() {
|
||||
try {
|
||||
getFreshDaemon().onUiReady();
|
||||
getFreshDaemon().getSession().onUiReady();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricOverlayConstants;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.common.ICancellationSignal;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.biometrics.common.OperationContext;
|
||||
import android.hardware.biometrics.common.OperationReason;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -41,7 +42,7 @@ import java.util.function.Supplier;
|
||||
* Performs fingerprint detection without exposing any matching information (e.g. accept/reject
|
||||
* have the same haptic, lockout counter is not increased).
|
||||
*/
|
||||
class FingerprintDetectClient extends AcquisitionClient<ISession> implements DetectionConsumer {
|
||||
class FingerprintDetectClient extends AcquisitionClient<AidlSession> implements DetectionConsumer {
|
||||
|
||||
private static final String TAG = "FingerprintDetectClient";
|
||||
|
||||
@@ -49,7 +50,7 @@ class FingerprintDetectClient extends AcquisitionClient<ISession> implements Det
|
||||
@NonNull private final SensorOverlays mSensorOverlays;
|
||||
@Nullable private ICancellationSignal mCancellationSignal;
|
||||
|
||||
FingerprintDetectClient(@NonNull Context context, @NonNull Supplier<ISession> lazyDaemon,
|
||||
FingerprintDetectClient(@NonNull Context context, @NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token, long requestId,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull String owner, int sensorId,
|
||||
@@ -86,7 +87,7 @@ class FingerprintDetectClient extends AcquisitionClient<ISession> implements Det
|
||||
mSensorOverlays.show(getSensorId(), BiometricOverlayConstants.REASON_AUTH_KEYGUARD, this);
|
||||
|
||||
try {
|
||||
mCancellationSignal = getFreshDaemon().detectInteraction();
|
||||
mCancellationSignal = doDetectInteraction();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting finger detect", e);
|
||||
mSensorOverlays.hide(getSensorId());
|
||||
@@ -94,6 +95,22 @@ class FingerprintDetectClient extends AcquisitionClient<ISession> implements Det
|
||||
}
|
||||
}
|
||||
|
||||
private ICancellationSignal doDetectInteraction() throws RemoteException {
|
||||
final AidlSession session = getFreshDaemon();
|
||||
|
||||
if (session.hasContextMethods()) {
|
||||
final OperationContext context = new OperationContext();
|
||||
// TODO: add reason, id, and isAoD
|
||||
context.id = 0;
|
||||
context.reason = OperationReason.UNKNOWN;
|
||||
context.isAoD = false;
|
||||
context.isCrypto = isCryptoOperation();
|
||||
return session.getSession().detectInteractionWithContext(context);
|
||||
} else {
|
||||
return session.getSession().detectInteraction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInteractionDetected() {
|
||||
vibrateSuccess();
|
||||
|
||||
@@ -24,12 +24,15 @@ import android.hardware.biometrics.BiometricFingerprintConstants;
|
||||
import android.hardware.biometrics.BiometricFingerprintConstants.FingerprintAcquired;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.common.ICancellationSignal;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.biometrics.common.OperationContext;
|
||||
import android.hardware.biometrics.common.OperationReason;
|
||||
import android.hardware.biometrics.fingerprint.PointerContext;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.ISidefpsController;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.hardware.keymaster.HardwareAuthToken;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -48,7 +51,7 @@ import com.android.server.biometrics.sensors.fingerprint.UdfpsHelper;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps {
|
||||
|
||||
private static final String TAG = "FingerprintEnrollClient";
|
||||
|
||||
@@ -61,7 +64,7 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
private boolean mIsPointerDown;
|
||||
|
||||
FingerprintEnrollClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token, long requestId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token, long requestId,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||
@NonNull byte[] hardwareAuthToken, @NonNull String owner,
|
||||
@NonNull BiometricUtils<Fingerprint> utils, int sensorId,
|
||||
@@ -158,8 +161,7 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
|
||||
BiometricNotificationUtils.cancelBadCalibrationNotification(getContext());
|
||||
try {
|
||||
mCancellationSignal = getFreshDaemon().enroll(
|
||||
HardwareAuthTokenUtils.toHardwareAuthToken(mHardwareAuthToken));
|
||||
mCancellationSignal = doEnroll();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting enroll", e);
|
||||
onError(BiometricFingerprintConstants.FINGERPRINT_ERROR_UNABLE_TO_PROCESS,
|
||||
@@ -168,11 +170,42 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
}
|
||||
}
|
||||
|
||||
private ICancellationSignal doEnroll() throws RemoteException {
|
||||
final AidlSession session = getFreshDaemon();
|
||||
final HardwareAuthToken hat =
|
||||
HardwareAuthTokenUtils.toHardwareAuthToken(mHardwareAuthToken);
|
||||
|
||||
if (session.hasContextMethods()) {
|
||||
final OperationContext context = new OperationContext();
|
||||
// TODO: add reason, id, and isAoD
|
||||
context.id = 0;
|
||||
context.reason = OperationReason.UNKNOWN;
|
||||
context.isAoD = false;
|
||||
context.isCrypto = isCryptoOperation();
|
||||
return session.getSession().enrollWithContext(hat, context);
|
||||
} else {
|
||||
return session.getSession().enroll(hat);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerDown(int x, int y, float minor, float major) {
|
||||
try {
|
||||
mIsPointerDown = true;
|
||||
getFreshDaemon().onPointerDown(0 /* pointerId */, x, y, minor, major);
|
||||
|
||||
final AidlSession session = getFreshDaemon();
|
||||
if (session.hasContextMethods()) {
|
||||
final PointerContext context = new PointerContext();
|
||||
context.pointerId = 0;
|
||||
context.x = x;
|
||||
context.y = y;
|
||||
context.minor = minor;
|
||||
context.major = major;
|
||||
context.isAoD = false;
|
||||
session.getSession().onPointerDownWithContext(context);
|
||||
} else {
|
||||
session.getSession().onPointerDown(0 /* pointerId */, x, y, minor, major);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to send pointer down", e);
|
||||
}
|
||||
@@ -182,7 +215,15 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
public void onPointerUp() {
|
||||
try {
|
||||
mIsPointerDown = false;
|
||||
getFreshDaemon().onPointerUp(0 /* pointerId */);
|
||||
|
||||
final AidlSession session = getFreshDaemon();
|
||||
if (session.hasContextMethods()) {
|
||||
final PointerContext context = new PointerContext();
|
||||
context.pointerId = 0;
|
||||
session.getSession().onPointerUpWithContext(context);
|
||||
} else {
|
||||
session.getSession().onPointerUp(0 /* pointerId */);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to send pointer up", e);
|
||||
}
|
||||
@@ -196,7 +237,7 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
@Override
|
||||
public void onUiReady() {
|
||||
try {
|
||||
getFreshDaemon().onUiReady();
|
||||
getFreshDaemon().getSession().onUiReady();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to send UI ready", e);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -32,11 +31,11 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Fingerprint-specific generateChallenge client for the {@link IFingerprint} AIDL HAL interface.
|
||||
*/
|
||||
class FingerprintGenerateChallengeClient extends GenerateChallengeClient<ISession> {
|
||||
class FingerprintGenerateChallengeClient extends GenerateChallengeClient<AidlSession> {
|
||||
private static final String TAG = "FingerprintGenerateChallengeClient";
|
||||
|
||||
FingerprintGenerateChallengeClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon,
|
||||
@NonNull IBinder token,
|
||||
@NonNull ClientMonitorCallbackConverter listener,
|
||||
int userId, @NonNull String owner, int sensorId) {
|
||||
@@ -46,7 +45,7 @@ class FingerprintGenerateChallengeClient extends GenerateChallengeClient<ISessio
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().generateChallenge();
|
||||
getFreshDaemon().getSession().generateChallenge();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to generateChallenge", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
|
||||
@@ -30,14 +29,14 @@ import com.android.server.biometrics.sensors.HalClientMonitor;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
class FingerprintGetAuthenticatorIdClient extends HalClientMonitor<ISession> {
|
||||
class FingerprintGetAuthenticatorIdClient extends HalClientMonitor<AidlSession> {
|
||||
|
||||
private static final String TAG = "FingerprintGetAuthenticatorIdClient";
|
||||
|
||||
private final Map<Integer, Long> mAuthenticatorIds;
|
||||
|
||||
FingerprintGetAuthenticatorIdClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, @NonNull String owner,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, @NonNull String owner,
|
||||
int sensorId, Map<Integer, Long> authenticatorIds) {
|
||||
super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
|
||||
0 /* cookie */, sensorId, BiometricsProtoEnums.MODALITY_FINGERPRINT,
|
||||
@@ -58,7 +57,7 @@ class FingerprintGetAuthenticatorIdClient extends HalClientMonitor<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().getAuthenticatorId();
|
||||
getFreshDaemon().getSession().getAuthenticatorId();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.os.IBinder;
|
||||
|
||||
@@ -37,10 +36,10 @@ import java.util.function.Supplier;
|
||||
* Fingerprint-specific internal cleanup client supporting the
|
||||
* {@link android.hardware.biometrics.fingerprint.IFingerprint} AIDL interface.
|
||||
*/
|
||||
class FingerprintInternalCleanupClient extends InternalCleanupClient<Fingerprint, ISession> {
|
||||
class FingerprintInternalCleanupClient extends InternalCleanupClient<Fingerprint, AidlSession> {
|
||||
|
||||
FingerprintInternalCleanupClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, @NonNull String owner,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, @NonNull String owner,
|
||||
int sensorId, @NonNull List<Fingerprint> enrolledList,
|
||||
@NonNull FingerprintUtils utils, @NonNull Map<Integer, Long> authenticatorIds) {
|
||||
super(context, lazyDaemon, userId, owner, sensorId,
|
||||
@@ -48,16 +47,16 @@ class FingerprintInternalCleanupClient extends InternalCleanupClient<Fingerprint
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InternalEnumerateClient<ISession> getEnumerateClient(Context context,
|
||||
Supplier<ISession> lazyDaemon, IBinder token, int userId, String owner,
|
||||
protected InternalEnumerateClient<AidlSession> getEnumerateClient(Context context,
|
||||
Supplier<AidlSession> lazyDaemon, IBinder token, int userId, String owner,
|
||||
List<Fingerprint> enrolledList, BiometricUtils<Fingerprint> utils, int sensorId) {
|
||||
return new FingerprintInternalEnumerateClient(context, lazyDaemon, token, userId, owner,
|
||||
enrolledList, utils, sensorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RemovalClient<Fingerprint, ISession> getRemovalClient(Context context,
|
||||
Supplier<ISession> lazyDaemon, IBinder token, int biometricId, int userId,
|
||||
protected RemovalClient<Fingerprint, AidlSession> getRemovalClient(Context context,
|
||||
Supplier<AidlSession> lazyDaemon, IBinder token, int biometricId, int userId,
|
||||
String owner, BiometricUtils<Fingerprint> utils, int sensorId,
|
||||
Map<Integer, Long> authenticatorIds) {
|
||||
return new FingerprintRemovalClient(context, lazyDaemon, token,
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -35,11 +34,11 @@ import java.util.function.Supplier;
|
||||
* Fingerprint-specific internal client supporting the
|
||||
* {@link android.hardware.biometrics.fingerprint.IFingerprint} AIDL interface.
|
||||
*/
|
||||
class FingerprintInternalEnumerateClient extends InternalEnumerateClient<ISession> {
|
||||
class FingerprintInternalEnumerateClient extends InternalEnumerateClient<AidlSession> {
|
||||
private static final String TAG = "FingerprintInternalEnumerateClient";
|
||||
|
||||
protected FingerprintInternalEnumerateClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token, int userId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token, int userId,
|
||||
@NonNull String owner, @NonNull List<Fingerprint> enrolledList,
|
||||
@NonNull BiometricUtils<Fingerprint> utils, int sensorId) {
|
||||
super(context, lazyDaemon, token, userId, owner, enrolledList, utils, sensorId,
|
||||
@@ -49,7 +48,7 @@ class FingerprintInternalEnumerateClient extends InternalEnumerateClient<ISessio
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().enumerateEnrollments();
|
||||
getFreshDaemon().getSession().enumerateEnrollments();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting enumerate", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.IInvalidationCallback;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -29,11 +28,11 @@ import com.android.server.biometrics.sensors.InvalidationClient;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FingerprintInvalidationClient extends InvalidationClient<Fingerprint, ISession> {
|
||||
public class FingerprintInvalidationClient extends InvalidationClient<Fingerprint, AidlSession> {
|
||||
private static final String TAG = "FingerprintInvalidationClient";
|
||||
|
||||
public FingerprintInvalidationClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, int sensorId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, int sensorId,
|
||||
@NonNull Map<Integer, Long> authenticatorIds, @NonNull IInvalidationCallback callback) {
|
||||
super(context, lazyDaemon, userId, sensorId, authenticatorIds, callback);
|
||||
}
|
||||
@@ -41,7 +40,7 @@ public class FingerprintInvalidationClient extends InvalidationClient<Fingerprin
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().invalidateAuthenticatorId();
|
||||
getFreshDaemon().getSession().invalidateAuthenticatorId();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.fingerprint.Fingerprint;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
@@ -37,13 +36,13 @@ import java.util.function.Supplier;
|
||||
* Fingerprint-specific removal client supporting the
|
||||
* {@link android.hardware.biometrics.fingerprint.IFingerprint} interface.
|
||||
*/
|
||||
class FingerprintRemovalClient extends RemovalClient<Fingerprint, ISession> {
|
||||
class FingerprintRemovalClient extends RemovalClient<Fingerprint, AidlSession> {
|
||||
private static final String TAG = "FingerprintRemovalClient";
|
||||
|
||||
private final int[] mBiometricIds;
|
||||
|
||||
FingerprintRemovalClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token,
|
||||
@Nullable ClientMonitorCallbackConverter listener, int[] biometricIds, int userId,
|
||||
@NonNull String owner, @NonNull BiometricUtils<Fingerprint> utils, int sensorId,
|
||||
@NonNull Map<Integer, Long> authenticatorIds) {
|
||||
@@ -55,7 +54,7 @@ class FingerprintRemovalClient extends RemovalClient<Fingerprint, ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().removeEnrollments(mBiometricIds);
|
||||
getFreshDaemon().getSession().removeEnrollments(mBiometricIds);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when requesting remove", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricsProtoEnums;
|
||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.keymaster.HardwareAuthToken;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -41,7 +40,7 @@ import java.util.function.Supplier;
|
||||
* Updates the framework's lockout cache and notifies clients such as Keyguard when lockout is
|
||||
* cleared.
|
||||
*/
|
||||
class FingerprintResetLockoutClient extends HalClientMonitor<ISession> implements ErrorConsumer {
|
||||
class FingerprintResetLockoutClient extends HalClientMonitor<AidlSession> implements ErrorConsumer {
|
||||
|
||||
private static final String TAG = "FingerprintResetLockoutClient";
|
||||
|
||||
@@ -50,7 +49,7 @@ class FingerprintResetLockoutClient extends HalClientMonitor<ISession> implement
|
||||
private final LockoutResetDispatcher mLockoutResetDispatcher;
|
||||
|
||||
FingerprintResetLockoutClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, int userId, String owner, int sensorId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, int userId, String owner, int sensorId,
|
||||
@NonNull byte[] hardwareAuthToken, @NonNull LockoutCache lockoutTracker,
|
||||
@NonNull LockoutResetDispatcher lockoutResetDispatcher) {
|
||||
super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
|
||||
@@ -75,7 +74,7 @@ class FingerprintResetLockoutClient extends HalClientMonitor<ISession> implement
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().resetLockout(mHardwareAuthToken);
|
||||
getFreshDaemon().getSession().resetLockout(mHardwareAuthToken);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to reset lockout", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.fingerprint.IFingerprint;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -31,14 +30,14 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
* Fingerprint-specific revokeChallenge client for the {@link IFingerprint} AIDL HAL interface.
|
||||
*/
|
||||
class FingerprintRevokeChallengeClient extends RevokeChallengeClient<ISession> {
|
||||
class FingerprintRevokeChallengeClient extends RevokeChallengeClient<AidlSession> {
|
||||
|
||||
private static final String TAG = "FingerpirntRevokeChallengeClient";
|
||||
|
||||
private final long mChallenge;
|
||||
|
||||
FingerprintRevokeChallengeClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @NonNull IBinder token,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token,
|
||||
int userId, @NonNull String owner, int sensorId, long challenge) {
|
||||
super(context, lazyDaemon, token, userId, owner, sensorId);
|
||||
mChallenge = challenge;
|
||||
@@ -47,7 +46,7 @@ class FingerprintRevokeChallengeClient extends RevokeChallengeClient<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().revokeChallenge(mChallenge);
|
||||
getFreshDaemon().getSession().revokeChallenge(mChallenge);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to revokeChallenge", e);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
|
||||
@@ -55,10 +55,12 @@ public class FingerprintStartUserClient extends StartUserClient<IFingerprint, IS
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
final ISession newSession = getFreshDaemon().createSession(getSensorId(),
|
||||
final IFingerprint hal = getFreshDaemon();
|
||||
final int version = hal.getInterfaceVersion();
|
||||
final ISession newSession = hal.createSession(getSensorId(),
|
||||
getTargetUserId(), mSessionCallback);
|
||||
Binder.allowBlocking(newSession.asBinder());
|
||||
mUserStartedCallback.onUserStarted(getTargetUserId(), newSession);
|
||||
mUserStartedCallback.onUserStarted(getTargetUserId(), newSession, version);
|
||||
getCallback().onClientFinished(this, true /* success */);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
@@ -68,6 +70,5 @@ public class FingerprintStartUserClient extends StartUserClient<IFingerprint, IS
|
||||
|
||||
@Override
|
||||
public void unableToStart() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -29,11 +28,11 @@ import com.android.server.biometrics.sensors.StopUserClient;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FingerprintStopUserClient extends StopUserClient<ISession> {
|
||||
public class FingerprintStopUserClient extends StopUserClient<AidlSession> {
|
||||
private static final String TAG = "FingerprintStopUserClient";
|
||||
|
||||
public FingerprintStopUserClient(@NonNull Context context,
|
||||
@NonNull Supplier<ISession> lazyDaemon, @Nullable IBinder token, int userId,
|
||||
@NonNull Supplier<AidlSession> lazyDaemon, @Nullable IBinder token, int userId,
|
||||
int sensorId, @NonNull UserStoppedCallback callback) {
|
||||
super(context, lazyDaemon, token, userId, sensorId, callback);
|
||||
}
|
||||
@@ -47,7 +46,7 @@ public class FingerprintStopUserClient extends StopUserClient<ISession> {
|
||||
@Override
|
||||
protected void startHalOperation() {
|
||||
try {
|
||||
getFreshDaemon().close();
|
||||
getFreshDaemon().getSession().close();
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception", e);
|
||||
getCallback().onClientFinished(this, false /* success */);
|
||||
@@ -56,6 +55,5 @@ public class FingerprintStopUserClient extends StopUserClient<ISession> {
|
||||
|
||||
@Override
|
||||
public void unableToStart() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,24 +86,8 @@ class Sensor {
|
||||
@NonNull private final LockoutCache mLockoutCache;
|
||||
@NonNull private final Map<Integer, Long> mAuthenticatorIds;
|
||||
|
||||
@Nullable private Session mCurrentSession;
|
||||
@NonNull private final Supplier<ISession> mLazySession;
|
||||
|
||||
static class Session {
|
||||
@NonNull private final String mTag;
|
||||
@NonNull private final ISession mSession;
|
||||
private final int mUserId;
|
||||
@NonNull final HalSessionCallback mHalSessionCallback;
|
||||
|
||||
Session(@NonNull String tag, @NonNull ISession session, int userId,
|
||||
@NonNull HalSessionCallback halSessionCallback) {
|
||||
mTag = tag;
|
||||
mSession = session;
|
||||
mUserId = userId;
|
||||
mHalSessionCallback = halSessionCallback;
|
||||
Slog.d(mTag, "New session created for user: " + userId);
|
||||
}
|
||||
}
|
||||
@Nullable private AidlSession mCurrentSession;
|
||||
@NonNull private final Supplier<AidlSession> mLazySession;
|
||||
|
||||
static class HalSessionCallback extends ISessionCallback.Stub {
|
||||
|
||||
@@ -452,7 +436,7 @@ class Sensor {
|
||||
mScheduler = new UserAwareBiometricScheduler(tag,
|
||||
BiometricScheduler.sensorTypeFromFingerprintProperties(mSensorProperties),
|
||||
gestureAvailabilityDispatcher,
|
||||
() -> mCurrentSession != null ? mCurrentSession.mUserId : UserHandle.USER_NULL,
|
||||
() -> mCurrentSession != null ? mCurrentSession.getUserId() : UserHandle.USER_NULL,
|
||||
new UserAwareBiometricScheduler.UserSwitchCallback() {
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -464,20 +448,21 @@ class Sensor {
|
||||
@NonNull
|
||||
@Override
|
||||
public StartUserClient<?, ?> getStartUserClient(int newUserId) {
|
||||
final HalSessionCallback.Callback callback = () -> {
|
||||
Slog.e(mTag, "Got ERROR_HW_UNAVAILABLE");
|
||||
mCurrentSession = null;
|
||||
};
|
||||
|
||||
final int sensorId = mSensorProperties.sensorId;
|
||||
|
||||
final HalSessionCallback resultController = new HalSessionCallback(mContext,
|
||||
mHandler, mTag, mScheduler, sensorId, newUserId, mLockoutCache,
|
||||
lockoutResetDispatcher, callback);
|
||||
lockoutResetDispatcher, () -> {
|
||||
Slog.e(mTag, "Got ERROR_HW_UNAVAILABLE");
|
||||
mCurrentSession = null;
|
||||
});
|
||||
|
||||
final StartUserClient.UserStartedCallback<ISession> userStartedCallback =
|
||||
(userIdStarted, newSession) -> {
|
||||
mCurrentSession = new Session(mTag,
|
||||
(userIdStarted, newSession, halInterfaceVersion) -> {
|
||||
Slog.d(mTag, "New session created for user: "
|
||||
+ userIdStarted + " with hal version: "
|
||||
+ halInterfaceVersion);
|
||||
mCurrentSession = new AidlSession(halInterfaceVersion,
|
||||
newSession, userIdStarted, resultController);
|
||||
if (FingerprintUtils.getInstance(sensorId)
|
||||
.isInvalidationInProgress(mContext, userIdStarted)) {
|
||||
@@ -497,10 +482,10 @@ class Sensor {
|
||||
}
|
||||
});
|
||||
mAuthenticatorIds = new HashMap<>();
|
||||
mLazySession = () -> mCurrentSession != null ? mCurrentSession.mSession : null;
|
||||
mLazySession = () -> mCurrentSession != null ? mCurrentSession : null;
|
||||
}
|
||||
|
||||
@NonNull Supplier<ISession> getLazySession() {
|
||||
@NonNull Supplier<AidlSession> getLazySession() {
|
||||
return mLazySession;
|
||||
}
|
||||
|
||||
@@ -508,8 +493,8 @@ class Sensor {
|
||||
return mSensorProperties;
|
||||
}
|
||||
|
||||
@Nullable Session getSessionForUser(int userId) {
|
||||
if (mCurrentSession != null && mCurrentSession.mUserId == userId) {
|
||||
@Nullable AidlSession getSessionForUser(int userId) {
|
||||
if (mCurrentSession != null && mCurrentSession.getUserId() == userId) {
|
||||
return mCurrentSession;
|
||||
} else {
|
||||
return null;
|
||||
@@ -539,10 +524,10 @@ class Sensor {
|
||||
if (enabled != mTestHalEnabled) {
|
||||
// The framework should retrieve a new session from the HAL.
|
||||
try {
|
||||
if (mCurrentSession != null && mCurrentSession.mSession != null) {
|
||||
if (mCurrentSession != null) {
|
||||
// TODO(181984005): This should be scheduled instead of directly invoked
|
||||
Slog.d(mTag, "Closing old session");
|
||||
mCurrentSession.mSession.close();
|
||||
mCurrentSession.getSession().close();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(mTag, "RemoteException", e);
|
||||
|
||||
@@ -217,7 +217,7 @@ public class UserAwareBiometricSchedulerTest {
|
||||
int numInvocations;
|
||||
|
||||
@Override
|
||||
public void onUserStarted(int newUserId, Object newObject) {
|
||||
public void onUserStarted(int newUserId, Object newObject, int halInterfaceVersion) {
|
||||
numInvocations++;
|
||||
mCurrentUserId = newUserId;
|
||||
}
|
||||
@@ -270,7 +270,8 @@ public class UserAwareBiometricSchedulerTest {
|
||||
|
||||
mCallback = callback;
|
||||
if (mShouldFinish) {
|
||||
mUserStartedCallback.onUserStarted(getTargetUserId(), new Object());
|
||||
mUserStartedCallback.onUserStarted(
|
||||
getTargetUserId(), new Object(), 1 /* halInterfaceVersion */);
|
||||
callback.onClientFinished(this, true /* success */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ public class SensorTest {
|
||||
mLockoutCache.setLockoutModeForUser(USER_ID, LockoutTracker.LOCKOUT_TIMED);
|
||||
|
||||
mScheduler.scheduleClientMonitor(new FaceResetLockoutClient(mContext,
|
||||
() -> mSession, USER_ID, TAG, SENSOR_ID, HAT, mLockoutCache,
|
||||
mLockoutResetDispatcher));
|
||||
() -> new AidlSession(1, mSession, USER_ID, mHalCallback),
|
||||
USER_ID, TAG, SENSOR_ID, HAT, mLockoutCache, mLockoutResetDispatcher));
|
||||
mLooper.dispatchAll();
|
||||
|
||||
verifyNotLocked();
|
||||
|
||||
@@ -101,8 +101,8 @@ public class SensorTest {
|
||||
mLockoutCache.setLockoutModeForUser(USER_ID, LockoutTracker.LOCKOUT_TIMED);
|
||||
|
||||
mScheduler.scheduleClientMonitor(new FingerprintResetLockoutClient(mContext,
|
||||
() -> mSession, USER_ID, TAG, SENSOR_ID, HAT, mLockoutCache,
|
||||
mLockoutResetDispatcher));
|
||||
() -> new AidlSession(1, mSession, USER_ID, mHalCallback),
|
||||
USER_ID, TAG, SENSOR_ID, HAT, mLockoutCache, mLockoutResetDispatcher));
|
||||
mLooper.dispatchAll();
|
||||
|
||||
verifyNotLocked();
|
||||
|
||||
Reference in New Issue
Block a user