Only attach long-press handlers to LongPressActions.

Previously, all actions created views with a long press handler. Now, we only add long press handlers to the views if the action supports them, which prevents TalkBack from speaking long press instructions for actions that have no long press behavior.

This does not account for actions which have a long press handler which does not provide any user feedback, either because the result is not visible, or because it does nothing due to some other restriction, like user privileges. In the future, I think we should remove these long press behaviors where possible, since they're inscrutible to all users, and even moreso to users with visual impairments.

Test: Manual. Turn on talkback and verify that the Emergency action does not speak instructions to "double tap and hold to long press." Other actions with a long press handler (like Bug Report or Restart) should still speak these instructions.

Fixes: 147861227
Change-Id: I203bd0ac661a3912389ee584a863eb9f773b2927
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 082b065..92f7e1f 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -1045,7 +1045,9 @@
             Action action = getItem(position);
             View view = action.create(mContext, convertView, parent, LayoutInflater.from(mContext));
             view.setOnClickListener(v -> onClickItem(position));
-            view.setOnLongClickListener(v -> onLongClickItem(position));
+            if (action instanceof LongPressAction) {
+                view.setOnLongClickListener(v -> onLongClickItem(position));
+            }
             return view;
         }