Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept fingerprint even after cancel the dialog #8

Open
nikz-dev opened this issue Aug 23, 2018 · 1 comment
Open

Accept fingerprint even after cancel the dialog #8

nikz-dev opened this issue Aug 23, 2018 · 1 comment

Comments

@nikz-dev
Copy link

nikz-dev commented Aug 23, 2018

After click on USE PASSWORD Biometric dialog disappears and show you requested password Toast but accept fingerprint at the same time.
Bug reproduce steps : -
1- click on USE PASSWORD
2- Biometric Dialog disappears
3- Now touch fingerprint senser Its accept fingerprint and show Success Toast.
Tested on Nexus 6P, Android version 8.1.0

@nikz-dev
Copy link
Author

BiometricPromptApi23Impl(
            @NonNull Context context,
            @NonNull CharSequence title,
            @Nullable CharSequence subtitle,
            @Nullable CharSequence description,
            @Nullable CharSequence negativeButtonText,
            @Nullable DialogInterface.OnClickListener negativeButtonListener
    ) {
        this.context = context;
        this.mainHandler = new Handler(context.getMainLooper());
        this.animateHandler = new AnimateHandler(context.getMainLooper());
        this.fingerprintManager = context.getSystemService(FingerprintManager.class);
        this.negativeButtonListener = negativeButtonListener;

        dialog = new BiometricPromptCompatDialog(context);

        dialog.setTitle(title);
        if (subtitle == null) {
            dialog.getSubtitle().setVisibility(View.GONE);
        } else {
            dialog.getSubtitle().setText(subtitle);
        }
        if (description == null) {
            dialog.getDescription().setVisibility(View.GONE);
        } else {
            dialog.getDescription().setText(description);
        }
        if (negativeButtonText == null) {
            dialog.getNegativeButton().setVisibility(View.INVISIBLE);
        } else {
            dialog.getNegativeButton().setText(negativeButtonText);
            if (negativeButtonListener == null) {
                throw new IllegalArgumentException("Negative button listener should not be null.");
            }
            dialog.getNegativeButton().setOnClickListener(v -> {
                shouldNotifyClose = false;
                dialog.dismiss();

                negativeButtonListener.onClick(dialog, DialogInterface.BUTTON_NEGATIVE);
                
                //I think by adding this code we can resolve this issue.
                if (cancellationSignal != null && !cancellationSignal.isCanceled()) {
                    cancellationSignal.cancel();
                }
            });
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant