AutoVoice Samsung S6 - Sometimes huge delay between AutoVoice and Tasker

Discussion in 'AutoApps' started by androiduser99, Aug 12, 2015.

  1. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    I just got a fancy new Galaxy S6 despite some reservations but it's the best phone out there right now. I had AutoVoice working great on my LG G3 but now having problems on the S6 with significant delays between AutoVoice and Tasker. It would almost seem as if something is getting unloaded if the phone sits for a while the delay will happen but after the first recognized command everything is generally lighting fast (much faster then hte G3!). I have plenty of free memory so it seems odd that the OS would be unloading the app and if it is this should be addressable by using a service.

    When I say an OK Google command I see the toast message from AutoVoice instantly but then the task in Tasker is not trigger for up to 15 secs. The odd thing is that tasker is running as a foreground app and everything else in Tasker is instant so I don't believe this is an issue on the Tasker end but more likely the plugin (Tasker integration code). I've tried clearing data on both AutoVoice and Tasker then setup a very basic profile and task to simply trigger a flash but same results.

    How can we debug this and determine exactly what is the cause? I'm on a stock rom and no root (bang my head - sales guy installed the latest update so I can't root at this time). This is one of the most popular Android phones right now so I hope we can put some effort into a resolution.

    Thank you!
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Hi there.
    Does the same thing happen if you use the built-in AutoVoice recognize action?

    Sorry for the trouble
     
  3. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    I'm going to guess the answer to your question is that it makes no difference because I always see the "toast in" from AutoVoice instantly. It's that the Tasker task does not trigger for up to 15 secs. If I do additional voice commands shortly after the delayed on it's very fast and effectively no delay (much faster then on my LG G3).

    Hopefully I can have an answer for this within a day or so. I was actually so sick about not having root that I took the phone back to get the bigger 128GB model planning to decline the update so I can root. Hoping something has not changed and the phone comes with the update already installed! I'm hoping the a debloated ROM will free up some memory and maybe address the issue as it seems that something is getting unloaded. Otherwise hopefully soon xposed should be available soon for a S6 (currently not available for 64bit and touchwiz) then I can try using App settings to make the app resident (keep it from unloading). Although it would appear it's not getting entirely unloaded as the "toast in" message is always instant.
     
  4. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    Well I got the new phone, rooted it, and since going to Clean ROM I have only had 1 or 2 delays so it's a non issue for me at this time. I'll probably go back to stock when Marshmellow is released on the S6 so I'm hoping it's still not an issue at that time.
     
  5. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Glad to hear that. :) Still going to look into it, so let me know if it comes back
     
  6. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    Well I've been busy and wanted to make sure I had accurate information before reporting back on this issue so it's been a whilte. I continue to have issues with a large delay (sometimes not always) and it happens both with the Google Now and if I use the built-in AutoVoice commands. As I previously noted it's really odd because if I enable toasts in AutoVoice I will see the recognized command right away but then the tasker task will not trigger for 5-15 secs. If I do another command soon after it's instantaneous. I've applied recommended memory management tweaks for the S6 and use Greenify to sleep a lot of other tasks so I generally have 500MB-1GB ram available but it seems Samsung's kernel is still unloading some part of AutoVoice.

    Please let me know how I can further troubleshoot or produce some detailed logged that will help you better understand this issue and hopefully come up with a solution.

    Thank you!
     
  7. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    It seems the S6 has several Samsung "enhancements" that prevent some things to work correctly. In this case, it seems that it's preventing Tasker from contacting the plugins in a timely manner. Technically Tasker and its plugins communicate via broadcast receivers which Android sometimes gives a very low priority too, so if there's other stuff happening this can take a while to be processed. Unfortunately, unless Tasker changes its communication protocol in the future, I don't think there's anything I can do :( For example, on my Nexus 6 and 7 I've never had this issue.
    I really really wish I could help, sorry :(
     
  8. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    Can we at least look further into this? It seems very odd and unlikely that it's a broadcast receiver delay when consecutive commands are always instant. If this were a broadcast receiver issue the delays would be completely random and consecutive commands would be as random as any command. I can assure you that I have never had a single delay with voice commands that are triggered within minutes of another command. I use Tasker a lot and trigger tasks with intents but never have delays with those tasks. Is there some way we can do some logging to at least determine where the problem is?

    I understand you can't make every AutoVoice work perfect on every Android phone but Samsung phones are the most popular Android phones on the market so you are potentially ignoring a huge market share here.
     
  9. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Thing is, I'm not ignoring them, I just don't have the means to fix it :)
    Believe me, more than anyone I want this to work on your and everyone else's phones.
    I already made tests related to this in the past and came to the conclusion that sometimes the process is just slow, but if you are willing I can go through it again with you.
    Can you please try this:
    • clear logs in AutoVoice and Tasker
    • enable system logs in AutoVoice
    • enable log to sd in Tasker
    • delete Tasker log file
    • do command with delay (if possible)
    • Export both logs and paste them here
    My guess is that you won't have a delay after doing this.
    But if you can, keep both logs enabled and the next time you have a delay get the latest logs and post them here.

    thanks in advance
     
  10. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    I'll follow your steps and get some logs soon. I'd like to note that I'm 99% sure this has nothing to do with broadcast receivers now as I created a tasker appfactory app that simply sends a broadcast receiver intent. I then have a profile that listens for the intent in Tasker. I fired this off a dozen times last night and every single time it was instant to run the tasker profile/task. At the end of the night when I was ready to turn off the TV (using AutoVoice) I first run my test app (tasker fired instantly) then triggered my AutoVoice task via "OK google turn off the tv". The google search showed up then nothing happened for over 10 seconds and finally my tasker task ran. These tests would indicate to me the broadcast receiver intents for Tasker are being picked up quickly and cause not delays.

    Thank you!
     
  11. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    I've uploaded AutoVoice and tasker logs. Immediately after I started the logging I triggered a command which took about 4 secs to trigger the tasker task and the last one in the log took about 5 secs or so. These are not extreme examples but when all is working well the commands are triggered in less then a second. Any commands between the first and last all took a second or less. As noted in my last message it can send a broadcast receiver intent from an appfactory app I created and it always triggers the profile/task in tasker in less then a second.

    Thank you!
     

    Attached Files:

  12. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    Here is another set of logs. The last AutoVoice command I triggered took around 8-10 secs.
     

    Attached Files:

  13. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    Anything in the logs to help resolve this issue? Would really like a fix as the inconsistency and long waits make it unreliable and therefore unusable.
     
  14. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    Its been almost 2 weeks since providing the logs. Any update? What are the next steps to resolve this issue?
     
  15. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Sorry, for some reason I missed your replies in this thread. I'll take a look at the logs now
     
  16. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Ok, having looked at the logs:

    This is the AutoVoice log that says that your command has been recognized:
    Code (Text):
    Recognition - 2015-09-18 22:50:58.031 - Got commands: Received possible commands:
    turn off the bedroom tv and lamb
    This is the Tasker log that recieves the AutoVoice request to check if there's any matching condition:
    Code (Text):
    18-09-2015 : 22.51.13#:     com.twofortyfouram.locale.intent.extra.ACTIVITY / com.joaomgcd.autovoice.activity.ActivityConfigReceiveVoice (java.lang.String)
    As you can see this happened about 15 seconds later.
    And these are the AutoVoice logs that indicate that Tasker is asking AutoVoice if the conditions are matching:

    Code (Text):
    Profile Matches - 2015-09-18 22:51:14.585 - "^.*?\bturn|remote|button|dish|listen|watch|move|google|music|spotify|like\b.*?$" matches "turn off the bedroom tv and lamb": true
    Profile Matches - 2015-09-18 22:51:14.569 - "Anything" matches "turn off the bedroom tv and lamb": false
    Profile Matches - 2015-09-18 22:51:14.553 - "to do list" matches "turn off the bedroom tv and lamb": false
    Profile Matches - 2015-09-18 22:51:14.530 - "^.*?\bin|out|rotate|center|map\b.*?$" matches "turn off the bedroom tv and lamb": false
    This happens almost immediately after the Tasker log above.
    This means:
    1. AutoVoice receives your voice command quickly
    2. AutoVoice sends request to Tasker to query for valid conditions->this request takes a long time to arrive in Tasker
    3. Tasker sends several requests to AutoVoice asking if each condition is met->this happens very quickly
    In my opinion this means that Tasker (or your system) is busy with something and so doesn't receive the request in step 2 right away.
    In those logs I can see that around the same time your connection status changed. Maybe that's what was keeping Tasker busy?

    Hope this helps
     
  17. androiduser99

    androiduser99 New Member

    Joined:
    Jul 24, 2015
    Messages:
    22
    Likes Received:
    2
    There has to be more to it then this (tasker is busy). I have a complete A/V home automation remote software written in Tasker and everything I do in it is instantaneous with zero delay. Furthermore I thoroughly tested the idea that broadcast receiver intents are received in a timely manner (never took over 1 sec). I also tested tasker after a data wipe and a single simple profile/task.
     
  18. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    ok, can you try this:
    • Setup a task that has the "Ok Google Now" Autovoice condition
    • wait a few seconds in the task (to simulate that you are waiting for the command)
    • use app factory app to send the broadcast at about the same time you finish saying your command (not before)
    • Check if there's a delay in receiving that broadcast
    Also, do you know if you had a connectivity change in that second log at about the same time you said the command? Tasker logs seem to indicate so...
     

Share This Page