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

Commit 573a59f8 authored by Diya Bera's avatar Diya Bera Committed by Automerger Merge Worker
Browse files
parents ae5e86f2 565ce9ea
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -1031,13 +1031,21 @@
    <!-- Dialog message for dialog which shows when user touches the icon on the screen, instead of the sensor at the back [CHAR LIMIT=NONE] -->
    <!-- Dialog message for dialog which shows when user touches the icon on the screen, instead of the sensor at the back [CHAR LIMIT=NONE] -->
    <string name="security_settings_fingerprint_enroll_touch_dialog_message">Touch the sensor on the back of your phone. Use your index finger.</string>
    <string name="security_settings_fingerprint_enroll_touch_dialog_message">Touch the sensor on the back of your phone. Use your index finger.</string>
    <!-- Dialog message for dialog which shows when finger cannot be processed in enrollment. [CHAR LIMIT=45] -->
    <!-- Dialog message for dialog which shows when finger cannot be processed in enrollment. [CHAR LIMIT=45] -->
    <string name="security_settings_fingerprint_enroll_error_unable_to_process_dialog_title">Enrollment was not completed</string>
    <string name="security_settings_fingerprint_enroll_error_unable_to_process_dialog_title">Can\u2019t complete fingerprint setup</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled because the HAL is unable to process it (SUW). -->
    <string name="security_settings_fingerprint_enroll_error_unable_to_process_message_setup">You can try again now or set up your fingerprint later in Settings.</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled because the HAL is unable to process it. -->
    <string name="security_settings_fingerprint_enroll_error_unable_to_process_message">You can try again now or set up your fingerprint later.</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled. [CHAR LIMIT=45] -->
    <!-- Dialog message for dialog which shows when finger cannot be enrolled. [CHAR LIMIT=45] -->
    <string name="security_settings_fingerprint_enroll_error_dialog_title">Fingerprint setup timed out</string>
    <string name="security_settings_fingerprint_enroll_error_dialog_title">Fingerprint setup timed out</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled due to being idle too long (SUW). -->
    <string name="security_settings_fingerprint_enroll_error_timeout_dialog_message_setup">You can set up your fingerprint later in Settings.</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled due to an internal error or fingerprint can't be read (SUW). -->
    <string name="security_settings_fingerprint_enroll_error_generic_dialog_message_setup">Something went wrong. You can set up your fingerprint later in Settings.</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled due to being idle too long. -->
    <!-- Dialog message for dialog which shows when finger cannot be enrolled due to being idle too long. -->
    <string name="security_settings_fingerprint_enroll_error_timeout_dialog_message">You can set up your fingerprint later in Settings.</string>
    <string name="security_settings_fingerprint_enroll_error_timeout_dialog_message">You can set up your fingerprint later.</string>
    <!-- Dialog message for dialog which shows when finger cannot be enrolled due to an internal error or fingerprint can't be read. -->
    <!-- Dialog message for dialog which shows when finger cannot be enrolled due to an internal error or fingerprint can't be read. -->
    <string name="security_settings_fingerprint_enroll_error_generic_dialog_message">Fingerprint enrollment didn\'t work. Try again or use a different finger.</string>
    <string name="security_settings_fingerprint_enroll_error_generic_dialog_message">Something went wrong. You can set up your fingerprint later.</string>
    <!-- Button text shown at the end of enrollment that allows the user to add another fingerprint -->
    <!-- Button text shown at the end of enrollment that allows the user to add another fingerprint -->
    <string name="fingerprint_enroll_button_add">Add another</string>
    <string name="fingerprint_enroll_button_add">Add another</string>
    <!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
    <!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
