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

Commit 37d24564 authored by Bryce Lee's avatar Bryce Lee
Browse files

Allow swiping to Glanceable Hub by config.

This change restores swipe to Glanceable Hub functionality,
enabled by configuration

Test: atest CommunalViewModelTest
Test: atest GlanceableHubContainerControllerTest
Bug: 389108560
Flag: EXEMPT bugfix
Change-Id: I03bf4ee6966d802f1d0c7085a9b58e2d4afd7b4b
parent 913d4058
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -200,8 +200,9 @@ fun CommunalContainer(
        scene(
            CommunalScenes.Blank,
            userActions =
                if (viewModel.v2FlagEnabled()) emptyMap()
                else mapOf(Swipe.Start(fromSource = Edge.End) to CommunalScenes.Communal),
                if (viewModel.swipeToHubEnabled())
                    mapOf(Swipe.Start(fromSource = Edge.End) to CommunalScenes.Communal)
                else emptyMap(),
        ) {
            // This scene shows nothing only allowing for transitions to the communal scene.
            Box(modifier = Modifier.fillMaxSize())
+1 −0
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
            metricsLogger,
            kosmos.mediaCarouselController,
            kosmos.blurConfig,
            false,
        )
    }

+3 −0
Original line number Diff line number Diff line
@@ -1110,4 +1110,7 @@
    <!-- Configuration for wallpaper focal area -->
    <bool name="center_align_focal_area_shape">false</bool>
    <string name="focal_area_target" translatable="false" />

    <!-- Configuration to swipe to open glanceable hub -->
    <bool name="config_swipeToOpenGlanceableHub">false</bool>
</resources>
+7 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ interface CommunalModule {
    companion object {
        const val LOGGABLE_PREFIXES = "loggable_prefixes"
        const val LAUNCHER_PACKAGE = "launcher_package"
        const val SWIPE_TO_HUB = "swipe_to_hub"

        @Provides
        @Communal
@@ -143,5 +144,11 @@ interface CommunalModule {
        fun provideLauncherPackage(@Main resources: Resources): String {
            return resources.getString(R.string.launcher_overlayable_package)
        }

        @Provides
        @Named(SWIPE_TO_HUB)
        fun provideSwipeToHub(@Main resources: Resources): Boolean {
            return resources.getBoolean(R.bool.config_swipeToOpenGlanceableHub)
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.communal.ui.viewmodel
import android.content.ComponentName
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.Flags
import com.android.systemui.communal.dagger.CommunalModule.Companion.SWIPE_TO_HUB
import com.android.systemui.communal.domain.interactor.CommunalInteractor
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor
import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor
@@ -92,6 +93,7 @@ constructor(
    private val metricsLogger: CommunalMetricsLogger,
    mediaCarouselController: MediaCarouselController,
    blurConfig: BlurConfig,
    @Named(SWIPE_TO_HUB) private val swipeToHub: Boolean,
) :
    BaseCommunalViewModel(
        communalSceneInteractor,
@@ -349,6 +351,8 @@ constructor(
    /** See [CommunalSettingsInteractor.isV2FlagEnabled] */
    fun v2FlagEnabled(): Boolean = communalSettingsInteractor.isV2FlagEnabled()

    fun swipeToHubEnabled(): Boolean = swipeToHub

    companion object {
        const val POPUP_AUTO_HIDE_TIMEOUT_MS = 12000L
    }
Loading