Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception: Callbacks must set parent bounds in populateNodeForVirtualViewId()

My Android app crash reporting service has reported many instances of:

java.lang.RuntimeException: Callbacks must set parent bounds in populateNodeForVirtualViewId()
at iv.a(SourceFile:56)
at iw.a(SourceFile:716)
at hq.a(SourceFile:112)
at hw.createAccessibilityNodeInfo(SourceFile:42)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:724)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:147)
at android.view.AccessibilityInteractionController.access$300(AccessibilityInteractionController.java:49)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:971)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5140)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
at dalvik.system.NativeStart.main(Native Method)

Feels connected to Accessibility issues I didn't really take care of, but how do I start fixing this ? the call stack doesn't point me in any direction

I tried adding a contentDescpription xml tag to all the places in my code that lint informed me it's missing but it didn't help

Edit: Found the problem, the crash occurred when I displayed a StreetViewPanoramaFragment above a map fragment when explore by touch (talkback?) was enabled.

I don't know what's causing this, I guess I will open a separate more focused question

like image 601
Shai Levy Avatar asked Aug 23 '14 08:08

Shai Levy


3 Answers

Found the problem, the crash occurred when I displayed a StreetViewPanoramaFragment above a map fragment when explore by touch (talkback?) was enabled.

I don't know what's causing this, I guess I will open a separate more focused question

like image 97
Shai Levy Avatar answered Nov 06 '22 12:11

Shai Levy


Well the question is "How do I start fixing this?", so I'd say: start looking into the framework code.

I could track down that createAccessibilityNodeInfo() is actually from View.createAccessibilityNodeInfo().

Also searching for "Callbacks must set parent bounds in populateNodeForVirtualViewId()" I found that this is called at line 395 in the class ExploreByTouchHelper.java.

I can't say more without knowing your code, but that's a good starting point for your quest.

like image 1
Gil Vegliach Avatar answered Nov 06 '22 13:11

Gil Vegliach


This may be a bug in support v4 lib when running in android versions older than ICS. Runtime exception is thrown by ExploreByTouchHelper

393        node.getBoundsInParent(mTempParentRect);
394        if (mTempParentRect.isEmpty()) {
395            throw new RuntimeException("Callbacks must set parent bounds in "
396                    + "populateNodeForVirtualViewId()");
397        }

That node.getBoundsInParent call is implemented in an AccessibilityNodeInfoImpl implementation based on the android version where the code is running, as you can see in AccessibilityNodeInfoCompat

755     static {
756         if (Build.VERSION.SDK_INT >= 19) { // KitKat
757             IMPL = new AccessibilityNodeInfoKitKatImpl();
758         } else if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
759             IMPL = new AccessibilityNodeInfoJellybeanMr2Impl();
760         } else if (Build.VERSION.SDK_INT >= 16) { // JellyBean
761             IMPL = new AccessibilityNodeInfoJellybeanImpl();
762         } else if (Build.VERSION.SDK_INT >= 14) { // ICS
763             IMPL = new AccessibilityNodeInfoIcsImpl();
764         } else {
765             IMPL = new AccessibilityNodeInfoStubImpl();
766         }
767     }
768 
769     private static final AccessibilityNodeInfoImpl IMPL;

And it seems that AccessibilityNodeInfoStubImpl is an empty stub, so you can try in the emulator running something < 14 and see if you get the exception.

like image 1
isalgueiro Avatar answered Nov 06 '22 11:11

isalgueiro