diff options
| author | 2017-02-28 17:22:49 -0800 | |
|---|---|---|
| committer | 2017-03-03 10:26:29 -0800 | |
| commit | 1b5543939a7e07f5a1238c8d880b87586c4a06cd (patch) | |
| tree | f3892df05413322ca8fef7d308a724a6f61816fb | |
| parent | fc9fb15c22c36c6fe3a56ed6758afeac702fe8da (diff) | |
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
| -rw-r--r-- | core/java/android/app/Notification.java | 2 | ||||
| -rw-r--r-- | core/java/android/view/NotificationHeaderView.java | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index e8ddc41ee68c..96d44a5215b0 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -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 { diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index c3d3f3918ccf..16d46666732d 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -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; + } } |