Merge changes from topic "auth_credential_pin-tm-qpr-dev" into tm-qpr-dev

* changes:
  Fix AuthCredentialPasswordView inputfield overlap issue
  Polish biometric credential pattern view layouts
  Fix Auth Credential PIN layout inconsistence layout in landscape
  Customize input field style for Auth Credential ImeAwareEditText
This commit is contained in:
TreeHugger Robot
2022-10-20 19:26:11 +00:00
committed by Android (Google) Code Review
20 changed files with 650 additions and 254 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="4dp"
android:insetRight="4dp"
android:insetTop="10dp"
android:insetBottom="10dp">
<selector>
<item android:state_enabled="false">
<nine-patch android:src="@drawable/textfield_default_filled"
android:tint="?android:attr/colorControlNormal" />
</item>
<item android:state_pressed="false" android:state_focused="false">
<nine-patch android:src="@drawable/textfield_default_filled"
android:tint="?android:attr/colorControlNormal" />
</item>
<item>
<nine-patch android:src="@drawable/textfield_default_filled"
android:tint="?android:attr/colorControlActivated" />
</item>
</selector>
</inset>

View File

@@ -16,46 +16,74 @@
<com.android.systemui.biometrics.AuthCredentialPasswordView
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="vertical"
android:gravity="center_horizontal"
android:elevation="@dimen/biometric_dialog_elevation">
android:orientation="horizontal"
android:elevation="@dimen/biometric_dialog_elevation"
android:theme="?app:attr/lockPinPasswordStyle">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Title"/>
<RelativeLayout
android:id="@+id/auth_credential_header"
style="?headerStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="@+id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Subtitle"/>
<ImageView
android:id="@+id/icon"
style="?headerIconStyle"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@null"/>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Description"/>
<TextView
android:id="@+id/title"
style="?titleTextAppearance"
android:layout_below="@id/icon"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImeAwareEditText
android:id="@+id/lockPassword"
android:layout_width="208dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:minHeight="48dp"
android:gravity="center"
android:inputType="textPassword"
android:maxLength="500"
android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
style="@style/TextAppearance.AuthCredential.PasswordEntry"/>
<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/error"
android:layout_width="match_parent"
<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>
<LinearLayout
android:id="@+id/auth_credential_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Error"/>
android:orientation="vertical">
<ImeAwareEditText
android:id="@+id/lockPassword"
style="?passwordTextAppearance"
android:layout_width="208dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
android:inputType="textPassword"
android:minHeight="48dp" />
<TextView
android:id="@+id/error"
style="?errorTextAppearance"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</com.android.systemui.biometrics.AuthCredentialPasswordView>

View File

@@ -16,91 +16,71 @@
<com.android.systemui.biometrics.AuthCredentialPatternView
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:elevation="@dimen/biometric_dialog_elevation"
android:theme="?app:attr/lockPatternStyle">
<LinearLayout
<RelativeLayout
android:id="@+id/auth_credential_header"
style="?headerStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
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="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Title"/>
<TextView
android:id="@+id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Subtitle"/>
style="?subTitleTextAppearance"
android:layout_below="@id/title"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Description"/>
style="?descriptionTextAppearance"
android:layout_below="@id/subtitle"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
</RelativeLayout>
<FrameLayout
android:layout_weight="1"
style="?containerStyle"
android:layout_width="0dp"
android:layout_height="match_parent">
<com.android.internal.widget.LockPatternView
android:id="@+id/lockPattern"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView
android:id="@+id/error"
style="?errorTextAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AuthCredential.Error"/>
android:layout_gravity="center_horizontal|bottom"/>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="16dp"
android:clipToPadding="false">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
style="@style/LockPatternContainerStyle">
<com.android.internal.widget.LockPatternView
android:id="@+id/lockPattern"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
style="@style/LockPatternStyleBiometricPrompt"/>
</FrameLayout>
</LinearLayout>
</FrameLayout>
</com.android.systemui.biometrics.AuthCredentialPatternView>

View File

