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

Commit 838035ab authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Remove released long press flag" into main

parents e382bca2 f5309268
Loading
Loading
Loading
Loading
+7 −19
Original line number Original line Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.shared.FaceAuthUiEvent
import com.android.systemui.deviceentry.shared.FaceAuthUiEvent
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
@@ -93,9 +92,7 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
        testScope.runTest {
        testScope.runTest {
            val isEnabled = collectLastValue(underTest.isLongPressHandlingEnabled)
            val isEnabled = collectLastValue(underTest.isLongPressHandlingEnabled)
            KeyguardState.values().forEach { keyguardState ->
            KeyguardState.values().forEach { keyguardState ->
                setUpState(
                setUpState(keyguardState = keyguardState)
                    keyguardState = keyguardState,
                )


                if (keyguardState == KeyguardState.LOCKSCREEN) {
                if (keyguardState == KeyguardState.LOCKSCREEN) {
                    assertThat(isEnabled()).isTrue()
                    assertThat(isEnabled()).isTrue()
@@ -110,10 +107,7 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
        testScope.runTest {
        testScope.runTest {
            val isEnabled = collectLastValue(underTest.isLongPressHandlingEnabled)
            val isEnabled = collectLastValue(underTest.isLongPressHandlingEnabled)
            KeyguardState.values().forEach { keyguardState ->
            KeyguardState.values().forEach { keyguardState ->
                setUpState(
                setUpState(keyguardState = keyguardState, isQuickSettingsVisible = true)
                    keyguardState = keyguardState,
                    isQuickSettingsVisible = true,
                )


                assertThat(isEnabled()).isFalse()
                assertThat(isEnabled()).isFalse()
            }
            }
@@ -290,22 +284,19 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
            keyguardTransitionRepository.sendTransitionSteps(
            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.LOCKSCREEN,
                from = KeyguardState.LOCKSCREEN,
                to = KeyguardState.GONE,
                to = KeyguardState.GONE,
                testScope
                testScope,
            )
            )
            assertThat(isMenuVisible).isFalse()
            assertThat(isMenuVisible).isFalse()


            keyguardTransitionRepository.sendTransitionSteps(
            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.GONE,
                from = KeyguardState.GONE,
                to = KeyguardState.LOCKSCREEN,
                to = KeyguardState.LOCKSCREEN,
                testScope
                testScope,
            )
            )
            assertThat(isMenuVisible).isFalse()
            assertThat(isMenuVisible).isFalse()
        }
        }


    private suspend fun createUnderTest(
    private suspend fun createUnderTest(isRevampedWppFeatureEnabled: Boolean = true) {
        isLongPressFeatureEnabled: Boolean = true,
        isRevampedWppFeatureEnabled: Boolean = true,
    ) {
        // This needs to be re-created for each test outside of kosmos since the flag values are
        // This needs to be re-created for each test outside of kosmos since the flag values are
        // read during initialization to set up flows. Maybe there is a better way to handle that.
        // read during initialization to set up flows. Maybe there is a better way to handle that.
        underTest =
        underTest =
@@ -315,10 +306,7 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
                transitionInteractor = kosmos.keyguardTransitionInteractor,
                transitionInteractor = kosmos.keyguardTransitionInteractor,
                repository = keyguardRepository,
                repository = keyguardRepository,
                logger = logger,
                logger = logger,
                featureFlags =
                featureFlags = kosmos.fakeFeatureFlagsClassic,
                    kosmos.fakeFeatureFlagsClassic.apply {
                        set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, isLongPressFeatureEnabled)
                    },
                broadcastDispatcher = fakeBroadcastDispatcher,
                broadcastDispatcher = fakeBroadcastDispatcher,
                accessibilityManager = kosmos.accessibilityManagerWrapper,
                accessibilityManager = kosmos.accessibilityManagerWrapper,
                pulsingGestureListener = kosmos.pulsingGestureListener,
                pulsingGestureListener = kosmos.pulsingGestureListener,
@@ -334,7 +322,7 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
        keyguardTransitionRepository.sendTransitionSteps(
        keyguardTransitionRepository.sendTransitionSteps(
            from = KeyguardState.AOD,
            from = KeyguardState.AOD,
            to = keyguardState,
            to = keyguardState,
            testScope = testScope
            testScope = testScope,
        )
        )
        keyguardRepository.setQuickSettingsVisible(isVisible = isQuickSettingsVisible)
        keyguardRepository.setQuickSettingsVisible(isVisible = isQuickSettingsVisible)
    }
    }
+0 −3
Original line number Original line Diff line number Diff line
@@ -26,9 +26,7 @@ import com.android.systemui.biometrics.authController
import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.flags.Flags
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardClockRepository
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
import com.android.systemui.keyguard.data.repository.keyguardOcclusionRepository
import com.android.systemui.keyguard.shared.model.ClockSize
import com.android.systemui.keyguard.shared.model.ClockSize
@@ -77,7 +75,6 @@ class LockscreenContentViewModelTest(flags: FlagsParameterization) : SysuiTestCa
    @Before
    @Before
    fun setup() {
    fun setup() {
        with(kosmos) {
        with(kosmos) {
            fakeFeatureFlagsClassic.set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, true)
            shadeRepository.setShadeLayoutWide(false)
            shadeRepository.setShadeLayoutWide(false)
            underTest = lockscreenContentViewModel
            underTest = lockscreenContentViewModel
            underTest.activateIn(testScope)
            underTest.activateIn(testScope)
+0 −4
Original line number Original line Diff line number Diff line
@@ -100,10 +100,6 @@ object Flags {
    // TODO(b/242908637): Tracking Bug
    // TODO(b/242908637): Tracking Bug
    @JvmField val WALLPAPER_FULLSCREEN_PREVIEW = releasedFlag("wallpaper_fullscreen_preview")
    @JvmField val WALLPAPER_FULLSCREEN_PREVIEW = releasedFlag("wallpaper_fullscreen_preview")


    /** Whether the long-press gesture to open wallpaper picker is enabled. */
    // TODO(b/266242192): Tracking Bug
    @JvmField val LOCK_SCREEN_LONG_PRESS_ENABLED = releasedFlag("lock_screen_long_press_enabled")

    /** Inflate and bind views upon emitting a blueprint value . */
    /** Inflate and bind views upon emitting a blueprint value . */
    // TODO(b/297365780): Tracking Bug
    // TODO(b/297365780): Tracking Bug
    @JvmField val LAZY_INFLATE_KEYGUARD = releasedFlag("lazy_inflate_keyguard")
    @JvmField val LAZY_INFLATE_KEYGUARD = releasedFlag("lazy_inflate_keyguard")
+5 −12
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.content.IntentFilter
import android.view.accessibility.AccessibilityManager
import android.view.accessibility.AccessibilityManager
import androidx.annotation.VisibleForTesting
import androidx.annotation.VisibleForTesting
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.internal.logging.UiEvent
import com.android.internal.logging.UiEvent
import com.android.internal.logging.UiEventLogger
import com.android.internal.logging.UiEventLogger
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.broadcast.BroadcastDispatcher
@@ -29,7 +30,6 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.res.R
import com.android.systemui.res.R
@@ -51,7 +51,6 @@ import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.stateIn
import com.android.app.tracing.coroutines.launchTraced as launch


/** Business logic for use-cases related to top-level touch handling in the lock screen. */
/** Business logic for use-cases related to top-level touch handling in the lock screen. */
@OptIn(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
@@ -121,9 +120,7 @@ constructor(
    init {
    init {
        if (isFeatureEnabled()) {
        if (isFeatureEnabled()) {
            broadcastDispatcher
            broadcastDispatcher
                .broadcastFlow(
                .broadcastFlow(IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
                    IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS),
                )
                .onEach { hideMenu() }
                .onEach { hideMenu() }
                .launchIn(scope)
                .launchIn(scope)
        }
        }
@@ -188,8 +185,7 @@ constructor(
    }
    }


    private fun isFeatureEnabled(): Boolean {
    private fun isFeatureEnabled(): Boolean {
        return featureFlags.isEnabled(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED) &&
        return context.resources.getBoolean(R.bool.long_press_keyguard_customize_lockscreen_enabled)
            context.resources.getBoolean(R.bool.long_press_keyguard_customize_lockscreen_enabled)
    }
    }


    /** Updates application state to ask to show the menu. */
    /** Updates application state to ask to show the menu. */
@@ -230,14 +226,11 @@ constructor(
            .toLong()
            .toLong()
    }
    }


    enum class LogEvents(
    enum class LogEvents(private val _id: Int) : UiEventLogger.UiEventEnum {
        private val _id: Int,
    ) : UiEventLogger.UiEventEnum {
        @UiEvent(doc = "The lock screen was long-pressed and we showed the settings popup menu.")
        @UiEvent(doc = "The lock screen was long-pressed and we showed the settings popup menu.")
        LOCK_SCREEN_LONG_PRESS_POPUP_SHOWN(1292),
        LOCK_SCREEN_LONG_PRESS_POPUP_SHOWN(1292),
        @UiEvent(doc = "The lock screen long-press popup menu was clicked.")
        @UiEvent(doc = "The lock screen long-press popup menu was clicked.")
        LOCK_SCREEN_LONG_PRESS_POPUP_CLICKED(1293),
        LOCK_SCREEN_LONG_PRESS_POPUP_CLICKED(1293);
        ;


        override fun getId() = _id
        override fun getId() = _id
    }
    }
+3 −6
Original line number Original line Diff line number Diff line
@@ -32,8 +32,8 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.dock.DockManagerFake
import com.android.systemui.dock.DockManagerFake
import com.android.systemui.flags.FakeFeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.quickaffordance.BuiltInKeyguardQuickAffordanceKeys
import com.android.systemui.keyguard.data.quickaffordance.BuiltInKeyguardQuickAffordanceKeys
import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceConfig
import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceConfig
import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceProviderClientFactory
import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceProviderClientFactory
@@ -191,10 +191,7 @@ class KeyguardQuickAffordancesCombinedViewModelTest : SysuiTestCase() {
        dockManager = DockManagerFake()
        dockManager = DockManagerFake()
        biometricSettingsRepository = FakeBiometricSettingsRepository()
        biometricSettingsRepository = FakeBiometricSettingsRepository()


        val featureFlags =
        val withDeps = KeyguardInteractorFactory.create()
            FakeFeatureFlags().apply { set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, false) }

        val withDeps = KeyguardInteractorFactory.create(featureFlags = featureFlags)
        keyguardInteractor = withDeps.keyguardInteractor
        keyguardInteractor = withDeps.keyguardInteractor
        repository = withDeps.repository
        repository = withDeps.repository


@@ -287,7 +284,7 @@ class KeyguardQuickAffordancesCombinedViewModelTest : SysuiTestCase() {
                        keyguardStateController = keyguardStateController,
                        keyguardStateController = keyguardStateController,
                        userTracker = userTracker,
                        userTracker = userTracker,
                        activityStarter = activityStarter,
                        activityStarter = activityStarter,
                        featureFlags = featureFlags,
                        featureFlags = kosmos.fakeFeatureFlagsClassic,
                        repository = { quickAffordanceRepository },
                        repository = { quickAffordanceRepository },
                        launchAnimator = launchAnimator,
                        launchAnimator = launchAnimator,
                        logger = logger,
                        logger = logger,
Loading