diff options
| author | 2020-05-05 12:56:33 -0700 | |
|---|---|---|
| committer | 2020-05-05 14:41:47 -0700 | |
| commit | 670fa8097bc70704a5a19dfc446423eafc3ade8c (patch) | |
| tree | 64559e0ddc91f253f91b45e49f46562c9ff2dfb9 | |
| parent | 1cf3ce8fdec202f818b8015e3b638ce46b85574c (diff) | |
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
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java | 14 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java | 19 |
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 c802b59faba9..7e6f200cb716 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 @@ 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. |