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

Commit e803d7d8 authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Add isShadeFullyExpanded and isQsFullscreen" into main

parents 499d8e4a a2db71ca
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -973,6 +973,7 @@ public class QuickSettingsController implements Dumpable {

    void updateQsState() {
        boolean qsFullScreen = getExpanded() && !mSplitShadeEnabled;
        mShadeRepository.setLegacyQsFullscreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setScrollingEnabled(
                mBarState != KEYGUARD && (!qsFullScreen || mExpansionFromOverscroll));
+19 −2
Original line number Diff line number Diff line
@@ -102,6 +102,13 @@ interface ShadeRepository {
    @Deprecated("Use ShadeInteractor.isQsBypassingShade instead")
    val legacyExpandImmediate: 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>

    /**  */
    @Deprecated("Use ShadeInteractor instead")
    fun setLegacyQsFullscreen(legacyQsFullscreen: Boolean)

    /**
     * Sets whether Quick Settings is being expanded without first expanding the Shade or Quick
     * Settings is being collapsed without first collapsing to shade.
@@ -121,12 +128,13 @@ interface ShadeRepository {
    fun setLegacyExpandedOrAwaitingInputTransfer(legacyExpandedOrAwaitingInputTransfer: Boolean)

    /** Sets whether the user is moving Quick Settings with a pointer */
    fun setLegacyQsTracking(legacyQsTracking: Boolean)
    @Deprecated("Use ShadeInteractor instead") fun setLegacyQsTracking(legacyQsTracking: Boolean)

    /** Sets whether the user is moving the shade with a pointer */
    fun setLegacyShadeTracking(tracking: Boolean)
    @Deprecated("Use ShadeInteractor instead") fun setLegacyShadeTracking(tracking: Boolean)

    /** Sets whether the user is moving the shade with a pointer, on lockscreen only */
    @Deprecated("Use ShadeInteractor instead")
    fun setLegacyLockscreenShadeTracking(tracking: Boolean)

    /** Amount shade has expanded with regard to the UDFPS location */
@@ -216,8 +224,17 @@ constructor(shadeExpansionStateManager: ShadeExpansionStateManager) : ShadeRepos
    override val legacyIsQsExpanded: StateFlow<Boolean> = _legacyIsQsExpanded.asStateFlow()

    private val _legacyExpandImmediate = MutableStateFlow(false)
    @Deprecated("Use ShadeInteractor instead")
    override val legacyExpandImmediate: StateFlow<Boolean> = _legacyExpandImmediate.asStateFlow()

    private val _legacyQsFullscreen = MutableStateFlow(false)
    @Deprecated("Use ShadeInteractor instead")
    override val legacyQsFullscreen: StateFlow<Boolean> = _legacyQsFullscreen.asStateFlow()

    override fun setLegacyQsFullscreen(legacyQsFullscreen: Boolean) {
        _legacyQsFullscreen.value = legacyQsFullscreen
    }

    override fun setLegacyExpandImmediate(legacyExpandImmediate: Boolean) {
        _legacyExpandImmediate.value = legacyExpandImmediate
    }
+10 −1
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ interface ShadeInteractor : BaseShadeInteractor {
    /** Whether either the shade or QS is fully expanded. */
    val isAnyFullyExpanded: Flow<Boolean>

    /** Whether the Shade is fully expanded. */
    val isShadeFullyExpanded: Flow<Boolean>

    /**
     * Whether the user is expanding or collapsing either the shade or quick settings with user
     * input (i.e. dragging a pointer). This will be true even if the user's input gesture had ended
@@ -61,7 +64,7 @@ interface BaseShadeInteractor {
     */
    val isAnyExpanded: StateFlow<Boolean>

    /** The amount [0-1] that the shade has been opened */
    /** The amount [0-1] that the shade has been opened. */
    val shadeExpansion: Flow<Float>

    /**
@@ -81,6 +84,12 @@ interface BaseShadeInteractor {
     */
    val isQsBypassingShade: Flow<Boolean>

    /**
     * Emits true when QS is displayed over the entire screen of the device. Currently, this only
     * happens on phones that are not unfolded when QS expansion is equal to 1.
     */
    val isQsFullscreen: Flow<Boolean>

    /**
     * Whether the user is expanding or collapsing the shade with user input. This will be true even
     * if the user's input gesture has ended but a transition they initiated is animating.
+2 −0
Original line number Diff line number Diff line
@@ -32,8 +32,10 @@ class ShadeInteractorEmptyImpl @Inject constructor() : ShadeInteractor {
    override val qsExpansion: StateFlow<Float> = inactiveFlowFloat
    override val isQsExpanded: StateFlow<Boolean> = inactiveFlowBoolean
    override val isQsBypassingShade: Flow<Boolean> = inactiveFlowBoolean
    override val isQsFullscreen: Flow<Boolean> = inactiveFlowBoolean
    override val anyExpansion: StateFlow<Float> = inactiveFlowFloat
    override val isAnyFullyExpanded: Flow<Boolean> = inactiveFlowBoolean
    override val isShadeFullyExpanded: Flow<Boolean> = inactiveFlowBoolean
    override val isAnyExpanded: StateFlow<Boolean> = inactiveFlowBoolean
    override val isUserInteractingWithShade: Flow<Boolean> = inactiveFlowBoolean
    override val isUserInteractingWithQs: Flow<Boolean> = inactiveFlowBoolean
+3 −0
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@ constructor(
    override val isAnyFullyExpanded: Flow<Boolean> =
        anyExpansion.map { it >= 1f }.distinctUntilChanged()

    override val isShadeFullyExpanded: Flow<Boolean> =
        baseShadeInteractor.shadeExpansion.map { it >= 1f }.distinctUntilChanged()

    override val isUserInteracting: Flow<Boolean> =
        combine(isUserInteractingWithShade, isUserInteractingWithQs) { shade, qs -> shade || qs }
            .distinctUntilChanged()
Loading