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

Commit 870b4863 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

14/n: Remove the use of groupId

GroupId was never used. FingerprintService#enroll sets groupId to
always be the same as userId. This change removes it from (almost)
everywhere.

We should update BiometricUtils and subclasses so that new HIDLs
do not take space for groupId. Since the framework persists the
info and we do not want to deal with database migration, let's
leave it there until the devices which shipped with groupId are
EOL.

Bug: 157790417

Test: Enroll fingerprints with a build before this change. Update
      to a build with this change - still able to authenticate, rename,
      remove previously enrolled fingerprints
Change-Id: I21391f5ffb71b27d7f9d4cfd4e6253b6001276dc
parent c0191004
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        if (mService != null) try {
            mRemovalCallback = callback;
            mRemovalFingerprint = fp;
            mService.remove(mToken, fp.getBiometricId(), fp.getGroupId(), userId, mServiceReceiver,
            mService.remove(mToken, fp.getBiometricId(), userId, mServiceReceiver,
                    mContext.getOpPackageName());
        } catch (RemoteException e) {
            Slog.w(TAG, "Remote exception in remove: ", e);
@@ -779,12 +779,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
            Slog.w(TAG, "Finger id didn't match: " + fingerId + " != " + reqFingerId);
            return;
        }
        int groupId = fingerprint.getGroupId();
        int reqGroupId = mRemovalFingerprint.getGroupId();
        if (groupId != reqGroupId) {
            Slog.w(TAG, "Group id didn't match: " + groupId + " != " + reqGroupId);
            return;
        }

        mRemovalCallback.onRemovalSucceeded(fingerprint, remaining);
    }
+2 −2
Original line number Diff line number Diff line
@@ -63,8 +63,8 @@ interface IFingerprintService {
    void cancelEnrollment(IBinder token);

    // Any errors resulting from this call will be returned to the listener
    void remove(IBinder token, int fingerId, int groupId, int userId,
            IFingerprintServiceReceiver receiver, String opPackageName);
    void remove(IBinder token, int fingerId, int userId, IFingerprintServiceReceiver receiver,
            String opPackageName);

    // Rename the fingerprint specified by fingerId and userId to the given name
    void rename(int fingerId, int userId, String name);
+4 −4
Original line number Diff line number Diff line
@@ -47,10 +47,10 @@ public abstract class AcquisitionClient extends ClientMonitor {
    private final VibrationEffect mErrorVibrationEffect;

    AcquisitionClient(@NonNull Context context, @NonNull IBinder token,
            @NonNull ClientMonitorCallbackConverter listener, int userId, int groupId,
            boolean restricted, @NonNull String owner, int cookie, int sensorId, int statsModality,
            int statsAction, int statsClient) {
        super(context, token, listener, userId, groupId, restricted, owner, cookie, sensorId,
            @NonNull ClientMonitorCallbackConverter listener, int userId, boolean restricted,
            @NonNull String owner, int cookie, int sensorId, int statsModality, int statsAction,
            int statsClient) {
        super(context, token, listener, userId, restricted, owner, cookie, sensorId,
                statsModality, statsAction, statsClient);
        mPowerManager = context.getSystemService(PowerManager.class);
        mSuccessVibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
+5 −6
Original line number Diff line number Diff line
@@ -49,12 +49,11 @@ public abstract class AuthenticationClient extends AcquisitionClient {
    private long mStartTimeMs;

    public AuthenticationClient(@NonNull Context context, @NonNull IBinder token,
            @NonNull ClientMonitorCallbackConverter listener, int targetUserId, int groupId,
            long operationId, boolean restricted, @NonNull String owner, int cookie,
            boolean requireConfirmation, int sensorId, boolean isStrongBiometric, int statsModality,
            int statsClient, @NonNull TaskStackListener taskStackListener,
            @NonNull LockoutTracker lockoutTracker) {
        super(context, token, listener, targetUserId, groupId, restricted, owner, cookie, sensorId,
            @NonNull ClientMonitorCallbackConverter listener, int targetUserId, long operationId,
            boolean restricted, @NonNull String owner, int cookie, boolean requireConfirmation,
            int sensorId, boolean isStrongBiometric, int statsModality, int statsClient,
            @NonNull TaskStackListener taskStackListener, @NonNull LockoutTracker lockoutTracker) {
        super(context, token, listener, targetUserId, restricted, owner, cookie, sensorId,
                statsModality, BiometricsProtoEnums.ACTION_AUTHENTICATE, statsClient);
        mIsStrongBiometric = isStrongBiometric;
        mOperationId = operationId;
+3 −10
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ public abstract class ClientMonitor extends LoggableMonitor implements IBinder.D

    private final Context mContext;
    private final int mTargetUserId;
    private final int mGroupId;
    // True if client does not have MANAGE_FINGERPRINT permission
    private final boolean mIsRestricted;
    private final String mOwner;
@@ -59,7 +58,6 @@ public abstract class ClientMonitor extends LoggableMonitor implements IBinder.D
     * @param token      a unique token for the client
     * @param listener   recipient of related events (e.g. authentication)
     * @param userId     target user id for operation
     * @param groupId    groupId for the fingerprint set
     * @param restricted whether or not client has the MANAGE_* permission
     *                   permission
     * @param owner      name of the client that owns this
@@ -70,15 +68,14 @@ public abstract class ClientMonitor extends LoggableMonitor implements IBinder.D
     * @param statsClient   One of {@link BiometricsProtoEnums} CLIENT_* constants
     */
    public ClientMonitor(@NonNull Context context, IBinder token,
            @Nullable ClientMonitorCallbackConverter listener, int userId, int groupId,
            boolean restricted, @NonNull String owner, int cookie, int sensorId, int statsModality,
            int statsAction, int statsClient) {
            @Nullable ClientMonitorCallbackConverter listener, int userId, boolean restricted,
            @NonNull String owner, int cookie, int sensorId, int statsModality, int statsAction,
            int statsClient) {
        super(statsModality, statsAction, statsClient);
        mContext = context;
        mToken = token;
        mListener = listener;
        mTargetUserId = userId;
        mGroupId = groupId;
        mIsRestricted = restricted;
        mOwner = owner;
        mCookie = cookie;
@@ -209,10 +206,6 @@ public abstract class ClientMonitor extends LoggableMonitor implements IBinder.D
        return mTargetUserId;
    }

    public final int getGroupId() {
        return mGroupId;
    }

    public final IBinder getToken() {
        return mToken;
    }
Loading