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

Commit 493e889d authored by Joe Bolinger's avatar Joe Bolinger
Browse files

Update remove face enrollment strings for convenience.

Fix: 209877102
Test: manual (enroll & delete)
Change-Id: Idb3a8d3622574edc47673e8fe6a72a5b9d449c7b
parent e8d9c1e1
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -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>
+16 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+10 −1
Original line number Diff line number Diff line
@@ -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());
        }
    }