Battery optimization (Doze mode)
The Battery optimization screen allows you to configure Android's Doze mode, selecting which apps may be optimized by this feature.
This screen can usually be reached by the overflow menu (often the three dots icon) in the Battery settings (or Battery usage on some devices).
Doze mode is a feature introduced in Android 6.0 (Marshmallow) and refined in Android 7.0 (Nougat) as an attempt to address problems of battery drain by individual apps and increase your device's overall battery life, particularly when your phone or tablet is asleep (with the screen off).
What problem it solves
A common problem in earlier versions of Android was that any individual app could consume huge amounts of battery power, even while your device was asleep. While most apps were well-optimized and did not cause a problem, the growing tendency for people to install very large numbers of apps on modern smartphones led to the increased likelihood that one misbehaving app might pose a significant battery drain issue.
On a mobile device, apps need to be able to perform some tasks or respond to some situations even while your device is asleep with its screen off. For example, messaging apps need to receive messages, and various apps need to perform sync or updating functionality. In the best case, the app wakes up your device's CPU for a short time, and then allows it to go back to sleep (the screen never wakes).
A misbehaving app, however, may become "stuck" doing something, and prevent the CPU from going back to sleep. This is called a "wakelock", named after the internal functionality that allows an app to keep the CPU awake while it's performing some function.
How Doze mode works
Doze mode is activated once your device has been asleep for a significant amount of time without interacting with it.
While active, apps are restricted in two ways:
- Apps which need to do background processing work can only do so during periodic short maintenance windows. Outside of these times, the device's CPU goes to sleep, and any processing in progress will be suspended until it wakes up during the next processing window. These windows are kept short, restricting the maximum amount of CPU time that apps may use.
- Apps which need to respond immediately to incoming messages may do so only if they receive their messages via Google Cloud Messaging services, which allows apps to mark themselves "High priority" and to respond immediately to messages even in Doze mode. This routing of messaging through Google servers allows Google to control and restrict an app if it's found to be misusing this feature in a way that could use undue battery drain.
When Doze mode is activated
In Android 6.0 (Marshmallow), Doze mode only activated while the device had been asleep for a significant time and it was sitting still, such as when on a table or desk. The primary benefit to this was a decrease in battery drain for devices left unused overnight or on a desk during the day.
Android 7.0 (Nougat) expanded Doze mode to also activate when asleep and moving, such as when being carried in a pocket, albeit with slightly relaxed restrictions to app functionality.
How to enable Doze mode
Doze mode is already enabled on devices running Android 6.0 and later. It does not need to be switched on or configured to receive the benefit to battery life it gives.
Excluding certain apps from Doze mode
Certain apps can be excluded from the restrictions imposed by Doze mode, allowing them unrestricted ability to perform background processing or respond instantly to incoming messages without using Google's services.
Tap on the app you wish to exclude and select Don't optimize.
This is useful if you have an app that requires significant background processing to run correctly or needs to respond instantly to incoming messages but has not been designed to do so in a way that is compatible with Doze mode.
Optimisation is disabled for some system apps, which will always be treated as excluded from Doze mode.