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

Commit 624bfe12 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

21/n: Clean up ClientMonitor parameters

Bug: 157790417

Test: Builds
Change-Id: Ie5dcef72f623dd0efe1764af826c29a9d706e6c8
parent dbe67876
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -48,11 +48,11 @@ public abstract class AcquisitionClient<T> extends ClientMonitor<T>
    private final VibrationEffect mErrorVibrationEffect;

    AcquisitionClient(@NonNull Context context, @NonNull IBinder token,
            @NonNull ClientMonitorCallbackConverter listener, int userId, boolean restricted,
            @NonNull ClientMonitorCallbackConverter listener, int userId,
            @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);
        super(context, token, listener, userId, owner, cookie, sensorId, statsModality, statsAction,
                statsClient);
        mPowerManager = context.getSystemService(PowerManager.class);
        mSuccessVibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
        mErrorVibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK);
+9 −8
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> {
    private final IActivityTaskManager mActivityTaskManager;
    private final TaskStackListener mTaskStackListener;
    private final LockoutTracker mLockoutTracker;
    private final boolean mIsRestricted;

    protected final long mOperationId;

@@ -51,13 +52,12 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> {

    protected boolean mAuthAttempted;

    public AuthenticationClient(@NonNull Context context,
            @NonNull IBinder token, @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,
    public AuthenticationClient(@NonNull Context context, @NonNull IBinder token,
            @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, owner, cookie, sensorId,
                statsModality, BiometricsProtoEnums.ACTION_AUTHENTICATE, statsClient);
        mIsStrongBiometric = isStrongBiometric;
        mOperationId = operationId;
@@ -65,6 +65,7 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> {
        mActivityTaskManager = ActivityTaskManager.getService();
        mTaskStackListener = taskStackListener;
        mLockoutTracker = lockoutTracker;
        mIsRestricted = restricted;
    }

    public @LockoutTracker.LockoutMode int handleFailedAttempt(int userId) {
@@ -147,7 +148,7 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> {

                    // Explicitly have if/else here to make it super obvious in case the code is
                    // touched in the future.
                    if (!getIsRestricted()) {
                    if (!mIsRestricted) {
                        listener.onAuthenticationSucceeded(getSensorId(), identifier, byteToken,
                                getTargetUserId(), mIsStrongBiometric);
                    } else {
+2 −11
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ public abstract class ClientMonitor<T> extends LoggableMonitor implements IBinde

    @NonNull private final Context mContext;
    private final int mTargetUserId;
    // True if client does not have MANAGE_FINGERPRINT permission
    private final boolean mIsRestricted;
    @NonNull private final String mOwner;
    private final int mSensorId; // sensorId as configured by the framework

@@ -73,8 +71,6 @@ public abstract class ClientMonitor<T> extends LoggableMonitor implements IBinde
     * @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 restricted whether or not client has the MANAGE_* permission
     *                   permission
     * @param owner      name of the client that owns this
     * @param cookie     BiometricPrompt authentication cookie (to be moved into a subclass soon)
     * @param sensorId   ID of the sensor that the operation should be requested of
@@ -83,15 +79,14 @@ public abstract class ClientMonitor<T> extends LoggableMonitor implements IBinde
     * @param statsClient   One of {@link BiometricsProtoEnums} CLIENT_* constants
     */
    public ClientMonitor(@NonNull Context context, @Nullable IBinder token,
            @Nullable ClientMonitorCallbackConverter listener, int userId, boolean restricted,
            @NonNull String owner, int cookie, int sensorId, int statsModality, int statsAction,
            @Nullable ClientMonitorCallbackConverter listener, int userId, @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;
        mIsRestricted = restricted;
        mOwner = owner;
        mCookie = cookie;
        mSensorId = sensorId;
@@ -184,10 +179,6 @@ public abstract class ClientMonitor<T> extends LoggableMonitor implements IBinde
        return mListener;
    }

    public final boolean getIsRestricted() {
        return mIsRestricted;
    }

    public final int getTargetUserId() {
        return mTargetUserId;
    }
+4 −5
Original line number Diff line number Diff line
@@ -43,12 +43,11 @@ public abstract class EnrollClient<T> extends AcquisitionClient<T> {

    public EnrollClient(@NonNull Context context, @NonNull IBinder token,
            @NonNull ClientMonitorCallbackConverter listener, int userId,
            @NonNull byte[] hardwareAuthToken, boolean restricted, String owner,
            @NonNull BiometricUtils utils, int timeoutSec, int statsModality, int sensorId,
            @NonNull byte[] hardwareAuthToken, @NonNull String owner, @NonNull BiometricUtils utils,
            int timeoutSec, int statsModality, int sensorId,
            boolean shouldVibrate) {
        super(context, token, listener, userId, restricted, owner, 0 /* cookie */,
                sensorId, statsModality, BiometricsProtoEnums.ACTION_ENROLL,
                BiometricsProtoEnums.CLIENT_UNKNOWN);
        super(context, token, listener, userId, owner, 0 /* cookie */, sensorId, statsModality,
                BiometricsProtoEnums.ACTION_ENROLL, BiometricsProtoEnums.CLIENT_UNKNOWN);
        mBiometricUtils = utils;
        mHardwareAuthToken = Arrays.copyOf(hardwareAuthToken, hardwareAuthToken.length);
        mTimeoutSec = timeoutSec;
+3 −3
Original line number Diff line number Diff line
@@ -31,9 +31,9 @@ public abstract class GenerateChallengeClient<T> extends ClientMonitor<T> {

    public GenerateChallengeClient(Context context, IBinder token,
            ClientMonitorCallbackConverter listener, String owner, int sensorId) {
        super(context, token, listener, 0 /* userId */, false /* restricted */,
                owner, 0 /* cookie */, sensorId, BiometricsProtoEnums.MODALITY_UNKNOWN,
                BiometricsProtoEnums.ACTION_UNKNOWN, BiometricsProtoEnums.CLIENT_UNKNOWN);
        super(context, token, listener, 0 /* userId */, owner, 0 /* cookie */, sensorId,
                BiometricsProtoEnums.MODALITY_UNKNOWN, BiometricsProtoEnums.ACTION_UNKNOWN,
                BiometricsProtoEnums.CLIENT_UNKNOWN);
    }

    @Override
Loading