-->

Debug Android vibration

2019-02-20 11:12发布

问题:

Guys my phone is vibration without any reason. So I want to determine the application which sends vibration command to vibrate. Does Android logging such events? Or can I write an application which will monitor Vibrator::vibrate(TIMEOUT) calls from another application?

Note: I have root access.

回答1:

If you look in the system log (logcat -b system) it will show you the core system service's logs. The VibrateService only makes a couple in the latest version of Android, which will tell you what vibration pattern is being started. Unfortunately, it won't show you what UID/PID is responsible for the request. Beyond that, you may be able to find some information from the kernel by digging around to figure out which device interface (e.g. /dev/gpio1) is the one used by the vibrator service. If that driver exposes some stats/debug on /proc or debugfs you might be able to figure out which process is responsible.