0

When the user presses on the Power button to turn off the screen, at some point Android goes into sleep mode shutting down the CPU. It isn't clear whether this happens immediately or after a period of time. Does the CPU stay fully or partially awake for a duration and then go into a complete sleep mode?

Johann
  • 27,536
  • 39
  • 165
  • 279

1 Answers1

0

When the user presses the power button, Android goes into screen off mode. Some time after this, the device will go into sleep mode if nothing is kept awake using a Wakelock. The duration of this period is uncertain. See here for more: https://stackoverflow.com/a/5120225/1369222

Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
  • So in other words, Android doesn't have a 2-step sleep mode. If no wakelocks are present, it will turn off immediately, although there is no guarantee that that is the case. I thought that by knowing whether there is a fixed time for deep sleep would help to test my app as it comes out of sleep mode. But since I probably can't figure out whether my app comes out of sleep mode, testing for this could be problematic. – Johann Jul 09 '13 at 07:00
  • @AndroidDev yeah. I wouldn't recommend basing any app logic on the certainty of this behavior. – Anup Cowkur Jul 09 '13 at 07:04
  • yeah I release all my wakelocks as soon as the user presses the power button (onPause code runs) – hamish Jul 12 '14 at 22:20