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

Commit 9c613a48 authored by Joe Bolinger's avatar Joe Bolinger Committed by Automerger Merge Worker
Browse files

Merge "Fix feedback and animations for face to fingerprint fallback...

Merge "Fix feedback and animations for face to fingerprint fallback authentication." into sc-dev am: 896ac3e1

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

Change-Id: Ia43474de4d06c8809543f51d36c7198e445e0d3c
parents 6950c1f3 896ac3e1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ public interface BiometricAuthenticator {
            TYPE_NONE,
            TYPE_CREDENTIAL,
            TYPE_FINGERPRINT,
            TYPE_IRIS
            TYPE_IRIS,
            TYPE_FACE
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface Modality {}
+14 −6
Original line number Diff line number Diff line
@@ -143,17 +143,25 @@ oneway interface IStatusBar

    void showShutdownUi(boolean isReboot, String reason);

    // Used to show the authentication dialog (Biometrics, Device Credential)
    /**
    * Used to show the authentication dialog (Biometrics, Device Credential).
    */
    void showAuthenticationDialog(in PromptInfo promptInfo, IBiometricSysuiReceiver sysuiReceiver,
            in int[] sensorIds, boolean credentialAllowed, boolean requireConfirmation, int userId,
            String opPackageName, long operationId, int multiSensorConfig);
    // Used to notify the authentication dialog that a biometric has been authenticated
    /**
    * Used to notify the authentication dialog that a biometric has been authenticated.
    */
    void onBiometricAuthenticated();
    // Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
    void onBiometricHelp(String message);
    // Used to show an error - the dialog will dismiss after a certain amount of time
    /**
    * Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc.
    */
    void onBiometricHelp(int modality, String message);
    /** Used to show an error - the dialog will dismiss after a certain amount of time. */
    void onBiometricError(int modality, int error, int vendorCode);
    // Used to hide the authentication dialog, e.g. when the application cancels authentication
    /**
    * Used to hide the authentication dialog, e.g. when the application cancels authentication.
    */
    void hideAuthenticationDialog();

    /**
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ interface IStatusBarService
    // Used to notify the authentication dialog that a biometric has been authenticated
    void onBiometricAuthenticated();
    // Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
    void onBiometricHelp(String message);
    void onBiometricHelp(int modality, String message);
    // Used to show an error - the dialog will dismiss after a certain amount of time
    void onBiometricError(int modality, int error, int vendorCode);
    // Used to hide the authentication dialog, e.g. when the application cancels authentication
+16 −4
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRIN
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.BiometricAuthenticator.Modality;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.util.AttributeSet;
import android.util.Log;
@@ -87,9 +87,11 @@ public class AuthBiometricFaceToFingerprintView extends AuthBiometricFaceView {
        }
    }

    @BiometricAuthenticator.Modality private int mActiveSensorType = TYPE_FACE;
    @Modality
    private int mActiveSensorType = TYPE_FACE;

    @Nullable UdfpsDialogMeasureAdapter mUdfpsMeasureAdapter;
    @Nullable
    private UdfpsDialogMeasureAdapter mUdfpsMeasureAdapter;

    public AuthBiometricFaceToFingerprintView(Context context) {
        super(context);
@@ -125,6 +127,16 @@ public class AuthBiometricFaceToFingerprintView extends AuthBiometricFaceView {
        return false;
    }

    @Override
    public void onAuthenticationFailed(
            @Modality int modality, @Nullable String failureReason) {
        if (modality == TYPE_FACE && mActiveSensorType == TYPE_FACE) {
            // switching from face -> fingerprint mode, suppress soft error messages
            failureReason = mContext.getString(R.string.fingerprint_dialog_use_fingerprint_instead);
        }
        super.onAuthenticationFailed(modality, failureReason);
    }

    @Override
    @BiometricState
    protected int getStateForAfterError() {
@@ -155,7 +167,7 @@ public class AuthBiometricFaceToFingerprintView extends AuthBiometricFaceView {
    }

    @Override
    public void updateState(int newState) {
    public void updateState(@BiometricState int newState) {
        if (mState == STATE_HELP || mState == STATE_ERROR) {
            mActiveSensorType = TYPE_FINGERPRINT;

+5 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.hardware.biometrics.BiometricAuthenticator.Modality;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
@@ -29,6 +30,8 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.R;

@@ -206,7 +209,7 @@ public class AuthBiometricFaceView extends AuthBiometricView {
    }

    @Override
    public void onAuthenticationFailed(String failureReason) {
    public void onAuthenticationFailed(@Modality int modality, @Nullable String failureReason) {
        if (getSize() == AuthDialog.SIZE_MEDIUM) {
            if (supportsManualRetry()) {
                mTryAgainButton.setVisibility(View.VISIBLE);
@@ -216,7 +219,7 @@ public class AuthBiometricFaceView extends AuthBiometricView {

        // Do this last since we want to know if the button is being animated (in the case of
        // small -> medium dialog)
        super.onAuthenticationFailed(failureReason);
        super.onAuthenticationFailed(modality, failureReason);
    }

    private void resetErrorView() {
Loading