From c681346ad69f02dda5b1294b65824d01cbdbc899 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 13 Jan 2017 17:10:38 -0800 Subject: [PATCH] Fixed the interactivness of the shelf on the keyguard The shelf could still be double-tapped on the lock screen. Test: manual, tap on bottom part of last notification on lockscreen Change-Id: Ic5ceb729e28095b90e96da85acd3da3d65110ccf Fixes: 33766648 --- .../statusbar/ActivatableNotificationView.java | 9 ++++++++- .../systemui/statusbar/NotificationShelf.java | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index cc3c7db62d9ec..b5358bfb6f6e1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -251,7 +251,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView @Override public boolean onTouchEvent(MotionEvent event) { boolean result; - if (mDimmed && !isTouchExplorationEnabled()) { + if (mDimmed && !isTouchExplorationEnabled() && isInteractive()) { boolean wasActivated = mActivated; result = handleTouchEventDimmed(event); if (wasActivated && result && event.getAction() == MotionEvent.ACTION_UP) { @@ -263,6 +263,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView return result; } + /** + * @return whether this view is interactive and can be double tapped + */ + protected boolean isInteractive() { + return true; + } + @Override public void drawableHotspotChanged(float x, float y) { if (!mDimmed){ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index bc1b9fb89270c..64c49496ee9ce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -67,6 +67,7 @@ public class NotificationShelf extends ActivatableNotificationView { private int mStatusBarState; private float mMaxShelfEnd; private int mRelativeOffset; + private boolean mInteractive; public NotificationShelf(Context context, AttributeSet attrs) { super(context, attrs); @@ -555,13 +556,18 @@ public class NotificationShelf extends ActivatableNotificationView { } private void updateInteractiveness() { - boolean interactive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf; - setClickable(interactive); - setFocusable(interactive); - setImportantForAccessibility(interactive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES + mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf; + setClickable(mInteractive); + setFocusable(mInteractive); + setImportantForAccessibility(mInteractive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO); } + @Override + protected boolean isInteractive() { + return mInteractive; + } + public void setMaxShelfEnd(float maxShelfEnd) { mMaxShelfEnd = maxShelfEnd; }