Merge "Add functionality to restart fp enrollment." into tm-qpr-dev am: 81224f09e3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/18788040 Change-Id: I0188ab24c487cc569645d1b07dbb25c94024df4e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1128,6 +1128,8 @@
|
|||||||
<string name="security_settings_fingerprint_enroll_dialog_name_label">Name</string>
|
<string name="security_settings_fingerprint_enroll_dialog_name_label">Name</string>
|
||||||
<!-- Button text shown in fingerprint dialog that allows the user to rename a fingerprint template [CHAR LIMIT=22] -->
|
<!-- Button text shown in fingerprint dialog that allows the user to rename a fingerprint template [CHAR LIMIT=22] -->
|
||||||
<string name="security_settings_fingerprint_enroll_dialog_ok">OK</string>
|
<string name="security_settings_fingerprint_enroll_dialog_ok">OK</string>
|
||||||
|
<!-- Button text shown in fingerprint dialog that allows the user to try and enroll again[CHAR LIMIT=22] -->
|
||||||
|
<string name="security_settings_fingerprint_enroll_dialog_try_again">Try again</string>
|
||||||
<!-- Button text shown in fingerprint dialog that allows the user to delete the fingerprint template [CHAR LIMIT=22] -->
|
<!-- Button text shown in fingerprint dialog that allows the user to delete the fingerprint template [CHAR LIMIT=22] -->
|
||||||
<string name="security_settings_fingerprint_enroll_dialog_delete">Delete</string>
|
<string name="security_settings_fingerprint_enroll_dialog_delete">Delete</string>
|
||||||
<!-- Title shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=29]-->
|
<!-- Title shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=29]-->
|
||||||
@@ -1284,9 +1286,9 @@
|
|||||||
<!-- 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 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">Enrollment was not completed</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. -->
|
<!-- 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">Fingerprint enrollment time limit reached. Try again.</string>
|
<string name="security_settings_fingerprint_enroll_error_timeout_dialog_message">Try again now or 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. -->
|
<!-- 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">Fingerprint enrollment didn\'t work. Try again or use a different finger.</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 -->
|
||||||
|
@@ -16,20 +16,78 @@
|
|||||||
|
|
||||||
package com.android.settings.biometrics.fingerprint;
|
package com.android.settings.biometrics.fingerprint;
|
||||||
|
|
||||||
|
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_FINISHED;
|
||||||
|
import static com.android.settings.biometrics.BiometricEnrollBase.RESULT_TIMEOUT;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.hardware.biometrics.BiometricConstants;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||||
import com.android.settings.biometrics.BiometricErrorDialog;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
|
|
||||||
|
/** Fingerprint error dialog, will be shown when an error occurs during fingerprint enrollment. */
|
||||||
|
public class FingerprintErrorDialog extends InstrumentedDialogFragment {
|
||||||
|
|
||||||
|
public static final String KEY_ERROR_MSG = "error_msg";
|
||||||
|
public static final String KEY_ERROR_ID = "error_id";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
CharSequence errorString = getArguments().getCharSequence(KEY_ERROR_MSG);
|
||||||
|
final int errMsgId = getArguments().getInt(KEY_ERROR_ID);
|
||||||
|
boolean wasTimeout = errMsgId == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT;
|
||||||
|
|
||||||
|
builder.setTitle(R.string.security_settings_fingerprint_enroll_error_dialog_title)
|
||||||
|
.setMessage(errorString)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(
|
||||||
|
R.string.security_settings_fingerprint_enroll_dialog_ok,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
Activity activity = getActivity();
|
||||||
|
activity.setResult(RESULT_FINISHED);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (wasTimeout) {
|
||||||
|
builder.setPositiveButton(
|
||||||
|
R.string.security_settings_fingerprint_enroll_dialog_try_again,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
getActivity().recreate();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(
|
||||||
|
R.string.security_settings_fingerprint_enroll_dialog_ok,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
Activity activity = getActivity();
|
||||||
|
activity.setResult(RESULT_TIMEOUT);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fingerprint error dialog, will be shown when an error occurs during fingerprint enrollment.
|
|
||||||
*/
|
|
||||||
public class FingerprintErrorDialog extends BiometricErrorDialog {
|
|
||||||
public static void showErrorDialog(BiometricEnrollBase host, int errMsgId) {
|
public static void showErrorDialog(BiometricEnrollBase host, int errMsgId) {
|
||||||
if (host.isFinishing()) {
|
if (host.isFinishing()) {
|
||||||
return;
|
return;
|
||||||
@@ -48,8 +106,8 @@ public class FingerprintErrorDialog extends BiometricErrorDialog {
|
|||||||
private static int getErrorMessage(int errMsgId) {
|
private static int getErrorMessage(int errMsgId) {
|
||||||
switch (errMsgId) {
|
switch (errMsgId) {
|
||||||
case FingerprintManager.FINGERPRINT_ERROR_TIMEOUT:
|
case FingerprintManager.FINGERPRINT_ERROR_TIMEOUT:
|
||||||
// This message happens when the underlying crypto layer decides to revoke the
|
// This message happens when the underlying crypto layer decides to revoke
|
||||||
// enrollment auth token.
|
// the enrollment auth token.
|
||||||
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;
|
||||||
@@ -68,16 +126,6 @@ public class FingerprintErrorDialog extends BiometricErrorDialog {
|
|||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTitleResId() {
|
|
||||||
return R.string.security_settings_fingerprint_enroll_error_dialog_title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOkButtonTextResId() {
|
|
||||||
return R.string.security_settings_fingerprint_enroll_dialog_ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.DIALOG_FINGERPINT_ERROR;
|
return SettingsEnums.DIALOG_FINGERPINT_ERROR;
|
||||||
|
Reference in New Issue
Block a user