am 0f7ed1f4: Merge "Adding system support for a single accessibility focus."
* commit '0f7ed1f4776844f3ee8d3ce9d903f62cace66a06': Adding system support for a single accessibility focus.
This commit is contained in:
@@ -525,6 +525,31 @@ public abstract class AccessibilityService extends Service {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the view that has the specified focus type. The search is performed
|
||||
* across all windows.
|
||||
* <p>
|
||||
* <strong>Note:</strong> In order to access the windows your service has
|
||||
* to declare the capability to retrieve window content by setting the
|
||||
* {@link android.R.styleable#AccessibilityService_canRetrieveWindowContent}
|
||||
* property in its meta-data. For details refer to {@link #SERVICE_META_DATA}.
|
||||
* Also the service has to opt-in to retrieve the interactive windows by
|
||||
* setting the {@link AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS}
|
||||
* flag.Otherwise, the search will be performed only in the active window.
|
||||
* </p>
|
||||
*
|
||||
* @param focus The focus to find. One of {@link AccessibilityNodeInfo#FOCUS_INPUT} or
|
||||
* {@link AccessibilityNodeInfo#FOCUS_ACCESSIBILITY}.
|
||||
* @return The node info of the focused view or null.
|
||||
*
|
||||
* @see AccessibilityNodeInfo#FOCUS_INPUT
|
||||
* @see AccessibilityNodeInfo#FOCUS_ACCESSIBILITY
|
||||
*/
|
||||
public AccessibilityNodeInfo findFocus(int focus) {
|
||||
return AccessibilityInteractionClient.getInstance().findFocus(mConnectionId,
|
||||
AccessibilityNodeInfo.ANY_WINDOW_ID, AccessibilityNodeInfo.ROOT_NODE_ID, focus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the an {@link AccessibilityServiceInfo} describing this
|
||||
* {@link AccessibilityService}. This method is useful if one wants
|
||||
|
||||
@@ -296,6 +296,28 @@ public final class UiAutomation {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the view that has the specified focus type. The search is performed
|
||||
* across all windows.
|
||||
* <p>
|
||||
* <strong>Note:</strong> In order to access the windows you have to opt-in
|
||||
* to retrieve the interactive windows by setting the
|
||||
* {@link AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS} flag.
|
||||
* Otherwise, the search will be performed only in the active window.
|
||||
* </p>
|
||||
*
|
||||
* @param focus The focus to find. One of {@link AccessibilityNodeInfo#FOCUS_INPUT} or
|
||||
* {@link AccessibilityNodeInfo#FOCUS_ACCESSIBILITY}.
|
||||
* @return The node info of the focused view or null.
|
||||
*
|
||||
* @see AccessibilityNodeInfo#FOCUS_INPUT
|
||||
* @see AccessibilityNodeInfo#FOCUS_ACCESSIBILITY
|
||||
*/
|
||||
public AccessibilityNodeInfo findFocus(int focus) {
|
||||
return AccessibilityInteractionClient.getInstance().findFocus(mConnectionId,
|
||||
AccessibilityNodeInfo.ANY_WINDOW_ID, AccessibilityNodeInfo.ROOT_NODE_ID, focus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the an {@link AccessibilityServiceInfo} describing this UiAutomation.
|
||||
* This method is useful if one wants to change some of the dynamically
|
||||
|
||||
@@ -8790,11 +8790,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
&& !pointInView(event.getX(), event.getY()))) {
|
||||
mSendingHoverAccessibilityEvents = false;
|
||||
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
|
||||
// If the window does not have input focus we take away accessibility
|
||||
// focus as soon as the user stop hovering over the view.
|
||||
if (mAttachInfo != null && !mAttachInfo.mHasWindowFocus) {
|
||||
getViewRootImpl().setAccessibilityFocus(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,19 @@ public final class AccessibilityInteractionClient
|
||||
false, AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root {@link AccessibilityNodeInfo} in a given window.
|
||||
*
|
||||
* @param connectionId The id of a connection for interacting with the system.
|
||||
* @param windowId The window id.
|
||||
* @return The root {@link AccessibilityNodeInfo} if found, null otherwise.
|
||||
*/
|
||||
public AccessibilityNodeInfo getRootInWindow(int connectionId, int windowId) {
|
||||
return findAccessibilityNodeInfoByAccessibilityId(connectionId, windowId,
|
||||
AccessibilityNodeInfo.ROOT_NODE_ID, false,
|
||||
AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the info for a window.
|
||||
*
|
||||
|
||||
@@ -76,6 +76,9 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
/** @hide */
|
||||
public static final int ACTIVE_WINDOW_ID = UNDEFINED_ITEM_ID;
|
||||
|
||||
/** @hide */
|
||||
public static final int ANY_WINDOW_ID = -2;
|
||||
|
||||
/** @hide */
|
||||
public static final int FLAG_PREFETCH_PREDECESSORS = 0x00000001;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user