summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorAbodunrinwa Toki <toki@google.com>2022-01-19 00:39:33 +0000
committerAbodunrinwa Toki <toki@google.com>2022-01-21 19:44:26 +0000
commit6487bc38c174135e49424bf2d96ea3e77e77a585 (patch)
tree522f00e983098166fc1ef775e2805a0efc685abf /core/java/android/widget/TextView.java
parent0309ed5d490f649dea2310afe527e208d97d61e0 (diff)
Ensure that "smart" actions are shown in Talkback.
The "Local Context Menu" (https://support.google.com/accessibility/android/answer/6007066?hl=en-GB) is missing smart actions. This CL adds them. We need this to happen even more now that we are going to be rendering the selection toolbar in a system UI and are experiencing accessibility focus issues. See referenced bugs for more details. Bug: 214122485 Test: m Test: https://screenshot.googleplex.com/3SdNNBt5bWMz2CN.png Change-Id: If5266c8b44461349877cf0029b7803e0bc8a9174
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 1a808b2e7c24..487342fc530c 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -440,6 +440,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// Accessibility action start id for "process text" actions.
static final int ACCESSIBILITY_ACTION_PROCESS_TEXT_START_ID = 0x10000100;
+ /** Accessibility action start id for "smart" actions. @hide */
+ static final int ACCESSIBILITY_ACTION_SMART_START_ID = 0x10001000;
+
/**
* @hide
*/
@@ -12174,6 +12177,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
if (canProcessText()) { // also implies mEditor is not null.
mEditor.mProcessTextIntentActionsHandler.onInitializeAccessibilityNodeInfo(info);
+ mEditor.onInitializeSmartActionsAccessibilityNodeInfo(info);
}
}
@@ -12377,9 +12381,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*/
@Override
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
- if (mEditor != null
- && mEditor.mProcessTextIntentActionsHandler.performAccessibilityAction(action)) {
- return true;
+ if (mEditor != null) {
+ if (mEditor.mProcessTextIntentActionsHandler.performAccessibilityAction(action)
+ || mEditor.performSmartActionsAccessibilityAction(action)) {
+ return true;
+ }
}
switch (action) {
case AccessibilityNodeInfo.ACTION_CLICK: {