@@ -16,74 +16,71 @@
<com.android.systemui.biometrics.AuthCredentialPasswordView
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:elevation="@dimen/biometric_dialog_elevation"
android:orientation="vertical">
android:orientation="vertical"
android:theme="?app:attr/lockPinPasswordStyle">
<RelativeLayout
android:id="@+id/auth_credential_header"
style="?headerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/auth_credential_header"
style="@style/AuthCredentialHeaderStyle"
<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"
android:layout_alignParentTop="true">
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@null" />
<TextView
android:id="@+id/title"
style="@style/TextAppearance.AuthNonBioCredential.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/subtitle"
style="@style/TextAppearance.AuthNonBioCredential.Subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/description"
style="@style/TextAppearance.AuthNonBioCredential.Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
<TextView
android:id="@+id/subtitle"
style="?subTitleTextAppearance"
android:layout_below="@id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<ImeAwareEditText
android:id="@+id/lockPassword"
style="@style/TextAppearance.AuthCredential.PasswordEntry"
android:layout_width="208dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:imeOptions="actionNext|flagNoFullscreen|flagForceAscii"
android:inputType="textPassword"
android:minHeight="48dp" />
<TextView
android:id="@+id/error"
style="@style/TextAppearance.AuthNonBioCredential.Error"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/description"
style="?descriptionTextAppearance"
android:layout_below="@id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/auth_credential_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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>
</com.android.systemui.biometrics.AuthCredentialPasswordView>

View File

@@ -16,87 +16,66 @@
<com.android.systemui.biometrics.AuthCredentialPatternView
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="vertical"
android:gravity="center_horizontal"
android:elevation="@dimen/biometric_dialog_elevation">
android:elevation="@dimen/biometric_dialog_elevation"
android:theme="?app:attr/lockPatternStyle">
<RelativeLayout
android:id="@+id/auth_credential_header"
style="?headerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/auth_credential_header"
style="@style/AuthCredentialHeaderStyle"
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"/>
<ImageView
android:id="@+id/icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@null" />
<TextView
android:id="@+id/title"
style="?titleTextAppearance"
android:layout_below="@id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/title"
style="@style/TextAppearance.AuthNonBioCredential.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/subtitle"
style="@style/TextAppearance.AuthNonBioCredential.Subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/description"
style="@style/TextAppearance.AuthNonBioCredential.Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/auth_credential_header"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingTop="60dp">
<FrameLayout
style="@style/LockPatternContainerStyle"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1">
<com.android.internal.widget.LockPatternView
android:id="@+id/lockPattern"
style="@style/LockPatternStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView
android:id="@+id/error"
style="@style/TextAppearance.AuthNonBioCredential.Error"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="@+id/subtitle"
style="?subTitleTextAppearance"
android:layout_below="@id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/description"
style="?descriptionTextAppearance"
android:layout_below="@id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<FrameLayout
android:id="@+id/auth_credential_container"
style="?containerStyle"
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="match_parent"
android:layout_height="match_parent"/>
<TextView
android:id="@+id/error"
style="?errorTextAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"/>
</FrameLayout>
</com.android.systemui.biometrics.AuthCredentialPatternView>

View File

