summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lyn Han <lynhan@google.com> 2020-05-06 18:09:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-05-06 18:09:32 +0000
commit7f64be032f953a1faeb28f5190958a6a6ada8484 (patch)
treee9b23dac5ae4346b292cd8bda5bdcca54e9a060e
parentc59312aaec566bb648c59a539fa603ac6f5fce02 (diff)
parent670fa8097bc70704a5a19dfc446423eafc3ade8c (diff)
Merge "Manage button a11y local actions prompt" into rvc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java19
2 files changed, 24 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index b3c2c6d60708..baf92dc7abe7 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.Gravity;
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 @@ public class BubbleExpandedView extends LinearLayout {
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 35ac78df29ab..341458763625 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -1076,26 +1076,27 @@ public class BubbleStackView extends FrameLayout
@Override
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfoInternal(info);
+ setupLocalMenu(info);
+ }
+
+ void setupLocalMenu(AccessibilityNodeInfo info) {
+ Resources res = mContext.getResources();
- // Custom actions.
+ // 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.