+2 −1
Original line number Original line Diff line number Diff line
@@ -511,7 +511,8 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
        // showErrorDialog() will cause onWindowFocusChanged(false), set mIsCanceled to false
        // showErrorDialog() will cause onWindowFocusChanged(false), set mIsCanceled to false
        // before showErrorDialog() to prevent that another error dialog is triggered again.
        // before showErrorDialog() to prevent that another error dialog is triggered again.
        mIsCanceled = true;
        mIsCanceled = true;
        FingerprintErrorDialog.showErrorDialog(this, errorMsgId);
        FingerprintErrorDialog.showErrorDialog(this, errorMsgId,
                this instanceof SetupFingerprintEnrollEnrolling);
        cancelEnrollment();
        cancelEnrollment();
        stopIconAnimation();
        stopIconAnimation();
        stopListenOrientationEvent();
        stopListenOrientationEvent();
+2 −1
Original line number Original line Diff line number Diff line
@@ -329,7 +329,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
        if (mNextClicked && errMsgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
        if (mNextClicked && errMsgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
            proceedToEnrolling(false /* cancelEnrollment */);
            proceedToEnrolling(false /* cancelEnrollment */);
        } else {
        } else {
            FingerprintErrorDialog.showErrorDialog(this, errMsgId);
            FingerprintErrorDialog.showErrorDialog(this, errMsgId,
                    this instanceof SetupFingerprintEnrollFindSensor);
        }
        }
    }
    }


+61 −5
Original line number Original line Diff line number Diff line
@@ -18,11 +18,14 @@ package com.android.settings.biometrics.fingerprint;


import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_FINISHED;
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_FINISHED;
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_TIMEOUT;
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_TIMEOUT;
import static com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling.KEY_STATE_CANCELED;


import android.app.Activity;
import android.app.Activity;
import android.app.Dialog;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricFingerprintConstants;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.Bundle;


@@ -48,6 +51,8 @@ public class FingerprintErrorDialog extends InstrumentedDialogFragment {
        final CharSequence errorTitle = getArguments().getCharSequence(KEY_ERROR_TITLE);
        final CharSequence errorTitle = getArguments().getCharSequence(KEY_ERROR_TITLE);
        final int errMsgId = getArguments().getInt(KEY_ERROR_ID);
        final int errMsgId = getArguments().getInt(KEY_ERROR_ID);
        final boolean wasTimeout = errMsgId == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT;
        final boolean wasTimeout = errMsgId == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT;
        final boolean showTryAgain = errMsgId
                == BiometricFingerprintConstants.FINGERPRINT_ERROR_UNABLE_TO_PROCESS;


        builder.setTitle(errorTitle)
        builder.setTitle(errorTitle)
                .setMessage(errorString)
                .setMessage(errorString)
@@ -64,12 +69,33 @@ public class FingerprintErrorDialog extends InstrumentedDialogFragment {
                            }
                            }
                            activity.finish();
                            activity.finish();
                        });
                        });

        if (showTryAgain) {
            builder.setPositiveButton(
                    R.string.security_settings_fingerprint_enroll_dialog_try_again,
                    (dialog, which) -> {
                        dialog.dismiss();
                        final Activity activity = getActivity();
                        final Intent intent = activity.getIntent();
                        intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
                        intent.putExtra(KEY_STATE_CANCELED, false);
                        activity.startActivity(intent);
                        activity.finish();
                    })
                    .setNegativeButton(R.string.security_settings_fingerprint_enroll_dialog_ok,
                            (dialog, which) -> {
                                dialog.dismiss();
                                final Activity activity = getActivity();
                                activity.setResult(RESULT_FINISHED);
                                activity.finish();
                            });
        }
        final AlertDialog dialog = builder.create();
        final AlertDialog dialog = builder.create();
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCanceledOnTouchOutside(false);
        return dialog;
        return dialog;
    }
    }


    public static void showErrorDialog(BiometricEnrollBase host, int errMsgId) {
    public static void showErrorDialog(BiometricEnrollBase host, int errMsgId, boolean isSetup) {
        if (host.isFinishing()) {
        if (host.isFinishing()) {
            return;
            return;
        }
        }
@@ -77,12 +103,39 @@ public class FingerprintErrorDialog extends InstrumentedDialogFragment {
        if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
        if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
            return;
            return;
        }
        }
        CharSequence errMsg = host.getText(getErrorMessage(errMsgId));
        CharSequence errMsg;
        if (isSetup) {
            errMsg = host.getText(getSetupErrorMessage(errMsgId));
        } else {
            errMsg = host.getText(getErrorMessage(errMsgId));
        }
        final CharSequence errTitle = host.getText(getErrorTitle(errMsgId));
        final CharSequence errTitle = host.getText(getErrorTitle(errMsgId));
        final FingerprintErrorDialog dialog = newInstance(errMsg, errTitle, errMsgId);
        final FingerprintErrorDialog dialog = newInstance(errMsg, errTitle, errMsgId);
        dialog.show(fragmentManager, FingerprintErrorDialog.class.getName());
        dialog.show(fragmentManager, FingerprintErrorDialog.class.getName());
    }
    }


    /**
     * Gets dialog message as error id inside {@link FingerprintManager}
     */
    public static int getSetupErrorMessage(int errMsgId) {
        switch (errMsgId) {
            case FingerprintManager.FINGERPRINT_ERROR_TIMEOUT:
                // This message happens when the underlying crypto layer decides to revoke
                // the enrollment auth token.
                return R.string
                        .security_settings_fingerprint_enroll_error_timeout_dialog_message_setup;
            case FingerprintManager.FINGERPRINT_ERROR_BAD_CALIBRATION:
                return R.string.security_settings_fingerprint_bad_calibration;
            case FingerprintManager.FINGERPRINT_ERROR_UNABLE_TO_PROCESS:
                return R.string
                        .security_settings_fingerprint_enroll_error_unable_to_process_message_setup;
            default:
                // There's nothing specific to tell the user about. Ask them to try again.
                return R.string
                        .security_settings_fingerprint_enroll_error_generic_dialog_message_setup;
        }
    }

    /**
    /**
     * Gets dialog message as error id inside {@link FingerprintManager}
     * Gets dialog message as error id inside {@link FingerprintManager}
     */
     */
