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

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

Merge "Remove sidefps toggle from SUW."

parents 0ed6e65e cfaf707a
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -30,15 +30,6 @@
        android:clipToPadding="false"
        android:clipChildren="false">

            <com.android.settings.biometrics.fingerprint.FingerprintRequireScreenOnToAuthToggle
                style="@style/SudSwitchStyle"
                android:id="@+id/require_screen_on_to_auth_toggle"
                android:layout_gravity="start"
                android:paddingLeft="0dp"
                android:paddingStart="0dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <com.google.android.setupdesign.view.FillContentLayout
                android:layout_width="@dimen/sfps_enrollment_finished_icon_max_size"
                android:layout_height="@dimen/sfps_enrollment_finished_icon_max_size"
+0 −62
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"
    android:layout_gravity="start"
    style="?attr/fingerprint_layout_theme">

    <!-- Title -->
    <com.google.android.setupdesign.view.RichTextView
        android:id="@+id/title"
        android:paddingTop="8dp"
        android:paddingBottom="4dp"
        android:layout_alignParentStart="true"
        android:textAlignment="viewStart"
        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:paddingBottom="8dp"
        android:layout_alignParentStart="true"
        android:textAlignment="viewStart"
        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"/>

    <!-- 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"
        style="@style/SudSwitchStyle"/>

</RelativeLayout>
 No newline at end of file
+0 −33
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ 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;

@@ -45,7 +44,6 @@ 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
@@ -54,15 +52,10 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {

    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);
@@ -72,11 +65,6 @@ 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);
        }
@@ -104,20 +92,6 @@ 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
@@ -131,13 +105,6 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
    @Override
    protected void onResume() {
        super.onResume();
        if (mCanAssumeSfps) {
            mRequireScreenOnToAuthToggleListener.onCheckedChanged(
                    mRequireScreenOnToAuthToggle.getSwitch(),
                    mRequireScreenOnToAuthToggle.isChecked()
            );
        }

        FooterButton addButton = mFooterBarMixin.getSecondaryButton();

        final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this);
+0 −77
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.
 */

package com.android.settings.biometrics.fingerprint;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.Switch;

import com.android.settings.R;

/**
 * A layout that contains a start-justified title, and an end-justified switch.
 */
public class FingerprintRequireScreenOnToAuthToggle extends LinearLayout {
    private Switch mSwitch;

    public FingerprintRequireScreenOnToAuthToggle(Context context) {
        this(context, null /* attrs */);
    }

    public FingerprintRequireScreenOnToAuthToggle(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public FingerprintRequireScreenOnToAuthToggle(
            Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        LayoutInflater.from(context).inflate(R.layout.sfps_require_screen_on_to_auth_toggle,
                this, true /* attachToRoot */);

        mSwitch = findViewById(R.id.toggle);
        mSwitch.setClickable(true);
        mSwitch.setFocusable(false);
    }

    public boolean isChecked() {
        return mSwitch.isChecked();
    }

    /**
     *
     * @param checked
     */
    public void setChecked(boolean checked) {
        mSwitch.setChecked(checked);
    }

    /**
     *
     * @param listener
     */
    public void setListener(CompoundButton.OnCheckedChangeListener listener) {
        mSwitch.setOnCheckedChangeListener(listener);
    }

    public Switch getSwitch() {
        return mSwitch;
    }
}