Java Code Examples for android.view.accessibility.AccessibilityNodeInfo#getVirtualDescendantId()
The following examples show how to use
android.view.accessibility.AccessibilityNodeInfo#getVirtualDescendantId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutofillManager.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private boolean notifyViewEntered(int windowId, long nodeId, Rect focusedBounds) { final int virtualId = AccessibilityNodeInfo.getVirtualDescendantId(nodeId); if (!isVirtualNode(virtualId)) { return false; } final View view = findViewByAccessibilityId(windowId, nodeId); if (view == null) { return false; } final AccessibilityNodeInfo node = findVirtualNodeByAccessibilityId(view, virtualId); if (node == null) { return false; } if (!node.isEditable()) { return false; } final Rect newBounds = mTempBounds; node.getBoundsInScreen(newBounds); if (newBounds.equals(focusedBounds)) { return false; } focusedBounds.set(newBounds); AutofillManager.this.notifyViewEntered(view, virtualId, newBounds); return true; }
Example 2
Source File: AutofillManager.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private void notifyValueChanged(int windowId, long nodeId) { final int virtualId = AccessibilityNodeInfo.getVirtualDescendantId(nodeId); if (!isVirtualNode(virtualId)) { return; } final View view = findViewByAccessibilityId(windowId, nodeId); if (view == null) { return; } final AccessibilityNodeInfo node = findVirtualNodeByAccessibilityId(view, virtualId); if (node == null) { return; } AutofillManager.this.notifyValueChanged(view, virtualId, AutofillValue.forText(node.getText())); }
Example 3
Source File: AccessibilityInteractionController.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void findAccessibilityNodeInfoByAccessibilityIdClientThread( long accessibilityNodeId, Region interactiveRegion, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid, MagnificationSpec spec, Bundle arguments) { final Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBILITY_NODE_INFO_BY_ACCESSIBILITY_ID; message.arg1 = flags; final SomeArgs args = SomeArgs.obtain(); args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg1 = callback; args.arg2 = spec; args.arg3 = interactiveRegion; args.arg4 = arguments; message.obj = args; scheduleMessage(message, interrogatingPid, interrogatingTid, CONSIDER_REQUEST_PREPARERS); }
Example 4
Source File: AccessibilityInteractionController.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId, String text, Region interactiveRegion, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid, MagnificationSpec spec) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBILITY_NODE_INFO_BY_TEXT; message.arg1 = flags; SomeArgs args = SomeArgs.obtain(); args.arg1 = text; args.arg2 = callback; args.arg3 = spec; args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg4 = interactiveRegion; message.obj = args; scheduleMessage(message, interrogatingPid, interrogatingTid, CONSIDER_REQUEST_PREPARERS); }
Example 5
Source File: AccessibilityInteractionController.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void findFocusClientThread(long accessibilityNodeId, int focusType, Region interactiveRegion, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid, MagnificationSpec spec) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_FOCUS; message.arg1 = flags; message.arg2 = focusType; SomeArgs args = SomeArgs.obtain(); args.argi1 = interactionId; args.argi2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.arg1 = callback; args.arg2 = spec; args.arg3 = interactiveRegion; message.obj = args; scheduleMessage(message, interrogatingPid, interrogatingTid, CONSIDER_REQUEST_PREPARERS); }
Example 6
Source File: AccessibilityInteractionController.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void performAccessibilityActionClientThread(long accessibilityNodeId, int action, Bundle arguments, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_PERFORM_ACCESSIBILITY_ACTION; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = SomeArgs.obtain(); args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi2 = action; args.argi3 = interactionId; args.arg1 = callback; args.arg2 = arguments; message.obj = args; scheduleMessage(message, interrogatingPid, interrogatingTid, CONSIDER_REQUEST_PREPARERS); }
Example 7
Source File: AutofillManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void notifyViewExited(int windowId, long nodeId) { final int virtualId = AccessibilityNodeInfo.getVirtualDescendantId(nodeId); if (!isVirtualNode(virtualId)) { return; } final View view = findViewByAccessibilityId(windowId, nodeId); if (view == null) { return; } AutofillManager.this.notifyViewExited(view, virtualId); }
Example 8
Source File: AutofillManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void notifyViewClicked(int windowId, long nodeId) { final int virtualId = AccessibilityNodeInfo.getVirtualDescendantId(nodeId); if (!isVirtualNode(virtualId)) { return; } final View view = findViewByAccessibilityId(windowId, nodeId); if (view == null) { return; } final AccessibilityNodeInfo node = findVirtualNodeByAccessibilityId(view, virtualId); if (node == null) { return; } AutofillManager.this.notifyViewClicked(view, virtualId); }
Example 9
Source File: AccessibilityInteractionController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void prefetchPredecessorsOfVirtualNode(AccessibilityNodeInfo root, View providerHost, AccessibilityNodeProvider provider, List<AccessibilityNodeInfo> outInfos) { final int initialResultSize = outInfos.size(); long parentNodeId = root.getParentNodeId(); int accessibilityViewId = AccessibilityNodeInfo.getAccessibilityViewId(parentNodeId); while (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) { if (outInfos.size() >= MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) { return; } final int virtualDescendantId = AccessibilityNodeInfo.getVirtualDescendantId(parentNodeId); if (virtualDescendantId != AccessibilityNodeProvider.HOST_VIEW_ID || accessibilityViewId == providerHost.getAccessibilityViewId()) { final AccessibilityNodeInfo parent; parent = provider.createAccessibilityNodeInfo(virtualDescendantId); if (parent == null) { // Going up the parent relation we found a null predecessor, // so remove these disconnected nodes form the result. final int currentResultSize = outInfos.size(); for (int i = currentResultSize - 1; i >= initialResultSize; i--) { outInfos.remove(i); } // Couldn't obtain the parent, which means we have a // disconnected sub-tree. Abort prefetch immediately. return; } outInfos.add(parent); parentNodeId = parent.getParentNodeId(); accessibilityViewId = AccessibilityNodeInfo.getAccessibilityViewId( parentNodeId); } else { prefetchPredecessorsOfRealNode(providerHost, outInfos); return; } } }
Example 10
Source File: AccessibilityInteractionController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void prefetchSiblingsOfVirtualNode(AccessibilityNodeInfo current, View providerHost, AccessibilityNodeProvider provider, List<AccessibilityNodeInfo> outInfos) { final long parentNodeId = current.getParentNodeId(); final int parentAccessibilityViewId = AccessibilityNodeInfo.getAccessibilityViewId(parentNodeId); final int parentVirtualDescendantId = AccessibilityNodeInfo.getVirtualDescendantId(parentNodeId); if (parentVirtualDescendantId != AccessibilityNodeProvider.HOST_VIEW_ID || parentAccessibilityViewId == providerHost.getAccessibilityViewId()) { final AccessibilityNodeInfo parent = provider.createAccessibilityNodeInfo(parentVirtualDescendantId); if (parent != null) { final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { if (outInfos.size() >= MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) { return; } final long childNodeId = parent.getChildId(i); if (childNodeId != current.getSourceNodeId()) { final int childVirtualDescendantId = AccessibilityNodeInfo.getVirtualDescendantId(childNodeId); AccessibilityNodeInfo child = provider.createAccessibilityNodeInfo( childVirtualDescendantId); if (child != null) { outInfos.add(child); } } } } } else { prefetchSiblingsOfRealNode(providerHost, outInfos); } }