After OnePlus's Android 12 update, the Play Story started behaving weirdly, which means that downloading apps stuck for no reason. After some sweat and tears I figured out that turning the wifi off and on fixis this issue, but only for about 10 seconds, then I have to do this again.
So I made a task which starts the update, and periodically pokes the wifi until everything is downloaded. For checking that, I'm using the UI query, to check for a text which appeares when no more updates are available.
Since I have to poke the wifi, then check for the UI and so on, I've put them in a for loop, and on a timeout (not finding some text) I wish to continue, which somewhat works, but the UI Query seems to struggle after a few times.
By struggle I mean 2 things:
- There seems to be 2 different errors happening on timeout, and I cannot really tell why, and what is the condition for them. the error messages are "timeout", and "Action timed out".
- The second error seems to be more serious, and it doesn't always actually wait until the specified timeout has passed
For me, it seems like somehow the last error of the same task somehow affects the next iteration's execution
Also, it seems that with more variables I try to set, this timeout issue becomes more error prone
I made a small demo. Actually 2, but they are almost the same, one just has one more variable to set.
The outline of the task:
The variable setting parameters:
The recordings of running the demos are attached.
The differing timeouts are present in both, and the shorter waiting time can be seen in the one with the longer variable settings.
Sometimes the last 3 iterations happen with basically no timeout, but the issue is not very consistent, so I did not manage to record that, only when the last iteration has this issue.
Also, I found a workaround, which is to put the UI query into a separate task, and run that task instead of the UI Query itself, and just return the error message.
This works pretty consistently, but I'd prefer not doing this for each UI Query in similar situations
(Oneplus 9 Pro - Android 12)