From 5e71aee4cdc86158ff8ee1ddadc50a34c121cc08 Mon Sep 17 00:00:00 2001 From: Wenhui Yang Date: Mon, 5 Jun 2023 21:58:09 +0000 Subject: [PATCH] Fix face model delete message Add new strings for face model deletion when fingerprint unlock is available. Test: Manual - test on devices and observe the error message is correct. Fixes: 283122570 Change-Id: I0511e58d030b8b63391d8406bfc0447fe33fa9fc --- res/values/strings.xml | 4 ++++ ...tingsRemoveButtonPreferenceController.java | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index c0917ffcefd..bec0448020b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -746,6 +746,10 @@ Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps. Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone. + + Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone or for authentication in apps. + + Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your fingerprint, PIN, pattern, or password to unlock your phone. Use Face Unlock to unlock your phone diff --git a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java index 7db59584899..1e74ad7c822 100644 --- a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java +++ b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java @@ -21,6 +21,7 @@ import android.app.Dialog; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.DialogInterface; +import android.content.pm.PackageManager; import android.hardware.face.Face; import android.hardware.face.FaceManager; import android.os.Bundle; @@ -69,10 +70,22 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final PackageManager pm = getContext().getPackageManager(); + final boolean hasFingerprint = pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT); + final int dialogMessageRes; + + if (hasFingerprint) { + dialogMessageRes = mIsConvenience + ? R.string.security_settings_face_remove_dialog_details_fingerprint_conv + : R.string.security_settings_face_remove_dialog_details_fingerprint; + } else { + dialogMessageRes = mIsConvenience + ? R.string.security_settings_face_settings_remove_dialog_details_convenience + : R.string.security_settings_face_settings_remove_dialog_details; + } + builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title) - .setMessage(mIsConvenience - ? R.string.security_settings_face_settings_remove_dialog_details_convenience - : R.string.security_settings_face_settings_remove_dialog_details) + .setMessage(dialogMessageRes) .setPositiveButton(R.string.delete, mOnClickListener) .setNegativeButton(R.string.cancel, mOnClickListener); AlertDialog dialog = builder.create();