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

Commit 5611f3b3 authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Add a shadow to HUNs over GONE

HUNs used to have a z translation, when they were displayed outside the
shade over launcher. They have lost it over some refactors, which forces
ENR#isAboveShelf() to return false, which causes NSSL's child placement
logic to hit unexpected paths, which can ultimately result in some
flickering while snoozing a Notification.

Bug: 391204020
Test: post a HUN over launcher -> check its shadow
Flag: com.android.systemui.scene_container
Change-Id: I422207e3bf1c6e6614ec17138ec2d4ccab2ef283
parent 64cd689b
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -145,6 +145,20 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        resetViewStates_hunYTranslationIs(headsUpTop)
        resetViewStates_hunYTranslationIs(headsUpTop)
    }
    }


    @Test
    @EnableSceneContainer
    fun resetViewStates_defaultHun_hasShadow() {
        val headsUpTop = 200f
        ambientState.headsUpTop = headsUpTop

        whenever(notificationRow.isPinned).thenReturn(true)
        whenever(notificationRow.isHeadsUp).thenReturn(true)

        stackScrollAlgorithm.resetViewStates(ambientState, 0)

        assertThat(notificationRow.viewState.zTranslation).isGreaterThan(baseZ)
    }

    @Test
    @Test
    @DisableSceneContainer
    @DisableSceneContainer
    fun resetViewStates_defaultHunWhenShadeIsOpening_yTranslationIsInset() {
    fun resetViewStates_defaultHunWhenShadeIsOpening_yTranslationIsInset() {
+1 −0
Original line number Original line Diff line number Diff line
@@ -4228,6 +4228,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            pw.print(", isPinned: " + isPinned());
            pw.print(", isPinned: " + isPinned());
            pw.print(", expandedWhenPinned: " + mExpandedWhenPinned);
            pw.print(", expandedWhenPinned: " + mExpandedWhenPinned);
            pw.print(", isMinimized: " + mIsMinimized);
            pw.print(", isMinimized: " + mIsMinimized);
            pw.print(", isAboveShelf: " + isAboveShelf());


            pw.println();
            pw.println();
            if (NotificationContentView.INCLUDE_HEIGHTS_TO_DUMP) {
            if (NotificationContentView.INCLUDE_HEIGHTS_TO_DUMP) {
+9 −5
Original line number Original line Diff line number Diff line
@@ -1227,13 +1227,17 @@ public class StackScrollAlgorithm {
        float baseZ = ambientState.getBaseZHeight();
        float baseZ = ambientState.getBaseZHeight();


        if (SceneContainerFlag.isEnabled()) {
        if (SceneContainerFlag.isEnabled()) {
            // SceneContainer flags off this logic, and just sets the baseZ because:
            // SceneContainer simplifies this logic, because:
            // - there are no overlapping HUNs anymore, no need for multiplying their shadows
            // - there are no overlapping HUNs anymore, no need for multiplying their shadows
            // - shadows for HUNs overlapping with the stack are now set from updateHeadsUpStates
            // - shadows for HUNs overlapping with the stack are now set from updateHeadsUpStates
            // - shadows for HUNs overlapping with the shelf are NOT set anymore, because it only
            if (child.isPinned() || ambientState.getTrackedHeadsUpRow() == child) {
            // happens on AOD/Pulsing, where they're displayed on a black background so a shadow
                // set a default elevation on the HUN, which would be overridden
            // wouldn't be visible.
                // from updateHeadsUpStates if it is displayed in the shade
                childViewState.setZTranslation(baseZ + mPinnedZTranslationExtra);
            } else {
                // set baseZ for every notification
                childViewState.setZTranslation(baseZ);
                childViewState.setZTranslation(baseZ);
            }
        } else {
        } else {
            if (child.mustStayOnScreen() && !childViewState.headsUpIsVisible
            if (child.mustStayOnScreen() && !childViewState.headsUpIsVisible
                    && !ambientState.isDozingAndNotPulsing(child)
                    && !ambientState.isDozingAndNotPulsing(child)