Doze - In depth

Search This thread

italia0101

Senior Member
Nov 9, 2008
3,803
1,358
I guess my point is if I leave my phone on my desk for an hour it will go into doze. I'm not sleeping and I still want my notifications. I haven't seen any I'll effects from it sitting on my desk and going into doze. I understand your point though.

Sent from my Nexus 6 using Tapatalk

Yea if GCM ( Google cloud messaging ) is doing most of your notifications then you won't see a delay,
 

ses184

Member
May 30, 2013
13
0
Something is seriously wrong with your setup if its sucking down 10% per hour just sitting there motionless with the screen off. That wouldn't even last a work day (8 hours + commute). Imagine what would happen if you had a phone call or read some email! I was on vacation a couple weeks ago and pretty much didn't touch the phone much, about 4-5 days between charges. I didn't play with 6.0 until I got back. That puts it around 2% per hour. Mind you, I wasn't letting it run flat, just plugging it in when it started looking low-ish. Also keep in mind that doze comes on in stages, so until it is all the way in, it is gradually becoming more and more efficient.

Edit: right now... its at 91%. Unplugged it 5 hours ago, had 2 long phone calls, and answered a few emails. It has NOT been kept motionless.

Well my point was that from the time I set the phone on the nightstand at 11pm until the time I pick it up at 6am, I am seeing between 5-10% battery drainage. So I'm assuming that the majority of that is coming before Doze kicks in. I just don't understand how people are reporting that they only say 1-2% of battery loss overnight. That would lead me to believe that the 1-2% was when the phone was awake and they lost zero while in Doze.
My overall question or point was that I am unaware of what the expectations are for Doze in general. Everyone's battery usage will vary depending on apps installed, but if the phone is sitting in Doze for seven hours with minimal notifications coming through (between 0-3 overnight for me) then I'm curious what could be expected in that time frame. There is just limited information available at this point, I'm guessing that as the new Nexus 5X and 6P start arriving, more information will come out.
 

neonixxx

Senior Member
May 17, 2010
313
133
Nice finds. I'm sure it won't be very long before some clever developers make some apps to boot doze mode into action on demand. Definitely possible with Xposed and modified roms, but I bet someone will figure out how to do it with just root.
 

doitright

Senior Member
Oct 31, 2014
1,512
861
Well my point was that from the time I set the phone on the nightstand at 11pm until the time I pick it up at 6am, I am seeing between 5-10% battery drainage. So I'm assuming that the majority of that is coming before Doze kicks in. I just don't understand how people are reporting that they only say 1-2% of battery loss overnight. That would lead me to believe that the 1-2% was when the phone was awake and they lost zero while in Doze.
My overall question or point was that I am unaware of what the expectations are for Doze in general. Everyone's battery usage will vary depending on apps installed, but if the phone is sitting in Doze for seven hours with minimal notifications coming through (between 0-3 overnight for me) then I'm curious what could be expected in that time frame. There is just limited information available at this point, I'm guessing that as the new Nexus 5X and 6P start arriving, more information will come out.

The new phones won't provide any new information. Everything is fully enabled on your 6 already that the 5x and 6p get, and its all in AOSP to look at anyway.

But yes, doze *will* use incredibly less power while it is fully enabled. That is just the nature of waking up so infrequently. Certainly not ZERO percent, but think about it like this;
If your phone uses 10% per hour *in your pocket*, then for stationary doze after the first 10th of an hour, it uses 1%. In the next 10th of an hour, it might use 0.75%, in the third tenth of an hour 0.6%, which ultimately means that it won't use the full 10% during that first hour while doze is gradually coming on. It might use HALF that -- 5%. Then through the remainder of the night, lets imagine a couple of percent, so total of 7%. HOWEVER, don't assume that yours will follow this pattern, since it seems that you have something running there that is not behaving, so all bets are off.

For a more normal case of a phone that uses 2% per hour in your pocket, the first hour while doze comes on might use 1%, leaving *nearly* 2% for the remainder of the night for it to report 98% in the morning. Have to keep in mind that it won't report a drop of 3% until it reaches the FULL 3%... 2.99% will be reported as 2%.
 

ses184

Member
May 30, 2013
13
0
The new phones won't provide any new information. Everything is fully enabled on your 6 already that the 5x and 6p get, and its all in AOSP to look at anyway.

