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

Commit 1cda0a84 authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Android (Google) Code Review
Browse files

Merge "Revert^2 "Implement SFPS “require screen on to auth”""

parents 9f10021c 73bf45ee
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -55,13 +55,17 @@
                    android:src="@drawable/sfps_enroll_finish" />
            </com.google.android.setupdesign.view.FillContentLayout>

            <!-- Added to align elements with fingerprint_enroll_enrolling_base -->
            <TextView
                style="@style/TextAppearance.ErrorText"
            <Space
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1" />

            <com.android.settings.biometrics.fingerprint.FingerprintRequireScreenOnToAuthToggle
                style="@style/SudSwitchStyle"
                android:id="@+id/require_screen_on_to_auth_toggle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|bottom"
                android:visibility="invisible" />
                android:layout_gravity="center_horizontal|bottom" />

        </LinearLayout>

+79 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2022 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.
  -->

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    style="?attr/fingerprint_layout_theme">

    <!-- Top divider -->
    <View
        android:layout_alignParentTop="true"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="?android:attr/listDivider" />

    <!-- Title -->
    <com.google.android.setupdesign.view.RichTextView
        android:id="@+id/title"
        android:paddingHorizontal="8dp"
        android:paddingTop="8dp"
        android:paddingBottom="4dp"
        android:gravity="start"
        android:layout_alignParentStart="true"
        android:layout_toStartOf="@+id/toggle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/security_settings_require_screen_on_to_auth_title"
        android:textColor="?android:attr/textColorPrimary"
        android:textSize="@dimen/sud_description_text_size"
    />

    <!-- Subtitle -->
    <TextView
        android:id="@+id/subtitle"
        android:paddingHorizontal="8dp"
        android:paddingBottom="8dp"
        android:layout_alignParentStart="true"
        android:layout_toStartOf="@+id/toggle"
        android:layout_below="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/security_settings_require_screen_on_to_auth_description"
        android:textColor="?android:attr/textColorSecondary"/>

    <!-- Vertical divider -->
    <View
        android:layout_centerVertical="true"
        android:layout_alignTop="@+id/toggle"
        android:layout_alignBottom="@+id/toggle"
        android:layout_toStartOf="@+id/toggle"
        android:layout_width="1dp"
        android:layout_height="wrap_content"
        android:background="?android:attr/listDivider" />

    <!-- Toggle -->
    <Switch
        android:layout_alignParentEnd="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/toggle"
        android:layout_centerVertical="true"
        android:checked="false"/>

</RelativeLayout>
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -783,6 +783,8 @@
    <!-- Note: Update FingerprintEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
    <!-- Title shown for menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] -->
    <string name="security_settings_fingerprint_preference_title">Fingerprint</string>
    <!-- Title for a category shown for the fingerprint settings page, followed by items that the user can toggle on/off to require/disable. [CHAR LIMIT=50] -->
    <string name="security_settings_fingerprint_settings_preferences_category">When using Fingerprint Unlock</string>
    <!-- Title shown for work menu item that launches fingerprint settings or enrollment [CHAR LIMIT=22] -->
    <string name="security_settings_work_fingerprint_preference_title">Fingerprint for work</string>
    <!-- Preference to add another fingerprint -->
@@ -1036,6 +1038,12 @@
    <string name="security_settings_fingerprint_enroll_finish_v2_message" product="device">Now you can use your fingerprint to unlock your device or verify it\u2019s you, like when you sign in to apps</string>
    <!-- Message shown in fingerprint enrollment dialog once enrollment is completed (default) [CHAR LIMIT=NONE] -->
    <string name="security_settings_fingerprint_enroll_finish_v2_message" product="default">Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps</string>
    <!-- Title for require screen on to auth toggle shown in fingerprint enrollment dialog once enrollment is completed. [CHAR LIMIT=NONE] -->
    <string name="security_settings_require_screen_on_to_auth_title">Unlock only when screen is on</string>
    <!-- Description for require screen on to auth toggle shown in fingerprint enrollment dialog once enrollment is completed. [CHAR LIMIT=NONE] -->
    <string name="security_settings_require_screen_on_to_auth_description">The screen must be on before you can unlock with your fingerprint. This makes accidental unlocking less likely.</string>
    <!-- Description for require screen on to auth toggle shown in fingerprint enrollment dialog once enrollment is completed. [CHAR LIMIT=NONE] -->
    <string name="security_settings_require_screen_on_to_auth_keywords">Screen, Unlock</string>
    <!-- Button text to skip enrollment of fingerprint [CHAR LIMIT=40] -->
    <string name="security_settings_fingerprint_enroll_enrolling_skip">Do it later</string>
    <!-- Accessibility message for fingerprint enrollment asking the user to place the tip of their finger on the fingerprint sensor [CHAR LIMIT=NONE] -->
