AutoInput UI Query timeout seems inconsistent

Skip to first unread message

Regi Zer

May 21, 2022, 7:48:20 AMMay 21
to Tasker
For context:
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.

The problem:
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:
shorter: index:12=:=tryagain
longer: index:12=:=tryagain,

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)


João Dias

May 24, 2022, 10:46:03 AMMay 24
to Tasker
Hhmm, maybe you just need to clear the %errmsg variable after checking it? Otherwise it'll still be there the next time the loop runs :)

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins


João Dias

You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Regi Zer

Jun 12, 2022, 3:08:33 PM (12 days ago) Jun 12
to Tasker
Clearing the %errmsg does not seem to help (same for the %err and the 2 combined), the UI Query task still fails instantly in some iterations without any timeout.
I also tried more iterations, and it seems to be consistently unstable. Starting at about iteration 3-4, 2-3 iterations are skipped, then there is one actual timeout happening, then 2-3 skips, and so on (skip ~ instant fail without timeout)
I also tried adding an additional wait, guessing there might be some underlying racecondition, but it still acts the same (sometimes there is less than 1 second between the waits even though the timeout is supposed to be 6 seconds for the UI Query)
So it seems like there is something cached in the task's context other than the error variables which instantly fails the next iteration, but it somehow gets resolved after every 2-3 failiures just to make itself fail again

João Dias

Jun 14, 2022, 8:11:50 AM (11 days ago) Jun 14
to Tasker
Hhmm, what if you do UI Query > Wait 3 seconds > UI Query > Wait 3 seconds > etc? 
Does that fail too?

Regi Zer

Jun 17, 2022, 5:41:48 PM (7 days ago) Jun 17
to Tasker
Yes, it does.
First I though this happens only if I use a loop to reuse the same UI query, but now I also tried to actually put multiple UI query and wait tasks after each other (in an alternating manner) multiple times, and it fails exactly the same way as if I just run a UI query and a wait task in a loop
The interesting part is that without a wait, the occurance seems to worsen after a couple of loops, with 3-4 seconds of waiting every second UI query fails (pretty consistently, ni worsening), and with 7 or 14 seconds of waiting there seem to be no issue whatsoever.
All of the above was done with a 6 second UI query timeout, so I checked with a 3 second timeout as well, and the results are still the same respective to the wait times
So I guess there is some relatively fixed cooldown in the UI query, which makes subsequent Ui queries fail

Reply all
Reply to author
0 new messages