@@ -18,4 +18,42 @@
<style name="BrightnessDialogContainer" parent="@style/BaseBrightnessDialogContainer">
<item name="android:layout_width">360dp</item>
</style>
<style name="AuthCredentialHeaderStyle">
<item name="android:paddingStart">48dp</item>
<item name="android:paddingEnd">24dp</item>
<item name="android:paddingTop">48dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:gravity">top|left</item>
</style>
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">320dp</item>
<item name="android:maxWidth">320dp</item>
<item name="android:minHeight">200dp</item>
<item name="android:minWidth">200dp</item>
<item name="android:paddingHorizontal">60dp</item>
<item name="android:paddingVertical">20dp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Title">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">6dp</item>
<item name="android:textSize">36dp</item>
<item name="android:focusable">true</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Subtitle">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">6dp</item>
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Description">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">6dp</item>
<item name="android:textSize">18sp</item>
</style>
</resources>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">420dp</item>
<item name="android:maxWidth">420dp</item>
<item name="android:minHeight">200dp</item>
<item name="android:minWidth">200dp</item>
<item name="android:paddingHorizontal">120dp</item>
<item name="android:paddingVertical">40dp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Title">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">36sp</item>
<item name="android:focusable">true</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Subtitle">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Description">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">18sp</item>
</style>
</resources>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AuthCredentialHeaderStyle">
<item name="android:paddingStart">120dp</item>
<item name="android:paddingEnd">120dp</item>
<item name="android:paddingTop">80dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:layout_gravity">top</item>
</style>
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">420dp</item>
<item name="android:maxWidth">420dp</item>
<item name="android:minHeight">200dp</item>
<item name="android:minWidth">200dp</item>
<item name="android:paddingHorizontal">180dp</item>
<item name="android:paddingVertical">80dp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Title">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">24dp</item>
<item name="android:textSize">36sp</item>
<item name="android:focusable">true</item>
</style>
</resources>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">420dp</item>
<item name="android:maxWidth">420dp</item>
<item name="android:minHeight">200dp</item>
<item name="android:minWidth">200dp</item>
<item name="android:paddingHorizontal">120dp</item>
<item name="android:paddingVertical">40dp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Title">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">36sp</item>
<item name="android:focusable">true</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Subtitle">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Description">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:textSize">18sp</item>
</style>
</resources>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AuthCredentialHeaderStyle">
<item name="android:paddingStart">120dp</item>
<item name="android:paddingEnd">120dp</item>
<item name="android:paddingTop">80dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:layout_gravity">top</item>
</style>
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">420dp</item>
<item name="android:maxWidth">420dp</item>
<item name="android:minHeight">200dp</item>
<item name="android:minWidth">200dp</item>
<item name="android:paddingHorizontal">240dp</item>
<item name="android:paddingVertical">120dp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Title">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">24dp</item>
<item name="android:textSize">36sp</item>
<item name="android:focusable">true</item>
</style>
</resources>

View File

@@ -191,5 +191,18 @@
<declare-styleable name="DelayableMarqueeTextView">
<attr name="marqueeDelay" format="integer" />
</declare-styleable>
<declare-styleable name="AuthCredentialView">
<attr name="lockPatternStyle" format="reference" />
<attr name="lockPinPasswordStyle" format="reference" />
<attr name="containerStyle" format="reference" />
<attr name="headerStyle" format="reference" />
<attr name="headerIconStyle" format="reference" />
<attr name="titleTextAppearance" format="reference" />
<attr name="subTitleTextAppearance" format="reference" />
<attr name="descriptionTextAppearance" format="reference" />
<attr name="passwordTextAppearance" format="reference" />
<attr name="errorTextAppearance" format="reference"/>
</declare-styleable>
</resources>

View File

@@ -950,6 +950,9 @@
<dimen name="biometric_dialog_width">240dp</dimen>
<dimen name="biometric_dialog_height">240dp</dimen>
<!-- Biometric Auth Credential values -->
<dimen name="biometric_auth_icon_size">48dp</dimen>
<!-- Starting text size in sp of batteryLevel for wireless charging animation -->
<item name="wireless_charging_anim_battery_level_text_size_start" format="float" type="dimen">
0

View File

