Loading core/java/android/view/AccessibilityInteractionController.java +101 −13 Original line number Diff line number Diff line Loading @@ -138,18 +138,26 @@ final class AccessibilityInteractionController { } public void findAccessibilityNodeInfoByAccessibilityIdClientThread( long accessibilityNodeId, int interactionId, long accessibilityNodeId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID; message.arg1 = flags; SomeArgs args = mPool.acquire(); args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -164,13 +172,21 @@ final class AccessibilityInteractionController { private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) { final int flags = message.arg1; SomeArgs args = (SomeArgs) message.obj; final int accessibilityViewId = args.argi1; final int virtualDescendantId = args.argi2; final int interactionId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList; infos.clear(); try { Loading Loading @@ -200,17 +216,26 @@ final class AccessibilityInteractionController { } public void findAccessibilityNodeInfoByViewIdClientThread(long accessibilityNodeId, int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int viewId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_VIEW_ID; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = mPool.acquire(); args.argi1 = viewId; args.argi2 = interactionId; args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -226,12 +251,20 @@ final class AccessibilityInteractionController { private void findAccessibilityNodeInfoByViewIdUiThread(Message message) { final int flags = message.arg1; final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int viewId = args.argi1; final int interactionId = args.argi2; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); AccessibilityNodeInfo info = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -262,18 +295,27 @@ final class AccessibilityInteractionController { } public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { String text, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT; message.arg1 = flags; SomeArgs args = mPool.acquire(); args.arg1 = text; args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg2 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.arg1 = callback; moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -288,14 +330,22 @@ final class AccessibilityInteractionController { private void findAccessibilityNodeInfosByTextUiThread(Message message) { final int flags = message.arg1; SomeArgs args = (SomeArgs) message.obj; final String text = (String) args.arg1; final int accessibilityViewId = args.argi1; final int virtualDescendantId = args.argi2; final int interactionId = args.argi3; SomeArgs moreArgs = (SomeArgs) args.arg2; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg2; (IAccessibilityInteractionConnectionCallback) moreArgs.arg1; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); List<AccessibilityNodeInfo> infos = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -353,19 +403,27 @@ final class AccessibilityInteractionController { } } public void findFocusClientThread(long accessibilityNodeId, int interactionId, int focusType, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { public void findFocusClientThread(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_FOCUS; message.arg1 = flags; message.arg2 = focusType; SomeArgs args = mPool.acquire(); args.argi1 = interactionId; args.argi2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -381,13 +439,21 @@ final class AccessibilityInteractionController { private void findFocusUiThread(Message message) { final int flags = message.arg1; final int focusType = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int interactionId = args.argi1; final int accessibilityViewId = args.argi2; final int virtualDescendantId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); AccessibilityNodeInfo focused = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -440,19 +506,27 @@ final class AccessibilityInteractionController { } } public void focusSearchClientThread(long accessibilityNodeId, int interactionId, int direction, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { public void focusSearchClientThread(long accessibilityNodeId, int direction, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FOCUS_SEARCH; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = mPool.acquire(); args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi2 = direction; args.argi3 = interactionId; args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -468,13 +542,21 @@ final class AccessibilityInteractionController { private void focusSearchUiThread(Message message) { final int flags = message.arg1; final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int virtualDescendantId = args.argi1; final int direction = args.argi2; final int interactionId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); AccessibilityNodeInfo next = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -541,13 +623,16 @@ final class AccessibilityInteractionController { message.what = PrivateHandler.MSG_PERFORM_ACCESSIBILITY_ACTION; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = mPool.acquire(); args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi2 = action; args.argi3 = interactionId; args.arg1 = callback; args.arg2 = arguments; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -563,6 +648,7 @@ final class AccessibilityInteractionController { private void perfromAccessibilityActionUiThread(Message message) { final int flags = message.arg1; final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int virtualDescendantId = args.argi1; final int action = args.argi2; Loading @@ -570,7 +656,9 @@ final class AccessibilityInteractionController { final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; Bundle arguments = (Bundle) args.arg2; mPool.release(args); boolean succeeded = false; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading core/java/android/view/View.java +39 −0 Original line number Diff line number Diff line Loading @@ -3609,6 +3609,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal case R.styleable.View_importantForAccessibility: setImportantForAccessibility(a.getInt(attr, IMPORTANT_FOR_ACCESSIBILITY_DEFAULT)); break; } } Loading Loading @@ -4901,6 +4902,30 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } /** * Returns the delta between the actual and last reported window left. * * @hide */ public int getActualAndReportedWindowLeftDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; } return 0; } /** * Returns the delta between the actual and last reported window top. * * @hide */ public int getActualAndReportedWindowTopDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; } return 0; } /** * Computes whether this view is visible to the user. Such a view is * attached, visible, all its predecessors are visible, it is not clipped Loading Loading @@ -17306,6 +17331,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ int mWindowTop; /** * Left actual position of this view's window. * * TODO: This is a workaround for 6623031. Remove when fixed. */ int mActualWindowLeft; /** * Actual top position of this view's window. * * TODO: This is a workaround for 6623031. Remove when fixed. */ int mActualWindowTop; /** * Indicates whether views need to use 32-bit drawing caches */ core/java/android/view/ViewRootImpl.java +24 −16 Original line number Diff line number Diff line Loading @@ -5172,13 +5172,15 @@ public final class ViewRootImpl implements ViewParent, @Override public void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findAccessibilityNodeInfoByAccessibilityIdClientThread(accessibilityNodeId, interactionId, callback, flags, interrogatingPid, interrogatingTid); windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading Loading @@ -5211,13 +5213,15 @@ public final class ViewRootImpl implements ViewParent, @Override public void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findAccessibilityNodeInfoByViewIdClientThread(accessibilityNodeId, viewId, interactionId, callback, flags, interrogatingPid, interrogatingTid); windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading @@ -5230,13 +5234,15 @@ public final class ViewRootImpl implements ViewParent, @Override public void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findAccessibilityNodeInfosByTextClientThread(accessibilityNodeId, text, interactionId, callback, flags, interrogatingPid, interrogatingTid); windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading @@ -5248,14 +5254,15 @@ public final class ViewRootImpl implements ViewParent, } @Override public void findFocus(long accessibilityNodeId, int interactionId, int focusType, public void findFocus(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findFocusClientThread(accessibilityNodeId, interactionId, focusType, callback, flags, interrogatingPid, interrogatingTid); .findFocusClientThread(accessibilityNodeId, focusType, windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading @@ -5267,14 +5274,15 @@ public final class ViewRootImpl implements ViewParent, } @Override public void focusSearch(long accessibilityNodeId, int interactionId, int direction, public void focusSearch(long accessibilityNodeId, int direction, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .focusSearchClientThread(accessibilityNodeId, interactionId, direction, callback, flags, interrogatingPid, interrogatingTid); .focusSearchClientThread(accessibilityNodeId, direction, windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading core/java/android/view/accessibility/AccessibilityNodeInfo.java +7 −0 Original line number Diff line number Diff line Loading @@ -382,6 +382,10 @@ public class AccessibilityNodeInfo implements Parcelable { private int mConnectionId = UNDEFINED; // TODO: These are a workaround for 6623031. Remove when fixed. private int mActualAndReportedWindowLeftDelta; private int mActualAndReportedWindowTopDelta; /** * Hide constructor from clients. */ Loading Loading @@ -428,6 +432,8 @@ public class AccessibilityNodeInfo implements Parcelable { final int rootAccessibilityViewId = (root != null) ? root.getAccessibilityViewId() : UNDEFINED; mSourceNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); mActualAndReportedWindowLeftDelta = root.getActualAndReportedWindowLeftDelta(); mActualAndReportedWindowTopDelta = root.getActualAndReportedWindowTopDelta(); } /** Loading Loading @@ -831,6 +837,7 @@ public class AccessibilityNodeInfo implements Parcelable { public void setBoundsInScreen(Rect bounds) { enforceNotSealed(); mBoundsInScreen.set(bounds.left, bounds.top, bounds.right, bounds.bottom); mBoundsInScreen.offset(mActualAndReportedWindowLeftDelta, mActualAndReportedWindowTopDelta); } /** Loading core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl +15 −15 Original line number Diff line number Diff line Loading @@ -28,25 +28,25 @@ import android.view.accessibility.IAccessibilityInteractionConnectionCallback; */ oneway interface IAccessibilityInteractionConnection { void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int id, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findFocus(long accessibilityNodeId, int interactionId, int focusType, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findFocus(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void focusSearch(long accessibilityNodeId, int interactionId, int direction, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void focusSearch(long accessibilityNodeId, int direction, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void performAccessibilityAction(long accessibilityNodeId, int action, in Bundle arguments, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, Loading Loading
core/java/android/view/AccessibilityInteractionController.java +101 −13 Original line number Diff line number Diff line Loading @@ -138,18 +138,26 @@ final class AccessibilityInteractionController { } public void findAccessibilityNodeInfoByAccessibilityIdClientThread( long accessibilityNodeId, int interactionId, long accessibilityNodeId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID; message.arg1 = flags; SomeArgs args = mPool.acquire(); args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -164,13 +172,21 @@ final class AccessibilityInteractionController { private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) { final int flags = message.arg1; SomeArgs args = (SomeArgs) message.obj; final int accessibilityViewId = args.argi1; final int virtualDescendantId = args.argi2; final int interactionId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList; infos.clear(); try { Loading Loading @@ -200,17 +216,26 @@ final class AccessibilityInteractionController { } public void findAccessibilityNodeInfoByViewIdClientThread(long accessibilityNodeId, int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int viewId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_VIEW_ID; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = mPool.acquire(); args.argi1 = viewId; args.argi2 = interactionId; args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -226,12 +251,20 @@ final class AccessibilityInteractionController { private void findAccessibilityNodeInfoByViewIdUiThread(Message message) { final int flags = message.arg1; final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int viewId = args.argi1; final int interactionId = args.argi2; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); AccessibilityNodeInfo info = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -262,18 +295,27 @@ final class AccessibilityInteractionController { } public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { String text, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT; message.arg1 = flags; SomeArgs args = mPool.acquire(); args.arg1 = text; args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi3 = interactionId; args.arg2 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.arg1 = callback; moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -288,14 +330,22 @@ final class AccessibilityInteractionController { private void findAccessibilityNodeInfosByTextUiThread(Message message) { final int flags = message.arg1; SomeArgs args = (SomeArgs) message.obj; final String text = (String) args.arg1; final int accessibilityViewId = args.argi1; final int virtualDescendantId = args.argi2; final int interactionId = args.argi3; SomeArgs moreArgs = (SomeArgs) args.arg2; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg2; (IAccessibilityInteractionConnectionCallback) moreArgs.arg1; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); List<AccessibilityNodeInfo> infos = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -353,19 +403,27 @@ final class AccessibilityInteractionController { } } public void findFocusClientThread(long accessibilityNodeId, int interactionId, int focusType, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { public void findFocusClientThread(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FIND_FOCUS; message.arg1 = flags; message.arg2 = focusType; SomeArgs args = mPool.acquire(); args.argi1 = interactionId; args.argi2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -381,13 +439,21 @@ final class AccessibilityInteractionController { private void findFocusUiThread(Message message) { final int flags = message.arg1; final int focusType = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int interactionId = args.argi1; final int accessibilityViewId = args.argi2; final int virtualDescendantId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); AccessibilityNodeInfo focused = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -440,19 +506,27 @@ final class AccessibilityInteractionController { } } public void focusSearchClientThread(long accessibilityNodeId, int interactionId, int direction, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { public void focusSearchClientThread(long accessibilityNodeId, int direction, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid, long interrogatingTid) { Message message = mHandler.obtainMessage(); message.what = PrivateHandler.MSG_FOCUS_SEARCH; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = mPool.acquire(); args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi2 = direction; args.argi3 = interactionId; args.arg1 = callback; SomeArgs moreArgs = mPool.acquire(); moreArgs.argi1 = windowLeft; moreArgs.argi2 = windowTop; args.arg2 = moreArgs; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -468,13 +542,21 @@ final class AccessibilityInteractionController { private void focusSearchUiThread(Message message) { final int flags = message.arg1; final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int virtualDescendantId = args.argi1; final int direction = args.argi2; final int interactionId = args.argi3; final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; SomeArgs moreArgs = (SomeArgs) args.arg2; mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1; mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2; mPool.release(moreArgs); mPool.release(args); AccessibilityNodeInfo next = null; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading Loading @@ -541,13 +623,16 @@ final class AccessibilityInteractionController { message.what = PrivateHandler.MSG_PERFORM_ACCESSIBILITY_ACTION; message.arg1 = flags; message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId); SomeArgs args = mPool.acquire(); args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId); args.argi2 = action; args.argi3 = interactionId; args.arg1 = callback; args.arg2 = arguments; message.obj = args; // If the interrogation is performed by the same thread as the main UI // thread in this process, set the message as a static reference so // after this call completes the same thread but in the interrogating Loading @@ -563,6 +648,7 @@ final class AccessibilityInteractionController { private void perfromAccessibilityActionUiThread(Message message) { final int flags = message.arg1; final int accessibilityViewId = message.arg2; SomeArgs args = (SomeArgs) message.obj; final int virtualDescendantId = args.argi1; final int action = args.argi2; Loading @@ -570,7 +656,9 @@ final class AccessibilityInteractionController { final IAccessibilityInteractionConnectionCallback callback = (IAccessibilityInteractionConnectionCallback) args.arg1; Bundle arguments = (Bundle) args.arg2; mPool.release(args); boolean succeeded = false; try { if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) { Loading
core/java/android/view/View.java +39 −0 Original line number Diff line number Diff line Loading @@ -3609,6 +3609,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal case R.styleable.View_importantForAccessibility: setImportantForAccessibility(a.getInt(attr, IMPORTANT_FOR_ACCESSIBILITY_DEFAULT)); break; } } Loading Loading @@ -4901,6 +4902,30 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } /** * Returns the delta between the actual and last reported window left. * * @hide */ public int getActualAndReportedWindowLeftDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; } return 0; } /** * Returns the delta between the actual and last reported window top. * * @hide */ public int getActualAndReportedWindowTopDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; } return 0; } /** * Computes whether this view is visible to the user. Such a view is * attached, visible, all its predecessors are visible, it is not clipped Loading Loading @@ -17306,6 +17331,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ int mWindowTop; /** * Left actual position of this view's window. * * TODO: This is a workaround for 6623031. Remove when fixed. */ int mActualWindowLeft; /** * Actual top position of this view's window. * * TODO: This is a workaround for 6623031. Remove when fixed. */ int mActualWindowTop; /** * Indicates whether views need to use 32-bit drawing caches */
core/java/android/view/ViewRootImpl.java +24 −16 Original line number Diff line number Diff line Loading @@ -5172,13 +5172,15 @@ public final class ViewRootImpl implements ViewParent, @Override public void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findAccessibilityNodeInfoByAccessibilityIdClientThread(accessibilityNodeId, interactionId, callback, flags, interrogatingPid, interrogatingTid); windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading Loading @@ -5211,13 +5213,15 @@ public final class ViewRootImpl implements ViewParent, @Override public void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findAccessibilityNodeInfoByViewIdClientThread(accessibilityNodeId, viewId, interactionId, callback, flags, interrogatingPid, interrogatingTid); windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading @@ -5230,13 +5234,15 @@ public final class ViewRootImpl implements ViewParent, @Override public void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findAccessibilityNodeInfosByTextClientThread(accessibilityNodeId, text, interactionId, callback, flags, interrogatingPid, interrogatingTid); windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading @@ -5248,14 +5254,15 @@ public final class ViewRootImpl implements ViewParent, } @Override public void findFocus(long accessibilityNodeId, int interactionId, int focusType, public void findFocus(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .findFocusClientThread(accessibilityNodeId, interactionId, focusType, callback, flags, interrogatingPid, interrogatingTid); .findFocusClientThread(accessibilityNodeId, focusType, windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading @@ -5267,14 +5274,15 @@ public final class ViewRootImpl implements ViewParent, } @Override public void focusSearch(long accessibilityNodeId, int interactionId, int direction, public void focusSearch(long accessibilityNodeId, int direction, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid) { ViewRootImpl viewRootImpl = mViewRootImpl.get(); if (viewRootImpl != null && viewRootImpl.mView != null) { viewRootImpl.getAccessibilityInteractionController() .focusSearchClientThread(accessibilityNodeId, interactionId, direction, callback, flags, interrogatingPid, interrogatingTid); .focusSearchClientThread(accessibilityNodeId, direction, windowLeft, windowTop, interactionId, callback, flags, interrogatingPid, interrogatingTid); } else { // We cannot make the call and notify the caller so it does not wait. try { Loading
core/java/android/view/accessibility/AccessibilityNodeInfo.java +7 −0 Original line number Diff line number Diff line Loading @@ -382,6 +382,10 @@ public class AccessibilityNodeInfo implements Parcelable { private int mConnectionId = UNDEFINED; // TODO: These are a workaround for 6623031. Remove when fixed. private int mActualAndReportedWindowLeftDelta; private int mActualAndReportedWindowTopDelta; /** * Hide constructor from clients. */ Loading Loading @@ -428,6 +432,8 @@ public class AccessibilityNodeInfo implements Parcelable { final int rootAccessibilityViewId = (root != null) ? root.getAccessibilityViewId() : UNDEFINED; mSourceNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId); mActualAndReportedWindowLeftDelta = root.getActualAndReportedWindowLeftDelta(); mActualAndReportedWindowTopDelta = root.getActualAndReportedWindowTopDelta(); } /** Loading Loading @@ -831,6 +837,7 @@ public class AccessibilityNodeInfo implements Parcelable { public void setBoundsInScreen(Rect bounds) { enforceNotSealed(); mBoundsInScreen.set(bounds.left, bounds.top, bounds.right, bounds.bottom); mBoundsInScreen.offset(mActualAndReportedWindowLeftDelta, mActualAndReportedWindowTopDelta); } /** Loading
core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl +15 −15 Original line number Diff line number Diff line Loading @@ -28,25 +28,25 @@ import android.view.accessibility.IAccessibilityInteractionConnectionCallback; */ oneway interface IAccessibilityInteractionConnection { void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int id, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findFocus(long accessibilityNodeId, int interactionId, int focusType, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void findFocus(long accessibilityNodeId, int focusType, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void focusSearch(long accessibilityNodeId, int interactionId, int direction, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void focusSearch(long accessibilityNodeId, int direction, int windowLeft, int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, long interrogatingTid); void performAccessibilityAction(long accessibilityNodeId, int action, in Bundle arguments, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, Loading