diff options
| author | 2024-05-28 04:29:09 +0000 | |
|---|---|---|
| committer | 2024-05-28 11:49:04 +0000 | |
| commit | b57ecafb37b10c9a6e53edd11c8664e3aed6b014 (patch) | |
| tree | e6d36fc3d4fa57c2ccef4ef6ed7054e3d3eb973c | |
| parent | 48cc3a8425e9cc92e684f957868426c79b38f927 (diff) | |
Fix NPE crash when BP fallback to credentialUI and rotate
Flag: NONE
Bug: 287480279
Fixes: 342184246
Test: atest AuthContainerViewTest
Test: manual show BP on SFPS project and make sure the BP location
meet requirement
Change-Id: Id548e5b6db5fa28407b9a5d6a247a59ccef1bf1f
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java | 2 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 9de71c1880fe..94b1979548f0 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -629,7 +629,7 @@ public class AuthContainerView extends LinearLayout if (fpProp != null && fpProp.isAnyUdfpsType()) { maybeUpdatePositionForUdfps(forceInvalidate /* invalidate */); } - if (faceProp != null && mBiometricView.isFaceOnly()) { + if (faceProp != null && mBiometricView != null && mBiometricView.isFaceOnly()) { alwaysUpdatePositionAtScreenBottom(forceInvalidate /* invalidate */); } if (fpProp != null && fpProp.sensorType == TYPE_POWER_BUTTON) { 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 13bc8dd1fac6..b594f91ef132 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.kt @@ -18,6 +18,7 @@ package com.android.systemui.biometrics import android.app.ActivityTaskManager import android.app.admin.DevicePolicyManager import android.content.pm.PackageManager +import android.content.res.Configuration import android.hardware.biometrics.BiometricAuthenticator import android.hardware.biometrics.BiometricConstants import android.hardware.biometrics.BiometricManager @@ -384,6 +385,33 @@ open class AuthContainerViewTest : SysuiTestCase() { } @Test + fun testAnimateToCredentialUI_rotateCredentialUI() { + val container = initializeFingerprintContainer( + authenticators = BiometricManager.Authenticators.BIOMETRIC_WEAK or + BiometricManager.Authenticators.DEVICE_CREDENTIAL + ) + container.animateToCredentialUI(false) + 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() + + val configuration = Configuration(context.resources.configuration) + configuration.orientation = Configuration.ORIENTATION_LANDSCAPE + container.dispatchConfigurationChanged(configuration) + waitForIdleSync() + + assertThat(container.hasCredentialView()).isTrue() + assertThat(container.hasBiometricPrompt()).isFalse() + } + + @Test fun testShowBiometricUI() { val container = initializeFingerprintContainer() |