@@ -197,8 +197,9 @@
<style name="TextAppearance.AuthNonBioCredential.Title">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">20dp</item>
<item name="android:textSize">36sp</item>
<item name="android:layout_marginTop">24dp</item>
<item name="android:textSize">36dp</item>
<item name="android:focusable">true</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Subtitle">
@@ -210,12 +211,10 @@
<style name="TextAppearance.AuthNonBioCredential.Description">
<item name="android:fontFamily">google-sans</item>
<item name="android:layout_marginTop">20dp</item>
<item name="android:textSize">16sp</item>
<item name="android:textSize">18sp</item>
</style>
<style name="TextAppearance.AuthNonBioCredential.Error">
<item name="android:paddingTop">6dp</item>
<item name="android:paddingBottom">18dp</item>
<item name="android:paddingHorizontal">24dp</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">?android:attr/colorError</item>
@@ -224,20 +223,43 @@
<style name="TextAppearance.AuthCredential.PasswordEntry" parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:gravity">center</item>
<item name="android:paddingTop">28dp</item>
<item name="android:singleLine">true</item>
<item name="android:textColor">?android:attr/colorForeground</item>
<item name="android:textSize">24sp</item>
<item name="android:background">@drawable/edit_text_filled</item>
</style>
<style name="AuthCredentialHeaderStyle">
<item name="android:paddingStart">48dp</item>
<item name="android:paddingEnd">24dp</item>
<item name="android:paddingTop">28dp</item>
<item name="android:paddingBottom">20dp</item>
<item name="android:orientation">vertical</item>
<item name="android:paddingEnd">48dp</item>
<item name="android:paddingTop">48dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:layout_gravity">top</item>
</style>
<style name="AuthCredentialIconStyle">
<item name="android:layout_width">@dimen/biometric_auth_icon_size</item>
<item name="android:layout_height">@dimen/biometric_auth_icon_size</item>
</style>
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">420dp</item>
<item name="android:maxWidth">420dp</item>
<item name="android:minHeight">200dp</item>
<item name="android:minWidth">200dp</item>
<item name="android:padding">20dp</item>
</style>
<style name="AuthCredentialPinPasswordContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">48dp</item>
<item name="android:maxWidth">600dp</item>
<item name="android:minHeight">48dp</item>
<item name="android:minWidth">200dp</item>
</style>
<style name="DeviceManagementDialogTitle">
<item name="android:gravity">center</item>
<item name="android:textAppearance">@style/TextAppearance.DeviceManagementDialog.Title</item>
@@ -275,7 +297,9 @@
<item name="wallpaperTextColorSecondary">@*android:color/secondary_text_material_dark</item>
<item name="wallpaperTextColorAccent">@color/material_dynamic_primary90</item>
<item name="android:colorError">@*android:color/error_color_material_dark</item>
<item name="*android:lockPatternStyle">@style/LockPatternStyle</item>
<item name="*android:lockPatternStyle">@style/LockPatternViewStyle</item>
<item name="lockPatternStyle">@style/LockPatternContainerStyle</item>
<item name="lockPinPasswordStyle">@style/LockPinPasswordContainerStyle</item>
<item name="passwordStyle">@style/PasswordTheme</item>
<item name="numPadKeyStyle">@style/NumPadKey</item>
<item name="backgroundProtectedStyle">@style/BackgroundProtectedStyle</item>
@@ -301,27 +325,33 @@
<item name="android:textColor">?attr/wallpaperTextColor</item>
</style>
<style name="LockPatternContainerStyle">
<item name="android:maxHeight">400dp</item>
<item name="android:maxWidth">420dp</item>
<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>
<item name="android:paddingHorizontal">60dp</item>
<item name="android:paddingBottom">40dp</item>
<style name="AuthCredentialStyle">
<item name="*android:regularColor">?android:attr/colorForeground</item>
<item name="*android:successColor">?android:attr/colorForeground</item>
<item name="*android:errorColor">?android:attr/colorError</item>
<item name="*android:dotColor">?android:attr/textColorSecondary</item>
<item name="headerStyle">@style/AuthCredentialHeaderStyle</item>
<item name="headerIconStyle">@style/AuthCredentialIconStyle</item>
<item name="titleTextAppearance">@style/TextAppearance.AuthNonBioCredential.Title</item>
<item name="subTitleTextAppearance">@style/TextAppearance.AuthNonBioCredential.Subtitle</item>
<item name="descriptionTextAppearance">@style/TextAppearance.AuthNonBioCredential.Description</item>
<item name="passwordTextAppearance">@style/TextAppearance.AuthCredential.PasswordEntry</item>
<item name="errorTextAppearance">@style/TextAppearance.AuthNonBioCredential.Error</item>
</style>
<style name="LockPatternStyle">
<style name="LockPatternViewStyle" >
<item name="*android:regularColor">?android:attr/colorAccent</item>
<item name="*android:successColor">?android:attr/textColorPrimary</item>
<item name="*android:errorColor">?android:attr/colorError</item>
<item name="*android:dotColor">?android:attr/textColorSecondary</item>
</style>
<style name="LockPatternStyleBiometricPrompt">
<item name="*android:regularColor">?android:attr/colorForeground</item>
<item name="*android:successColor">?android:attr/colorForeground</item>
<item name="*android:errorColor">?android:attr/colorError</item>
<item name="*android:dotColor">?android:attr/textColorSecondary</item>
<style name="LockPatternContainerStyle" parent="@style/AuthCredentialStyle">
<item name="containerStyle">@style/AuthCredentialPatternContainerStyle</item>
</style>
<style name="LockPinPasswordContainerStyle" parent="@style/AuthCredentialStyle">
<item name="containerStyle">@style/AuthCredentialPinPasswordContainerStyle</item>
</style>
<style name="Theme.SystemUI.QuickSettings" parent="@*android:style/Theme.DeviceDefault">

