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

Commit 0b558a93 authored by Matt Pietal's avatar Matt Pietal
Browse files

Do not handle touches next to shelf

NSSL would return true for all touches below the last notification,
and to the right of the shelf. This is essentially empty space.
The reason for this is the SwipeHelper is always returning true,
which would set horizontalSwipeWantsIt == true even though that
is clearly not true on a tap.

This causes an issue with tapping the unlocked icon when the
last notification is directly above it. The shelf was taking
the touch directly over lock icon, preventing device unlock.

Instead, use the swipe information from the intercept event which
seems to be more accurate, and carry this state to the onTouch
event.

Fixes: 370270324
Fixes: 358424256
Test: manual - horizontal swipe notifications
Test: manual - vertically swipe notifications
Test: manual - all touch interactions with notifs
Test: manual - tap on shelf to expand shade
Flag: EXEMPT bugfix
Change-Id: I906da1cf5e5106ada355232941399efe7f1d3b14
parent 472e3aa9
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -58,22 +58,22 @@
             android:layout_height="match_parent"
             android:visibility="invisible" />

    <!-- Shared container for the notification stack. Can be positioned by either
         the keyguard_root_view or notification_panel -->
    <com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
        android:id="@+id/shared_notification_container"
    <!-- Root for all keyguard content. It was previously located within the shade. -->
    <com.android.systemui.keyguard.ui.view.KeyguardRootView
        android:id="@id/keyguard_root_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false"
        />

    <!-- Root for all keyguard content. It was previously located within the shade. -->
    <com.android.systemui.keyguard.ui.view.KeyguardRootView
        android:id="@id/keyguard_root_view"
    <!-- Shared container for the notification stack. Can be positioned by either
         the keyguard_root_view or notification_panel -->
    <com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
        android:id="@+id/shared_notification_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false"
        />

    <include layout="@layout/brightness_mirror_container" />
+11 −6
Original line number Diff line number Diff line
@@ -2098,8 +2098,13 @@ public class NotificationStackScrollLayoutController implements Dumpable {
    }

    class TouchHandler implements Gefingerpoken {
        private boolean mSwipeWantsIt = false;

        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            // Reset on each call to intercept, and share swipe state with onTouchEvent()
            // below when this method returns true.
            mSwipeWantsIt = false;
            mView.initDownStates(ev);
            mView.handleEmptySpaceClick(ev);

@@ -2126,17 +2131,16 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    mView.startDraggingOnHun();
                }
            }
            boolean swipeWantsIt = false;
            if (mLongPressedView == null && !mView.isBeingDragged()
                    && !mView.isExpandingNotification()
                    && !mView.getExpandedInThisMotion()
                    && !mView.getOnlyScrollingInThisMotion()
                    && !mView.getDisallowDismissInThisMotion()) {
                swipeWantsIt = mSwipeHelper.onInterceptTouchEvent(ev);
                mSwipeWantsIt = mSwipeHelper.onInterceptTouchEvent(ev);
            }
            // Check if we need to clear any snooze leavebehinds
            boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP;
            if (!NotificationSwipeHelper.isTouchInView(ev, guts) && isUp && !swipeWantsIt &&
            if (!NotificationSwipeHelper.isTouchInView(ev, guts) && isUp && !mSwipeWantsIt &&
                    !expandWantsIt && !scrollWantsIt) {
                mView.setCheckForLeaveBehind(false);
                mNotificationGutsManager.closeAndSaveGuts(true /* removeLeavebehind */,
@@ -2155,7 +2159,8 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
                mJankMonitor.begin(mView, CUJ_NOTIFICATION_SHADE_SCROLL_FLING);
            }
            return swipeWantsIt || scrollWantsIt || expandWantsIt || longPressWantsIt || hunWantsIt;
            return mSwipeWantsIt || scrollWantsIt || expandWantsIt || longPressWantsIt ||
                    hunWantsIt;
        }

        @Override
@@ -2192,7 +2197,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    }
                }
            }
            boolean horizontalSwipeWantsIt = false;
            boolean horizontalSwipeWantsIt = mSwipeWantsIt;
            boolean scrollerWantsIt = false;
            // NOTE: the order of these is important. If reversed, onScrollTouch will reset on an
            // UP event, causing horizontalSwipeWantsIt to be set to true on vertical swipes.
@@ -2201,7 +2206,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && !mView.getExpandedInThisMotion()
                    && !onlyScrollingInThisMotion
                    && !mView.getDisallowDismissInThisMotion()) {
                horizontalSwipeWantsIt = mSwipeHelper.onTouchEvent(ev);
                mSwipeHelper.onTouchEvent(ev);
            }
            if (mLongPressedView == null && mView.isExpanded() && !mSwipeHelper.isSwiping()
                    && !expandingNotification && !mView.getDisallowScrollingInThisMotion()) {