Merge "Always execute the user switch HAL operation." into sc-dev
This commit is contained in:
@@ -866,7 +866,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
|
||||
private void scheduleUpdateActiveUserWithoutHandler(int targetUserId) {
|
||||
final boolean hasEnrolled = !getEnrolledFaces(mSensorId, targetUserId).isEmpty();
|
||||
final FaceUpdateActiveUserClient client = new FaceUpdateActiveUserClient(mContext,
|
||||
mLazyDaemon, targetUserId, mContext.getOpPackageName(), mSensorId, mCurrentUserId,
|
||||
mLazyDaemon, targetUserId, mContext.getOpPackageName(), mSensorId,
|
||||
hasEnrolled, mAuthenticatorIds);
|
||||
mScheduler.scheduleClientMonitor(client, new BaseClientMonitor.Callback() {
|
||||
@Override
|
||||
|
||||
@@ -34,38 +34,23 @@ public class FaceUpdateActiveUserClient extends HalClientMonitor<IBiometricsFace
|
||||
private static final String TAG = "FaceUpdateActiveUserClient";
|
||||
private static final String FACE_DATA_DIR = "facedata";
|
||||
|
||||
private final int mCurrentUserId;
|
||||
private final boolean mHasEnrolledBiometrics;
|
||||
@NonNull private final Map<Integer, Long> mAuthenticatorIds;
|
||||
|
||||
FaceUpdateActiveUserClient(@NonNull Context context,
|
||||
@NonNull LazyDaemon<IBiometricsFace> lazyDaemon, int userId, @NonNull String owner,
|
||||
int sensorId, int currentUserId, boolean hasEnrolledBIometrics,
|
||||
@NonNull LazyDaemon<IBiometricsFace> lazyDaemon, int userId, @NonNull String owner,
|
||||
int sensorId, boolean hasEnrolledBiometrics,
|
||||
@NonNull Map<Integer, Long> authenticatorIds) {
|
||||
super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
|
||||
0 /* cookie */, sensorId, BiometricsProtoEnums.MODALITY_UNKNOWN,
|
||||
BiometricsProtoEnums.ACTION_UNKNOWN, BiometricsProtoEnums.CLIENT_UNKNOWN);
|
||||
mCurrentUserId = currentUserId;
|
||||
mHasEnrolledBiometrics = hasEnrolledBIometrics;
|
||||
mHasEnrolledBiometrics = hasEnrolledBiometrics;
|
||||
mAuthenticatorIds = authenticatorIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(@NonNull Callback callback) {
|
||||
super.start(callback);
|
||||
|
||||
if (mCurrentUserId == getTargetUserId()) {
|
||||
Slog.d(TAG, "Already user: " + mCurrentUserId + ", refreshing authenticatorId");
|
||||
try {
|
||||
mAuthenticatorIds.put(getTargetUserId(), mHasEnrolledBiometrics
|
||||
? getFreshDaemon().getAuthenticatorId().value : 0L);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to refresh authenticatorId", e);
|
||||
}
|
||||
callback.onClientFinished(this, true /* success */);
|
||||
return;
|
||||
}
|
||||
|
||||
startHalOperation();
|
||||
}
|
||||
|
||||
@@ -85,7 +70,10 @@ public class FaceUpdateActiveUserClient extends HalClientMonitor<IBiometricsFace
|
||||
}
|
||||
|
||||
try {
|
||||
getFreshDaemon().setActiveUser(getTargetUserId(), storePath.getAbsolutePath());
|
||||
final IBiometricsFace daemon = getFreshDaemon();
|
||||
daemon.setActiveUser(getTargetUserId(), storePath.getAbsolutePath());
|
||||
mAuthenticatorIds.put(getTargetUserId(),
|
||||
mHasEnrolledBiometrics ? daemon.getAuthenticatorId().value : 0L);
|
||||
mCallback.onClientFinished(this, true /* success */);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Failed to setActiveUser: " + e);
|
||||
|
||||
Reference in New Issue
Block a user