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

Commit 94367ecd authored by burakov's avatar burakov Committed by Danny Burakov
Browse files

[Dual Shade] Set the shade invocation zone to always be split 50/50.

This is due to a recently changed decision that followed from moving
notifications to the left. Instead of a dynamic invocation zone based
on the position of status bar notifications icons, we'll have a simple
50/50 split of the status bar to invoke the notifications shade (on the
left) or quick settings shade (on the right).

This will be mirrored in RTL layouts respectively.

For the time being, we will keep the code in place to make this dynamic
again in the future.

Fix: 384898612
Test: Manually tested by opening and closing both the notifications
 shade and quick settings shade on a folded and unfolded device.
Flag: com.android.systemui.dual_shade
Change-Id: Ib74cab24e6cfc64f1988d1002bfdfe7dd6a86d6b
parent e32e28c7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -118,12 +118,12 @@ class ShadeModeInteractorImplTest : SysuiTestCase() {
        }

    @Test
    fun getTopEdgeSplitFraction_wideScreen_leftSideLarger() =
    fun getTopEdgeSplitFraction_wideScreen_splitInHalf() =
        testScope.runTest {
            // Ensure isShadeLayoutWide is collected.
            val isShadeLayoutWide by collectLastValue(underTest.isShadeLayoutWide)
            kosmos.shadeRepository.setShadeLayoutWide(true)

            assertThat(underTest.getTopEdgeSplitFraction()).isGreaterThan(0.5f)
            assertThat(underTest.getTopEdgeSplitFraction()).isEqualTo(0.5f)
        }
}
+1 −5
Original line number Diff line number Diff line
@@ -79,11 +79,7 @@ interface ShadeInteractor : BaseShadeInteractor {
     * The fraction between [0..1] (i.e., percentage) of screen width to consider the threshold
     * between "top-left" and "top-right" for the purposes of dual-shade invocation.
     *
     * When the dual-shade is not wide, this always returns 0.5 (the top edge is evenly split). On
     * wide layouts however, a larger fraction is returned because only the area of the system
     * status icons is considered top-right.
     *
     * Note that this fraction only determines the split between the absolute left and right
     * Note that this fraction only determines the *split* between the absolute left and right
     * directions. In RTL layouts, the "top-start" edge will resolve to "top-right", and "top-end"
     * will resolve to "top-left".
     */
+3 −13
Original line number Diff line number Diff line
@@ -76,10 +76,8 @@ interface ShadeModeInteractor {

class ShadeModeInteractorImpl
@Inject
constructor(
    @Application applicationScope: CoroutineScope,
    private val repository: ShadeRepository,
) : ShadeModeInteractor {
constructor(@Application applicationScope: CoroutineScope, repository: ShadeRepository) :
    ShadeModeInteractor {

    override val isShadeLayoutWide: StateFlow<Boolean> = repository.isShadeLayoutWide

@@ -92,15 +90,7 @@ constructor(
                initialValue = determineShadeMode(isShadeLayoutWide.value),
            )

    @FloatRange(from = 0.0, to = 1.0)
    override fun getTopEdgeSplitFraction(): Float {
        // Note: this implicitly relies on isShadeLayoutWide being hot (i.e. collected). This
        // assumption allows us to query its value on demand (during swipe source detection) instead
        // of running another infinite coroutine.
        // TODO(b/338577208): Instead of being fixed at 0.8f, this should dynamically updated based
        //  on the position of system-status icons in the status bar.
        return if (repository.isShadeLayoutWide.value) 0.8f else 0.5f
    }
    @FloatRange(from = 0.0, to = 1.0) override fun getTopEdgeSplitFraction(): Float = 0.5f

    private fun determineShadeMode(isShadeLayoutWide: Boolean): ShadeMode {
        return when {