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

Commit 15128cf2 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Update Settings to match new mocks

Fixes: 122119972

Test: layout looks good
Change-Id: I259f7e706a6be18edc0e595ff6c3fdccf41b1178
parent 5652550c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -927,10 +927,12 @@
    <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] -->
    <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] -->
    <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] -->
    <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>
+7 −4
Original line number Diff line number Diff line
@@ -47,13 +47,16 @@
        <SwitchPreference
            android:key="security_settings_face_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:controller="com.android.settings.biometrics.face.FaceSettingsAttentionPreferenceController"/>

        <Preference
            android:key="security_settings_face_improve"
            android:title="@string/security_settings_face_settings_improve_face">
        </Preference>
        <SwitchPreference
            android:key="security_settings_face_require_confirmation"
            android:title="@string/security_settings_face_settings_require_confirmation"
            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
            android:key="security_settings_face_delete_faces_container"
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ public class FaceSettings extends DashboardFragment {
        controllers.add(new FaceSettingsAttentionPreferenceController(context));
        controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
        controllers.add(new FaceSettingsFooterPreferenceController(context));
        controllers.add(new FaceSettingsConfirmPreferenceController(context));
        return controllers;
    }

+62 −0
Original line number 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;
    }
}