From bbe3b2085678d5cc34332efd0635e79239cd9102 Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Tue, 21 Apr 2020 12:15:50 -0400 Subject: [PATCH] Fix long-press issue in RelativeTouchListener. performLongClick does not check if the view is long-clickable, and defaults to showing a context menu if the long-click listener is not set. This crashes Bubbles. Just check if the view is long-clickable first. Test: manual Fixes: 154417194 Change-Id: I0bb1363fac3b5a2d16d1f5dc79f40b4a2bf88f4d --- .../src/com/android/systemui/util/RelativeTouchListener.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/util/RelativeTouchListener.kt b/packages/SystemUI/src/com/android/systemui/util/RelativeTouchListener.kt index d65b285adb0cb..8880df9959c12 100644 --- a/packages/SystemUI/src/com/android/systemui/util/RelativeTouchListener.kt +++ b/packages/SystemUI/src/com/android/systemui/util/RelativeTouchListener.kt @@ -115,7 +115,9 @@ abstract class RelativeTouchListener : View.OnTouchListener { performedLongClick = false handler.postDelayed({ - performedLongClick = v.performLongClick() + if (v.isLongClickable) { + performedLongClick = v.performLongClick() + } }, ViewConfiguration.getLongPressTimeout().toLong()) }