ניפוי באגים של חסימות מצב שינה באופן מקומי
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
יש כמה כלים שאפשר להשתמש בהם כדי לנפות באגים באפליקציה שפועלת באופן מקומי ומשתמשת בנעילות השכמה. הכלים האלה יכולים לעזור לכם לזהות ולפתור בעיות בביצועים.
הכלים הבאים יכולים לעזור לכם לנפות באגים או לבצע אופטימיזציה של נעילות ההשכמה:
- הפקודה dumpsys מספקת מידע על הסטטוס של שירותי המערכת במכשיר.
- מעקב אחר המערכת יוצר קובץ מעקב שאפשר להשתמש בו כדי ליצור דוח מערכת.
- בעזרת Background Task Inspector ב-Android Studio אפשר לעקוב אחרי נעילות השכמה, כולל נעילות השכמה שאולי נרכשו על ידי ספריות כמו WorkManager.
dumpsys
dumpsys הוא כלי שפועל במכשירי Android ומספק מידע על שירותי המערכת של המכשיר.
הפקודה הבאה שימושית במיוחד לניפוי באגים של נעילות השכמה:
adb shell dumpsys batterystats
מספק היסטוריה מפורטת של נעילות השהיה שכל אפליקציה מחזיקה בהן. מידע נוסף זמין במסמכי התיעוד של dumpsys בדיקת אבחון הסוללה.
תיעוד עקבות המערכת
מעקב אחר המערכת מתעד מגוון רחב של פעילות במכשיר
במשך תקופה קצרה. תהליך המעקב אחר המערכת יוצר קובץ מעקב שבעזרתו אפשר ליצור דוח מערכת. הדוח הזה עוזר לכם לזהות דרכים לשיפור הביצועים של האפליקציה.
למידע על תחילת העבודה, אפשר לעיין במדריך למתחילים בנושא מעקב אחר המערכת. אפשר גם לצפות בסרטון הזה על שיפור היעילות של הסוללה ב-Android.
הכלי לבדיקת משימות ברקע
אתם יכולים להשתמש בכלי לבדיקת משימות ברקע ב-Android Studio כדי לעקוב אחרי נעילות השכמה, התראות ומשימות.
ספציפית, ספריית WorkManager משתמשת ב-JobScheduler כדי לתזמן ולהפעיל משימות. בזמן שהעבודות האלה פועלות, הן מחזיקות בנעילת השכמה שמיוחסת לאפליקציה. אתם יכולים להשתמש בכלי לבדיקת משימות ברקע כדי לעקוב אחרי עובדים ועבודות שמתבצעים ברקע ולראות פרטים על העבודה שלהם.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-27 (שעון 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."]]