In my application I have an accessibility service that gets the root of the active window before performing further actions. The relevant section looks like this:
@Override
public final void onAccessibilityEvent(AccessibilityEvent event) {
...
AccessibilityNodeInfo rootAccessibilityNode = getRootInActiveWindow();
...
}
I'm getting complaints from users about ANRs, and the stacktrace is pointing me towards the getRootInActiveWindow line.
Is it possible that getRootInActiveWindow causes ANRs and if so, what is the mechanism? Does this method need to be called in it's own thread? There's nothing in the documentation about this.