From 79d5c75d1bed7896d3fe17809dedbb5a3797ea1a Mon Sep 17 00:00:00 2001 From: Austin Delgado Date: Tue, 21 Nov 2023 11:54:24 -0800 Subject: Fix BiometricPrompt credential view rotation Fixes: 310527539 Test: atest SystemUITests:com.android.systemui.biometrics Flag: None Change-Id: I77d758072a1c7478ad95c18ce923a6ed771dce13 --- .../src/com/android/systemui/biometrics/AuthContainerView.java | 6 +++++- .../src/com/android/systemui/biometrics/AuthContainerViewTest.kt | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 1ac4163649a4..ab23564a1df4 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -30,6 +30,7 @@ import android.content.Context; import android.graphics.PixelFormat; import android.hardware.biometrics.BiometricAuthenticator.Modality; import android.hardware.biometrics.BiometricConstants; +import android.hardware.biometrics.BiometricManager.Authenticators; import android.hardware.biometrics.PromptInfo; import android.hardware.face.FaceSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; @@ -168,7 +169,7 @@ public class AuthContainerView extends LinearLayout // HAT received from LockSettingsService when credential is verified. @Nullable private byte[] mCredentialAttestation; - // TODO(b/287311775): remove when legacy prompt is replaced + // TODO(b/313469218): remove when legacy prompt is replaced @Deprecated static class Config { Context mContext; @@ -220,6 +221,9 @@ public class AuthContainerView extends LinearLayout mHandler.postDelayed(() -> { addCredentialView(false /* animatePanel */, true /* animateContents */); }, mConfig.mSkipAnimation ? 0 : ANIMATE_CREDENTIAL_START_DELAY_MS); + + // TODO(b/313469218): Remove Config + mConfig.mPromptInfo.setAuthenticators(Authenticators.DEVICE_CREDENTIAL); } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt index f4122d59cea1..ea20d29556dc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt @@ -338,6 +338,13 @@ open class AuthContainerViewTest : SysuiTestCase() { waitForIdleSync() assertThat(container.hasCredentialView()).isTrue() + assertThat(container.hasBiometricPrompt()).isFalse() + + // Check credential view persists after new attachment + container.onAttachedToWindow() + + assertThat(container.hasCredentialView()).isTrue() + assertThat(container.hasBiometricPrompt()).isFalse() } @Test -- cgit v1.2.3-59-g8ed1b