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

Commit 02ae2fc6 authored by burakov's avatar burakov
Browse files

[bc25] Remove SceneFamilies.NotifShade and associated resolver code.

Bug: 356596436
Flag: com.android.systemui.scene_container
Test: Existing unit tests still pass.
Test: Tested manually that Single and Split shades are still working
 by expanding and collapsing each on both Gone and Lockscreen.
Change-Id: I535a27bc3342bfd61b07ef2d426ee5e025064f7f
parent e716b400
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import com.android.systemui.scene.data.repository.Idle
import com.android.systemui.scene.data.repository.Transition
import com.android.systemui.scene.data.repository.setSceneTransition
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.domain.resolver.notifShadeSceneFamilyResolver
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.testKosmos
@@ -79,7 +78,6 @@ class KeyguardDismissActionInteractorTest : SysuiTestCase() {
                applicationScope = testScope.backgroundScope,
                sceneInteractor = { kosmos.sceneInteractor },
                deviceUnlockedInteractor = { kosmos.deviceUnlockedInteractor },
                notifShadeSceneFamilyResolver = { kosmos.notifShadeSceneFamilyResolver },
                powerInteractor = kosmos.powerInteractor,
                alternateBouncerInteractor = kosmos.alternateBouncerInteractor,
                shadeInteractor = { kosmos.shadeInteractor },
+1 −4
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.domain.resolver.NotifShadeSceneFamilyResolver
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.domain.interactor.ShadeInteractor
@@ -63,7 +62,6 @@ constructor(
    @Application private val applicationScope: CoroutineScope,
    sceneInteractor: Lazy<SceneInteractor>,
    deviceUnlockedInteractor: Lazy<DeviceUnlockedInteractor>,
    notifShadeSceneFamilyResolver: Lazy<NotifShadeSceneFamilyResolver>,
    powerInteractor: PowerInteractor,
    alternateBouncerInteractor: AlternateBouncerInteractor,
    shadeInteractor: Lazy<ShadeInteractor>,
@@ -107,8 +105,7 @@ constructor(
                    deviceUnlockedInteractor.get().deviceUnlockStatus,
                ) { scene, unlockStatus ->
                    unlockStatus.isUnlocked &&
                        (scene == Scenes.QuickSettings ||
                            notifShadeSceneFamilyResolver.get().includesScene(scene))
                        (scene == Scenes.QuickSettings || scene == Scenes.Shade)
                }
                .distinctUntilChanged()
        } else if (ComposeBouncerFlags.isOnlyComposeBouncerEnabled()) {
+0 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import com.android.systemui.notifications.ui.composable.NotificationsShadeSessio
import com.android.systemui.scene.domain.SceneDomainModule
import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor
import com.android.systemui.scene.domain.resolver.HomeSceneFamilyResolverModule
import com.android.systemui.scene.domain.resolver.NotifShadeSceneFamilyResolverModule
import com.android.systemui.scene.domain.startable.KeyguardStateCallbackStartable
import com.android.systemui.scene.domain.startable.SceneContainerStartable
import com.android.systemui.scene.domain.startable.ScrimStartable
@@ -55,7 +54,6 @@ import dagger.multibindings.IntoMap

            // List SceneResolver modules for supported SceneFamilies
            HomeSceneFamilyResolverModule::class,
            NotifShadeSceneFamilyResolverModule::class,
        ]
)
interface KeyguardlessSceneContainerFrameworkModule {
+0 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import com.android.systemui.notifications.ui.composable.NotificationsShadeSessio
import com.android.systemui.scene.domain.SceneDomainModule
import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor
import com.android.systemui.scene.domain.resolver.HomeSceneFamilyResolverModule
import com.android.systemui.scene.domain.resolver.NotifShadeSceneFamilyResolverModule
import com.android.systemui.scene.domain.startable.KeyguardStateCallbackStartable
import com.android.systemui.scene.domain.startable.SceneContainerStartable
import com.android.systemui.scene.domain.startable.ScrimStartable
@@ -59,7 +58,6 @@ import dagger.multibindings.IntoMap

            // List SceneResolver modules for supported SceneFamilies
            HomeSceneFamilyResolverModule::class,
            NotifShadeSceneFamilyResolverModule::class,
        ]
)
interface SceneContainerFrameworkModule {
+0 −71
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.domain.resolver

import com.android.compose.animation.scene.SceneKey
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.scene.shared.model.SceneFamilies
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor
import com.android.systemui.shade.shared.model.ShadeMode
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoSet
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn

@SysUISingleton
class NotifShadeSceneFamilyResolver
@Inject
constructor(
    @Application applicationScope: CoroutineScope,
    shadeModeInteractor: ShadeModeInteractor,
) : SceneResolver {
    override val targetFamily: SceneKey = SceneFamilies.NotifShade

    override val resolvedScene: StateFlow<SceneKey> =
        shadeModeInteractor.shadeMode
            .map(::notifShadeScene)
            .stateIn(
                applicationScope,
                started = SharingStarted.Eagerly,
                initialValue = notifShadeScene(shadeModeInteractor.shadeMode.value),
            )

    override fun includesScene(scene: SceneKey): Boolean = scene in notifShadeScenes

    private fun notifShadeScene(shadeMode: ShadeMode) =
        when (shadeMode) {
            is ShadeMode.Single -> Scenes.Shade
            is ShadeMode.Dual -> Scenes.NotificationsShade
            is ShadeMode.Split -> Scenes.Shade
        }

    companion object {
        val notifShadeScenes = setOf(Scenes.NotificationsShade, Scenes.Shade)
    }
}

@Module
interface NotifShadeSceneFamilyResolverModule {
    @Binds @IntoSet fun bindResolver(interactor: NotifShadeSceneFamilyResolver): SceneResolver
}
Loading