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

Commit 70057436 authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Allow to increase Notif height with drag-to-expand on the LS

As the user drags down on a Notification on the LS, the Notification
will gradually increase its actual height. However StackSizeCalculator
will override it with a restricted height for the Lockscreen. Previously
we were making an exception for this restriction based on
"fractionToShade", but since NSSL cannot control the Shade expansion state
directly anymore, we cannot rely on this value.

This CL exempts Notifications from the LS constraints in StackSizeCalculator
while the user is dragging on them.

Bug: 359957196
Test: Drag down on a Notification on the LS -> Check if its rendered height is growing
Flag: com.android.systemui.scene_container
Change-Id: I1f223159d1701f7e931ace38069df03f04365a09
parent 86a624c0
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.view.View.VISIBLE
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.testScope
import com.android.systemui.media.controls.domain.pipeline.MediaDataManager
import com.android.systemui.res.R
@@ -382,6 +383,35 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {
        assertThat(space.whenSavingSpace).isEqualTo(5)
    }

    @Test
    @EnableSceneContainer
    fun getSpaceNeeded_onLockscreenAndUserLocked_intrinsicHeight() {
        // GIVEN: No divider height since we're testing one element where index = 0
        setGapHeight(0f)

        // AND: the row has its max height
        val expandableView = createMockRow(rowHeight)

        // AND: the user is dragging down on the Notification
        whenever(expandableView.isUserLocked).thenReturn(true)

        // AND: the row has a smaller min height, that we won't use here
        whenever(expandableView.getMinHeight(any())).thenReturn(1)

        // WHEN: we calculate the space for the Lockscreen
        val space =
            sizeCalculator.getSpaceNeeded(
                expandableView,
                visibleIndex = 0,
                previousView = null,
                stack = stackLayout,
                onLockscreen = true,
            )

        // THEN: the row gets its unrestricted height (if there's enough space)
        assertThat(space.whenEnoughSpace).isEqualTo(rowHeight)
    }

    @Test
    fun getSpaceNeeded_notOnLockscreen_intrinsicHeight() {
        setGapHeight(0f)
+5 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.media.controls.domain.pipeline.MediaDataManager
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.statusbar.LockscreenShadeTransitionController
import com.android.systemui.statusbar.StatusBarState.KEYGUARD
@@ -421,6 +422,7 @@ constructor(
                "\tcomputeHeightPerNotificationLimit i=$i notifs=$notifications " +
                    "notifsHeightSavingSpace=$notifsWithCollapsedHun" +
                    " shelfWithSpaceBefore=$shelfWithSpaceBefore" +
                    " isOnLockScreen=$onLockscreen" +
                    " limitLockScreenToOneImportant: $limitLockScreenToOneImportant"
            }
            yield(
@@ -476,7 +478,9 @@ constructor(
            if (onLockscreen) {
                if (
                    view is ExpandableNotificationRow &&
                        (canPeek || view.isPromotedOngoing)
                        (canPeek ||
                            view.isPromotedOngoing ||
                            (SceneContainerFlag.isEnabled && view.isUserLocked))
                ) {
                    height
                } else {