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

Commit 57089e1b authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Remove Shade expansion FRP check" into main

parents 9358d9b5 833a6e3e
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.FakeMobi
import com.android.systemui.statusbar.pipeline.mobile.ui.viewmodel.MobileIconsViewModel
import com.android.systemui.statusbar.pipeline.mobile.util.FakeMobileMappingsProxy
import com.android.systemui.statusbar.pipeline.shared.data.repository.FakeConnectivityRepository
import com.android.systemui.statusbar.policy.data.repository.fakeDeviceProvisioningRepository
import com.android.systemui.statusbar.policy.domain.interactor.deviceProvisioningInteractor
import com.android.systemui.telephony.data.repository.fakeTelephonyRepository
import com.android.systemui.testKosmos
@@ -549,21 +548,6 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() {
            assertCurrentScene(Scenes.Lockscreen)
        }

    @Test
    fun deviceProvisioningAndFactoryResetProtection() =
        testScope.runTest {
            val isVisible by collectLastValue(sceneContainerViewModel.isVisible)
            kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(false)
            kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(true)
            assertThat(isVisible).isFalse()

            kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(false)
            assertThat(isVisible).isFalse()

            kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(true)
            assertThat(isVisible).isTrue()
        }

    /**
     * Asserts that the current scene in the view-model matches what's expected.
     *
+1 −10
Original line number Diff line number Diff line
@@ -187,27 +187,20 @@ class SceneContainerStartableTest : SysuiTestCase() {
        }

    @Test
    fun hydrateVisibility_basedOnDeviceProvisioningAndFactoryResetProtection() =
    fun hydrateVisibility_basedOnDeviceProvisioning() =
        testScope.runTest {
            val isVisible by collectLastValue(sceneInteractor.isVisible)
            prepareState(
                isDeviceUnlocked = true,
                initialSceneKey = Scenes.Lockscreen,
                isDeviceProvisioned = false,
                isFrpActive = true,
            )

            underTest.start()
            assertThat(isVisible).isFalse()

            kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(false)
            assertThat(isVisible).isFalse()

            kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(true)
            assertThat(isVisible).isTrue()

            kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(true)
            assertThat(isVisible).isFalse()
        }

    @Test
@@ -1030,7 +1023,6 @@ class SceneContainerStartableTest : SysuiTestCase() {
        isLockscreenEnabled: Boolean = true,
        startsAwake: Boolean = true,
        isDeviceProvisioned: Boolean = true,
        isFrpActive: Boolean = false,
    ): MutableStateFlow<ObservableTransitionState> {
        if (authenticationMethod?.isSecure == true) {
            assert(isLockscreenEnabled) {
@@ -1068,7 +1060,6 @@ class SceneContainerStartableTest : SysuiTestCase() {
        }

        kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(isDeviceProvisioned)
        kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(isFrpActive)

        runCurrent()

+0 −14
Original line number Diff line number Diff line
@@ -618,20 +618,6 @@ class ShadeInteractorImplTest : SysuiTestCase() {
            assertThat(actual).isFalse()
        }

    @Test
    fun isShadeTouchable_isFalse_whenFrpIsActive() =
        testScope.runTest {
            deviceProvisioningRepository.setFactoryResetProtectionActive(true)
            keyguardTransitionRepository.sendTransitionStep(
                TransitionStep(
                    transitionState = TransitionState.STARTED,
                )
            )
            val isShadeTouchable by collectLastValue(underTest.isShadeTouchable)
            runCurrent()
            assertThat(isShadeTouchable).isFalse()
        }

    @Test
    fun isShadeTouchable_isFalse_whenDeviceAsleepAndNotPulsing() =
        testScope.runTest {
+1 −6
Original line number Diff line number Diff line
@@ -126,12 +126,7 @@ constructor(
    private fun hydrateVisibility() {
        applicationScope.launch {
            // TODO(b/296114544): Combine with some global hun state to make it visible!
            combine(
                    deviceProvisioningInteractor.isDeviceProvisioned,
                    deviceProvisioningInteractor.isFactoryResetProtectionActive,
                ) { isDeviceProvisioned, isFrpActive ->
                    isDeviceProvisioned && !isFrpActive
                }
            deviceProvisioningInteractor.isDeviceProvisioned
                .distinctUntilChanged()
                .flatMapLatest { isAllowedToBeVisible ->
                    if (isAllowedToBeVisible) {
+4 −8
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
package com.android.systemui.shade

import android.view.MotionEvent
import com.android.systemui.log.dagger.ShadeLog
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.dagger.ShadeLog
import com.android.systemui.shade.ShadeViewController.Companion.FLING_COLLAPSE
import com.android.systemui.shade.ShadeViewController.Companion.FLING_EXPAND
import com.android.systemui.shade.ShadeViewController.Companion.FLING_HIDE
@@ -304,8 +304,7 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
        msg: String,
        forceCancel: Boolean,
        expand: Boolean,
    )
    {
    ) {
        buffer.log(
            TAG,
            LogLevel.VERBOSE,
@@ -322,8 +321,7 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
        msg: String,
        panelClosedOnDown: Boolean,
        expandFraction: Float,
    )
    {
    ) {
        buffer.log(
            TAG,
            LogLevel.VERBOSE,
@@ -381,7 +379,6 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
        shouldControlScreenOff: Boolean,
        deviceInteractive: Boolean,
        isPulsing: Boolean,
        isFrpActive: Boolean,
    ) {
        buffer.log(
            TAG,
@@ -392,12 +389,11 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
                bool3 = shouldControlScreenOff
                bool4 = deviceInteractive
                str1 = isPulsing.toString()
                str2 = isFrpActive.toString()
            },
            {
                "CentralSurfaces updateNotificationPanelTouchState set disabled to: $bool1\n" +
                        "isGoingToSleep: $bool2, !shouldControlScreenOff: $bool3," +
                        "!mDeviceInteractive: $bool4, !isPulsing: $str1, isFrpActive: $str2"
                        "!mDeviceInteractive: $bool4, !isPulsing: $str1"
            }
        )
    }
Loading