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

Commit 277c5beb authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[Flexiglas] Split shade - data layer

Data layer changes to support the split shade.

Split shade is the single panel shade that's shown for large screens and
unfolded devices where quick settings is one the left and notifications
is on the right.

Bug: 328473018
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Test: see next CLs
Change-Id: I71264bca1493f4e82c37d9a7fb03f1847843a828
parent 81408d50
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -100,12 +100,17 @@ interface ShadeRepository {
    @Deprecated("Use ShadeInteractor.isQsBypassingShade instead")
    val legacyExpandImmediate: StateFlow<Boolean>

    /** Whether the current configuration requires the split shade to be shown. */
    val isSplitShade: StateFlow<Boolean>

    /** True when QS is taking up the entire screen, i.e. fully expanded on a non-unfolded phone. */
    @Deprecated("Use ShadeInteractor instead") val legacyQsFullscreen: StateFlow<Boolean>

    /** NPVC.mClosing as a flow. */
    @Deprecated("Use ShadeAnimationInteractor instead") val legacyIsClosing: StateFlow<Boolean>

    fun setSplitShade(isSplitShade: Boolean)

    /** Sets whether a closing animation is happening. */
    @Deprecated("Use ShadeAnimationInteractor instead") fun setLegacyIsClosing(isClosing: Boolean)

@@ -214,6 +219,13 @@ class ShadeRepositoryImpl @Inject constructor() : ShadeRepository {
    @Deprecated("Use ShadeInteractor instead")
    override val legacyQsFullscreen: StateFlow<Boolean> = _legacyQsFullscreen.asStateFlow()

    val _isSplitShade = MutableStateFlow(false)
    override val isSplitShade: StateFlow<Boolean> = _isSplitShade.asStateFlow()

    override fun setSplitShade(isSplitShade: Boolean) {
        _isSplitShade.value = isSplitShade
    }

    override fun setLegacyQsFullscreen(legacyQsFullscreen: Boolean) {
        _legacyQsFullscreen.value = legacyQsFullscreen
    }
+5 −1
Original line number Diff line number Diff line
@@ -30,7 +30,11 @@ import kotlinx.coroutines.flow.asStateFlow

@SysUISingleton
class FakeConfigurationRepository @Inject constructor() : ConfigurationRepository {
    private val _onAnyConfigurationChange = MutableSharedFlow<Unit>()
    private val _onAnyConfigurationChange =
        MutableSharedFlow<Unit>(
            replay = 1,
            onBufferOverflow = BufferOverflow.DROP_OLDEST,
        )
    override val onAnyConfigurationChange: Flow<Unit> = _onAnyConfigurationChange.asSharedFlow()

    private val _onConfigurationChange =
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import dagger.Module
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow

/** Fake implementation of [ShadeRepository] */
@SysUISingleton
@@ -59,6 +60,9 @@ class FakeShadeRepository @Inject constructor() : ShadeRepository {

    override val legacyLockscreenShadeTracking = MutableStateFlow(false)

    private val _isSplitShade = MutableStateFlow(false)
    override val isSplitShade: StateFlow<Boolean> = _isSplitShade.asStateFlow()

    @Deprecated("Use ShadeInteractor instead")
    override fun setLegacyIsQsExpanded(legacyIsQsExpanded: Boolean) {
        _legacyIsQsExpanded.value = legacyIsQsExpanded
@@ -131,6 +135,10 @@ class FakeShadeRepository @Inject constructor() : ShadeRepository {
    override fun setLegacyShadeExpansion(expandedFraction: Float) {
        _legacyShadeExpansion.value = expandedFraction
    }

    override fun setSplitShade(isSplitShade: Boolean) {
        _isSplitShade.value = isSplitShade
    }
}

@Module
+1 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 * 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.
+22 −0
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.user.data.repository

import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture

val Kosmos.userSwitcherRepository by Fixture { FakeUserSwitcherRepository() }