Sleep action and "Wakeup from idle/doze"

Post your questions and help other users.

Moderator: Martin

Post Reply
Wibbly
Posts: 330
Joined: 17 Mar 2014 09:02

Sleep action and "Wakeup from idle/doze"

Post by Wibbly » 21 Feb 2018 15:04

What the effect of unticking both "Wakeup from idle/doze" and "Keep device awake" on Oreo (which more acressively enters doze mode when the phone screen is off)? Will the flow stay asleep if doze is active (despite the sleep duration) until the the screen is on or there's a doze maintenance window?

Problem is that I've noticed that GSam Battery Stats seems to be reporting a wakelock during the sleep duration. Is that normal/expected? The top 3 wakelocks below all have 5m duration Sleep actions in flows with with "Wakeup from idle/doze" ticked and "Keep device awake" unticked... So wondering if not allowing "Wakeup from idle/doze" in the Sleep action is how to fix this?

Image

User avatar
Desmanto
Posts: 2337
Joined: 21 Jul 2017 17:50

Re: Sleep action and "Wakeup from idle/doze"

Post by Desmanto » 21 Feb 2018 15:51

Don't have phone with MM above, can't test the doze. But If I need 5 minutes sleep in a flow, I will move it to a separate flow using trigger global variable date/time. Add the current time with the sleep and the flow will trigger after the added minutes. (5 minutes from now). Do whatever you need in the target flow. Similar to this topic : viewtopic.php?f=5&t=7181
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200117 Official, Android Pie 9.0, Rooted.

Wibbly
Posts: 330
Joined: 17 Mar 2014 09:02

Re: Sleep action and "Wakeup from idle/doze"

Post by Wibbly » 21 Feb 2018 17:46

Thanks. I'm not sure that's a solution to the issue I'm seeing. I'm executing a Sleep action ok. It's just a case of what happens wakelock-wise whilst that action is in progress.

User avatar
Desmanto
Posts: 2337
Joined: 21 Jul 2017 17:50

Re: Sleep action and "Wakeup from idle/doze"

Post by Desmanto » 22 Feb 2018 06:18

That wakelock is caused by the sleep action right? Or it is cause by one of the elements inside the flow

If it is caused by sleep; By moving the sleep to glovardt, you don't need any sleep action anymore. So there is no more running flow at the background only sleeping (thus creating no wakelock). This is what my hypothesis about a running flow will create wakelock at the background, thus preventing the CPU from sleeping gracefully.

Your flow concept used to be
1. Main flow
2. sleep (flow keep running)
3. rest of the flow
This create wakelock in your case

Moving to glovardt,
1. Main flow
2. set glovardt (flow Stopped)
3. ***time passed***
4. Glovardt triggered (flow started again)
5. rest of the flow
This should create no wakelock during the time passed, allowing the phone to went to sleep gracefully. But you should tested it out to see if it really makes difference.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200117 Official, Android Pie 9.0, Rooted.

Wibbly
Posts: 330
Joined: 17 Mar 2014 09:02

Re: Sleep action and "Wakeup from idle/doze"

Post by Wibbly » 22 Feb 2018 08:25

Thanks. I see what you mean now.

Wibbly
Posts: 330
Joined: 17 Mar 2014 09:02

Re: Sleep action and "Wakeup from idle/doze"

Post by Wibbly » 22 Feb 2018 09:42

@Martin, can you provide any insights if possible anyway? What's the expected effect of "Wakeup from idle/doze" and "Keep device awake" options on Oreo? I tried a 28min Sleep action with "Wakeup from idle/doze" and "Keep device awake" both unticked, left the phone alone, and the flow ended at the expected time... Also there was no long wakelock from the flow during this time. What's the "downside" of leaving these both unticked?

User avatar
Martin
Posts: 4430
Joined: 09 Nov 2012 14:23

Re: Sleep action and "Wakeup from idle/doze"

Post by Martin » 01 Mar 2018 14:59

Keep device awake registers a wake lock to keep the CPU of the device awake. The flow simply waits for the configured amount of time and then continues. This option should usually not lead to any delays when Automagic is running as a foreground service (notification on statusbar is turned on).
As soon as Keep device awake is disabled, Automagic asks the systems alarm manager to continue the flow when the configured time elapses. The alarm manager will usually invoke Automagic on time when the device is actively in use (not in doze). The system will delay the sleep action up to 15 minutes when it's in doze mode and option Wakeup from idle/doze is activated. The system might delay the sleep action for an undefined amount of time when this option is not enabled. Also check the linked device idle/doze mode page in the help section to see some more explanations.

Regards,
Martin

Post Reply