rootpanthera rootpanthera - 1 year ago 137
Android Question

When does android device go to sleep mode?

I was searching SO and web but i couldn't find sufficient answer for my particular question. Ok here we go:

Every user can modify screen timeout on android. (when screen turns off when its idle for __ seconds/minutes - users choice ). But user can modify ONLY screen timeout and not when device goes actually to sleep. I found here what happens when device goes to sleep: (Really nice answer by CommonsWare) Android Sleep/Standby Mode

Ok my question is simple. How do i know when my phone will go to sleep? Will it go to sleep immediately after turning screen off? Will it stay "awake" a while after screen was turned off? And most important: Does sleep mode in particular device varies from brand device ( how manufacturer implement this ) or it depends on ROM version (For instance, all ICS powered devices will go to sleep X seconds after screen was turned off )?

Answer Source

You can never really be sure if the device has gone to sleep. At best, I can give you a list of things that would make sure that the device hasn't gone to sleep:

  • Screen being on - Requires CPU and GPU, and hence RAM, to stay active
  • Any app holding a wakelock - Even the lowest wakelocks keep the CPU on, though the screen may be switched off

Apart from this, there is no guarantee that the device will go to sleep n seconds after the screen is turned off, even if no wakelocks are being held. This is upto the OEM, and they can alter this.

Keep in mind that Android devices have an option to keep the device unlocked for a certain amount of time after the screen has gone to sleep.