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

Commit 76ac97aa authored by Oli Thompson's avatar Oli Thompson Committed by Android (Google) Code Review
Browse files

Merge "Add Emergency Button to biometric credential screen" into main

parents 535da070 ad8f13b0
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -465,6 +465,19 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
        }
        // LINT.ThenChange(frameworks/base/core/java/android/hardware/biometrics/PromptInfo.java)

        /**
         * Set if emergency call button should show, for example if biometrics are
         * required to access the dialer app
         * @param showEmergencyCallButton if true, shows emergency call button
         * @return This builder.
         * @hide
         */
        @NonNull
        public Builder setShowEmergencyCallButton(boolean showEmergencyCallButton) {
            mPromptInfo.setShowEmergencyCallButton(showEmergencyCallButton);
            return this;
        }

        /**
         * Creates a {@link BiometricPrompt}.
         *
+11 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ public class PromptInfo implements Parcelable {
    private boolean mAllowBackgroundAuthentication;
    private boolean mIgnoreEnrollmentState;
    private boolean mIsForLegacyFingerprintManager = false;
    private boolean mShowEmergencyCallButton = false;

    public PromptInfo() {

@@ -72,6 +73,7 @@ public class PromptInfo implements Parcelable {
        mAllowBackgroundAuthentication = in.readBoolean();
        mIgnoreEnrollmentState = in.readBoolean();
        mIsForLegacyFingerprintManager = in.readBoolean();
        mShowEmergencyCallButton = in.readBoolean();
    }

    public static final Creator<PromptInfo> CREATOR = new Creator<PromptInfo>() {
@@ -111,6 +113,7 @@ public class PromptInfo implements Parcelable {
        dest.writeBoolean(mAllowBackgroundAuthentication);
        dest.writeBoolean(mIgnoreEnrollmentState);
        dest.writeBoolean(mIsForLegacyFingerprintManager);
        dest.writeBoolean(mShowEmergencyCallButton);
    }

    // LINT.IfChange
@@ -228,6 +231,10 @@ public class PromptInfo implements Parcelable {
        mAllowedSensorIds.add(sensorId);
    }

    public void setShowEmergencyCallButton(boolean showEmergencyCallButton) {
        mShowEmergencyCallButton = showEmergencyCallButton;
    }

    // Getters

    public CharSequence getTitle() {
@@ -309,4 +316,8 @@ public class PromptInfo implements Parcelable {
    public boolean isForLegacyFingerprintManager() {
        return mIsForLegacyFingerprintManager;
    }

    public boolean isShowEmergencyCallButton() {
        return mShowEmergencyCallButton;
    }
}
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 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.
  -->
<inset xmlns:android="http://schemas.android.com/apk/res/android">
    <shape android:shape="rectangle">
        <corners android:radius="25dp"/>
        <solid android:color="@android:color/system_accent3_100" />
    </shape>
</inset>
+34 −17
Original line number Diff line number Diff line
@@ -61,10 +61,16 @@

    </RelativeLayout>

    <LinearLayout
    <FrameLayout
        android:id="@+id/auth_credential_input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|top"
            android:orientation="vertical">

            <ImeAwareEditText
@@ -72,7 +78,7 @@
                style="?passwordTextAppearance"
                android:layout_width="208dp"
                android:layout_height="wrap_content"
            android:layout_gravity="center"
                android:layout_gravity="center_horizontal"
                android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
                android:inputType="textPassword"
                android:minHeight="48dp"/>
@@ -80,10 +86,21 @@
            <TextView
                android:id="@+id/error"
                style="?errorTextAppearance"
            android:layout_gravity="center"
                android:layout_gravity="center_horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>

        </LinearLayout>

        <Button
            android:id="@+id/emergencyCallButton"
            style="@style/AuthCredentialEmergencyButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:layout_gravity="center_horizontal|bottom"
            android:layout_marginTop="12dp"
            android:layout_marginBottom="12dp"
            android:text="@string/work_challenge_emergency_button_text"/>
    </FrameLayout>

</com.android.systemui.biometrics.ui.CredentialPasswordView>
 No newline at end of file
+31 −14
Original line number Diff line number Diff line
@@ -60,27 +60,44 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <TextView
            android:id="@+id/error"
            style="?errorTextAppearanceLand"
            android:layout_below="@id/description"
            android:layout_alignParentLeft="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

    </RelativeLayout>

    <FrameLayout
    <RelativeLayout
        android:layout_weight="1"
        style="?containerStyle"
        android:layout_width="0dp"
        android:layout_height="match_parent">

        <FrameLayout
            style="?containerStyle"
            android:layout_above="@id/emergencyCallButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.android.internal.widget.LockPatternView
                android:id="@+id/lockPattern"
                android:layout_gravity="center"
                android:layout_width="@dimen/biometric_auth_pattern_view_size"
                android:layout_height="@dimen/biometric_auth_pattern_view_size"/>
        </FrameLayout>

        <TextView
            android:id="@+id/error"
            style="?errorTextAppearance"
            android:layout_width="match_parent"
        <Button
            android:id="@+id/emergencyCallButton"
            style="@style/AuthCredentialEmergencyButtonStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|bottom"/>

    </FrameLayout>
            android:layout_marginBottom="35dp"
            android:visibility="gone"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:text="@string/work_challenge_emergency_button_text"/>
    </RelativeLayout>

</com.android.systemui.biometrics.ui.CredentialPatternView>
 No newline at end of file
Loading