View File

@@ -16,12 +16,21 @@
package com.android.systemui.biometrics;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.view.WindowInsets.Type.ime;
import android.annotation.NonNull;
import android.content.Context;
import android.graphics.Insets;
import android.os.UserHandle;
import android.text.InputType;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnApplyWindowInsetsListener;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImeAwareEditText;
@@ -31,18 +40,24 @@ import com.android.internal.widget.LockPatternChecker;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockscreenCredential;
import com.android.internal.widget.VerifyCredentialResponse;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import java.io.PrintWriter;
/**
* Pin and Password UI
*/
public class AuthCredentialPasswordView extends AuthCredentialView
implements TextView.OnEditorActionListener {
implements TextView.OnEditorActionListener, OnApplyWindowInsetsListener, Dumpable {
private static final String TAG = "BiometricPrompt/AuthCredentialPasswordView";
private final InputMethodManager mImm;
private ImeAwareEditText mPasswordField;
private ViewGroup mAuthCredentialHeader;
private ViewGroup mAuthCredentialInput;
private int mBottomInset = 0;
public AuthCredentialPasswordView(Context context,
AttributeSet attrs) {
@@ -53,6 +68,9 @@ public class AuthCredentialPasswordView extends AuthCredentialView
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mAuthCredentialHeader = findViewById(R.id.auth_credential_header);
mAuthCredentialInput = findViewById(R.id.auth_credential_input);
mPasswordField = findViewById(R.id.lockPassword);
mPasswordField.setOnEditorActionListener(this);
// TODO: De-dupe the logic with AuthContainerView
@@ -66,6 +84,8 @@ public class AuthCredentialPasswordView extends AuthCredentialView
}
return true;
});
setOnApplyWindowInsetsListener(this);
}
@Override
@@ -127,4 +147,92 @@ public class AuthCredentialPasswordView extends AuthCredentialView
mPasswordField.setText("");
}
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mAuthCredentialInput == null || mAuthCredentialHeader == null || mSubtitleView == null
|| mDescriptionView == null || mPasswordField == null || mErrorView == null) {
return;
}
int inputLeftBound;
int inputTopBound;
int headerRightBound = right;
int headerTopBounds = top;
final int subTitleBottom = (mSubtitleView.getVisibility() == GONE) ? mTitleView.getBottom()
: mSubtitleView.getBottom();
final int descBottom = (mDescriptionView.getVisibility() == GONE) ? subTitleBottom
: mDescriptionView.getBottom();
if (getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
inputTopBound = (bottom - mAuthCredentialInput.getHeight()) / 2;
inputLeftBound = (right - left) / 2;
headerRightBound = inputLeftBound;
headerTopBounds -= Math.min(mIconView.getBottom(), mBottomInset);
} else {
inputTopBound =
descBottom + (bottom - descBottom - mAuthCredentialInput.getHeight()) / 2;
inputLeftBound = (right - left - mAuthCredentialInput.getWidth()) / 2;
}
if (mDescriptionView.getBottom() > mBottomInset) {
mAuthCredentialHeader.layout(left, headerTopBounds, headerRightBound, bottom);
}
mAuthCredentialInput.layout(inputLeftBound, inputTopBound, right, bottom);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final int newWidth = MeasureSpec.getSize(widthMeasureSpec);
final int newHeight = MeasureSpec.getSize(heightMeasureSpec) - mBottomInset;
setMeasuredDimension(newWidth, newHeight);
final int halfWidthSpec = MeasureSpec.makeMeasureSpec(getWidth() / 2,
MeasureSpec.AT_MOST);
final int fullHeightSpec = MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.UNSPECIFIED);
if (getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
measureChildren(halfWidthSpec, fullHeightSpec);
} else {
measureChildren(widthMeasureSpec, fullHeightSpec);
}
}
@NonNull
@Override
public WindowInsets onApplyWindowInsets(@NonNull View v, WindowInsets insets) {
final Insets bottomInset = insets.getInsets(ime());
if (v instanceof AuthCredentialPasswordView && mBottomInset != bottomInset.bottom) {
mBottomInset = bottomInset.bottom;
if (mBottomInset > 0
&& getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
mTitleView.setSingleLine(true);
mTitleView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
mTitleView.setMarqueeRepeatLimit(-1);
// select to enable marquee unless a screen reader is enabled
mTitleView.setSelected(!mAccessibilityManager.isEnabled()
|| !mAccessibilityManager.isTouchExplorationEnabled());
} else {
mTitleView.setSingleLine(false);
mTitleView.setEllipsize(null);
// select to enable marquee unless a screen reader is enabled
mTitleView.setSelected(false);
}
requestLayout();
}
return insets;
}
@Override
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
pw.println(TAG + "State:");
pw.println(" mBottomInset=" + mBottomInset);
pw.println(" mAuthCredentialHeader size=(" + mAuthCredentialHeader.getWidth() + ","
+ mAuthCredentialHeader.getHeight());
pw.println(" mAuthCredentialInput size=(" + mAuthCredentialInput.getWidth() + ","
+ mAuthCredentialInput.getHeight());
}
}

