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

Commit aafe0849 authored by Yabin Huang's avatar Yabin Huang
Browse files

Allow to customize BiometricsPromt for automative builds

- Allow to inflate different layouts for credential pin and password
- Use the same layout for credential pin and password so that the
layout stays the same for non-automative builds
- Specify the layout of CredentialPasswordView in its layout file instead of programmatically so that it can be customized easily
- Introduce IPinPad, which will used in automative variation of auth_credential_pin_view

Bug: 276918288
Test: manual
Change-Id: I3aec4081144b51014cdaf1cde70a04c8b2006240
parent 6162ea96
Loading
Loading
Loading
Loading
+101 −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.
  -->

<merge xmlns:android="http://schemas.android.com/apk/res/android">

  <RelativeLayout
    android:id="@+id/auth_credential_header"
    style="?headerStyle"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1">

    <ImageView
        android:id="@+id/icon"
        style="?headerIconStyle"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:contentDescription="@null"/>

    <TextView
        android:id="@+id/title"
        style="?titleTextAppearance"
        android:layout_below="@id/icon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/subtitle"
        style="?subTitleTextAppearance"
        android:layout_below="@id/title"
        android:layout_alignParentLeft="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

  </RelativeLayout>

  <FrameLayout
      android:id="@+id/auth_credential_input"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:orientation="vertical">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical">

      <ImeAwareEditText
          android:id="@+id/lockPassword"
          style="?passwordTextAppearance"
          android:layout_width="208dp"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
          android:inputType="textPassword"
          android:minHeight="48dp"/>

      <TextView
          android:id="@+id/error"
          style="?errorTextAppearance"
          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>

</merge>
+1 −79
Original line number Diff line number Diff line
@@ -23,84 +23,6 @@
    android:elevation="@dimen/biometric_dialog_elevation"
    android:theme="?app:attr/lockPinPasswordStyle">

    <RelativeLayout
        android:id="@+id/auth_credential_header"
        style="?headerStyle"
        android:layout_width="wrap_content"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/icon"
            style="?headerIconStyle"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:contentDescription="@null"/>

        <TextView
            android:id="@+id/title"
            style="?titleTextAppearance"
            android:layout_below="@id/icon"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <TextView
            android:id="@+id/subtitle"
            style="?subTitleTextAppearance"
            android:layout_below="@id/title"
            android:layout_alignParentLeft="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

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

    </RelativeLayout>

    <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
                android:id="@+id/lockPassword"
                style="?passwordTextAppearance"
                android:layout_width="208dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
                android:inputType="textPassword"
                android:minHeight="48dp"/>

            <TextView
                android:id="@+id/error"
                style="?errorTextAppearance"
                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>
    <include layout="@layout/auth_credential_password_pin_content_view" />

</com.android.systemui.biometrics.ui.CredentialPasswordView>
 No newline at end of file
+28 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2020 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.
  -->

<com.android.systemui.biometrics.ui.CredentialPasswordView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:elevation="@dimen/biometric_dialog_elevation"
    android:theme="?app:attr/lockPinPasswordStyle">

    <include layout="@layout/auth_credential_password_pin_content_view" />

</com.android.systemui.biometrics.ui.CredentialPasswordView>
 No newline at end of file
+104 −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.
  -->

<merge xmlns:android="http://schemas.android.com/apk/res/android">

  <ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
      android:id="@+id/auth_credential_header"
      style="?headerStyle"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:paddingBottom="0dp">

      <ImageView
          android:id="@+id/icon"
          style="?headerIconStyle"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:contentDescription="@null" />

      <TextView
          android:id="@+id/title"
          style="?titleTextAppearance"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/icon" />

      <TextView
          android:id="@+id/subtitle"
          style="?subTitleTextAppearance"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/title" />

      <TextView
          android:id="@+id/description"
          style="?descriptionTextAppearance"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/subtitle" />

    </RelativeLayout>

  </ScrollView>

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical">

      <ImeAwareEditText
          android:id="@+id/lockPassword"
          style="?passwordTextAppearance"
          android:layout_width="208dp"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
          android:inputType="textPassword"
          android:minHeight="48dp"/>

      <TextView
          android:id="@+id/error"
          style="?errorTextAppearance"
          android:layout_gravity="center_horizontal"
          android:layout_width="match_parent"
          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>

</merge>
+1 −83
Original line number Diff line number Diff line
@@ -23,88 +23,6 @@
    android:orientation="vertical"
    android:theme="?app:attr/lockPinPasswordStyle">

    <ScrollView
        android:id="@+id/auth_credential_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <RelativeLayout
            style="?headerStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/icon"
                style="?headerIconStyle"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:contentDescription="@null" />

            <TextView
                android:id="@+id/title"
                style="?titleTextAppearance"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/icon" />

            <TextView
                android:id="@+id/subtitle"
                style="?subTitleTextAppearance"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/title" />

            <TextView
                android:id="@+id/description"
                style="?descriptionTextAppearance"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/subtitle" />

        </RelativeLayout>

    </ScrollView>

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

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

            <ImeAwareEditText
                android:id="@+id/lockPassword"
                style="?passwordTextAppearance"
                android:layout_width="208dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
                android:inputType="textPassword"
                android:minHeight="48dp"/>

            <TextView
                android:id="@+id/error"
                style="?errorTextAppearance"
                android:layout_gravity="center_horizontal"
                android:layout_width="match_parent"
                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>
    <include layout="@layout/auth_credential_password_pin_content_view" />

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