@@ -94,6 +147,9 @@ public class FingerprintErrorDialog extends InstrumentedDialogFragment {
                return R.string.security_settings_fingerprint_enroll_error_timeout_dialog_message;
                return R.string.security_settings_fingerprint_enroll_error_timeout_dialog_message;
            case FingerprintManager.FINGERPRINT_ERROR_BAD_CALIBRATION:
            case FingerprintManager.FINGERPRINT_ERROR_BAD_CALIBRATION:
                return R.string.security_settings_fingerprint_bad_calibration;
                return R.string.security_settings_fingerprint_bad_calibration;
            case FingerprintManager.FINGERPRINT_ERROR_UNABLE_TO_PROCESS:
                return R.string
                        .security_settings_fingerprint_enroll_error_unable_to_process_message;
            default:
            default:
                // There's nothing specific to tell the user about. Ask them to try again.
                // There's nothing specific to tell the user about. Ask them to try again.
                return R.string.security_settings_fingerprint_enroll_error_generic_dialog_message;
                return R.string.security_settings_fingerprint_enroll_error_generic_dialog_message;
@@ -105,11 +161,11 @@ public class FingerprintErrorDialog extends InstrumentedDialogFragment {
     */
     */
    public static int getErrorTitle(int errMsgId) {
    public static int getErrorTitle(int errMsgId) {
        switch (errMsgId) {
        switch (errMsgId) {
            case FingerprintManager.FINGERPRINT_ERROR_UNABLE_TO_PROCESS:
            case FingerprintManager.FINGERPRINT_ERROR_TIMEOUT:
                return R.string.security_settings_fingerprint_enroll_error_dialog_title;
            default:
                return R.string
                return R.string
                        .security_settings_fingerprint_enroll_error_unable_to_process_dialog_title;
                        .security_settings_fingerprint_enroll_error_unable_to_process_dialog_title;
            default:
                return R.string.security_settings_fingerprint_enroll_error_dialog_title;
        }
        }
    }
    }