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

Commit 1b554393 authored by Selim Cinek's avatar Selim Cinek
Browse files

All touches to low priority headers should be accepted

Since there is no conflicting touch target, we now accept
all touches there.

Test: add low-pririty notification, click below text
Fixes: 35851799
Change-Id: Iae36fc6b950a0dbb569bfae43a5505588d9e0ace
parent fc9fb15c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4177,7 +4177,7 @@ public class Notification implements Parcelable
            }

            RemoteViews header = makeNotificationHeader();

            header.setBoolean(R.id.notification_header, "setAcceptAllTouches", true);
            if (summary != null) {
                mN.extras.putCharSequence(EXTRA_SUB_TEXT, summary);
            } else {
+11 −2
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class NotificationHeaderView extends ViewGroup {
            }
        }
    };
    private boolean mAcceptAllTouches;

    public NotificationHeaderView(Context context) {
        this(context, null);
@@ -374,6 +375,8 @@ public class NotificationHeaderView extends ViewGroup {
                case MotionEvent.ACTION_DOWN:
                    mTrackGesture = false;
                    if (isInside(x, y)) {
                        mDownX = x;
                        mDownY = y;
                        mTrackGesture = true;
                        return true;
                    }
@@ -396,11 +399,12 @@ public class NotificationHeaderView extends ViewGroup {
        }

        private boolean isInside(float x, float y) {
            if (mAcceptAllTouches) {
                return true;
            }
            for (int i = 0; i < mTouchRects.size(); i++) {
                Rect r = mTouchRects.get(i);
                if (r.contains((int) x, (int) y)) {
                    mDownX = x;
                    mDownY = y;
                    return true;
                }
            }
@@ -433,4 +437,9 @@ public class NotificationHeaderView extends ViewGroup {
        }
        return mTouchListener.isInside(x, y);
    }

    @RemotableViewMethod
    public void setAcceptAllTouches(boolean acceptAllTouches) {
        mAcceptAllTouches = acceptAllTouches;
    }
}