You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When iterating through the child nodes of a parent node, the method onAccessibilityEvent invokes getSubNodes, a recursive function. This recursion, influenced by the depth of the tree (treeDepth), has the potential to cause a stack overflow, leading to Application Not Responding (ANR) errors.
There are discussions on StackOverflow, of ANRs occurring when the accessibility service is used for navigating through AccessibilityNodeInfo.
To mitigate this issue, I propose to add a new parameter, maximumTreeDepth, which would serve as a threshold for the recursion depth. Once this threshold is reached, further traversal operations would be halted, and the method getNextTexts can return.
This approach allows users to balance the trade-off between performance aspects (such as minimizing ANRs and reducing battery consumption) and usability, by adjusting the maximumTreeDepth parameter according to the needs of their specific application.
Let me know what do you think about it, I can then raise a PR for the same!
The text was updated successfully, but these errors were encountered:
When iterating through the child nodes of a parent node, the method
onAccessibilityEvent
invokesgetSubNodes
, a recursive function. This recursion, influenced by the depth of the tree (treeDepth
), has the potential to cause a stack overflow, leading to Application Not Responding (ANR) errors.There are discussions on StackOverflow, of ANRs occurring when the accessibility service is used for navigating through AccessibilityNodeInfo.
To mitigate this issue, I propose to add a new parameter,
maximumTreeDepth
, which would serve as a threshold for the recursion depth. Once this threshold is reached, further traversal operations would be halted, and the methodgetNextTexts
can return.This approach allows users to balance the trade-off between performance aspects (such as minimizing ANRs and reducing battery consumption) and usability, by adjusting the maximumTreeDepth parameter according to the needs of their specific application.
Let me know what do you think about it, I can then raise a PR for the same!
The text was updated successfully, but these errors were encountered: