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.
App background behavior trackers
Stay organized with collections
Save and categorize content based on your preferences.
Android 13 introduces the concept of a
power consumption tracker, which is a process that monitors foreground or
background battery usage by apps to determine if apps violate some policy.
Android 13 contains two power consumption trackers:
the foreground service tracker and background battery usage tracker. As opposed
to using your own mechanisms to determine battery abuse by apps, we
recommend using these trackers to monitor and alert users of excessive battery
usage.
Foreground service tracker
Foreground services can execute and use battery for an extended period of time.
The foreground service tracker displays a notification to users when a
foreground service has been running for a long period of time but is invisible,
such as when a user has dismissed the service's notification. If the user
clicks the notification, the task manager is displayed and lets
the user stop the foreground service. This tracker is enabled by default.
Background battery usage tracker
Apps can drain battery in the background without the user being aware. The
background battery tracker watches battery usage for each app. Battery usage
in this context is defined by three dimensions: foreground app on top,
foreground service running something that isn't visible, and background part of
app. If the background portion of the app's battery usage crosses some threshold,
the app is moved into a restricted bucket limiting it to one job per day. This
tracker is disabled by default. To enable this tracker, run the following
commands:
adb shell device_config put activity_manager bg_auto_restrict_abusive_apps 1
adb shell device_config put activity_manager bg_current_drain_auto_restrict_abusive_apps_enabled 1
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 2025-06-12 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 2025-06-12 UTC."],[],[],null,["# App background behavior trackers\n\nAndroid 13 introduces the concept of a\n*power consumption tracker*, which is a process that monitors foreground or\nbackground battery usage by apps to determine if apps violate some policy.\nAndroid 13 contains two power consumption trackers:\nthe foreground service tracker and background battery usage tracker. As opposed\nto using your own mechanisms to determine battery abuse by apps, we\nrecommend using these trackers to monitor and alert users of excessive battery\nusage.\n\nForeground service tracker\n--------------------------\n\nForeground services can execute and use battery for an extended period of time.\nThe foreground service tracker displays a notification to users when a\nforeground service has been running for a long period of time but is invisible,\nsuch as when a user has dismissed the service's notification. If the user\nclicks the notification, the task manager is displayed and lets\nthe user stop the foreground service. This tracker is enabled by default.\n\nBackground battery usage tracker\n--------------------------------\n\nApps can drain battery in the background without the user being aware. The\nbackground battery tracker watches battery usage for each app. Battery usage\nin this context is defined by three dimensions: foreground app on top,\nforeground service running something that isn't visible, and background part of\napp. If the background portion of the app's battery usage crosses some threshold,\nthe app is moved into a restricted bucket limiting it to one job per day. This\ntracker is disabled by default. To enable this tracker, run the following\ncommands: \n\n adb shell device_config put activity_manager bg_auto_restrict_abusive_apps 1\n adb shell device_config put activity_manager bg_current_drain_auto_restrict_abusive_apps_enabled 1"]]