View File

@@ -93,7 +93,9 @@ public class AuthCredentialPatternView extends AuthCredentialView {
@Override
protected void onErrorTimeoutFinish() {
super.onErrorTimeoutFinish();
mLockPatternView.setEnabled(true);
// select to enable marquee unless a screen reader is enabled
mLockPatternView.setEnabled(!mAccessibilityManager.isEnabled()
|| !mAccessibilityManager.isTouchExplorationEnabled());
}
public AuthCredentialPatternView(Context context, AttributeSet attrs) {

View File

@@ -30,7 +30,6 @@ import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.pm.UserInfo;
import android.graphics.drawable.Drawable;
import android.hardware.biometrics.BiometricPrompt;
import android.hardware.biometrics.PromptInfo;
import android.os.AsyncTask;
import android.os.CountDownTimer;
@@ -77,7 +76,7 @@ public abstract class AuthCredentialView extends LinearLayout {
protected final Handler mHandler;
protected final LockPatternUtils mLockPatternUtils;
private final AccessibilityManager mAccessibilityManager;
protected final AccessibilityManager mAccessibilityManager;
private final UserManager mUserManager;
private final DevicePolicyManager mDevicePolicyManager;
@@ -86,10 +85,10 @@ public abstract class AuthCredentialView extends LinearLayout {
private boolean mShouldAnimatePanel;
private boolean mShouldAnimateContents;
private TextView mTitleView;
private TextView mSubtitleView;
private TextView mDescriptionView;
private ImageView mIconView;
protected TextView mTitleView;
protected TextView mSubtitleView;
protected TextView mDescriptionView;
protected ImageView mIconView;
protected TextView mErrorView;
protected @Utils.CredentialType int mCredentialType;