From abdc5a078242e6842a4b3fa62db3e385fcacfa56 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 2 Sep 2014 13:46:00 +0200 Subject: [PATCH] Fixed a bug in the notification touch selection. This lead to the wrong notification being selected and therefore the longpress listener would not be triggered. Also added some logging for cases where the longpress listener would not fire. Bug: 17332879 Change-Id: I9a5cd9bfe3108ca3e366711d34d1e218f1d520cf --- .../com/android/systemui/statusbar/BaseStatusBar.java | 11 ++++++++--- .../stack/NotificationStackScrollLayout.java | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 399742a317a14..c3eb94c3162b4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -736,15 +736,20 @@ public abstract class BaseStatusBar extends SystemUI implements public boolean onLongPress(View v, int x, int y) { dismissPopups(); - if (v.getWindowToken() == null) return false; + if (v.getWindowToken() == null) { + Log.e(TAG, "Trying to show notification guts, but not attached to window"); + return false; + } // Assume we are a status_bar_notification_row final NotificationGuts guts = (NotificationGuts) v.findViewById( R.id.notification_guts); - if (guts == null) return false; // Already showing? - if (guts.getVisibility() == View.VISIBLE) return false; + if (guts.getVisibility() == View.VISIBLE) { + Log.e(TAG, "Trying to show notification guts, but already visible"); + return false; + } guts.setVisibility(View.VISIBLE); final double horz = Math.max(guts.getWidth() - x, x); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 82e7f5d1ebdec..148b00cfa3f10 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -580,7 +580,7 @@ public class NotificationStackScrollLayout extends ViewGroup } float childTop = slidingChild.getTranslationY(); float top = childTop + slidingChild.getClipTopAmount(); - float bottom = top + slidingChild.getActualHeight(); + float bottom = childTop + slidingChild.getActualHeight(); // Allow the full width of this view to prevent gesture conflict on Keyguard (phone and // camera affordance). @@ -1530,7 +1530,7 @@ public class NotificationStackScrollLayout extends ViewGroup return position; } if (child.getVisibility() != View.GONE) { - position += child.getHeight(); + position += getIntrinsicHeight(child); if (i < getChildCount()-1) { position += mPaddingBetweenElements; }