But yes, doze *will* use incredibly less power while it is fully enabled. That is just the nature of waking up so infrequently. Certainly not ZERO percent, but think about it like this;
If your phone uses 10% per hour *in your pocket*, then for stationary doze after the first 10th of an hour, it uses 1%. In the next 10th of an hour, it might use 0.75%, in the third tenth of an hour 0.6%, which ultimately means that it won't use the full 10% during that first hour while doze is gradually coming on. It might use HALF that -- 5%. Then through the remainder of the night, lets imagine a couple of percent, so total of 7%. HOWEVER, don't assume that yours will follow this pattern, since it seems that you have something running there that is not behaving, so all bets are off.

For a more normal case of a phone that uses 2% per hour in your pocket, the first hour while doze comes on might use 1%, leaving *nearly* 2% for the remainder of the night for it to report 98% in the morning. Have to keep in mind that it won't report a drop of 3% until it reaches the FULL 3%... 2.99% will be reported as 2%.

Sorry that was vague. All I meant by the new phones arriving is that there will be more users with devices that run Marshmallow, not that the devices themselves will provide more info. Just the larger the user base, the larger the statistical findings will be.
And again, my phone isn't using 10% per hour, I'm just saying that I use between 5-10% overnight total, so Doze is helping battery life stay manageable. I just have a hard time believing that people are reporting that they go to bed with a battery percentage and wake up 6-8 hours later only down 2% from that initial percentage. I'm definitely not seeing that amazing of a standby time.
 

OctoPI

Senior Member
Jun 18, 2010
65
5
Dallas, TX
I went to bed last night at 10pm. Battery was at 99% (had just taken it off the charger). Woke up this morning at 6am. Battery was at 96%.
So I'd say doze definitely works. There were two notifications waiting for me on my ambient display when I woke up (one Gmail and one text message)
 

doitright

Senior Member
Oct 31, 2014
1,512
861
The aspect of doze that is slightly annoying is that the time it really kicks in is the time when you normally would charge your phone anyway. I keep Qi charges beside the bed, one for myself, one for the wife. Just plunk the phone down on the pad and wake up ready for the day.
 

paulhott

Member
Jan 20, 2009
10
3
Redmond, WA
Going into doze doesn't block all notifications, just unimportant ones. You should still get notifications for text messages, etc... There is a whitelist for Doze as well, where you can specify apps that shouldn't be dozed. I see no reason NOT to lower the time before your device goes into doze, assuming you configure the whitelist.

Doze stops apps from using web traffic and stops the internal alarm manager from sending alarms to apps, it doesn't kill apps. Also, once the device comes out of doze all alarms that were queued up while in doze fire right away so there is very little effect on apps.

Another feature that is mentioned less is the App Standby feature of MM. This wholly disables apps whether in Doze or not, unless they have recently been recently used. This would be great for apps that you want to occasionally use, but don't want to do anything when not in use. There is much less information (documentation etc...) about standby but it would be another interesting feature to create an app for.
 
Last edited:

italia0101

Senior Member
Nov 9, 2008
3,803
1,358
For anyone messing around with the Doze settings i did some tests this morning. here's what i found
I was watching ADB this morning trying to understand Doze mode a little more , it does seem that setting the " sensing " and "locating " to 0 doesn't turn them off ,
Firstly here's an image of how it should look like the phone goes into doze mode; settings here are settings - sensing / location set to 0 , inactive time was set to 5 seconds . the device is flat , non moving on a table
attachment.php



Ok now lets see what happens with the same settings ; settings - sensing / location set to 0 , inactive time was set to 5 seconds / but this time i'm moving the device as soon as i turned the screen off

attachment.php


Notice how we don't see " anymotion detector " or " location " on this screen shot ( even after a 1min of the screen being off ) , we also don't see the device idle changed, so at the moment my phone is NOT dozeing. I was moving the phone around for about a minute and nothing happened , so it is still sensing motion even if its set to 0

Just as a test i kept the settings the same, i did the same thing, started moving the device as soon as the screen went off , then after some time i set it down , here's what happened

attachment.php


So here you can see the device did nothing while i was moving it around, as soon as i set it down all the Doze stuff kicked in...
So yeah , having a low inactive time / still moving around , isn't going to be great for battery life. i assume if you have a low " inactive time " , lets say 5 seconds , then if you're moving around it's going to try and do the " sensing" part every 5 seconds, which will fail as it'll see you're moving.

Looks like the only way to not have the " sensing " and " location " is to use the " adb shell dumpsys deviceidle force-idle " command. but you'll have to use something like tasker to activate that command after a certain period of time after screen off

EDIT- i wasn't right about the " force idle " check below ;

So testing out " force-idle " i believe this is what greenify uses for " aggressive doze "

This is what force-idle looks like when its flat on a table
attachment.php


