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

Commit e028e7cc authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[bc25] Remove QuickSettingsShadeScene and associated code." into main

parents a0520730 c0e9c2cb
Loading
Loading
Loading
Loading
+0 −29
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.scene

import com.android.systemui.qs.ui.composable.QuickSettingsShadeScene
import com.android.systemui.scene.ui.composable.Scene
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoSet

@Module
interface QuickSettingsShadeSceneModule {

    @Binds @IntoSet fun quickSettingsShade(scene: QuickSettingsShadeScene): Scene
}
+0 −92
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.qs.ui.composable

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserActionResult
import com.android.systemui.battery.BatteryMeterViewController
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.lifecycle.ExclusiveActivatable
import com.android.systemui.lifecycle.rememberViewModel
import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeSceneContentViewModel
import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeUserActionsViewModel
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.ui.composable.Scene
import com.android.systemui.shade.ui.composable.ExpandedShadeHeader
import com.android.systemui.shade.ui.composable.OverlayShade
import com.android.systemui.shade.ui.viewmodel.ShadeHeaderViewModel
import com.android.systemui.statusbar.phone.ui.StatusBarIconController
import com.android.systemui.statusbar.phone.ui.TintedIconManager
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow

@SysUISingleton
class QuickSettingsShadeScene
@Inject
constructor(
    private val actionsViewModelFactory: QuickSettingsShadeUserActionsViewModel.Factory,
    private val contentViewModelFactory: QuickSettingsShadeSceneContentViewModel.Factory,
    private val shadeHeaderViewModelFactory: ShadeHeaderViewModel.Factory,
    private val tintedIconManagerFactory: TintedIconManager.Factory,
    private val batteryMeterViewControllerFactory: BatteryMeterViewController.Factory,
    private val statusBarIconController: StatusBarIconController,
) : ExclusiveActivatable(), Scene {

    override val key = Scenes.QuickSettingsShade

    private val actionsViewModel: QuickSettingsShadeUserActionsViewModel by lazy {
        actionsViewModelFactory.create()
    }

    override val userActions: Flow<Map<UserAction, UserActionResult>> = actionsViewModel.actions

    override suspend fun onActivated(): Nothing {
        actionsViewModel.activate()
    }

    @Composable
    override fun SceneScope.Content(
        modifier: Modifier,
    ) {
        val viewModel =
            rememberViewModel("QuickSettingsShadeScene") { contentViewModelFactory.create() }

        OverlayShade(
            modifier = modifier,
            onScrimClicked = {},
        ) {
            Column {
                ExpandedShadeHeader(
                    viewModelFactory = shadeHeaderViewModelFactory,
                    createTintedIconManager = tintedIconManagerFactory::create,
                    createBatteryMeterViewController = batteryMeterViewControllerFactory::create,
                    statusBarIconController = statusBarIconController,
                    modifier = Modifier.padding(QuickSettingsShade.Dimensions.Padding),
                )

                ShadeBody(
                    viewModel = viewModel.quickSettingsContainerViewModel,
                )
            }
        }
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import dagger.multibindings.IntoMap
            QuickSettingsSceneModule::class,
            ShadeSceneModule::class,
            QuickSettingsShadeOverlayModule::class,
            QuickSettingsShadeSceneModule::class,
            NotificationsShadeOverlayModule::class,
            NotificationsShadeSceneModule::class,
            NotificationsShadeSessionModule::class,
+4 −18
Original line number Diff line number Diff line
@@ -69,26 +69,11 @@ object Scenes {
     * scene is used.
     *
     * For the dual shade configuration, where there are two separate shades: one for notifications
     * and one for quick settings, [NotificationsShade] and [QuickSettingsShade] scenes are used
     * respectively.
     * and one for quick settings, the overlays `NotificationsShade` and `QuickSettingsShade` are
     * used respectively.
     */
    @JvmField val QuickSettings = SceneKey("quick_settings")

    /**
     * The quick settings shade scene shows the quick setting tiles as an overlay UI.
     *
     * It's used only in the dual shade configuration, where there are two separate shades: one for
     * quick settings (this scene) and another for [NotificationsShade].
     *
     * It's not used in the single/accordion configuration (swipe down once to reveal the shade,
     * swipe down again the to expand quick settings) or in the "split" shade configuration (on
     * large screens or unfolded foldables, where notifications and quick settings are shown
     * side-by-side in their own columns).
     */
    @Deprecated("The quick settings shade scene has been replaced by an overlay")
    @JvmField
    val QuickSettingsShade = SceneKey("quick_settings_shade")

    /**
     * The shade is the scene that shows a scrollable list of notifications and the minimized
     * version of quick settings (AKA "quick quick settings" or "QQS").
@@ -97,7 +82,8 @@ object Scenes {
     * swipe down again the to expand quick settings) and for the "split" shade configuration (on
     * large screens or unfolded foldables, where notifications and quick settings are shown
     * side-by-side in their own columns). For the dual shade configuration, where there are two
     * separate shades: one for notifications and one for quick settings, other scenes are used.
     * separate shades: one for notifications and one for quick settings, the overlays
     * `NotificationsShade` and `QuickSettingsShade` are used respectively.
     */
    @JvmField val Shade = SceneKey("shade")
}