When Google first announced Doze for Android Marshmallow, it was touted as a bid to significantly boost battery life by putting the device into a very low power-consumption mode whenever it was stationary and the screen was turned off. This meant that leaving your phone on a table overnight or even for a full day would only sip away a very small amount of your battery. Unfortunately, since it only kicks in for a fully stationary device, Doze in Marshmallow doesn't get triggered if, say, you leave your phone in your pocket instead of placing it on the table, meaning that you won't see any of those battery savings.

Thankfully, that's about to change: starting with Android N, Doze will now activate whenever the device's screen is turned off, even if it's not laying on a still surface. This will undoubtedly be great news for sea captains and people who live in areas that are especially prone to earthquakes, but it's also great for normal people who keep their phones in their pockets for the larger part of the day.

In addition to an improved Doze mode, Google is also continuing to invest in Project Svelte, their effort to make Android much more memory efficient so that it can run smoothly on an even broader range of devices. By making background work more efficient, Android N should also consume less resources and gain even more battery savings too.

We'll be trying out the newly released N developer builds and paying close attention to how effective this updated version of Doze is in practice.

UPDATE: 2016/03/09 12:03pm PST BY

Now that the developer website is up, we've got access to some additional information on updates to Doze and Project Svelte in Android N. For one thing, Doze only kicks in after the screen "has been off for a certain time" and is on battery power. During the first stage, Doze will shut off app network access and defer jobs and syncs, and will only apply the remaining restrictions if the device stays stationary for "a certain time after entering Doze." Here, the usual system will take over, blocking wakelocks, AlarmManager alarms, and GPS and Wi-Fi scans.

doze-diagram-2

Doze kicks into second gear after the device has been stationary for a while

Regardless of whether the device is in full or "lite" Doze modes, the system will regularly wake to allow apps network access and run any previously deferred jobs and syncs. Obviously, turning the screen on or plugging in your device will exit Doze and lift any of these restrictions.

doze-diagram-1

Doze exits when the device gets plugged in or the screen is turned on

With Project Svelte, three broadcasts that have existed until now will also be removed: CONNECTIVITY_ACTION, NEW_PICTURE, and NEW_VIDEO. These allowed apps to monitor network connectivity changes between Wi-Fi and mobile data, as well as whenever a new photo or video was taken with the camera. Since many apps can request to get notified by any of these broadcasts, this would cause all of them to wake whenever a user changes their network connectivity or takes a photo or video, unnecessarily draining the battery.

To solve this, Android N now only allows an app to monitor a change in connectivity if it is running as a foreground app, and apps in N will no longer receive NEW_PICTURE or NEW_VIDEO broadcasts at all. These changes will certainly do a great deal in reducing unnecessary battery consumption by rogue apps, but we'll have to see if they also negatively impact user experience in any way.

Source: Android Developers website (1), (2)