Doze is one of the more interesting features of Android M, and also potentially huge for the platform. Google has said again and again that the new version of Android would improve battery life, but they might have actually done it this time. Doze puts apps into deep sleep when the device isn't in use to save power, and Google's developer docs explain exactly how this will work.

Doze is set to activate when a device is unplugged, stationary, and the screen is off. While in Doze, the phone or tablet will periodically wake up to sync data, but otherwise most things remain asleep. Here's what happens at the system level with Doze.

  • Network access is disabled, unless your app receives a high priority Google Cloud Messaging tickle.
  • Wake locks are ignored.
  • Alarms scheduled with the AlarmManager class are disabled, except for alarms that you've set with thesetAlarmClock() method and AlarmManager.setAndAllowWhileIdle().
  • WiFi scans are not performed.
  • Syncs and jobs for your sync adapters and JobScheduler are not permitted to run.

Developers will be able to designate some push messages as high-priority, which allows the device to wake up for a brief time. That should eliminate a lot of the wakelocks caused by rogue apps in the background. Apps also shouldn't be able to trigger device wake-ups (alarms) without having a good reason.

Low-priority jobs may be queued for when the device wakes back up, but developers are warned to test their apps and make sure they can recover gracefully from being in hibernation. We're still in the early days, so there might be some unforeseen consequences of Doze. We'll have to see how developers cope.