diff --git a/res/values/strings.xml b/res/values/strings.xml index b566d982523..da5926a2a84 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -871,11 +871,9 @@ Delete face model? - Your face model will be permanently and securely deleted. After deletion, you will need your PIN, pattern, or password to unlock your phone or for authentication in apps. - - Delete face model? - - 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 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. Use Face Unlock to unlock your phone diff --git a/src/com/android/settings/biometrics/BiometricUtils.java b/src/com/android/settings/biometrics/BiometricUtils.java index 7dd63850dee..5ee788095b4 100644 --- a/src/com/android/settings/biometrics/BiometricUtils.java +++ b/src/com/android/settings/biometrics/BiometricUtils.java @@ -22,6 +22,9 @@ import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.IntentSender; +import android.hardware.biometrics.SensorProperties; +import android.hardware.face.FaceManager; +import android.hardware.face.FaceSensorPropertiesInternal; import android.os.storage.StorageManager; import android.util.Log; import android.view.Surface; @@ -273,4 +276,17 @@ public class BiometricUtils { public static boolean isReverseLandscape(@NonNull Context context) { return context.getDisplay().getRotation() == Surface.ROTATION_270; } + + /** + * @param faceManager + * @return True if at least one sensor is set as a convenience. + */ + public static boolean isConvenience(@NonNull FaceManager faceManager) { + for (FaceSensorPropertiesInternal props : faceManager.getSensorPropertiesInternal()) { + if (props.sensorStrength == SensorProperties.STRENGTH_CONVENIENCE) { + return true; + } + } + return false; + } } diff --git a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java index d8ff4822a4e..616b736b8d6 100644 --- a/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java +++ b/src/com/android/settings/biometrics/face/FaceSettingsRemoveButtonPreferenceController.java @@ -33,6 +33,7 @@ import androidx.preference.Preference; import com.android.settings.R; import com.android.settings.SettingsActivity; +import com.android.settings.biometrics.BiometricUtils; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.instrumentation.InstrumentedDialogFragment; import com.android.settings.overlay.FeatureFactory; @@ -56,6 +57,7 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference public static class ConfirmRemoveDialog extends InstrumentedDialogFragment { + private boolean mIsConvenience; private DialogInterface.OnClickListener mOnClickListener; @Override @@ -68,7 +70,9 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.security_settings_face_settings_remove_dialog_title) - .setMessage(R.string.security_settings_face_settings_remove_dialog_details) + .setMessage(mIsConvenience + ? R.string.security_settings_face_settings_remove_dialog_details_convenience + : R.string.security_settings_face_settings_remove_dialog_details) .setPositiveButton(R.string.delete, mOnClickListener) .setNegativeButton(R.string.cancel, mOnClickListener); AlertDialog dialog = builder.create(); @@ -76,6 +80,10 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference return dialog; } + public void setIsConvenience(boolean isConvenience) { + mIsConvenience = isConvenience; + } + public void setOnClickListener(DialogInterface.OnClickListener listener) { mOnClickListener = listener; } @@ -197,6 +205,7 @@ public class FaceSettingsRemoveButtonPreferenceController extends BasePreference mRemoving = true; ConfirmRemoveDialog dialog = new ConfirmRemoveDialog(); dialog.setOnClickListener(mOnClickListener); + dialog.setIsConvenience(BiometricUtils.isConvenience(mFaceManager)); dialog.show(mActivity.getSupportFragmentManager(), ConfirmRemoveDialog.class.getName()); } }