summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/view/View.java39
2 files changed, 40 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 13c972f..695ba76 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -24381,6 +24381,7 @@ package android.view {
method public void onInitializeAccessibilityNodeInfo(android.view.View, android.view.accessibility.AccessibilityNodeInfo);
method public void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
method public boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent);
+ method public boolean performAccessibilityAction(android.view.View, int, android.os.Bundle);
method public void sendAccessibilityEvent(android.view.View, int);
method public void sendAccessibilityEventUnchecked(android.view.View, android.view.accessibility.AccessibilityEvent);
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2972774..0e8723f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6463,12 +6463,31 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
/**
* Performs the specified accessibility action on the view. For
* possible accessibility actions look at {@link AccessibilityNodeInfo}.
+ * <p>
+ * If an {@link AccessibilityDelegate} has been specified via calling
+ * {@link #setAccessibilityDelegate(AccessibilityDelegate)} its
+ * {@link AccessibilityDelegate#performAccessibilityAction(View, int, Bundle)}
+ * is responsible for handling this call.
+ * </p>
*
* @param action The action to perform.
* @param arguments Optional action arguments.
* @return Whether the action was performed.
*/
public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (mAccessibilityDelegate != null) {
+ return mAccessibilityDelegate.performAccessibilityAction(this, action, arguments);
+ } else {
+ return performAccessibilityActionInternal(action, arguments);
+ }
+ }
+
+ /**
+ * @see #performAccessibilityAction(int, Bundle)
+ *
+ * Note: Called from the default {@link AccessibilityDelegate}.
+ */
+ boolean performAccessibilityActionInternal(int action, Bundle arguments) {
switch (action) {
case AccessibilityNodeInfo.ACTION_CLICK: {
if (isClickable()) {
@@ -17412,6 +17431,26 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
}
/**
+ * Performs the specified accessibility action on the view. For
+ * possible accessibility actions look at {@link AccessibilityNodeInfo}.
+ * <p>
+ * The default implementation behaves as
+ * {@link View#performAccessibilityAction(int, Bundle)
+ * View#performAccessibilityAction(int, Bundle)} for the case of
+ * no accessibility delegate been set.
+ * </p>
+ *
+ * @param action The action to perform.
+ * @return Whether the action was performed.
+ *
+ * @see View#performAccessibilityAction(int, Bundle)
+ * View#performAccessibilityAction(int, Bundle)
+ */
+ public boolean performAccessibilityAction(View host, int action, Bundle args) {
+ return host.performAccessibilityActionInternal(action, args);
+ }
+
+ /**
* Sends an accessibility event. This method behaves exactly as
* {@link #sendAccessibilityEvent(View, int)} but takes as an argument an
* empty {@link AccessibilityEvent} and does not perform a check whether