Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16e3f6e8 authored by Joe Bolinger's avatar Joe Bolinger Committed by Automerger Merge Worker
Browse files

Merge "Always execute the user switch HAL operation." into sc-dev am: a95d3af4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15070224

Change-Id: I30139ae3377ea4a75f87ae9c23e5c22315edc0e8
parents 97d85c8a a95d3af4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+7 −19
Original line number Diff line number Diff line
@@ -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,
            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);