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

Commit d7dd7438 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: I2bdbf5891222169aba0ffcf994295292693caf41
parents aafa98ae a95d3af4
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -866,7 +866,7 @@ public class Face10 implements IHwBinder.DeathRecipient, ServiceProvider {
    private void scheduleUpdateActiveUserWithoutHandler(int targetUserId) {
    private void scheduleUpdateActiveUserWithoutHandler(int targetUserId) {
        final boolean hasEnrolled = !getEnrolledFaces(mSensorId, targetUserId).isEmpty();
        final boolean hasEnrolled = !getEnrolledFaces(mSensorId, targetUserId).isEmpty();
        final FaceUpdateActiveUserClient client = new FaceUpdateActiveUserClient(mContext,
        final FaceUpdateActiveUserClient client = new FaceUpdateActiveUserClient(mContext,
                mLazyDaemon, targetUserId, mContext.getOpPackageName(), mSensorId, mCurrentUserId,
                mLazyDaemon, targetUserId, mContext.getOpPackageName(), mSensorId,
                hasEnrolled, mAuthenticatorIds);
                hasEnrolled, mAuthenticatorIds);
        mScheduler.scheduleClientMonitor(client, new BaseClientMonitor.Callback() {
        mScheduler.scheduleClientMonitor(client, new BaseClientMonitor.Callback() {
            @Override
            @Override
+7 −19
Original line number Original line 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 TAG = "FaceUpdateActiveUserClient";
    private static final String FACE_DATA_DIR = "facedata";
    private static final String FACE_DATA_DIR = "facedata";


    private final int mCurrentUserId;
    private final boolean mHasEnrolledBiometrics;
    private final boolean mHasEnrolledBiometrics;
    @NonNull private final Map<Integer, Long> mAuthenticatorIds;
    @NonNull private final Map<Integer, Long> mAuthenticatorIds;


    FaceUpdateActiveUserClient(@NonNull Context context,
    FaceUpdateActiveUserClient(@NonNull Context context,
            @NonNull LazyDaemon<IBiometricsFace> lazyDaemon, int userId, @NonNull String owner,
            @NonNull LazyDaemon<IBiometricsFace> lazyDaemon, int userId, @NonNull String owner,
            int sensorId, int currentUserId, boolean hasEnrolledBIometrics,
            int sensorId, boolean hasEnrolledBiometrics,
            @NonNull Map<Integer, Long> authenticatorIds) {
            @NonNull Map<Integer, Long> authenticatorIds) {
        super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
        super(context, lazyDaemon, null /* token */, null /* listener */, userId, owner,
                0 /* cookie */, sensorId, BiometricsProtoEnums.MODALITY_UNKNOWN,
                0 /* cookie */, sensorId, BiometricsProtoEnums.MODALITY_UNKNOWN,
                BiometricsProtoEnums.ACTION_UNKNOWN, BiometricsProtoEnums.CLIENT_UNKNOWN);
                BiometricsProtoEnums.ACTION_UNKNOWN, BiometricsProtoEnums.CLIENT_UNKNOWN);
        mCurrentUserId = currentUserId;
        mHasEnrolledBiometrics = hasEnrolledBiometrics;
        mHasEnrolledBiometrics = hasEnrolledBIometrics;
        mAuthenticatorIds = authenticatorIds;
        mAuthenticatorIds = authenticatorIds;
    }
    }


    @Override
    @Override
    public void start(@NonNull Callback callback) {
    public void start(@NonNull Callback callback) {
        super.start(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();
        startHalOperation();
    }
    }


@@ -85,7 +70,10 @@ public class FaceUpdateActiveUserClient extends HalClientMonitor<IBiometricsFace
        }
        }


        try {
        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 */);
            mCallback.onClientFinished(this, true /* success */);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Slog.e(TAG, "Failed to setActiveUser: " + e);
            Slog.e(TAG, "Failed to setActiveUser: " + e);