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

Commit 28b24cbd authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed an issue where HUNs would be clipped on tablets

Because the NSSL can be inset, notifications can actually be
positioned outside of the container when HUNd. Our clipping
logic was assuming that our minimum position would be 0,
which is incorrect.
We now don't make such assumptions about minimum positions.

Fixes: 421318771
Test: atest SystemUITests
Flag: com.android.systemui.physical_notification_movement
Change-Id: I75dc0acde74d314d075ef67de7b40b14a9c0595a
parent a36d566e
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1410,17 +1410,20 @@ public class NotificationStackScrollLayout
            return;
        }
        createSortedNotificationLists(mTmpSortedChildren, mTmpNonOverlapChildren);
        // Now lets update the overlaps for the views, ensuring that we set the values for every
        // view, otherwise they might get stuck.
        mTmpNonOverlapChildren.forEach((child) -> {
            child.setBottomOverlap(0);
            child.setTopOverlap(0);
        });

        // Now lets update the overlaps for the views, ensuring that we set the values for every
        // view, otherwise they might get stuck
        float minimumClipPosition = 0;
        // The NSSL can actually  be inset and notifications even rendering above it. Let's make
        // sure that we don't clip them at 0 but use some large negative number (not min
        // because overflow)
        float minimumClipPosition = Integer.MIN_VALUE >> 1;
        ExpandableView lastTransientView = null;
        float transientClippingPosition = 0;
        float lastGroupEnd = 0;
        float transientClippingPosition = minimumClipPosition;
        float lastGroupEnd = minimumClipPosition;
        for (int i = 0; i < mTmpSortedChildren.size(); i++) {
            ExpandableView expandableView = mTmpSortedChildren.get(i);
            float currentTop = getRelativePosition(expandableView);
+19 −0
Original line number Diff line number Diff line
@@ -1916,6 +1916,25 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
                !nonOverlapList.contains(child));
    }

    @Test
    @EnableFlags({com.android.systemui.Flags.FLAG_PHYSICAL_NOTIFICATION_MOVEMENT})
    public void testOverlapWhenOutOfBounds() {
        ExpandableNotificationRow firstRow = mKosmos.createRow();
        mStackScroller.addContainerView(firstRow);

        ExpandableViewState viewState = firstRow.getViewState();
        viewState.initFrom(firstRow);
        viewState.setYTranslation(-100f);
        viewState.height = 100;
        viewState.notGoneIndex = 0;
        viewState.applyToView(firstRow);

        mStackScroller.avoidNotificationOverlaps();
        // bigger than because of padding
        assertTrue("TopOverlap not calculated accurately", firstRow.getTopOverlap() == 0);
        assertTrue("BottomOverlap not calculated accurately", firstRow.getBottomOverlap() == 0);
    }

    private MotionEvent captureTouchSentToSceneFramework() {
        ArgumentCaptor<MotionEvent> captor = ArgumentCaptor.forClass(MotionEvent.class);
        verify(mStackScrollLayoutController).sendTouchToSceneFramework(captor.capture());