+16 −1
Original line number Diff line number Diff line
@@ -16,5 +16,20 @@

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:title="@string/security_settings_fingerprint_preference_title"/>
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/security_settings_fingerprint_preference_title">

    <PreferenceCategory
        android:key="security_settings_fingerprint_unlock_category"
        android:title="@string/security_settings_fingerprint_settings_preferences_category"
        settings:controller="com.android.settings.biometrics.fingerprint.FingerprintUnlockCategoryPreferenceController">

        <com.android.settingslib.RestrictedSwitchPreference
            android:key="security_settings_require_screen_on_to_auth"
            android:title="@string/security_settings_require_screen_on_to_auth_title"
            android:summary="@string/security_settings_require_screen_on_to_auth_description"
            settings:keywords="@string/security_settings_require_screen_on_to_auth_keywords"
            settings:controller="com.android.settings.biometrics.fingerprint.FingerprintSettingsRequireScreenOnToAuthPreferenceController" />
    </PreferenceCategory>

</PreferenceScreen>
+34 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.CompoundButton;

import androidx.annotation.VisibleForTesting;

@@ -44,16 +45,24 @@ import java.util.List;
public class FingerprintEnrollFinish extends BiometricEnrollBase {

    private static final String TAG = "FingerprintEnrollFinish";
    private static final String KEY_REQUIRE_SCREEN_ON_TO_AUTH = "require_screen_on_to_auth_toggle";
    private static final String ACTION_FINGERPRINT_SETTINGS =
            "android.settings.FINGERPRINT_SETTINGS";
    @VisibleForTesting
    static final String FINGERPRINT_SUGGESTION_ACTIVITY =
            "com.android.settings.SetupFingerprintSuggestionActivity";

    private FingerprintManager mFingerprintManager;

    private FingerprintSettingsRequireScreenOnToAuthPreferenceController
            mRequireScreenOnToAuthPreferenceController;
    private FingerprintRequireScreenOnToAuthToggle mRequireScreenOnToAuthToggle;
    private boolean mCanAssumeSfps;

    private boolean mIsAddAnotherOrFinish;

    private CompoundButton.OnCheckedChangeListener mRequireScreenOnToAuthToggleListener;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -63,6 +72,11 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
        mCanAssumeSfps = props != null && props.size() == 1 && props.get(0).isAnySidefpsType();
        if (mCanAssumeSfps) {
            setContentView(R.layout.sfps_enroll_finish);
            mRequireScreenOnToAuthPreferenceController =
                    new FingerprintSettingsRequireScreenOnToAuthPreferenceController(
                            getApplicationContext(),
                            KEY_REQUIRE_SCREEN_ON_TO_AUTH
                    );
        } else {
            setContentView(R.layout.fingerprint_enroll_finish);
        }
@@ -90,6 +104,20 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
                        .setTheme(R.style.SudGlifButton_Primary)
                        .build()
        );

        if (mCanAssumeSfps) {
            mRequireScreenOnToAuthToggleListener =
                (buttonView, isChecked) -> {
                    mRequireScreenOnToAuthPreferenceController.setChecked(isChecked);
                };
            mRequireScreenOnToAuthToggle = findViewById(R.id.require_screen_on_to_auth_toggle);
            mRequireScreenOnToAuthToggle.setChecked(
            mRequireScreenOnToAuthPreferenceController.isChecked());
            mRequireScreenOnToAuthToggle.setListener(mRequireScreenOnToAuthToggleListener);
            mRequireScreenOnToAuthToggle.setOnClickListener(v -> {
                mRequireScreenOnToAuthToggle.getSwitch().toggle();
            });
        }
    }

    @Override
@@ -103,6 +131,12 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
    @Override
    protected void onResume() {
        super.onResume();
        if (mCanAssumeSfps) {
            mRequireScreenOnToAuthToggleListener.onCheckedChanged(
                    mRequireScreenOnToAuthToggle.getSwitch(),
                    mRequireScreenOnToAuthToggle.isChecked()
            );
        }

        FooterButton addButton = mFooterBarMixin.getSecondaryButton();

Loading