Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa0e7c0b authored by Shawn Lin's avatar Shawn Lin
Browse files

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
parent 11b85acc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -37,4 +37,8 @@ class UdfpsBpViewController(
    dumpManager
) {
    override val tag = "UdfpsBpViewController"

    override fun shouldPauseAuth(): Boolean {
        return false
    }
}
+68 −0
Original line number Diff line number Diff line
/*
 * 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())
    }
}