diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index 1e238f0b03b72..64a275553339d 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -32,11 +32,9 @@ import android.view.accessibility.AccessibilityNodeInfo; * when {@link AccessibilityEvent}s are fired. Such events denote some state transition * in the user interface, for example, the focus has changed, a button has been clicked, * etc. Such a service can optionally request the capability for querying the content - * of the active window. Development of an accessibility service requires extends this - * class and implements its abstract methods. - *
- * Lifecycle - *
+ * of the active window. Development of an accessibility service requires extending this + * class and implementing its abstract methods. + ** The lifecycle of an accessibility service is managed exclusively by the system and * follows the established service life cycle. Additionally, starting or stopping an @@ -45,30 +43,20 @@ import android.view.accessibility.AccessibilityNodeInfo; * calls {@link AccessibilityService#onServiceConnected()}. This method can be * overriden by clients that want to perform post binding setup. *
- *- * Declaration - *
+ ** An accessibility is declared as any other service in an AndroidManifest.xml but it * must also specify that it handles the "android.accessibilityservice.AccessibilityService" * {@link android.content.Intent}. Failure to declare this intent will cause the system to * ignore the accessibility service. Following is an example declaration: *
- *
- *
- *
- *
- * <service android:name=".MyAccessibilityService">
+ *
<service android:name=".MyAccessibilityService">
* <intent-filter>
- * <action android:name="android.accessibilityservice.AccessibilityService" />
+ * <action android:name="android.accessibilityservice.AccessibilityService" />
* </intent-filter>
* . . .
- * </service>
- *
- *
- * Configuration - *
+ * </service> + ** An accessibility service can be configured to receive specific types of accessibility events, * listen only to specific packages, get events from each type only once in a given time frame, @@ -81,30 +69,24 @@ import android.view.accessibility.AccessibilityNodeInfo; *
- *
- *
- *
- * <service android:name=".MyAccessibilityService">
+ *
<service android:name=".MyAccessibilityService">
* <intent-filter>
- * <action android:name="android.accessibilityservice.AccessibilityService" />
+ * <action android:name="android.accessibilityservice.AccessibilityService" />
* </intent-filter>
* <meta-data android:name="android.accessibilityservice" android:resource="@xml/accessibilityservice" />
- * </service>
- *
- *
- * Note:This approach enables setting all properties. + * </service> + *
+ * Note: This approach enables setting all properties. *
*
* For more details refer to {@link #SERVICE_META_DATA} and
- * <{@link android.R.styleable#AccessibilityService accessibility-service}>..
+ * <{@link android.R.styleable#AccessibilityService accessibility-service}>.
*
+ *
* Note: This approach enables setting only dynamically configurable properties: * {@link AccessibilityServiceInfo#eventTypes}, * {@link AccessibilityServiceInfo#feedbackType}, @@ -117,9 +99,7 @@ import android.view.accessibility.AccessibilityNodeInfo; *
*- * Retrieving window content - *
+ ** An service can specify in its declaration that it can retrieve the active window * content which is represented as a tree of {@link AccessibilityNodeInfo}. Note that @@ -144,8 +124,8 @@ import android.view.accessibility.AccessibilityNodeInfo; * this method will return an {@link AccessibilityNodeInfo} that can be used to traverse the * window content which represented as a tree of such objects. *
- *- * NoteAn accessibility service may have requested to be notified for + *
+ * Note An accessibility service may have requested to be notified for * a subset of the event types, thus be unaware that the active window has changed. Therefore * accessibility service that would like to retrieve window content should: *
- * Notification strategy - *
+ ** For each feedback type only one accessibility service is notified. Services are notified * in the order of registration. Hence, if two services are registered for the same @@ -178,40 +156,39 @@ import android.view.accessibility.AccessibilityNodeInfo; * well with most applications to coexist with "polished" ones that are targeted for * specific applications. *
- *- * Event types - *
- * {@link AccessibilityEvent#TYPE_VIEW_CLICKED} - * {@link AccessibilityEvent#TYPE_VIEW_LONG_CLICKED} - * {@link AccessibilityEvent#TYPE_VIEW_FOCUSED} - * {@link AccessibilityEvent#TYPE_VIEW_SELECTED} - * {@link AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} - * {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} - * {@link AccessibilityEvent#TYPE_NOTIFICATION_STATE_CHANGED} - * {@link AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_START} - * {@link AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_END} - * {@link AccessibilityEvent#TYPE_VIEW_HOVER_ENTER} - * {@link AccessibilityEvent#TYPE_VIEW_HOVER_EXIT} - * {@link AccessibilityEvent#TYPE_VIEW_SCROLLED} - * {@link AccessibilityEvent#TYPE_VIEW_TEXT_SELECTION_CHANGED} - * {@link AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED} - *- * Feedback types - *
- * {@link AccessibilityServiceInfo#FEEDBACK_AUDIBLE} - * {@link AccessibilityServiceInfo#FEEDBACK_HAPTIC} - * {@link AccessibilityServiceInfo#FEEDBACK_AUDIBLE} - * {@link AccessibilityServiceInfo#FEEDBACK_VISUAL} - * {@link AccessibilityServiceInfo#FEEDBACK_GENERIC} - * - * @see AccessibilityEvent - * @see AccessibilityServiceInfo - * @see android.view.accessibility.AccessibilityManager - * + *
* Note: The event notification timeout is useful to avoid propagating * events to the client too frequently since this is accomplished via an expensive * interprocess call. One can think of the timeout as a criteria to determine when - * event generation has settled down. + * event generation has settled down.
+ *<{@link android.R.styleable#AccessibilityService accessibility-service}>
* tag. This is a a sample XML file configuring an accessibility service:
- *
- *
- *
- *
- * <accessibility-service
+ *
<accessibility-service
* android:accessibilityEventTypes="typeViewClicked|typeViewFocused"
* android:packageNames="foo.bar, foo.baz"
* android:accessibilityFeedbackType="feedbackSpoken"
@@ -237,10 +211,7 @@ public abstract class AccessibilityService extends Service {
* android:settingsActivity="foo.bar.TestBackActivity"
* android:canRetrieveWindowContent="true"
* . . .
- * />
- *
- *
* Example: Adding formatted date string to an accessibility event in addition - * to the text added by the super implementation. - *
- * public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
+ * to the text added by the super implementation:
+ * public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
* super.onPopulateAccessibilityEvent(event);
* final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY;
* String selectedDateUtterance = DateUtils.formatDateTime(mContext,
* mCurrentDate.getTimeInMillis(), flags);
* event.getText().add(selectedDateUtterance);
- * }
- *
+ * }
* * If an {@link AccessibilityDelegate} has been specified via calling * {@link #setAccessibilityDelegate(AccessibilityDelegate)} its * {@link AccessibilityDelegate#onPopulateAccessibilityEvent(View, AccessibilityEvent)} * is responsible for handling this call. *
+ *Note: Always call the super implementation before adding + * information to the event, in case the default implementation has basic information to add. + *
* * @param event The accessibility event which to populate. * @@ -3994,20 +3998,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * the event. ** Example: Setting the password property of an event in addition - * to properties set by the super implementation. - *
- * public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
- * super.onInitializeAccessibilityEvent(event);
- * event.setPassword(true);
- * }
- *
+ * to properties set by the super implementation:
+ * public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ * super.onInitializeAccessibilityEvent(event);
+ * event.setPassword(true);
+ * }
* * If an {@link AccessibilityDelegate} has been specified via calling * {@link #setAccessibilityDelegate(AccessibilityDelegate)} its * {@link AccessibilityDelegate#onInitializeAccessibilityEvent(View, AccessibilityEvent)} * is responsible for handling this call. *
- * + *Note: Always call the super implementation before adding + * information to the event, in case the default implementation has basic information to add. + *
* @param event The event to initialize. * * @see #sendAccessibilityEvent(int) @@ -6179,8 +6183,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * are delivered to the view under the pointer. All other generic motion events are * delivered to the focused view. * - *
- * public boolean onGenericMotionEvent(MotionEvent event) {
+ * public boolean onGenericMotionEvent(MotionEvent event) {
* if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
* if (event.getAction() == MotionEvent.ACTION_MOVE) {
* // process the joystick movement...
@@ -6198,8 +6201,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
* }
* }
* return super.onGenericMotionEvent(event);
- * }
- *
+ * }
*
* @param event The generic motion event being processed.
* @return True if the event was handled, false otherwise.
diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java
index a80c2a7147c90..e37de6fc4ce9a 100644
--- a/core/java/android/view/accessibility/AccessibilityManager.java
+++ b/core/java/android/view/accessibility/AccessibilityManager.java
@@ -49,10 +49,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
*
*
*
- *
*
- * AccessibilityManager accessibilityManager =
- * (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
- *
+ * AccessibilityManager accessibilityManager =
+ * (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
*