diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java index 37a2df83cc00..5c6039489b6b 100644 --- a/core/java/android/hardware/biometrics/BiometricPrompt.java +++ b/core/java/android/hardware/biometrics/BiometricPrompt.java @@ -240,18 +240,19 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan * * @param logoDescription The logo description text that will be shown on the prompt. * @return This builder. - * @throws IllegalArgumentException If logo description is null or exceeds certain character - * limit. + * @throws IllegalArgumentException If logo description is null. */ @FlaggedApi(FLAG_CUSTOM_BIOMETRIC_PROMPT) @RequiresPermission(SET_BIOMETRIC_DIALOG_ADVANCED) @NonNull public BiometricPrompt.Builder setLogoDescription(@NonNull String logoDescription) { - if (logoDescription == null - || logoDescription.length() > MAX_LOGO_DESCRIPTION_CHARACTER_NUMBER) { - throw new IllegalArgumentException( - "Logo description passed in can not be null or exceed " - + MAX_LOGO_DESCRIPTION_CHARACTER_NUMBER + " character number."); + if (logoDescription == null || logoDescription.isEmpty()) { + throw new IllegalArgumentException("Logo description passed in can not be null"); + } + if (logoDescription.length() > MAX_LOGO_DESCRIPTION_CHARACTER_NUMBER) { + Log.w(TAG, + "Logo description passed in exceeds" + MAX_LOGO_DESCRIPTION_CHARACTER_NUMBER + + " character number and may be truncated."); } mPromptInfo.setLogoDescription(logoDescription); return this; diff --git a/core/tests/coretests/src/android/hardware/biometrics/BiometricPromptTest.java b/core/tests/coretests/src/android/hardware/biometrics/BiometricPromptTest.java index ca9154280a10..a3d0ec623683 100644 --- a/core/tests/coretests/src/android/hardware/biometrics/BiometricPromptTest.java +++ b/core/tests/coretests/src/android/hardware/biometrics/BiometricPromptTest.java @@ -16,7 +16,6 @@ package android.hardware.biometrics; -import static android.hardware.biometrics.BiometricPrompt.MAX_LOGO_DESCRIPTION_CHARACTER_NUMBER; import static android.hardware.biometrics.PromptContentViewWithMoreOptionsButton.MAX_DESCRIPTION_CHARACTER_NUMBER; import static android.hardware.biometrics.PromptVerticalListContentView.MAX_EACH_ITEM_CHARACTER_NUMBER; import static android.hardware.biometrics.PromptVerticalListContentView.MAX_ITEM_NUMBER; @@ -116,19 +115,7 @@ public class BiometricPromptTest { () -> new BiometricPrompt.Builder(mContext).setLogoDescription(null) ); - assertThat(e).hasMessageThat().contains( - "Logo description passed in can not be null or exceed"); - } - - @Test - public void testLogoDescription_charLimit() { - IllegalArgumentException e = assertThrows(IllegalArgumentException.class, - () -> new BiometricPrompt.Builder(mContext).setLogoDescription( - generateRandomString(MAX_LOGO_DESCRIPTION_CHARACTER_NUMBER + 1)) - ); - - assertThat(e).hasMessageThat().contains( - "Logo description passed in can not be null or exceed"); + assertThat(e).hasMessageThat().isEqualTo("Logo description passed in can not be null"); } @Test diff --git a/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml b/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml index c599f9e05b38..18a1544a1d5d 100644 --- a/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml +++ b/packages/SystemUI/res/layout/biometric_prompt_two_pane_layout.xml @@ -87,20 +87,21 @@ android:layout_height="match_parent"> android:id="@+id/logo_description" style="@style/TextAppearance.AuthCredential.LogoDescription" android:layout_width="0dp" - android:layout_height="wrap_content" + android:layout_height="@dimen/biometric_prompt_logo_size" + android:gravity="start|center_vertical" android:textAlignment="viewStart" - android:paddingStart="16dp" - app:layout_constraintBottom_toBottomOf="@+id/logo" + android:layout_marginStart="16dp" + app:layout_goneMarginStart="0dp" + app:layout_constraintBottom_toTopOf="@+id/title" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/logo" - app:layout_constraintTop_toTopOf="@+id/logo" /> + app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/logo" + app:layout_constraintTop_toBottomOf="@+id/logoBarrier" app:layout_constraintVertical_bias="0.0" app:layout_constraintVertical_chainStyle="packed" /> @@ -158,6 +159,15 @@ android:layout_height="match_parent"> app:layout_constraintTop_toBottomOf="@+id/subtitle" app:layout_constraintVertical_bias="0.0" /> + + @*android:string/config_bodyFontFamilyMedium - marquee @integer/biometric_dialog_text_gravity - 1 - true + 1 ?androidprv:attr/materialColorOnSurfaceVariant + end