-
检查服务端进程是否存活 (
adb shell ps | grep <package>
) -
检查服务端日志 (
adb logcat | grep <provider>
) -
adb shell ps -T | grep pid | grep Binder
-
如果线程数接近或达到上限(如16个),可能因线程耗尽导致阻塞
-
S
表示线程状态为 Sleeping(正常等待状态) -
如果出现
D
(Uninterruptible Sleep)或R
(Running 且长时间不切换),则可能是死锁或阻塞。 -
adb shell "ps -A -T | grep pid | grep Binder",出现了很多
com.huawei.hwid.core的线程,待查
-
-
查看阻塞调用栈(oppo报错)adb shell am dumpheap [your_pid] /data/local/tmp/heap.hprof
- 检查 Binder 状态(可能需要root)
adb shell cat /sys/kernel/debug/binder/proc/[your_pid] 观察 pending_work和 threads计数
- Binder连接诊断(需要root)
adb shell su root cat /sys/kernel/debug/binder/proc/[pid]
- 强制回收Binder引用(需要root)
adb shell su root am binder-heal [client-pid]
- 监控Binder事务(需要root)
adb shell su root cat /sys/kernel/debug/tracing/trace_pipe | grep Binder:
- 检查Binder连接状态(报错)
adb shell cat /proc/[client-pid]/fd | grep binder
-
检查目标provider状态
adb shell dumpsys activity providers | grep -A 30 your.authority
-
监控binder调用延迟 (No such file or directory)
adb shell cat /sys/kernel/debug/tracing/trace_pipe | grep Binder
ContentProvider问题排查的adb命令
于 2025-04-22 09:13:05 首次发布