So we forced idle, then i'm using the step command to push it to its next step, so that way we can know the previous step it was just in
This is working as it should. it switches between idle ( doze) and idle maintenance ( receive notifications, do tasks )
From this we can see we are correctly in Doze mode.

Now this time i did the same force idle command, but i'm going to move the device while doing it ( simulate walking )

attachment.php


So this time it was a different story , even with the force-idle command if there's movement its not going to go straight into idle without a thought

So it stands to reason that if you're someone that moves around a lot, trains, walking etc, then having Doze try and kick in quickly or when moving is probably going to hurt your battery life rather than improve it ( unless we can find a way to truly disable the " sensing " and " locating " parts of Doze)
I'm no expert but that's what it looks like from the data i've got.

so to conclude - it seems sensing and location can't be deactivated rigth now ... the only issue i can see is people who are out walking and moving all day (if they set their inactive time to say 1min) ,
After that inactive time runs out the device is going to start the doze procedure, which won't work because they are moving, it'll then restart that 1 min inactive timer and the process will continue over and over , so you'll end up with a tonne more wakelocks and no battery gain

Which in that case i think it might be better with a longer inactive time ( i.e like googles default 1 hour ) , it's also probably still a good idea to make sensing / location timeouts much lower so that it's not running for ages
 
Last edited:

GeraldRudi

Senior Member
Feb 3, 2011
52
98
Vienna
So this time it was a different story , even with the force-idle command if there's movement its not going to go straight into idle without a thought

So it stands to reason that if you're someone that moves around a lot, trains, walking etc, then having Doze try and kick in quickly or when moving is probably going to hurt your battery life rather than improve it ( unless we can find a way to truly disable the " sensing " and " locating " parts of Doze)
I'm no expert but that's what it looks like from the data i've got.

so to conclude - it seems sensing and location can't be deactivated rigth now ... the only issue i can see is people who are out walking and moving all day (if they set their inactive time to say 1min) ,
After that inactive time runs out the device is going to start the doze procedure, which won't work because they are moving, it'll then restart that 1 min inactive timer and the process will continue over and over , so you'll end up with a tonne more wakelocks and no battery gain

Which in that case i think it might be better with a longer inactive time ( i.e like googles default 1 hour ) , it's also probably still a good idea to make sensing / location timeouts much lower so that it's not running for ages

i tested the same thing in the morning.
with the same result in terms of sensoring with sensoring_to = 0 - thanks for sharing your result! :)

in my opinion force-idle should work without sensoring - I will test it now

take a look at this adb output:
Code:
adb shell dumpsys deviceidle -h
Device idle controller (deviceidle) dump options:
  [-h] [CMD]
  -h: print this help text.
Commands:
  step
    Immediately step to next state, without waiting for alarm.
  force-idle
    Force directly into idle mode, regardless of other device state.
  [B]  Use "step" to get out.[/B]
  disable
    Completely disable device idle mode.
  enable
    Re-enable device idle mode after it had previously been disabled.
  enabled
    Print 1 if device idle mode is currently enabled, else 0.
  whitelist
    Print currently whitelisted apps.
  whitelist [package ...]
    Add (prefix with +) or remove (prefix with -) packages.
  tempwhitelist [package ..]
    Temporarily place packages in whitelist for 10 seconds.
 

italia0101

Senior Member
Nov 9, 2008
3,803
1,358
i tested the same thing in the morning.
with the same result in terms of sensoring with sensoring_to = 0 - thanks for sharing your result! :)

in my opinion force-idle should work without sensoring - I will test it now

take a look at this adb output:
Code:
adb shell dumpsys deviceidle -h
Device idle controller (deviceidle) dump options:
  [-h] [CMD]
  -h: print this help text.
Commands:
  step
    Immediately step to next state, without waiting for alarm.
  force-idle
    Force directly into idle mode, regardless of other device state.
  [B]  Use "step" to get out.[/B]
  disable
    Completely disable device idle mode.
  enable
    Re-enable device idle mode after it had previously been disabled.
  enabled
    Print 1 if device idle mode is currently enabled, else 0.
  whitelist
    Print currently whitelisted apps.
  whitelist [package ...]
    Add (prefix with +) or remove (prefix with -) packages.
  tempwhitelist [package ..]
    Temporarily place packages in whitelist for 10 seconds.

Ah ok that's very interesting! so when i used the step command it booted me out . here's another question, when the device goes into " idle maintenance "it seems the sensing and location are kicked back in, and if anything is found it won't go back into idle ( unless you force it of course )
 
Last edited:
  • Like
Reactions: [AltaiR]

tet-bundy

Senior Member
Jan 18, 2016
918
238
Are there devices that just can not enter doze mode because of hardware limitations? I doubt that as i thought it's mostly related to network traffic afaik... Though not an expert. But When i issue the below command i get:

