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

Commit a2db71ca authored by Justin Weir's avatar Justin Weir
Browse files

Add isShadeFullyExpanded and isQsFullscreen

This is to assist the ag/25175282 relation chain

Bug: 293167744
Test: added new unit tests
Test: build and manually verify basic CUJs
Flag: NONE
Change-Id: I68b213479e95226b198e96a4b99334707e2f0fcf
parent e89b3ae1
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -973,6 +973,7 @@ public class QuickSettingsController implements Dumpable {


    void updateQsState() {
    void updateQsState() {
        boolean qsFullScreen = getExpanded() && !mSplitShadeEnabled;
        boolean qsFullScreen = getExpanded() && !mSplitShadeEnabled;
        mShadeRepository.setLegacyQsFullscreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setQsFullScreen(qsFullScreen);
        mNotificationStackScrollLayoutController.setScrollingEnabled(
        mNotificationStackScrollLayoutController.setScrollingEnabled(
                mBarState != KEYGUARD && (!qsFullScreen || mExpansionFromOverscroll));
                mBarState != KEYGUARD && (!qsFullScreen || mExpansionFromOverscroll));
+19 −2
Original line number Original line Diff line number Diff line
@@ -102,6 +102,13 @@ interface ShadeRepository {
    @Deprecated("Use ShadeInteractor.isQsBypassingShade instead")
    @Deprecated("Use ShadeInteractor.isQsBypassingShade instead")
    val legacyExpandImmediate: StateFlow<Boolean>
    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
     * Sets whether Quick Settings is being expanded without first expanding the Shade or Quick
     * Settings is being collapsed without first collapsing to shade.
     * Settings is being collapsed without first collapsing to shade.
@@ -121,12 +128,13 @@ interface ShadeRepository {
    fun setLegacyExpandedOrAwaitingInputTransfer(legacyExpandedOrAwaitingInputTransfer: Boolean)
    fun setLegacyExpandedOrAwaitingInputTransfer(legacyExpandedOrAwaitingInputTransfer: Boolean)


    /** Sets whether the user is moving Quick Settings with a pointer */
    /** 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 */
    /** 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 */
    /** Sets whether the user is moving the shade with a pointer, on lockscreen only */
    @Deprecated("Use ShadeInteractor instead")
    fun setLegacyLockscreenShadeTracking(tracking: Boolean)
    fun setLegacyLockscreenShadeTracking(tracking: Boolean)


    /** Amount shade has expanded with regard to the UDFPS location */
    /** 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()
    override val legacyIsQsExpanded: StateFlow<Boolean> = _legacyIsQsExpanded.asStateFlow()


    private val _legacyExpandImmediate = MutableStateFlow(false)
    private val _legacyExpandImmediate = MutableStateFlow(false)
    @Deprecated("Use ShadeInteractor instead")
    override val legacyExpandImmediate: StateFlow<Boolean> = _legacyExpandImmediate.asStateFlow()
    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) {
    override fun setLegacyExpandImmediate(legacyExpandImmediate: Boolean) {
        _legacyExpandImmediate.value = legacyExpandImmediate
        _legacyExpandImmediate.value = legacyExpandImmediate
    }
    }
+10 −1
Original line number Original line Diff line number Diff line
@@ -31,6 +31,9 @@ interface ShadeInteractor : BaseShadeInteractor {
    /** Whether either the shade or QS is fully expanded. */
    /** Whether either the shade or QS is fully expanded. */
    val isAnyFullyExpanded: Flow<Boolean>
    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
     * 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
     * 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>
    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>
    val shadeExpansion: Flow<Float>


    /**
    /**
@@ -81,6 +84,12 @@ interface BaseShadeInteractor {
     */
     */
    val isQsBypassingShade: Flow<Boolean>
    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
     * 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.
     * if the user's input gesture has ended but a transition they initiated is animating.
+2 −0
Original line number Original line Diff line number Diff line
@@ -32,8 +32,10 @@ class ShadeInteractorEmptyImpl @Inject constructor() : ShadeInteractor {
    override val qsExpansion: StateFlow<Float> = inactiveFlowFloat
    override val qsExpansion: StateFlow<Float> = inactiveFlowFloat
    override val isQsExpanded: StateFlow<Boolean> = inactiveFlowBoolean
    override val isQsExpanded: StateFlow<Boolean> = inactiveFlowBoolean
    override val isQsBypassingShade: Flow<Boolean> = inactiveFlowBoolean
    override val isQsBypassingShade: Flow<Boolean> = inactiveFlowBoolean
    override val isQsFullscreen: Flow<Boolean> = inactiveFlowBoolean
    override val anyExpansion: StateFlow<Float> = inactiveFlowFloat
    override val anyExpansion: StateFlow<Float> = inactiveFlowFloat
    override val isAnyFullyExpanded: Flow<Boolean> = inactiveFlowBoolean
    override val isAnyFullyExpanded: Flow<Boolean> = inactiveFlowBoolean
    override val isShadeFullyExpanded: Flow<Boolean> = inactiveFlowBoolean
    override val isAnyExpanded: StateFlow<Boolean> = inactiveFlowBoolean
    override val isAnyExpanded: StateFlow<Boolean> = inactiveFlowBoolean
    override val isUserInteractingWithShade: Flow<Boolean> = inactiveFlowBoolean
    override val isUserInteractingWithShade: Flow<Boolean> = inactiveFlowBoolean
    override val isUserInteractingWithQs: Flow<Boolean> = inactiveFlowBoolean
    override val isUserInteractingWithQs: Flow<Boolean> = inactiveFlowBoolean
+3 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,9 @@ constructor(
    override val isAnyFullyExpanded: Flow<Boolean> =
    override val isAnyFullyExpanded: Flow<Boolean> =
        anyExpansion.map { it >= 1f }.distinctUntilChanged()
        anyExpansion.map { it >= 1f }.distinctUntilChanged()


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

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