Share
Embed
15分で分かった気になる dumpsys
DroidKaigi.collect { #15@Fukuoka } での発表です。Androidアプリ開発者向けの内容です。
Shinnosuke Kugimiya
January 10, 2025
Transcript
50 slides
-
ࣗݾհ w LHNZTIJOఝٶ ͗͘Έ w "OESPJEΤϯδχΞ w Ԭࢢࡏॅ w
߹ಉձࣾ%..DPN w 71P&ࣨࣨ w ݉ ΞϓϦ։ൃࣨࣨ w ݉ ։ൃਓࣄϢχοτ -
EVNQTZT adb shell dumpsys [-t timeout] [--help | -l |
--skip services | service [arguments] | -c | -h] EVNQTZTɺ"OESPJEσόΠε্Ͱಈ࡞͠ɺ ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹγεςϜαʔϏεʹؔ͢ΔใΛఏڙ͢ΔπʔϧͰ͢ɻ ࣮ػͰୟ͘ͱɺࣗͷ߹ݸͷγεςϜαʔϏε͕ಈ͍ͯ·ͨ͠ɻ -
EVNQTZT $ adb shell dumpsys --help usage: dumpsys To dump
all services. or: dumpsys [-t TIMEOUT] [--priority LEVEL] [--clients] [--dump] [--pid] [--thread] [--help | -l | --skip SERVICES | SERVICE [ARGS]] --help: shows this help -l: only list services, do not dump them -t TIMEOUT_SEC: TIMEOUT to use in seconds instead of default 10 seconds -T TIMEOUT_MS: TIMEOUT to use in milliseconds instead of default 10 seconds --clients: dump client PIDs instead of usual dump --dump: ask the service to dump itself (this is the default) --pid: dump PID instead of usual dump --proto: filter services that support dumping data in proto format. Dumps will be in proto format. --priority LEVEL: filter services based on specified priority LEVEL must be one of CRITICAL | HIGH | NORMAL --skip SERVICES: dumps all services but SERVICES (comma-separated list) --stability: dump binder stability information instead of usual dump --thread: dump thread usage instead of usual dump SERVICE [ARGS]: dumps only service SERVICE, optionally passing ARGS to it -
γεςϜαʔϏε val notification = getSystemService(NotificationManager::class.java) val alarmManager = getSystemService(Context.ALARM_SERVICE) as
AlarmManager ΞϓϦ։ൃऀͰೃછΈ͕ͳ͍ͳʁͱࢥ͏ਓ͕͍Δ͔͠Ε·ͤΜ͕ɺ ͜ΜͳίʔυΛॻ͍ͨ͜ͱ͋Γ·ͤΜ͔ʁ -
γεςϜαʔϏε ΞϓϦ։ൃऀͰೃછΈ͕ͳ͍ͳʁͱࢥ͏ਓ͕͍Δ͔͠Ε·ͤΜ͕ɺ ͜ΜͳίʔυΛॻ͍ͨ͜ͱ͋Γ·ͤΜ͔ʁ ͍͍ͩͨͦΕͰ͢ɻ val notification = getSystemService(NotificationManager::class.java) val alarmManager
= getSystemService(Context.ALARM_SERVICE) as AlarmManager -
γεςϜαʔϏε IUUQTDTBOESPJEDPNBOESPJEQMBUGPSNTVQFSQSPKFDUNBJO NBJOGSBNFXPSLTCBTFDPSFKBWBBOESPJEDPOUFOU$POUFYUKBWBM /** * Use with {@link #getSystemService(String)} to
retrieve a * {@link android.os.PowerManager} for controlling power management, * including "wake locks," which let you keep the device on while * you're running long tasks. */ public static final String POWER_SERVICE = "power"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.os.PowerStatsService} for accessing power stats * service. * * @see #getSystemService(String) * @hide */ public static final String POWER_STATS_SERVICE = "powerstats"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.os.RecoverySystem} for accessing the recovery system * service. * * @see #getSystemService(String) * @hide */ public static final String RECOVERY_SERVICE = "recovery"; $POUFYU999@4&37*$&ԼهͷΑ͏ʹେମҎ্ఆٛ͞Ε͍ͯ·͢ɻ˞͜ͷࢿྉ࡞͍ͬͯΔݱࡏ࣌Ͱɻ -
ύʔϛογϣϯใΛऔಘ adb shell dumpsys package com.kgmyshin.sample | grep permission declared
permissions: requested permissions: android.permission.INTERNET android.permission.ACCESS_NETWORK_STATE android.permission.WAKE_LOCK android.permission.POST_NOTIFICATIONS com.google.android.c2dm.permission.RECEIVE com.google.android.gms.permission.AD_ID android.permission.ACCESS_ADSERVICES_ATTRIBUTION android.permission.ACCESS_ADSERVICES_AD_ID com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE com.google.android.providers.gsf.permission.READ_GSERVICES android.permission.CAMERA install permissions: com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE: granted=true com.google.android.c2dm.permission.RECEIVE: granted=true com.google.android.providers.gsf.permission.READ_GSERVICES: granted=true android.permission.ACCESS_ADSERVICES_AD_ID: granted=true android.permission.INTERNET: granted=true android.permission.ACCESS_NETWORK_STATE: granted=true android.permission.ACCESS_ADSERVICES_ATTRIBUTION: granted=true com.google.android.gms.permission.AD_ID: granted=true android.permission.WAKE_LOCK: granted=true runtime permissions: android.permission.POST_NOTIFICATIONS: granted=true, flags=[ USER_SET|USER_SENSITIVE_WHEN_GRANTED| USER_SENSITIVE_WHEN_DENIED] android.permission.CAMERA: granted=true, flags=[ USER_SET|USER_SENSITIVE_WHEN_GRANTED| USER_SENSITIVE_WHEN_DENIED] -
%PTFϞʔυΛςετ͢Δ adb shell dumpsys battery unplug ॆిΛ0'' γεςϜΛڧ੍తʹΞΠυϧঢ়ଶʢ%P[FϞʔυʣʹ͠·͢ adb shell
dumpsys deviceidle force-idle -
%PTFϞʔυΛςετ͢Δ adb shell dumpsys battery unplug ॆిΛ0'' γεςϜΛڧ੍తʹΞΠυϧঢ়ଶʢ%P[FϞʔυʣʹ͠·͢ adb shell
dumpsys deviceidle force-idle %P[FϞʔυղআͯ͠ɺ%P[FϞʔυ͔Βൈ͚ͨ࣌ͷঢ়ଶΛ֬ೝ͢Δ adb shell dumpsys deviceidle unforce adb shell dumpsys battery reset -
ΤϯτϦʔҰཡΛදࣔ͢Δ $ adb shell dumpsys dropbox Drop box contents: 6
entries Max entries: 1000 Low priority rate limit period: 2000 ms Low priority tags: {data_app_wtf, keymaster, system_server_wtf, system_app_strictmode, system_app_wtf, system_server_strictmode, data_app_strictmode, netstats} 2024-12-26 03:58:32 data_app_anr (compressed text, 18256 bytes) 2024-12-26 04:01:03 data_app_anr (compressed text, 18134 bytes) 2024-12-26 04:01:16 data_app_anr (compressed text, 19418 bytes) 2024-12-27 14:58:32 data_app_anr (compressed text, 23326 bytes) 2024-12-27 14:59:29 data_app_anr (compressed text, 23742 bytes) 2024-12-27 15:00:16 data_app_crash (text, 1468 bytes) Usage: dumpsys dropbox [--print|--file] [YYYY-mm-dd] [HH:MM:SS] [tag] ABECTIFMMEVNQTZTESPQCPYAͰΤϯτϦʔҰཡΛ֬ೝͰ͖·͢ɻ ࠓճBOS͕ͭͱBQQ@DSBTI͕ͭཷ·ͬͯΔ͜ͱΛ֬ೝͰ͖·͢ -
ϩάΛ֬ೝ͢Δ $ adb shell dumpsys dropbox —print Drop box contents:
6 entries Max entries: 1000 Low priority rate limit period: 2000 ms Low priority tags: {data_app_wtf, keymaster, system_server_wtf, system_app_strictmode, system_app_wtf, system_server_strictmode, data_app_strictmode, netstats} ======================================== 2024-12-26 03:58:32 data_app_anr (compressed text, 18256 bytes) Process: com.amazon.kindle PID: 18263 UID: 10253 Frozen: false Flags: 0x30d83e44 Package: com.amazon.kindle v1285944011 (8.112.3.0(2.0.28400.0)) Foreground: Yes ABECTIFMMEVNQTZTESPQCPYQSJOUAͰϩάͷதΛදࣔͰ͖·͢ɻ ͔͠͠ɺͯ͢ͷΤϯτϦʔͷத͕࿈݁͞Εͯදࣔ͞ΕΔͷͰ͍͘͢͝Ͱ͢ -
ߜͬͯϩάΛදࣔ͢Δ $ adb shell dumpsys dropbox 2024-12-27 15:00:16 --print Drop
box contents: 6 entries Max entries: 1000 Low priority rate limit period: 2000 ms Low priority tags: {data_app_wtf, keymaster, system_server_wtf, system_app_strictmode, system_app_wtf, system_server_strictmode, data_app_strictmode, netstats} Searching for: 2024-12-27 15:00:16 ======================================== 2024-12-27 15:00:16 data_app_crash (text, 1468 bytes) Process: com.example.myapplication PID: 6858 UID: 10375 Frozen: false Flags: 0x20e8bf46 Package: com.example.myapplication v1 (1.0) Foreground: Yes Process-Runtime: 1971 Build: google/oriole/oriole:14/UQ1A.231205.015/11084887:user/release-keys Crash-Handler: com.android.internal.os.RuntimeInit$KillApplicationHandler Loading-Progress: 1.0 Dropped-Count: 0 java.lang.RuntimeException: test at com.example.myapplication.MainActivity.onCreate$lambda$1(MainActivity.kt:22) at com.example.myapplication.MainActivity.$r8$lambda$Qv3VJsM63Xovrk15oYiuFfzuA-I(Unknown Source:0) at com.example.myapplication.MainActivity$$ExternalSyntheticLambda1.onClick(D8$$SyntheticClass:0) at android.view.View.performClick(View.java:7658) at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1218) at android.view.View.performClickInternal(View.java:7635) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:30167) at android.os.Handler.handleCallback(Handler.java:958) Ұཡදࣔͨ࣌͠ͷ λΠϜελϯϓΛ͏͜ͱͰ ߜͬͯϩάΛදࣔ͢Δ͜ͱ͕ Ͱ͖·͢ ABECTIFMMEVNQTZTESPQCPY \UJNFTUBNQ^QSJOUA