Code:
adb shell dumpsys battery unplug
Can't find service: battery

Might the lack of this service make it impossible for my device to enter doze at all? Does not make sense to me from what i know, though just a user. Therefore my question and hope so can give me a hint what to look at next or whatever.

Thanks in advance :)
 

Black Manta

Senior Member
Apr 22, 2015
341
186
Hey,

Do you know how I can change the doze paramters with a shell script? Because I don't like it that aggressive doze isn't existent in stock doze and want to modify it. :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 51
    Hey fellas, was doing a little research on how exactly Doze mode works in Android Marshmallow, i've benefited from much battery standby time due to this feature.
    Had a play with adb shell on my PC too and found some cool functions
    ; (btw these have to be done on a PC afaik, if you try to do them in terminal on the device itself it'll throw up a permission error )
    $ adb shell dumpsys deviceidle ( will show you the doze settings )
    Settings:
    inactive_to=+30m0s0ms
    sensing_to=+5m0s0ms
    motion_inactive_to=+10m0s0ms
    idle_after_inactive_to=+30m0s0ms
    idle_pending_to=+5m0s0ms
    max_idle_pending_to=+10m0s0ms
    idle_pending_factor=2.0
    idle_to=+60m0s0ms
    max_idle_to=+6h0m0s0ms
    idle_factor=2.0
    min_time_to_alarm=+60m0s0ms
    max_temp_app_whitelist_duration=+5m0s0ms
    mms_temp_app_whitelist_duration=+60s0ms
    sms_temp_app_whitelist_duration=+20s0ms


    So this shows how long it takes for Doze to kick in, and what it looks for.

    You can also force the different states and move them along ;

    $ adb shell dumpsys deviceidle step , this allows you to step into the next state manually, if you do this with the screen on / charging it'll show ACTIVE and won't move state, so first you need to do ;
    adb shell dumpsys battery unplug
    then turn off the screen


    Now when you "$ adb shell dumpsys deviceidle step" this happens
    $ adb shell dumpsys deviceidle step => output will be Stepped to: IDLE_PENDING
    $ adb shell dumpsys deviceidle step => output will be Stepped to: SENSING
    $ adb shell dumpsys deviceidle step => output will be Stepped to: IDLE
    $ adb shell dumpsys deviceidle step => output will be Stepped to: IDLE_MAINTENANCE
    Following steps will alternate between IDLE and IDLE_MAINTENANCE


    Idle = Doze mode .
    Idle_Maintannce = is when doze modes allows the alarms / scheduler to run every so often

    Oh and there's also a quicker and easier " adb shell dumpsys deviceidle force-idle" to force doze mode straight away so you don't have to worry about the battery unplugging / screen off as previously mentioned

    Shame we can't ( or i don't know how ) use these " on device " as we could essentially kick doze mode in when we wanted ( not sure if that's a good thing, but fun playing ;-0 )

    Anyway, just thought i'd share
    :)
    6
    For anyone messing around with the Doze settings i did some tests this morning. here's what i found
    I was watching ADB this morning trying to understand Doze mode a little more , it does seem that setting the " sensing " and "locating " to 0 doesn't turn them off ,
    Firstly here's an image of how it should look like the phone goes into doze mode; settings here are settings - sensing / location set to 0 , inactive time was set to 5 seconds . the device is flat , non moving on a table
    attachment.php



    Ok now lets see what happens with the same settings ; settings - sensing / location set to 0 , inactive time was set to 5 seconds / but this time i'm moving the device as soon as i turned the screen off

    attachment.php


    Notice how we don't see " anymotion detector " or " location " on this screen shot ( even after a 1min of the screen being off ) , we also don't see the device idle changed, so at the moment my phone is NOT dozeing. I was moving the phone around for about a minute and nothing happened , so it is still sensing motion even if its set to 0

    Just as a test i kept the settings the same, i did the same thing, started moving the device as soon as the screen went off , then after some time i set it down , here's what happened

    attachment.php


    So here you can see the device did nothing while i was moving it around, as soon as i set it down all the Doze stuff kicked in...
    So yeah , having a low inactive time / still moving around , isn't going to be great for battery life. i assume if you have a low " inactive time " , lets say 5 seconds , then if you're moving around it's going to try and do the " sensing" part every 5 seconds, which will fail as it'll see you're moving.

    Looks like the only way to not have the " sensing " and " location " is to use the " adb shell dumpsys deviceidle force-idle " command. but you'll have to use something like tasker to activate that command after a certain period of time after screen off

    EDIT- i wasn't right about the " force idle " check below ;

    So testing out " force-idle " i believe this is what greenify uses for " aggressive doze "

    This is what force-idle looks like when its flat on a table
    attachment.php


    So we forced idle, then i'm using the step command to push it to its next step, so that way we can know the previous step it was just in
    This is working as it should. it switches between idle ( doze) and idle maintenance ( receive notifications, do tasks )
    From this we can see we are correctly in Doze mode.

    Now this time i did the same force idle command, but i'm going to move the device while doing it ( simulate walking )

    attachment.php


    So this time it was a different story , even with the force-idle command if there's movement its not going to go straight into idle without a thought

    So it stands to reason that if you're someone that moves around a lot, trains, walking etc, then having Doze try and kick in quickly or when moving is probably going to hurt your battery life rather than improve it ( unless we can find a way to truly disable the " sensing " and " locating " parts of Doze)
    I'm no expert but that's what it looks like from the data i've got.

    so to conclude - it seems sensing and location can't be deactivated rigth now ... the only issue i can see is people who are out walking and moving all day (if they set their inactive time to say 1min) ,
    After that inactive time runs out the device is going to start the doze procedure, which won't work because they are moving, it'll then restart that 1 min inactive timer and the process will continue over and over , so you'll end up with a tonne more wakelocks and no battery gain

    Which in that case i think it might be better with a longer inactive time ( i.e like googles default 1 hour ) , it's also probably still a good idea to make sensing / location timeouts much lower so that it's not running for ages
    5
    Would love to be able to modify these settings as well.

    is it possible to edit the deviceidle file? if so, can we just change "idle_to=+60m0s0ms" to "idle_to=+20m0s0ms"? that would make doze become active after 20min instead of 60min.

    Don't quote me on this but i get the feeling that may have to be the job of a custom ROM.

    Again , going on a gut feeling here, could be wrong.

    EDIT- i was wrong ! - here's an editor (http://xdaforums.com/android/apps-games/root-doze-settings-editor-android-t3235130) it needs root

    I did however see that Greenify added an " aggressive doze " option , which upon investigation basically uses the commands i posted in the OP to initiate doze as soon as the screen is turned off , so no waiting times at all or sensing
    It doesn't require root BUT you do need to give Greenify permission to use those commands, which is a 1 time thing and the device needs to be plugged into a PC .. instructions here ; http://greenify.uservoice.com/knowledgebase/articles/749142
    3
    So this time it was a different story , even with the force-idle command if there's movement its not going to go straight into idle without a thought

    So it stands to reason that if you're someone that moves around a lot, trains, walking etc, then having Doze try and kick in quickly or when moving is probably going to hurt your battery life rather than improve it ( unless we can find a way to truly disable the " sensing " and " locating " parts of Doze)
    I'm no expert but that's what it looks like from the data i've got.

    so to conclude - it seems sensing and location can't be deactivated rigth now ... the only issue i can see is people who are out walking and moving all day (if they set their inactive time to say 1min) ,
    After that inactive time runs out the device is going to start the doze procedure, which won't work because they are moving, it'll then restart that 1 min inactive timer and the process will continue over and over , so you'll end up with a tonne more wakelocks and no battery gain

    Which in that case i think it might be better with a longer inactive time ( i.e like googles default 1 hour ) , it's also probably still a good idea to make sensing / location timeouts much lower so that it's not running for ages

    i tested the same thing in the morning.
    with the same result in terms of sensoring with sensoring_to = 0 - thanks for sharing your result! :)

    in my opinion force-idle should work without sensoring - I will test it now

    take a look at this adb output:
    Code:
    adb shell dumpsys deviceidle -h
    Device idle controller (deviceidle) dump options:
      [-h] [CMD]
      -h: print this help text.
    Commands:
      step
        Immediately step to next state, without waiting for alarm.
      force-idle
        Force directly into idle mode, regardless of other device state.
      [B]  Use "step" to get out.[/B]
      disable
        Completely disable device idle mode.
      enable
        Re-enable device idle mode after it had previously been disabled.
      enabled
        Print 1 if device idle mode is currently enabled, else 0.
      whitelist
        Print currently whitelisted apps.
      whitelist [package ...]
        Add (prefix with +) or remove (prefix with -) packages.
      tempwhitelist [package ..]
        Temporarily place packages in whitelist for 10 seconds.
    2
    Doze... Love it even as it is. I can go hours even with a wear connected and after 8 hours lost 10 percent battery. Love Doze. It will be fun to play around with and see if more can be saved just by tweaking.
    I'm sure we will get there but .... lets hope no one will Overdoze/dose and kill their phone :cool: