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

Commit f756854f authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge "Control SystemUI behavior for rest to unlock using a device specific flag" into main

parents f8090450 359e30fa
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.view.DisplayInfo
import android.view.WindowInsets
import android.view.WindowManager
import android.view.WindowMetrics
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider
@@ -61,7 +62,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import org.mockito.Mock
import org.mockito.Mockito.mock
import org.mockito.Mockito.spy
@@ -69,7 +69,7 @@ import org.mockito.junit.MockitoJUnit

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(JUnit4::class)
@RunWith(AndroidJUnit4::class)
class SideFpsSensorInteractorTest : SysuiTestCase() {
    private val kosmos = testKosmos()

@@ -104,6 +104,7 @@ class SideFpsSensorInteractorTest : SysuiTestCase() {
        contextDisplayInfo.uniqueId = "current-display"
        whenever(fingerprintInteractiveToAuthProvider.enabledForCurrentUser)
            .thenReturn(isRestToUnlockEnabled)
        overrideResource(R.bool.config_restToUnlockSupported, true)
        underTest =
            SideFpsSensorInteractor(
                mContext,
+3 −0
Original line number Diff line number Diff line
@@ -962,6 +962,9 @@
    <!-- Whether to show bottom sheets edge to edge -->
    <bool name="config_edgeToEdgeBottomSheetDialog">true</bool>

    <!-- Device specific config that controls whether rest to unlock feature is supported.  -->
    <bool name="config_restToUnlockSupported">false</bool>

    <!--
    Time in milliseconds the user has to touch the side FPS sensor to successfully authenticate when
    the screen is turned off with AOD not enabled.
+4 −1
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ constructor(
    private val logger: SideFpsLogger,
) {

    private val isProlongedTouchEnabledForDevice =
        context.resources.getBoolean(R.bool.config_restToUnlockSupported)

    private val sensorLocationForCurrentDisplay =
        combine(
                displayStateInteractor.displayChanges,
@@ -82,7 +85,7 @@ constructor(
            .onEach { logger.authDurationChanged(it) }

    val isProlongedTouchRequiredForAuthentication: Flow<Boolean> =
        if (fingerprintInteractiveToAuthProvider.isEmpty) {
        if (fingerprintInteractiveToAuthProvider.isEmpty || !isProlongedTouchEnabledForDevice) {
            flowOf(false)
        } else {
            combine(