From 05c96d4b32e7722a5a16a7939009bc2b74096d76 Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Wed, 23 Mar 2022 15:12:49 -0700 Subject: [PATCH] Re-enable biometric prompt tests. These were temporarily disabled when the face-to-fingerprint flow was replaced with the coex flow. The test refactor caused presubmit failures because the detach method was not called after the test ended, which could cause unrelated downstream tests to fail. Bug: 222119218 Test: atest AuthBiometricViewTest Change-Id: Ie6c18ab2fabe6f42cff9706ad51062ebbad82bd0 --- .../systemui/biometrics/AuthBiometricViewTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java index 9418b50ff3906..f99b20d47ab8e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthBiometricViewTest.java @@ -42,6 +42,7 @@ import android.view.View; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; +import org.junit.After; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -50,7 +51,6 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -@Ignore @RunWith(AndroidTestingRunner.class) @RunWithLooper @SmallTest @@ -66,6 +66,11 @@ public class AuthBiometricViewTest extends SysuiTestCase { private AuthBiometricView mBiometricView; + @After + public void tearDown() { + destroyDialog(); + } + @Test public void testOnAuthenticationSucceeded_noConfirmationRequired_sendsActionAuthenticated() { initDialog(false /* allowDeviceCredential */, mCallback); @@ -245,6 +250,7 @@ public class AuthBiometricViewTest extends SysuiTestCase { // TODO: Test dialog size. Should move requireConfirmation to buildBiometricPromptBundle // Create new dialog and restore the previous state into it + destroyDialog(); initDialog(false /* allowDeviceCredential */, mCallback, state, 10000); mBiometricView.mAnimationDurationHideDialog = 10000; mBiometricView.setRequireConfirmation(requireConfirmation); @@ -304,6 +310,12 @@ public class AuthBiometricViewTest extends SysuiTestCase { waitForIdleSync(); } + private void destroyDialog() { + if (mBiometricView != null && mBiometricView.isAttachedToWindow()) { + ViewUtils.detachView(mBiometricView); + } + } + @Override protected void waitForIdleSync() { TestableLooper.get(this).processAllMessages();