Google's answer to apps that misbehave when you're not around is a huge step forward for folks whose device isn't constantly in-pocket.

One of the big user-facing changes to come from the Android M announcement at Google I/O this year is Doze, a new set of behaviors for making sure apps aren't sucking your battery life away when you aren't using your phone. More specifically, when you've left your phone on your desk or your tablet on the coffee table, Doze will detect the lack of motion and enter a new kind of deep sleep mode.

While it's not quite finished, and we know nothing about the Android M Developer Preview is set in stone, Google's message here couldn't be more clear. You should expect more from your devices when they are in an inactive state, and here's how they plan to do that.

Every year Google makes battery life improvements of some kind to Android, but those changes are often dependent on developers playing along and doing their part. When Google says Doze is meant to extend your battery life for idle devices, it's something that applies no matter what your apps are doing. Here's how Google describes the behavior changes that make up 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 the setAlarmClock() method and AlarmManager.setAndAllowWhileIdle().
  • WiFi scans are not performed.
  • Syncs and jobs for your sync adapters and JobScheduler are not permitted to run.

As you can see, Google is taking a much stronger position on app behavior through Doze, and as long as your phone is sitting still and not doing anything it'll get you a noticeable extension on battery life. Once the phone moves or you wake it up to do something, this function turns off and everything your phone has missed will come flooding in to the device. Hopefully developers will work to avoid individual notification tones for each missed message, but only time will tell how that gets sorted out.

Doze Exemptions

As we tested Doze through the M Developer Preview, a new exemption list for apps was discovered in the battery manager. This list gives you an idea of which apps are currently ignoring battery optimizations, and lets you go through and manually set others to behave the same way. It's a part of the App Standby feature, which helps determine when apps should be able to sync data and execute tasks. Like Doze, this feature can suspend network access for apps that are asking for it but not actually doing anything in the foreground. You can set just about anything to ignore battery optimizations currently, but it's an individual opt-in list so you can add or remove as you see fit.

The end result here is fantastic. Google has already delivered in a big way in the M Developer Preview when it comes to standby time, and that is going to make a big difference for a lot of folks. It means tablets that last for days, phones that can sit on desks without issue, and a generally better experience for the next iteration of Android.