AutoInput Often actions don't fire?

Discussion in 'AutoApps' started by gwar9999, Jul 28, 2015.

  1. OldAndWeary

    OldAndWeary New Member

    Joined:
    Aug 24, 2015
    Messages:
    9
    Likes Received:
    0
    Many thanks Joao for your response.

    I've joined the Beta community, so have been able to install the Beta version.

    Unfortunately, I get the same problem with my Toggle Mobile Data task ... always works if I have NOT touched mobile data for about 15 seconds. But if I change the state of mobile data, then it always results in the first AutoInput action hanging. (Tasker often then appears to throw up memory warnings on next launch)

    Furthermore, I have imported your Aeroplane task.
    • I had to make a small change (I think) cos there is no 'Nearby text' Airplane on my phone ... just 'Aeroplane mode'. Therefore, I changed 'Airplane' to 'Aeroplane' for the penultimate action.
    • Also, to make the last action work, I've introduced a 'Wait 1 second' ... since the Global Action Back was not being seen.
    • Other than that, the task does switch aeroplane mode ONCE. But then I have to wait for a period of time (approx. 15 seconds) before I can run the task successfully again ... otherwise it hangs on the UI Query for states().
    The XML for my Tog Mobile Data task is attached (with .txt extension)

    The only times when AutoInput seems to 'misbehave' is when anything to do with Internet Access is altered ... be it Aeroplane, WiFi or Mobile Data. Any clue here?

    I hope you can make some sense of what's going on - but I get the feeling that this is where it gets complicated!
    I guess it means that my phone (Moto G - 4G variant, running lollipop) exhibits a problem that you're never going to see ... therefore, it's going to be difficult to 'fix'.

    Thank you John
     

    Attached Files:

  2. OldAndWeary

    OldAndWeary New Member

    Joined:
    Aug 24, 2015
    Messages:
    9
    Likes Received:
    0
    Joao ... further to my response above, here's a bit more info in case it helps ...

    The fault ONLY occurs if either mobile data or WiFi is on at the time of running your aeroplane toggle task.

    If WiFi and mobile data are both off ... the task runs perfectly all the time.

    However, if either WiFi or mobile data is active at the time of running the aeroplane toggle task, then the task will only run once successfully. For it to run successfully again, I have to wait a period of time ... something of the order of 15 seconds.

    Furthermore, it is simply enough to have a task with just 'Global Action Home'. Then if manually toggle the state of aeroplane mode and try to run this task, there will be a big wait (10 to 15 seconds) before the task runs the action. (Note: Placing a simple Tasker activity first, e.g. flash, works; it's just the autoinput action that hangs.)

    Does that help locate my problem?

    Cheers John
     
  3. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
  4. OldAndWeary

    OldAndWeary New Member

    Joined:
    Aug 24, 2015
    Messages:
    9
    Likes Received:
    0
    Hi Joao
    The hangs occur with all actions I've tried - UI Query, Normal Actions, Global Actions etc. But not with Tasker actions.

    Tx for video link ... yes I can see all works there.

    I've attached a link to a video that (hopefully) you can see.
    https://drive.google.com/open?id=0B-yfA13cnhflYnNUQnJrNW9CQVU
    Note: Not sure if it will play with Media Player, but it certainly does with VLC. Otherwise Google Chrome seems to play it directly.
    Please note that I'll only leave the link there for a few days, but hopefully you can see the symptoms by then.

    In brief:
    • Its shows the running of a very simple task ... flashes up "Starting", then opens Quick Settings via AutoInput
    • Phone starts with WiFi and Mobile Data off
      • Initially I run it twice to demo it works OK
    • Then switch Aeroplane mode on
      • Again shows it running twice successfully
    • Then switch on WiFi (aeroplane mode still on)
      • It now hangs, after which I am able to run it twice again
    • Then switch WiFi off (aeroplane mode still on)
      • Again it hangs, after which I can run it twice again
    • Then switch aeroplane mode off also, but activate mobile data
      • Again it hangs, after which I run it twice again
    • Next I switch mobile data off
      • Again it hangs, after which I run it twice again
    • Finally I demo using your task (i.e. Toggling aeroplane mode with WiFi & Mobile data off)
      • Works 3 times
    • And now with WiFi On
      • Your task now hangs
    i.e. Hangs only occur if WiFi or Mobile Data state is changed

    I hope you can make some sense of this all!

    Many thanks for trying to help me resolve my problem

    Cheers John
     
  5. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Do you have any other AutoApp plugin? Can you please try to use any plugin's action instead of AutoInput Global action in the same situation as your first tests?
     
  6. OldAndWeary

    OldAndWeary New Member

    Joined:
    Aug 24, 2015
    Messages:
    9
    Likes Received:
    0
    I don't have any other AutoApp plugin. If you'd like me to try another one, then can you tell me the simplest one to try ... I think I only want to use AutoInput :) And don't particularly want a learning curve on others at the moment. However, I am keen to resolve the issue!

    The symptoms are the same with all AutoInput actions, e.g. I have another task that sets Bluetooth tethering active ... this also hangs (and therefore fails) if I switch mobile data or WiFi states just before using it.

    Cheers John
     
  7. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
  8. OldAndWeary

    OldAndWeary New Member

    Joined:
    Aug 24, 2015
    Messages:
    9
    Likes Received:
    0
    Have installed AutoVoice ... it shows the same symptoms.
    i.e. Toggle WiFi and my phone hangs on the AutoVoice action. But if I leave WiFi alone, it works fine.

    Really hoping that this is 'easy' to resolve

    PS. I have turned off all Google Sharing that I felt I was able to. I don't play games on my phone. And I don't use facebook or anything like this. So I always switch off as much 'sharing' as possible. Might this have made a difference? I may be paranoid! But that's how I work. So could this be causing the problem?
     
  9. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    I think this is the technical explanation for this:

    Tasker communicates with plugins through Broadcast Receivers. Android gives this kinda low priority on Android. When you toggle Wifi probably a bunch of apps and system resources are called because of the state change, which will cause a lot of stuff to happen in the background. Because android will not prioritize Broadcast Receivers, it'll put the plugin calls at the end of the "queue" so to speak and you see the delay you experience. Since this is happening for all plugins, this is my best guess on what is happening :(

    Sorry!
     
  10. OldAndWeary

    OldAndWeary New Member

    Joined:
    Aug 24, 2015
    Messages:
    9
    Likes Received:
    0
    I was afraid you'd come up with something like that as an explanation, i.e. no fix immediately possible.

    Strange that the effect is so bad on my Moto G ... possibly Motorola has added some heavy duty apps?

    Many thanks for looking into my problem anyway.

    Cheers John

    PS. Do you want to close this discussion? If so, can I leave you to do it.

    PPS. Just tried similar test using Secure Settings plugin ... same symptoms! Basically, toggling state of WiFi causes the Secure Settings plugin to hang as well. Therefore, definitely NOT a problem with AutoInput! Either its the Moto G configuration or lollipop?!
     
    Last edited: Sep 3, 2015
  11. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    I think it's probably a matter of Android giving Tasker-plugin communication a low priority :( Sorry!
     
  12. gwar9999

    gwar9999 New Member

    Joined:
    Mar 26, 2015
    Messages:
    15
    Likes Received:
    0
    Sorry for the delay in replying, been busy w/ other stuff. Just installed the beta as directed but sounds like this issue is not going to get fixed because of the Android queuing of broadcasts. However, I can understand that might be the case since if I toggle data mode (or wifi) there is always some lag on my phone, usually several seconds before I can do anything else. So if AI was going to toggle data mode on-then-off, off-then-on within 15 seconds of each other I would expect it to fail because of all of the other things Android is doing. However, in my case, I'm essentially just trying to toggle data mode so I wouldn't expect lag until after the data mode item was clicked. That is, just before that occurs the quick settings screen is brought up and AI is to click "data mode" so there could be lag after the click not before/during the click.

    The problem seems far more likely when run outside of the Tasker "play" button. Not sure if that's just because Tasker isn't doing much running a simple task vs detecting a profile change, running the enter tasks, etc...

    One odd thing is that even though I have the enable-data-mode task given a 50 priority the parent task that invokes it seems to continue without waiting for it. So it ends up launching the apps that need mobile data w/o mobile data yet being enabled.

    Also, I imported the Airplane Mode task XML and it didn't work. It brought up the settings page then flashed "%states1" so the variable was never populated by UI Query.
     
    Last edited: Nov 6, 2015
  13. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Maybe the airplane mode screen on your phone is slightly different and that's why it isn't populating? Can you try configuring UI query yourself on the action?
     
  14. Ghoria

    Ghoria New Member

    Joined:
    Jan 10, 2016
    Messages:
    26
    Likes Received:
    1
    I used to have the same problem with many of the settings panels.

    My fix is to call the settings panel twice, with a short wait in between.

    Example:

    1. Tasker settings action: mobile data settings
    2. Wait 2 seconds
    3. Tasker settings action: mobile data settings

    After that, the mobile data settings panel appears to be immediately ready for other autoinput actions.
     
    Last edited: Mar 9, 2016
  15. Ghoria

    Ghoria New Member

    Joined:
    Jan 10, 2016
    Messages:
    26
    Likes Received:
    1
    I have locked the Autoinput app in memory so that Android's memory management cannot kill it ever. Ever since that, the problem of misfiring autoinput actions seems fixed.

    The drawback is, this solution needs root plus a special memory locker app.
     
    Last edited: Apr 4, 2016
  16. TonyG

    TonyG New Member

    Joined:
    Sep 27, 2016
    Messages:
    10
    Likes Received:
    0
    Old thread but same issue: Nexus6 with Android M 6.01, NON-rooted. I want to toggle mobile data on/off. Open com.android.settings with AutoInput. I can do the click to toggle, including the OK confirmation on turn off. The problem is that the simulation of pressing the global Back button isn't working. I put the click into a loop, waiting a second for 5 iterations. Same for tapping Home. Any ideas? Thanks!
     
  17. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance
     
  18. TonyG

    TonyG New Member

    Joined:
    Sep 27, 2016
    Messages:
    10
    Likes Received:
    0
    Thanks for your interest!
    DataOn and DataOff initialize a parameter which is then passed to DataToggle. These operations are called from shortcuts and work fine. DataToggle calls Go Back, which tries three times to hit the back button, unsuccessfully. The back action doesn't work even when delays and pop-ups are removed.

    Code (Text):
    DataOn (27)
        A1: Perform Task [ Name:DataToggle Priority:%priority+1 Parameter 1 (%par1):on Parameter 2 (%par2): Return Value Variable: Stop:Off ]
        A2: Perform Task [ Name:Go Back Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]

    DataToggle (18)
        A1: Launch App [ App:Settings:Data usage Data: Exclude From Recent Apps:On Always Start New Copy:On ]
        A2: AutoInput UI Query [ Configuration:Only Visible: false
    Only Clickable: false
    App Package: com.android.settings
    Check Screen State: false
    Regex: true
    Variables: datastate, celldata() Timeout (Seconds):20 ]
        A3: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
        A4: Popup [ Title:Data Text:Operation '%par1', Current state '%datastate' Background Image: Layout:Popup Timeout (Seconds):3 Show Over Keyguard:On ]
        A5: [X] Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
        <Data ON>
        A6: AutoInput Action [ Configuration:Type: Text
    Value: Cellular data
    Action : Click
    Is Tasker Action: false
    Check Screen State: false Timeout (Seconds):20 ] If [ %par1 eq on & %datastate eq OFF ]
        <Data OFF>
        A7: AutoInput Action [ Configuration:Type: Text
    Value: Cellular data
    Action : Click
    Is Tasker Action: false
    Check Screen State: false Timeout (Seconds):20 ] If [ %par1 eq off & %datastate eq ON ]
        <Need to OK Data Off>
        A8: AutoInput Action [ Configuration:Type: Text
    Value: OK
    Action : Click
    Is Tasker Action: false
    Check Screen State: false Timeout (Seconds):20 ] If [ %par1 eq off & %datastate eq ON ]
        <Not working>
        A9: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ]
        <Just in case, doesn't work either>
        A10: AutoInput Global Action [ Configuration:Action: Home Timeout (Seconds):20 Continue Task After Error:On ]

    Go Back (38)
        A1: Variable Set [ Name:%times To:0 Do Maths:On Append:Off ]
        A2: Variable Set [ Name:%times To:%times+1 Do Maths:On Append:Off ]
        A3: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 Continue Task After Error:On ]
        A4: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
        A5: Stop [ With Error:Off Task: ] If [ %times > 3 ]
        A6: Popup [ Title:Go Back Text:Tried %times times Background Image: Layout:Popup Timeout (Seconds):1 Show Over Keyguard:On ]
        A7: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
        A8: Goto [ Type:Action Number Number:2 Label: ]

    DataOff (29)
        A1: Perform Task [ Name:DataToggle Priority:%priority+1 Parameter 1 (%par1):off Parameter 2 (%par2): Return Value Variable: Stop:Off ]
        A2: Perform Task [ Name:Go Back Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]
     
     
    Last edited: Oct 18, 2016
  19. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Do you get any kind of error in the back action? Thanks!
     
  20. TonyG

    TonyG New Member

    Joined:
    Sep 27, 2016
    Messages:
    10
    Likes Received:
    0
    %err = 2 but there is no %errmsg
     

Share This Page