From 34eda5ed70863320e41b6860a550ba6a4248c652 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 18 Feb 2016 17:10:43 -0800 Subject: [PATCH] Fixed a clicking bug on the lockscreen Parts of custom notficications were not singeclickable Bug: 27247884 Change-Id: I7c52500a77929059b24e8119f50492e0f1399401 --- .../statusbar/ExpandableNotificationRow.java | 9 ++++++++- .../statusbar/NotificationContentView.java | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index fb58ba11e0ebd..bfc2ae8795730 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -499,6 +499,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mPrivateLayout.getNotificationHeader(); } + private NotificationHeaderView getVisibleNotificationHeader() { + if (mNotificationHeader != null) { + return mNotificationHeader; + } + return getShowingLayout().getVisibleNotificationHeader(); + } + public void setOnExpandClickListener(OnExpandClickListener onExpandClickListener) { mOnExpandClickListener = onExpandClickListener; } @@ -1171,7 +1178,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { protected boolean disallowSingleClick(MotionEvent event) { float x = event.getX(); float y = event.getY(); - NotificationHeaderView header = getNotificationHeader(); + NotificationHeaderView header = getVisibleNotificationHeader(); if (header != null) { return header.isInTouchRect(x, y); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 839bc455746db..647f0bfd0e264 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -475,6 +475,19 @@ public class NotificationContentView extends FrameLayout { } } + private NotificationViewWrapper getCurrentVisibleWrapper() { + switch (mVisibleType) { + case VISIBLE_TYPE_EXPANDED: + return mExpandedWrapper; + case VISIBLE_TYPE_HEADSUP: + return mHeadsUpWrapper; + case VISIBLE_TYPE_CONTRACTED: + return mContractedWrapper; + default: + return null; + } + } + /** * @return one of the static enum types in this view, calculated form the current state */ @@ -684,6 +697,11 @@ public class NotificationContentView extends FrameLayout { return header; } + public NotificationHeaderView getVisibleNotificationHeader() { + NotificationViewWrapper wrapper = getCurrentVisibleWrapper(); + return wrapper == null ? null : wrapper.getNotificationHeader(); + } + public void setContainingNotification(ExpandableNotificationRow containingNotification) { mContainingNotification = containingNotification; }