From aa0e7c0b93ecc4c1fecebe9176517501d008d846 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Tue, 27 Jun 2023 08:42:06 +0000 Subject: [PATCH] Fix not able to auth when notification is expanded The shouldPauseAuth() would return true if the notification is expanded. But for BiometricPrompt case, we should always return false to let the auth continue. Bug: 286547452 Test: atest UdfpsControllerOverlayTest Change-Id: Ie79ffe456588af0ae4d540b5c9201325cb38d808 --- .../biometrics/UdfpsBpViewController.kt | 4 ++ .../biometrics/UdfpsBpViewControllerTest.kt | 68 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsBpViewControllerTest.kt diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsBpViewController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsBpViewController.kt index e6aeb43d9d9e4..802eea300bd4b 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsBpViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsBpViewController.kt @@ -37,4 +37,8 @@ class UdfpsBpViewController( dumpManager ) { override val tag = "UdfpsBpViewController" + + override fun shouldPauseAuth(): Boolean { + return false + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsBpViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsBpViewControllerTest.kt new file mode 100644 index 0000000000000..7de78a60b73e5 --- /dev/null +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsBpViewControllerTest.kt @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2023 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. + */ + +package com.android.systemui.biometrics + +import android.testing.TestableLooper +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.android.systemui.RoboPilotTest +import com.android.systemui.SysuiTestCase +import com.android.systemui.dump.DumpManager +import com.android.systemui.plugins.statusbar.StatusBarStateController +import com.android.systemui.shade.ShadeExpansionStateManager +import com.android.systemui.statusbar.phone.SystemUIDialogManager +import org.junit.Assert.assertFalse +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.Mock +import org.mockito.junit.MockitoJUnit + +@SmallTest +@RoboPilotTest +@RunWith(AndroidJUnit4::class) +@TestableLooper.RunWithLooper +class UdfpsBpViewControllerTest : SysuiTestCase() { + + @JvmField @Rule var rule = MockitoJUnit.rule() + + @Mock lateinit var udfpsBpView: UdfpsBpView + @Mock lateinit var statusBarStateController: StatusBarStateController + @Mock lateinit var shadeExpansionStateManager: ShadeExpansionStateManager + @Mock lateinit var systemUIDialogManager: SystemUIDialogManager + @Mock lateinit var dumpManager: DumpManager + + private lateinit var udfpsBpViewController: UdfpsBpViewController + + @Before + fun setup() { + udfpsBpViewController = + UdfpsBpViewController( + udfpsBpView, + statusBarStateController, + shadeExpansionStateManager, + systemUIDialogManager, + dumpManager + ) + } + + @Test + fun testShouldNeverPauseAuth() { + assertFalse(udfpsBpViewController.shouldPauseAuth()) + } +}