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

Commit f19c2182 authored by 0's avatar 0
Browse files

[flexiglass] Fix NSSL eating touches on empty space in decor views and margins

NSSL should now only run touch handling if a gesture started on an actual child view

Bug: 296118689
Test: manual
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: Iadf72a0f818b07563bda6060012cf87cc6501f59
parent 18347dfd
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -1825,8 +1825,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    }

    private ExpandableView getChildAtPosition(float touchX, float touchY) {
        return getChildAtPosition(
                touchX, touchY, true /* requireMinHeight */, true /* ignoreDecors */);
        return getChildAtPosition(touchX, touchY, true /* requireMinHeight */,
                true /* ignoreDecors */, true /* ignoreWidth */);
    }

    /**
@@ -1836,10 +1836,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
     * @param touchY           the y coordinate
     * @param requireMinHeight Whether a minimum height is required for a child to be returned.
     * @param ignoreDecors     Whether decors can be returned
     * @param ignoreWidth      Whether we should ignore the width of the child
     * @return the child at the given location.
     */
    ExpandableView getChildAtPosition(float touchX, float touchY,
                                      boolean requireMinHeight, boolean ignoreDecors) {
    ExpandableView getChildAtPosition(float touchX, float touchY, boolean requireMinHeight,
            boolean ignoreDecors, boolean ignoreWidth) {
        // find the view under the pointer, accounting for GONE views
        final int count = getChildCount();
        for (int childIdx = 0; childIdx < count; childIdx++) {
@@ -1855,8 +1856,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

            // Allow the full width of this view to prevent gesture conflict on Keyguard (phone and
            // camera affordance).
            int left = 0;
            int right = getWidth();
            int left = ignoreWidth ? 0 : slidingChild.getLeft();
            int right = ignoreWidth ? getWidth() : slidingChild.getRight();

            if ((bottom - top >= mMinInteractionHeight || !requireMinHeight)
                    && touchY >= top && touchY <= bottom && touchX >= left && touchX <= right) {
@@ -3579,9 +3580,20 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    public boolean onTouchEvent(MotionEvent ev) {
        if (mTouchHandler != null) {
            boolean touchHandled = mTouchHandler.onTouchEvent(ev);
            if (SceneContainerFlag.isEnabled() || touchHandled) {
            if (SceneContainerFlag.isEnabled()) {
                if (getChildAtPosition(
                        mInitialTouchX, mInitialTouchY, true, true, false) == null) {
                    // If scene container is enabled, any touch that we are handling that is not on
                    // a child view should be handled by scene container instead.
                    return false;
                } else {
                    // If scene container is enabled, any touch that we are handling that is not on
                    // a child view should be handled by scene container instead.
                    return touchHandled;
                }
            } else if (touchHandled) {
                return true;
            }
        }

        return super.onTouchEvent(ev);
@@ -4021,7 +4033,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                final int y = (int) ev.getY();
                mScrolledToTopOnFirstDown = mScrollAdapter.isScrolledToTop();
                final ExpandableView childAtTouchPos = getChildAtPosition(
                        ev.getX(), y, false /* requireMinHeight */, false /* ignoreDecors */);
                        ev.getX(), y, false /* requireMinHeight */,
                        false /* ignoreDecors */, true /* ignoreWidth */);
                if (childAtTouchPos == null) {
                    setIsBeingDragged(false);
                    recycleVelocityTracker();
+2 −1
Original line number Diff line number Diff line
@@ -590,7 +590,8 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                            ev.getX(),
                            ev.getY(),
                            true /* requireMinHeight */,
                            false /* ignoreDecors */);
                            false /* ignoreDecors */,
                            true /* ignoreWidth */);
                    if (child instanceof ExpandableNotificationRow row) {
                        ExpandableNotificationRow parent = row.getNotificationParent();
                        if (parent != null && parent.areChildrenExpanded()