Manage button a11y local actions prompt

Fixes: 131671647
Test: manual

Tap "manage" button to focus on it => TalkBack says "Expanded settings
for Bubbles bubbles button. Double tap to activate. Actions available.
Use swipe up then right to view"

Change-Id: I4ef8139283b6f8053a34494f5d2ef7879fa7d935
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index b3c2c6d..baf92dc 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -57,6 +57,7 @@
 import android.view.View;
 import android.view.WindowInsets;
 import android.view.WindowManager;
+import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.LinearLayout;
 
 import com.android.internal.policy.ScreenDecorationsUtils;
@@ -456,6 +457,19 @@
             mSettingsIcon.setContentDescription(getResources().getString(
                     R.string.bubbles_settings_button_description, bubble.getAppName()));
 
+            mSettingsIcon.setAccessibilityDelegate(
+                    new AccessibilityDelegate() {
+                        @Override
+                        public void onInitializeAccessibilityNodeInfo(View host,
+                                AccessibilityNodeInfo info) {
+                            super.onInitializeAccessibilityNodeInfo(host, info);
+                            // On focus, have TalkBack say
+                            // "Actions available. Use swipe up then right to view."
+                            // in addition to the default "double tap to activate".
+                            mStackView.setupLocalMenu(info);
+                        }
+                    });
+
             if (isNew) {
                 mPendingIntent = mBubble.getBubbleIntent();
                 if (mPendingIntent != null || mBubble.getShortcutInfo() != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index c802b59..7e6f200 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -1075,26 +1075,27 @@
     @Override
     public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
         super.onInitializeAccessibilityNodeInfoInternal(info);
+        setupLocalMenu(info);
+    }
 
-        // Custom actions.
+    void setupLocalMenu(AccessibilityNodeInfo info) {
+        Resources res = mContext.getResources();
+
+        // Custom local actions.
         AccessibilityAction moveTopLeft = new AccessibilityAction(R.id.action_move_top_left,
-                getContext().getResources()
-                        .getString(R.string.bubble_accessibility_action_move_top_left));
+                res.getString(R.string.bubble_accessibility_action_move_top_left));
         info.addAction(moveTopLeft);
 
         AccessibilityAction moveTopRight = new AccessibilityAction(R.id.action_move_top_right,
-                getContext().getResources()
-                        .getString(R.string.bubble_accessibility_action_move_top_right));
+                res.getString(R.string.bubble_accessibility_action_move_top_right));
         info.addAction(moveTopRight);
 
         AccessibilityAction moveBottomLeft = new AccessibilityAction(R.id.action_move_bottom_left,
-                getContext().getResources()
-                        .getString(R.string.bubble_accessibility_action_move_bottom_left));
+                res.getString(R.string.bubble_accessibility_action_move_bottom_left));
         info.addAction(moveBottomLeft);
 
         AccessibilityAction moveBottomRight = new AccessibilityAction(R.id.action_move_bottom_right,
-                getContext().getResources()
-                        .getString(R.string.bubble_accessibility_action_move_bottom_right));
+                res.getString(R.string.bubble_accessibility_action_move_bottom_right));
         info.addAction(moveBottomRight);
 
         // Default actions.