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

Commit f0a0180b authored by Kevin Chyn's avatar Kevin Chyn Committed by Android (Google) Code Review
Browse files

Merge "Update Settings to match new mocks"

parents 45f4f49a 15128cf2
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -927,10 +927,12 @@
    <string name="security_settings_face_settings_require_attention">Eyes open to unlock</string>
    <string name="security_settings_face_settings_require_attention">Eyes open to unlock</string>
    <!-- Text shown on the details of a toggle which disables/enables face authentication, depending if the user's eyes are open. [CHAR LIMIT=70] -->
    <!-- Text shown on the details of a toggle which disables/enables face authentication, depending if the user's eyes are open. [CHAR LIMIT=70] -->
    <string name="security_settings_face_settings_require_attention_details">When using face authentication, your eyes must be open</string>
    <string name="security_settings_face_settings_require_attention_details">When using face authentication, your eyes must be open</string>
    <!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=50] -->
    <string name="security_settings_face_settings_require_confirmation">Always require confirmation</string>
    <!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=70] -->
    <string name="security_settings_face_settings_require_confirmation_details">When authenticating in apps, always require confirmation</string>
    <!-- Button text in face settings which removes the user's faces from the device [CHAR LIMIT=20] -->
    <!-- Button text in face settings which removes the user's faces from the device [CHAR LIMIT=20] -->
    <string name="security_settings_face_settings_remove_face_data">Remove face data</string>
    <string name="security_settings_face_settings_remove_face_data">Remove face data</string>
    <!-- Text shown in face settings allowing the user to update/improve the enrolled face. This brings the user back to the enrollment flow. [CHAR LIMIT=30] -->
    <string name="security_settings_face_settings_improve_face">Improve your face data</string>
    <!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
    <!-- Text shown in face settings explaining what your face can be used for. [CHAR LIMIT=NONE] -->
    <string name="security_settings_face_settings_footer">Your face can be used to unlock your device and access apps.
    <string name="security_settings_face_settings_footer">Your face can be used to unlock your device and access apps.
        <annotation id="url">Learn more</annotation></string>
        <annotation id="url">Learn more</annotation></string>
+7 −4
Original line number Original line Diff line number Diff line
@@ -47,13 +47,16 @@
        <SwitchPreference
        <SwitchPreference
            android:key="security_settings_face_require_attention"
            android:key="security_settings_face_require_attention"
            android:title="@string/security_settings_face_settings_require_attention"
            android:title="@string/security_settings_face_settings_require_attention"
            android:summary="@string/security_settings_face_settings_require_attention_details"
            app:keywords="@string/keywords_face_unlock"
            app:keywords="@string/keywords_face_unlock"
            app:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>
            app:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>


        <Preference
        <SwitchPreference
            android:key="security_settings_face_improve"
            android:key="security_settings_face_require_confirmation"
            android:title="@string/security_settings_face_settings_improve_face">
            android:title="@string/security_settings_face_settings_require_confirmation"
        </Preference>
            android:summary="@string/security_settings_face_settings_require_confirmation_details"
            app:keywords="@string/keywords_face_unlock"
            app:controller="com.android.settings.biometrics.face.FaceSettingsConfirmPreferenceController"/>


        <com.android.settingslib.widget.LayoutPreference
        <com.android.settingslib.widget.LayoutPreference
            android:key="security_settings_face_delete_faces_container"
            android:key="security_settings_face_delete_faces_container"
+1 −0
Original line number Original line Diff line number Diff line
@@ -179,6 +179,7 @@ public class FaceSettings extends DashboardFragment {
        controllers.add(new FaceSettingsAttentionPreferenceController(context));
        controllers.add(new FaceSettingsAttentionPreferenceController(context));
        controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
        controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
        controllers.add(new FaceSettingsFooterPreferenceController(context));
        controllers.add(new FaceSettingsFooterPreferenceController(context));
        controllers.add(new FaceSettingsConfirmPreferenceController(context));
        return controllers;
        return controllers;
    }
    }


+62 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.settings.biometrics.face;

import static android.provider.Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION;

import android.content.Context;
import android.provider.Settings;

import com.android.settings.core.TogglePreferenceController;

/**
 * Preference controller giving the user an option to always require confirmation.
 */
public class FaceSettingsConfirmPreferenceController extends TogglePreferenceController {

    private static final String KEY = "security_settings_face_require_confirmation";

    private static final int ON = 1;
    private static final int OFF = 0;
    private static final int DEFAULT = OFF;

    public FaceSettingsConfirmPreferenceController(Context context) {
        this(context, KEY);
    }

    public FaceSettingsConfirmPreferenceController(Context context,
            String preferenceKey) {
        super(context, preferenceKey);
    }

    @Override
    public boolean isChecked() {
        return Settings.Secure.getInt(mContext.getContentResolver(),
                FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, DEFAULT) == ON;
    }

    @Override
    public boolean setChecked(boolean isChecked) {
        return Settings.Secure.putInt(mContext.getContentResolver(),
                FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION, isChecked ? ON : OFF);
    }

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
    }
}