diff options
3 files changed, 35 insertions, 10 deletions
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index 6fd0e6711545..1c0ea0f9120b 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -335,4 +335,11 @@ public class NotificationHeaderView extends LinearLayout { public boolean hasOverlappingRendering() { return false; } + + public boolean isInTouchRect(float x, float y) { + if (mExpandClickListener == null) { + return false; + } + return mTouchListener.isInside(x, y); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 9958b960b93f..38d24ced806f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -176,26 +176,31 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView }; @Override - public boolean dispatchTouchEvent(MotionEvent event) { - if (mDimmed && !mActivated) { - return handleTouchEventDimmed(event); - } else { - return super.dispatchTouchEvent(event); + public boolean onInterceptTouchEvent(MotionEvent ev) { + if (mDimmed && !mActivated + && ev.getActionMasked() == MotionEvent.ACTION_DOWN && disallowSingleClick(ev)) { + return true; } + return super.onInterceptTouchEvent(ev); + } + + protected boolean disallowSingleClick(MotionEvent ev) { + return false; } @Override public boolean onTouchEvent(MotionEvent event) { boolean result; - if (mDimmed && mActivated) { + if (mDimmed) { + boolean wasActivated = mActivated; result = handleTouchEventDimmed(event); + if (wasActivated && result && event.getAction() == MotionEvent.ACTION_UP) { + mFalsingManager.onNotificationDoubleTap(); + removeCallbacks(mTapTimeoutRunnable); + } } else { result = super.onTouchEvent(event); } - if (mActivated && result && event.getAction() == MotionEvent.ACTION_UP) { - mFalsingManager.onNotificationDoubleTap(); - removeCallbacks(mTapTimeoutRunnable); - } return result; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index f80630b6317b..45c5cfb5c15a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -25,8 +25,10 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.service.notification.StatusBarNotification; import android.util.AttributeSet; +import android.view.MotionEvent; import android.view.NotificationHeaderView; import android.view.View; +import android.view.ViewGroup; import android.view.ViewStub; import android.view.accessibility.AccessibilityEvent; import android.widget.Chronometer; @@ -1113,6 +1115,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mLoggingKey = key; } + @Override + protected boolean disallowSingleClick(MotionEvent event) { + float x = event.getX(); + float y = event.getY(); + NotificationHeaderView header = getNotificationHeader(); + if (header != null) { + return header.isInTouchRect(x, y); + } + return super.disallowSingleClick(event); + } + private void logExpansionEvent(boolean userAction, boolean wasExpanded) { final boolean nowExpanded = isExpanded(); if (wasExpanded != nowExpanded && mLogger != null) { |