Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Power management
Stay organized with collections
Save and categorize content based on your preferences.
Battery life is a perennial user concern. To extend battery life, Android
continually adds new features to help the platform optimize the off-charger
behavior of apps and devices.
Android includes the following battery life enhancements:
-
App restrictions.
The platform can suggest apps that negatively affect battery life, so
that users can choose to restrict those apps from consuming resources. Apps
aren't background restricted by default.
- App standby. The
platform can place unused apps in App standby mode, temporarily
restricting network access and deferring syncs and jobs for those
apps.
-
Doze. The platform can
enter a state of deep sleep (periodically resuming normal operations) if
users haven't actively used their device (screen off and stationary) for
extended periods of time. Android 7.0 and higher also enables Doze to
trigger a lighter set of optimizations when users turn off the device
screen yet continue to move around.
- Limiting power transfer during USB backup and restore. When performing a USB
backup or restore, set the
UsbPort
class's enableLimitPowerTransfer
method to true
to disable charging and limit the sourcing power. To verify that
power is limited, call UsbPortStatus
class's isPowerTransferLimited
method. When isPowerTransferLimited
is true
, the Android device
reduces the power draw as a sink to 0 (or the lowest possible value allowed by hardware) and
limits the source current to 0. Limiting source power can be enforced only when both port
partners support USB power delivery (PD) specification. To return power usage to the defatult
state, set enableLimitPowerTransfer
to false
. The default state is
also returned when the USB cable is disconnected.
-
Exemptions. Preloaded system apps and cloud
messaging services are typically exempted from App standby and Doze by
default. App developers can use intents to apply these settings to their
apps. Users can exempt apps from App standby and Doze power-saving modes
in the Settings menu.
-
Trackers. App background behavior trackers monitor
apps' foreground and background battery usage to determine if the apps violate some policy.
Exempt apps
You can exempt apps from being subject to Doze or App standby.
Exemptions may be needed in the following use cases:
- Device manufacturers using a cloud messaging platform other than
Firebase
cloud messaging (FCM)
- Carrier using non-FCM cloud messaging platform
- Third-party app using non-FCM cloud messaging platform
Warning: Don't exempt apps to avoid testing
and optimizing. Unnecessary exemptions undermine the benefits of Doze and App
standby and can compromise the user experience, so we strongly suggest
minimizing such exemptions as they allow apps to defeat beneficial
controls the platform has over power use. If users become unhappy about the
power consumption of these apps, it can lead to frustration, bad experiences
(and negative reviews for the app), and customer support questions. For these
reasons, we strongly recommend that you don't exempt third-party apps
and instead exempt only cloud messaging services or apps with similar
functions.
Apps exempted by default are listed in Settings > App &
Notifications > Special app access > Battery Optimization. This list is
used for exempting the app from both Doze and App standby modes. To provide
transparency to the user, the Settings menu MUST show all
exempted apps.
Users can manually exempt apps using Settings > App & Notifications >
APP-NAME > Battery > Battery Optimization and then selecting the
app to turn off (or back on) optimization. However, users can't change the except status of any
app or service that is exempted by default in the system image.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-08-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-26 UTC."],[],[],null,["# Power management\n\nBattery life is a perennial user concern. To extend battery life, Android\ncontinually adds new features to help the platform optimize the off-charger\nbehavior of apps and devices.\n\nAndroid includes the following battery life enhancements:\n\n- [App restrictions](/docs/core/power/app_mgmt#app-restrictions). The platform can suggest apps that negatively affect battery life, so that users can choose to restrict those apps from consuming resources. Apps aren't background restricted by default.\n- [App standby](/docs/core/power/app_mgmt#app-standby). The platform can place unused apps in App standby mode, temporarily restricting network access and deferring syncs and jobs for those apps.\n- [Doze](/docs/core/power/platform_mgmt#doze). The platform can enter a state of deep sleep (periodically resuming normal operations) if users haven't actively used their device (screen off and stationary) for extended periods of time. Android 7.0 and higher also enables Doze to trigger a lighter set of optimizations when users turn off the device screen yet continue to move around.\n- Limiting power transfer during USB backup and restore. When performing a USB backup or restore, set the `UsbPort` class's `enableLimitPowerTransfer` method to `true` to disable charging and limit the sourcing power. To verify that power is limited, call `UsbPortStatus` class's `isPowerTransferLimited` method. When `isPowerTransferLimited` is `true`, the Android device reduces the power draw as a sink to 0 (or the lowest possible value allowed by hardware) and limits the source current to 0. Limiting source power can be enforced only when both port partners support USB power delivery (PD) specification. To return power usage to the defatult state, set `enableLimitPowerTransfer` to `false`. The default state is also returned when the USB cable is disconnected.\n- [Exemptions](#exempt-apps). Preloaded system apps and cloud messaging services are typically exempted from App standby and Doze by default. App developers can use intents to apply these settings to their apps. Users can exempt apps from App standby and Doze power-saving modes in the Settings menu.\n- [Trackers](/docs/core/power/trackers). App background behavior trackers monitor apps' foreground and background battery usage to determine if the apps violate some policy.\n\nExempt apps\n-----------\n\nYou can exempt apps from being subject to Doze or App standby.\nExemptions may be needed in the following use cases:\n\n- Device manufacturers using a cloud messaging platform other than [Firebase\n cloud messaging (FCM)](https://firebase.google.com/docs/cloud-messaging/)\n- Carrier using non-FCM cloud messaging platform\n- Third-party app using non-FCM cloud messaging platform\n\n**Warning:** Don't exempt apps to avoid testing\nand optimizing. Unnecessary exemptions undermine the benefits of Doze and App\nstandby and can compromise the user experience, so we strongly suggest\nminimizing such exemptions as they allow apps to defeat beneficial\ncontrols the platform has over power use. If users become unhappy about the\npower consumption of these apps, it can lead to frustration, bad experiences\n(and negative reviews for the app), and customer support questions. For these\nreasons, we strongly recommend that you don't exempt third-party apps\nand instead exempt only cloud messaging services or apps with similar\nfunctions.\n\nApps exempted by default are listed in **Settings \\\u003e App \\&\nNotifications \\\u003e Special app access \\\u003e Battery Optimization** . This list is\nused for exempting the app from both Doze and App standby modes. To provide\ntransparency to the user, the Settings menu **MUST** show all\nexempted apps.\n\nUsers can manually exempt apps using **Settings \\\u003e App \\& Notifications \\\u003e\n\u003cvar translate=\"no\"\u003eAPP-NAME\u003c/var\u003e \\\u003e Battery \\\u003e Battery Optimization** and then selecting the\napp to turn off (or back on) optimization. However, users can't change the except status of any\napp or service that is exempted by default in the system image."]]