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

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

[Flexiglass] Send all touches through the NSSLC TouchHandler

Keep sending all the touch events through the NSSLC TouchHandler, let it decide whether the it needs to be dispatched to the individual TouchHandlers, or whether it needs to be ignored due to a drag.

Bug: 359957196
Test: Interact with the Notification stack.
Flag: com.android.systemui.scene_container
Change-Id: I4a6c3f39edda8f7d9aef2eb87bd45f7026bd26c4
parent dbfeb709
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -3654,20 +3654,11 @@ public class NotificationStackScrollLayout
    public boolean onTouchEvent(MotionEvent ev) {
        if (mTouchHandler != null) {
            boolean touchHandled = mTouchHandler.onTouchEvent(ev);
            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.
            if (SceneContainerFlag.isEnabled() || touchHandled) {
                // If scene container is enabled, let the TouchHandlers decide if this event is
                // handled by the NSSL.
                return touchHandled;
            }
            } else if (touchHandled) {
                return true;
            }
        }

        return super.onTouchEvent(ev);
@@ -3707,13 +3698,10 @@ public class NotificationStackScrollLayout
                    mScrollViewFields.sendCurrentGestureInGuts(false);
                    mScrollViewFields.sendCurrentGestureOverscroll(false);
                    setIsBeingDragged(false);
                    // dispatch to touchHandlers, so they can still finalize a previously started
                    // motion, while the shade is being dragged
                    return super.dispatchTouchEvent(ev);
                }
                return false;
            }
        }
        // dispatch all touches to TouchHandlers, so they can decide whether they want to handle it.
        return TouchLogger.logDispatchTouch(TAG, ev, super.dispatchTouchEvent(ev));
    }

+8 −4
Original line number Diff line number Diff line
@@ -2064,20 +2064,23 @@ public class NotificationStackScrollLayoutController implements Dumpable {
            mView.initDownStates(ev);
            mView.handleEmptySpaceClick(ev);

            boolean skipForDragging = SceneContainerFlag.isEnabled() && mView.isBeingDragged()
                    && ev.getAction() == MotionEvent.ACTION_MOVE;

            NotificationGuts guts = mNotificationGutsManager.getExposedGuts();

            boolean longPressWantsIt = false;
            if (mLongPressedView != null) {
            if (mLongPressedView != null && !skipForDragging) {
                longPressWantsIt = mSwipeHelper.onInterceptTouchEvent(ev);
            }
            boolean expandWantsIt = false;
            if (mLongPressedView == null && !mSwipeHelper.isSwiping()
                    && !mView.getOnlyScrollingInThisMotion() && guts == null) {
                    && !mView.getOnlyScrollingInThisMotion() && guts == null && !skipForDragging) {
                expandWantsIt = mView.getExpandHelper().onInterceptTouchEvent(ev);
            }
            boolean scrollWantsIt = false;
            if (mLongPressedView == null && !mSwipeHelper.isSwiping()
                    && !mView.isExpandingNotification()) {
                    && !mView.isExpandingNotification() && !skipForDragging) {
                scrollWantsIt = mView.onInterceptTouchEventScroll(ev);
            }
            boolean hunWantsIt = false;
@@ -2089,7 +2092,8 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && !mView.isExpandingNotification()
                    && !mView.getExpandedInThisMotion()
                    && !mView.getOnlyScrollingInThisMotion()
                    && !mView.getDisallowDismissInThisMotion()) {
                    && !mView.getDisallowDismissInThisMotion()
                    && !skipForDragging) {
                swipeWantsIt = mSwipeHelper.onInterceptTouchEvent(ev);
            }
            // Check if we need to clear any snooze leavebehinds