-
-
Save y-polek/febff143df8dd92f4ed2ce4035c99248 to your computer and use it in GitHub Desktop.
#! /bin/zsh | |
# Buttery powered state | |
adb shell dumpsys battery | grep powered | |
# Unplug battery | |
adb shell dumpsys battery unplug | |
# Reset battery | |
adb shell dumpsys battery reset | |
# Dump Doze mode info | |
adb shell dumpsys deviceidle | |
# Enable Doze mode (may be required on Android Emulator) | |
adb shell dumpsys deviceidle enable | |
# Get status of Light Doze mode | |
adb shell dumpsys deviceidle get light | |
# Get status of Deep Doze mode | |
adb shell dumpsys deviceidle get deep | |
# Enter Light Doze mode (should be called several times to pass all phases) | |
adb shell dumpsys deviceidle step light | |
# Enter Deep Doze mode (should be called several times to pass all phases) | |
adb shell dumpsys deviceidle step deep |
@chaoscreater
step deep
steps the device closer to the deep doze and is not guaranteed to reach it immediately with the first call. That's why you have to call it multiple times, and with each call, it will step into the next state closer to deep doze, until it finally reaches it. But when you callforce idle
, it seems to skip all of the gradual stepping and goes to idle state (not sure if it's light or deep - have to check by callingget
) immediately.
Thanks. How many times would I need to call step deep to get it to the deep doze state? I'm using MacroDroid / Tasker to call it and I can loop
the command X number of times.
You mentioned that force idle seems to cause issues and I noticed that too, for example the clock in my status bar doesn't update, unless I turn off the screen and turn it back on. Have you noticed any issues with the phone in deep doze mode from using step deep?
I have found the following information about step
commands:
Each of the doze modes will have multiple states.
Light: ACTIVE -> IDLE -> IDLE_MAINTENANCE -> OVERRIDE
Deep: ACTIVE -> IDLE_PENDING -> SENSING -> LOCATING -> IDLE -> IDLE_MAINTENANCE
Regarding the force idle issues - in my case, that was exactly what I expected. I wanted to see what happens with my app when the phone goes to sleep, and it is expected that it will kill some background tasks and interrupt the network. That's very much expected on real devices, so your app should deal with such situations properly.
The behavior differs among devices from different manufacturers. https://dontkillmyapp.com/ this is a very insightful site that tells more about the problems your apps can expect from deep idle states.
I have found the following information about
step
commands:Each of the doze modes will have multiple states.
Light: ACTIVE -> IDLE -> IDLE_MAINTENANCE -> OVERRIDE
Deep: ACTIVE -> IDLE_PENDING -> SENSING -> LOCATING -> IDLE -> IDLE_MAINTENANCERegarding the force idle issues - in my case, that was exactly what I expected. I wanted to see what happens with my app when the phone goes to sleep, and it is expected that it will kill some background tasks and interrupt the network. That's very much expected on real devices, so your app should deal with such situations properly. The behavior differs among devices from different manufacturers. dontkillmyapp.com this is a very insightful site that tells more about the problems your apps can expect from deep idle states.
Thanks for the info. Yep I know about dontkillmyapp and don't really have any issues with the apps on my phone, they're all whitelisted and run fine. I'm just trying to force my phone to go into doze mode properly. I know there are apps like ForceDoze and NapTime and some other ones, but I don't the doze profiles that they use and prefer to use my own. I also wanted to use a single app to automate everything (hence using Tasker and MacroDroid) and so the last thing I needed was to force doze mode using either step deep or force idle, but obviously wasn't sure what the difference was between them, until now.
Just to confirm, you mentioned that using step deep that it "does not cause any real deep sleep side effects". So does that mean your phone was in deep sleep and yet it wasn't having any issues? E.g. apps that are whitelisted can still generate notifications, etc?
I think at that time I did not call step deep
enough times. force idle
felt more convenient because it worked immediately.
@chaoscreater
step deep
steps the device closer to the deep doze and is not guaranteed to reach it immediately with the first call. That's why you have to call it multiple times, and with each call, it will step into the next state closer to deep doze, until it finally reaches it.But when you call
force idle
, it seems to skip all of the gradual stepping and goes to idle state (not sure if it's light or deep - have to check by callingget
) immediately.