Update remove face enrollment strings for convenience.

Fix: 209877102
Test: manual (enroll & delete)
Change-Id: Idb3a8d3622574edc47673e8fe6a72a5b9d449c7b
This commit is contained in:
Joe Bolinger
2021-12-09 19:21:44 +00:00
parent e8d9c1e1d3
commit 493e889dd6
3 changed files with 29 additions and 6 deletions

View File

@@ -871,11 +871,9 @@
<!-- Dialog title shown when the user removes an enrollment [CHAR LIMIT=35] -->
<string name="security_settings_face_settings_remove_dialog_title">Delete face model?</string>
<!-- Dialog contents shown when the user removes an enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_dialog_details">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.</string>
<!-- Dialog title shown when the user chooses to delete an existing enrolled face model. [CHAR LIMIT=35] -->
<string name="security_settings_face_settings_remove_model_dialog_title">Delete face model?</string>
<!-- Dialog contents shown when the user chooses to delete an existing enrolled face model. [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_model_dialog_details">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.</string>
<string name="security_settings_face_settings_remove_dialog_details">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.</string>
<!-- Dialog contents shown when the user removes an enrollment when configured as a convenience [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_remove_dialog_details_convenience">Your face model will be permanently and securely deleted.\n\nAfter deletion, you will need your PIN, pattern, or password to unlock your phone.</string>
<!-- Subtitle shown for contextual setting face enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_face_settings_context_subtitle">Use Face Unlock to unlock your phone</string>

View File

@@ -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;
}
}

View File

@@ -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());
}
}