@@ -138,18 +138,26 @@ private boolean isShown(View view) {
138138 }
139139
140140 public void findAccessibilityNodeInfoByAccessibilityIdClientThread (
141- long accessibilityNodeId , int interactionId ,
141+ long accessibilityNodeId , int windowLeft , int windowTop , int interactionId ,
142142 IAccessibilityInteractionConnectionCallback callback , int flags , int interrogatingPid ,
143143 long interrogatingTid ) {
144144 Message message = mHandler .obtainMessage ();
145145 message .what = PrivateHandler .MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID ;
146146 message .arg1 = flags ;
147+
147148 SomeArgs args = mPool .acquire ();
148149 args .argi1 = AccessibilityNodeInfo .getAccessibilityViewId (accessibilityNodeId );
149150 args .argi2 = AccessibilityNodeInfo .getVirtualDescendantId (accessibilityNodeId );
150151 args .argi3 = interactionId ;
151152 args .arg1 = callback ;
153+
154+ SomeArgs moreArgs = mPool .acquire ();
155+ moreArgs .argi1 = windowLeft ;
156+ moreArgs .argi2 = windowTop ;
157+ args .arg2 = moreArgs ;
158+
152159 message .obj = args ;
160+
153161 // If the interrogation is performed by the same thread as the main UI
154162 // thread in this process, set the message as a static reference so
155163 // after this call completes the same thread but in the interrogating
@@ -164,13 +172,21 @@ public void findAccessibilityNodeInfoByAccessibilityIdClientThread(
164172
165173 private void findAccessibilityNodeInfoByAccessibilityIdUiThread (Message message ) {
166174 final int flags = message .arg1 ;
175+
167176 SomeArgs args = (SomeArgs ) message .obj ;
168177 final int accessibilityViewId = args .argi1 ;
169178 final int virtualDescendantId = args .argi2 ;
170179 final int interactionId = args .argi3 ;
171180 final IAccessibilityInteractionConnectionCallback callback =
172181 (IAccessibilityInteractionConnectionCallback ) args .arg1 ;
182+
183+ SomeArgs moreArgs = (SomeArgs ) args .arg2 ;
184+ mViewRootImpl .mAttachInfo .mActualWindowLeft = moreArgs .argi1 ;
185+ mViewRootImpl .mAttachInfo .mActualWindowTop = moreArgs .argi2 ;
186+
187+ mPool .release (moreArgs );
173188 mPool .release (args );
189+
174190 List <AccessibilityNodeInfo > infos = mTempAccessibilityNodeInfoList ;
175191 infos .clear ();
176192 try {
@@ -200,17 +216,26 @@ private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message)
200216 }
201217
202218 public void findAccessibilityNodeInfoByViewIdClientThread (long accessibilityNodeId ,
203- int viewId , int interactionId , IAccessibilityInteractionConnectionCallback callback ,
204- int flags , int interrogatingPid , long interrogatingTid ) {
219+ int viewId , int windowLeft , int windowTop , int interactionId ,
220+ IAccessibilityInteractionConnectionCallback callback , int flags , int interrogatingPid ,
221+ long interrogatingTid ) {
205222 Message message = mHandler .obtainMessage ();
206223 message .what = PrivateHandler .MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_VIEW_ID ;
207224 message .arg1 = flags ;
208225 message .arg2 = AccessibilityNodeInfo .getAccessibilityViewId (accessibilityNodeId );
226+
209227 SomeArgs args = mPool .acquire ();
210228 args .argi1 = viewId ;
211229 args .argi2 = interactionId ;
212230 args .arg1 = callback ;
231+
232+ SomeArgs moreArgs = mPool .acquire ();
233+ moreArgs .argi1 = windowLeft ;
234+ moreArgs .argi2 = windowTop ;
235+ args .arg2 = moreArgs ;
236+
213237 message .obj = args ;
238+
214239 // If the interrogation is performed by the same thread as the main UI
215240 // thread in this process, set the message as a static reference so
216241 // after this call completes the same thread but in the interrogating
@@ -226,12 +251,20 @@ public void findAccessibilityNodeInfoByViewIdClientThread(long accessibilityNode
226251 private void findAccessibilityNodeInfoByViewIdUiThread (Message message ) {
227252 final int flags = message .arg1 ;
228253 final int accessibilityViewId = message .arg2 ;
254+
229255 SomeArgs args = (SomeArgs ) message .obj ;
230256 final int viewId = args .argi1 ;
231257 final int interactionId = args .argi2 ;
232258 final IAccessibilityInteractionConnectionCallback callback =
233259 (IAccessibilityInteractionConnectionCallback ) args .arg1 ;
260+
261+ SomeArgs moreArgs = (SomeArgs ) args .arg2 ;
262+ mViewRootImpl .mAttachInfo .mActualWindowLeft = moreArgs .argi1 ;
263+ mViewRootImpl .mAttachInfo .mActualWindowTop = moreArgs .argi2 ;
264+
265+ mPool .release (moreArgs );
234266 mPool .release (args );
267+
235268 AccessibilityNodeInfo info = null ;
236269 try {
237270 if (mViewRootImpl .mView == null || mViewRootImpl .mAttachInfo == null ) {
@@ -262,18 +295,27 @@ private void findAccessibilityNodeInfoByViewIdUiThread(Message message) {
262295 }
263296
264297 public void findAccessibilityNodeInfosByTextClientThread (long accessibilityNodeId ,
265- String text , int interactionId , IAccessibilityInteractionConnectionCallback callback ,
266- int flags , int interrogatingPid , long interrogatingTid ) {
298+ String text , int windowLeft , int windowTop , int interactionId ,
299+ IAccessibilityInteractionConnectionCallback callback , int flags ,
300+ int interrogatingPid , long interrogatingTid ) {
267301 Message message = mHandler .obtainMessage ();
268302 message .what = PrivateHandler .MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT ;
269303 message .arg1 = flags ;
304+
270305 SomeArgs args = mPool .acquire ();
271306 args .arg1 = text ;
272307 args .argi1 = AccessibilityNodeInfo .getAccessibilityViewId (accessibilityNodeId );
273308 args .argi2 = AccessibilityNodeInfo .getVirtualDescendantId (accessibilityNodeId );
274309 args .argi3 = interactionId ;
275- args .arg2 = callback ;
310+
311+ SomeArgs moreArgs = mPool .acquire ();
312+ moreArgs .arg1 = callback ;
313+ moreArgs .argi1 = windowLeft ;
314+ moreArgs .argi2 = windowTop ;
315+ args .arg2 = moreArgs ;
316+
276317 message .obj = args ;
318+
277319 // If the interrogation is performed by the same thread as the main UI
278320 // thread in this process, set the message as a static reference so
279321 // after this call completes the same thread but in the interrogating
@@ -288,14 +330,22 @@ public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeI
288330
289331 private void findAccessibilityNodeInfosByTextUiThread (Message message ) {
290332 final int flags = message .arg1 ;
333+
291334 SomeArgs args = (SomeArgs ) message .obj ;
292335 final String text = (String ) args .arg1 ;
293336 final int accessibilityViewId = args .argi1 ;
294337 final int virtualDescendantId = args .argi2 ;
295338 final int interactionId = args .argi3 ;
339+
340+ SomeArgs moreArgs = (SomeArgs ) args .arg2 ;
296341 final IAccessibilityInteractionConnectionCallback callback =
297- (IAccessibilityInteractionConnectionCallback ) args .arg2 ;
342+ (IAccessibilityInteractionConnectionCallback ) moreArgs .arg1 ;
343+ mViewRootImpl .mAttachInfo .mActualWindowLeft = moreArgs .argi1 ;
344+ mViewRootImpl .mAttachInfo .mActualWindowTop = moreArgs .argi2 ;
345+
346+ mPool .release (moreArgs );
298347 mPool .release (args );
348+
299349 List <AccessibilityNodeInfo > infos = null ;
300350 try {
301351 if (mViewRootImpl .mView == null || mViewRootImpl .mAttachInfo == null ) {
@@ -353,19 +403,27 @@ private void findAccessibilityNodeInfosByTextUiThread(Message message) {
353403 }
354404 }
355405
356- public void findFocusClientThread (long accessibilityNodeId , int interactionId , int focusType ,
357- IAccessibilityInteractionConnectionCallback callback , int flags , int interogatingPid ,
358- long interrogatingTid ) {
406+ public void findFocusClientThread (long accessibilityNodeId , int focusType , int windowLeft ,
407+ int windowTop , int interactionId , IAccessibilityInteractionConnectionCallback callback ,
408+ int flags , int interogatingPid , long interrogatingTid ) {
359409 Message message = mHandler .obtainMessage ();
360410 message .what = PrivateHandler .MSG_FIND_FOCUS ;
361411 message .arg1 = flags ;
362412 message .arg2 = focusType ;
413+
363414 SomeArgs args = mPool .acquire ();
364415 args .argi1 = interactionId ;
365416 args .argi2 = AccessibilityNodeInfo .getAccessibilityViewId (accessibilityNodeId );
366417 args .argi3 = AccessibilityNodeInfo .getVirtualDescendantId (accessibilityNodeId );
367418 args .arg1 = callback ;
419+
420+ SomeArgs moreArgs = mPool .acquire ();
421+ moreArgs .argi1 = windowLeft ;
422+ moreArgs .argi2 = windowTop ;
423+ args .arg2 = moreArgs ;
424+
368425 message .obj = args ;
426+
369427 // If the interrogation is performed by the same thread as the main UI
370428 // thread in this process, set the message as a static reference so
371429 // after this call completes the same thread but in the interrogating
@@ -381,13 +439,21 @@ public void findFocusClientThread(long accessibilityNodeId, int interactionId, i
381439 private void findFocusUiThread (Message message ) {
382440 final int flags = message .arg1 ;
383441 final int focusType = message .arg2 ;
442+
384443 SomeArgs args = (SomeArgs ) message .obj ;
385444 final int interactionId = args .argi1 ;
386445 final int accessibilityViewId = args .argi2 ;
387446 final int virtualDescendantId = args .argi3 ;
388447 final IAccessibilityInteractionConnectionCallback callback =
389448 (IAccessibilityInteractionConnectionCallback ) args .arg1 ;
449+
450+ SomeArgs moreArgs = (SomeArgs ) args .arg2 ;
451+ mViewRootImpl .mAttachInfo .mActualWindowLeft = moreArgs .argi1 ;
452+ mViewRootImpl .mAttachInfo .mActualWindowTop = moreArgs .argi2 ;
453+
454+ mPool .release (moreArgs );
390455 mPool .release (args );
456+
391457 AccessibilityNodeInfo focused = null ;
392458 try {
393459 if (mViewRootImpl .mView == null || mViewRootImpl .mAttachInfo == null ) {
@@ -440,19 +506,27 @@ private void findFocusUiThread(Message message) {
440506 }
441507 }
442508
443- public void focusSearchClientThread (long accessibilityNodeId , int interactionId , int direction ,
444- IAccessibilityInteractionConnectionCallback callback , int flags , int interogatingPid ,
445- long interrogatingTid ) {
509+ public void focusSearchClientThread (long accessibilityNodeId , int direction , int windowLeft ,
510+ int windowTop , int interactionId , IAccessibilityInteractionConnectionCallback callback ,
511+ int flags , int interogatingPid , long interrogatingTid ) {
446512 Message message = mHandler .obtainMessage ();
447513 message .what = PrivateHandler .MSG_FOCUS_SEARCH ;
448514 message .arg1 = flags ;
449515 message .arg2 = AccessibilityNodeInfo .getAccessibilityViewId (accessibilityNodeId );
516+
450517 SomeArgs args = mPool .acquire ();
451518 args .argi1 = AccessibilityNodeInfo .getVirtualDescendantId (accessibilityNodeId );
452519 args .argi2 = direction ;
453520 args .argi3 = interactionId ;
454521 args .arg1 = callback ;
522+
523+ SomeArgs moreArgs = mPool .acquire ();
524+ moreArgs .argi1 = windowLeft ;
525+ moreArgs .argi2 = windowTop ;
526+ args .arg2 = moreArgs ;
527+
455528 message .obj = args ;
529+
456530 // If the interrogation is performed by the same thread as the main UI
457531 // thread in this process, set the message as a static reference so
458532 // after this call completes the same thread but in the interrogating
@@ -468,13 +542,21 @@ public void focusSearchClientThread(long accessibilityNodeId, int interactionId,
468542 private void focusSearchUiThread (Message message ) {
469543 final int flags = message .arg1 ;
470544 final int accessibilityViewId = message .arg2 ;
545+
471546 SomeArgs args = (SomeArgs ) message .obj ;
472547 final int virtualDescendantId = args .argi1 ;
473548 final int direction = args .argi2 ;
474549 final int interactionId = args .argi3 ;
475550 final IAccessibilityInteractionConnectionCallback callback =
476551 (IAccessibilityInteractionConnectionCallback ) args .arg1 ;
552+
553+ SomeArgs moreArgs = (SomeArgs ) args .arg2 ;
554+ mViewRootImpl .mAttachInfo .mActualWindowLeft = moreArgs .argi1 ;
555+ mViewRootImpl .mAttachInfo .mActualWindowTop = moreArgs .argi2 ;
556+
557+ mPool .release (moreArgs );
477558 mPool .release (args );
559+
478560 AccessibilityNodeInfo next = null ;
479561 try {
480562 if (mViewRootImpl .mView == null || mViewRootImpl .mAttachInfo == null ) {
@@ -541,13 +623,16 @@ public void performAccessibilityActionClientThread(long accessibilityNodeId, int
541623 message .what = PrivateHandler .MSG_PERFORM_ACCESSIBILITY_ACTION ;
542624 message .arg1 = flags ;
543625 message .arg2 = AccessibilityNodeInfo .getAccessibilityViewId (accessibilityNodeId );
626+
544627 SomeArgs args = mPool .acquire ();
545628 args .argi1 = AccessibilityNodeInfo .getVirtualDescendantId (accessibilityNodeId );
546629 args .argi2 = action ;
547630 args .argi3 = interactionId ;
548631 args .arg1 = callback ;
549632 args .arg2 = arguments ;
633+
550634 message .obj = args ;
635+
551636 // If the interrogation is performed by the same thread as the main UI
552637 // thread in this process, set the message as a static reference so
553638 // after this call completes the same thread but in the interrogating
@@ -563,14 +648,17 @@ public void performAccessibilityActionClientThread(long accessibilityNodeId, int
563648 private void perfromAccessibilityActionUiThread (Message message ) {
564649 final int flags = message .arg1 ;
565650 final int accessibilityViewId = message .arg2 ;
651+
566652 SomeArgs args = (SomeArgs ) message .obj ;
567653 final int virtualDescendantId = args .argi1 ;
568654 final int action = args .argi2 ;
569655 final int interactionId = args .argi3 ;
570656 final IAccessibilityInteractionConnectionCallback callback =
571657 (IAccessibilityInteractionConnectionCallback ) args .arg1 ;
572658 Bundle arguments = (Bundle ) args .arg2 ;
659+
573660 mPool .release (args );
661+
574662 boolean succeeded = false ;
575663 try {
576664 if (mViewRootImpl .mView == null || mViewRootImpl .mAttachInfo == null ) {
0 commit comments