8

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

Shai Levy
  • 715
  • 9
  • 25
  • 1
    Have you used proguard? – hoomi Aug 23 '14 at 09:08
  • I have seen some crashes in the apps when the users allow third party apps access accessibility events. Maybe try to write your own app which listens to accessibility events and then write your app to see is you can reproduce it – hoomi Aug 23 '14 at 09:18
  • I tried several accessibility options and the app didn't crash (only my device). suggestions ? – Shai Levy Aug 24 '14 at 19:35

5 Answers5

3

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

Shai Levy
  • 715
  • 9
  • 25
1

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.

Gil Vegliach
  • 3,542
  • 2
  • 25
  • 37
  • The code doesn't have any accessibility features and the app has plenty of UI and UI libraries. I can't really tell which view is generating the problematic createAccessibilityNodeInfo(). Do you know what feature I need to turn on in phone in order for ExploreByTouchHelper to kick in ? – Shai Levy Aug 30 '14 at 09:23
  • Does the app crash when you start the launcher activity? I would say that the problem might arise when the problematic View is inflated, so navigate to the activity that causes the crash and check that layout. If you or the libraries use Fragments you must look in that Fragments generated Views as well. – Gil Vegliach Aug 30 '14 at 09:41
  • Also, check especially custom Views by you or the library doing fishy thing with the Accessibility API – Gil Vegliach Aug 30 '14 at 09:47
  • The app doesn't crash on launch, it crashes after several screen but I don't see a common screen for the crash point, I will look again. – Shai Levy Sep 02 '14 at 09:18
  • And of course I checked custom views but many of the are libraries so it's a bit harder to figure out – Shai Levy Sep 02 '14 at 09:20
  • Find ONE 'screen' where it crashes. See if it can be reproduced. Then you'll have narrowed the search space down to the custom views of that activity's layout. (the problematic code could be reused elsewhere, but that is for later) – Gil Vegliach Sep 02 '14 at 09:44
  • I wasn't able to reproduce on my device and on other devices, the problem is affecting 3-5% out of thousand of users. It's probably some kind of accessibility feature thats turned on – Shai Levy Sep 02 '14 at 14:05
  • You might want to try retrace (http://proguard.sourceforge.net/manual/retrace/examples.html#with) to figure out which library is causing the issue. You could also try turning on TalkBack (Settings > Accessibility > TalkBack) and running through your app. – alanv Sep 02 '14 at 18:28
  • The crash is from Androids code, I don't need a retrace. And I already tried talkback but it didn't reproduce the issue on several of my devices – Shai Levy Sep 03 '14 at 09:37
1

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.

isalgueiro
  • 1,973
  • 16
  • 20
  • 1
    According to the reports the crash is on KitKat devices... I should probably add this info to the question – Shai Levy Sep 04 '14 at 12:35
0

how do I start fixing this ?

The first step is to deobfuscate your stacktrace

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)

rds
  • 26,253
  • 19
  • 107
  • 134
  • My code isn't obfuscated and I don't care about the middle steps in the android support libraries and etc. The error is probably originating in and incorrect usage of the Android accessibility framework at one of the custom views in my app.. but that not really pointing anywhere – Shai Levy Sep 03 '14 at 12:47
  • Found the same issue when using android chip. Not sure how to go about it. – RamPrasadBismil Jun 15 '20 at 21:20
0

For reference, I'm getting this stack trace, which looks like a de-obfuscated version of yours:

java.lang.RuntimeException: Callbacks must set parent bounds in populateNodeForVirtualViewId()
       at android.support.v4.widget.EdgeEffectCompat$EdgeEffectImpl.newEdgeEffect(SourceFile:56)
       at android.support.v4.widget.EdgeEffectCompat$EdgeEffectLollipopImpl.a(SourceFile:717)
       at android.support.v4.view.accessibility.AccessibilityNodeProviderCompatKitKat.a(SourceFile:112)
       at android.support.v4.view.accessibility.AccessibilityRecordCompat$AccessibilityRecordImpl.createAccessibilityNodeInfo(SourceFile:42)
       at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfVirtualNode(AccessibilityInteractionController.java:1092)
       at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:1002)
       at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:998)
       at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:799)
       at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:155)
       at android.view.AccessibilityInteractionController.access$400(AccessibilityInteractionController.java:53)
       at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1146)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5343)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Fabric.io also revealed there is a streetview thread running:

thread
       at java.lang.Object.wait(Object.java)
       at com.google.maps.api.android.lib6.gmm6.streetview.bf.a()
       at com.google.maps.api.android.lib6.gmm6.streetview.bf.run()
Rob Crowell
  • 1,447
  • 3
  • 15
  • 25