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

Commit 2482d434 authored by Joe Bolinger's avatar Joe Bolinger
Browse files

Delay invoking biometric prompt.

Fix: 169323687
Test: manual
Change-Id: Iff00caaace97df6da476fd429ebf24bb6b1e14e1
parent ad84b3dd
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ public class BiometricFragment extends InstrumentedFragment {
    private int mUserId;

    // Created/Initialized once and retained
    private PromptInfo mPromptInfo;
    private BiometricPrompt mBiometricPrompt;
    private CancellationSignal mCancellationSignal;

@@ -127,7 +126,7 @@ public class BiometricFragment extends InstrumentedFragment {
        final Bundle bundle = getArguments();
        final PromptInfo promptInfo = bundle.getParcelable(KEY_PROMPT_INFO);

        final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(getContext())
        mBiometricPrompt = new BiometricPrompt.Builder(getContext())
                .setTitle(promptInfo.getTitle())
                .setUseDefaultTitle() // use default title if title is null/empty
                .setDeviceCredentialAllowed(true)
@@ -140,18 +139,23 @@ public class BiometricFragment extends InstrumentedFragment {
                .setConfirmationRequired(promptInfo.isConfirmationRequested())
                .setDisallowBiometricsIfPolicyExists(
                        promptInfo.isDisallowBiometricsIfPolicyExists())
                .setReceiveSystemEvents(true);
                .setReceiveSystemEvents(true)
                .build();
    }

        mBiometricPrompt = builder.build();
        mCancellationSignal = new CancellationSignal();
    @Override
    public void onResume() {
        super.onResume();

        if (mCancellationSignal == null) {
            mCancellationSignal = new CancellationSignal();
            mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor,
                    mAuthenticationCallback, mUserId);
        }
    }

    @Override
    public int getMetricsCategory() {
        return SettingsEnums.BIOMETRIC_FRAGMENT;
    }
}
+0 −11
Original line number Diff line number Diff line
@@ -150,17 +150,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
        }
    };

    private String getStringForError(int errorCode) {
        switch (errorCode) {
            case BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED:
                return getString(com.android.internal.R.string.biometric_error_user_canceled);
            case BiometricConstants.BIOMETRIC_ERROR_CANCELED:
                return getString(com.android.internal.R.string.biometric_error_canceled);
            default:
                return null;
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);