Debug wake locks locally
Stay organized with collections
Save and categorize content based on your preferences.
There are a number of tools you can use to debug a locally-running app that uses
wake locks. These tools can help you identify and fix performance issues.
The following tools can help you debug or optimize your wake locks:
- dumpsys provides information about the status of system services
on a device.
- System tracing produces a trace file that you can use to
generate a system report.
- The Android Studio Background Task Inspector helps you to
monitor wake locks, including wake locks that might be acquired by libraries
like WorkManager.
dumpsys
dumpsys is a tool that runs on Android devices and provides
information about the device's system services.
The following command is particularly useful for debugging wake locks:
adb shell dumpsys batterystats
provides a detailed history of wake locks
held by each app. For more information, see the dumpsys Inspect battery
diagnostics documentation.
System tracing
System tracing records a wide range of device activity
over a short period. System tracing produces a trace file that you can use to
generate a system report. This report helps you identify ways to improve your
app's performance.
For information on how to get started, see this system tracing quickstart
guide. You can also watch this video on improving
Android battery efficiency.
Background Task Inspector
You can use Android Studio's
Background Task Inspector to monitor wake locks,
alarms and jobs.
In particular, the WorkManager library uses JobScheduler to schedule and execute
jobs. While these jobs are running, they hold a wake lock that is attributed
to the app. You can use Background Task Inspector to monitor workers and jobs
that execute in the background and see details about their work.
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-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 2025-08-26 UTC."],[],[],null,["There are a number of tools you can use to debug a locally-running app that uses\nwake locks. These tools can help you identify and fix performance issues.\n| **Note:** [Some APIs acquire wake locks that are attributed to your app](/develop/background-work/background-tasks/awake#actions-keep). This means your app might be using wake locks even though you aren't writing that code explicitly. If your app has mysterious performance issues, it can be helpful to check if there are misbehaving wake locks. If your app is holding wake locks and you don't recognize the names, [Identify wake locks created by other APIs](/develop/background-work/background-tasks/awake/wakelock/identify-wls) can help you identify the API that might have created them.\n\nThe following tools can help you debug or optimize your wake locks:\n\n- [dumpsys](#dumpsys) provides information about the status of system services on a device.\n- [System tracing](#system-tracing) produces a trace file that you can use to generate a system report.\n- The Android Studio [Background Task Inspector](#bg-task) helps you to monitor wake locks, including wake locks that might be acquired by libraries like WorkManager.\n\ndumpsys\n\n[dumpsys](/tools/dumpsys) is a tool that runs on Android devices and provides\ninformation about the device's system services.\n\nThe following command is particularly useful for debugging wake locks:\n\n- `adb shell dumpsys batterystats` provides a detailed history of wake locks held by each app. For more information, see the dumpsys [Inspect battery\n diagnostics](/tools/dumpsys#battery) documentation.\n\nSystem tracing\n\n[System tracing](/topic/performance/tracing) records a wide range of device activity\nover a short period. System tracing produces a *trace file* that you can use to\ngenerate a system report. This report helps you identify ways to improve your\napp's performance.\n\nFor information on how to get started, see this [system tracing quickstart\nguide](https://perfetto.dev/docs/quickstart/android-tracing). You can also watch [this video on improving\nAndroid battery efficiency](https://youtu.be/jS46zP8kQ3k?si=BCteWawO-rK7EAGl).\n\nBackground Task Inspector\n\nYou can use Android Studio's\n[Background Task Inspector](/studio/inspect/task) to monitor [wake locks,\nalarms and jobs](/studio/inspect/task#inspect-jobs-alarms-wakelocks).\n\nIn particular, the WorkManager library uses JobScheduler to schedule and execute\njobs. While these jobs are running, they hold a wake lock that is attributed\nto the app. You can use Background Task Inspector to monitor workers and jobs\nthat execute in the background and see details about their work."]]