Android - How to determine which app is causing vibration?
In addition to the dumpsys
method explained in the other answer, you can use Android's hidden (kind of) permission manager appops
to get recently allowed vibrator requests, e.g. in last minute. From adb shell
:
for pkg in $(pm list packages | sed 's/package://')
do
echo "$pkg $(appops get $pkg VIBRATE)" | grep 'time=+[0-9]*s'
done
pm
is the package manager which lists all installed packages. appops
determines when last time each package made a vibration request and if it was allowed or rejected.
Result can be further filtered by piping output through awk '{printf "%-12s%-20s%s\n",$3,$4,$1}'
:
allow; time=+15s659ms com.termux
allow; time=+6s458ms com.google.android.inputmethod.latin
Termux made a vibration 15 seconds back. Also the request can be denied:
~$ appops set com.termux VIBRATE deny
Now the output will be like this:
deny; time=+9s500ms com.termux
allow; time=+6s392ms com.google.android.inputmethod.latin
And a shameless self-promotion. If not comfortable with CLI, you can use my open-source app Permission Manager X to get and set AppOps:
The next time your device vibrates, connect it to a PC with adb already setup, and issue this command:
adb shell dumpsys vibrator
In the output, along with the pattern of vibration you would be able to see the UID and package name of the app that caused the vibration in the device recently. For example, in my OnePlus 6 (Android 8.1.0) device it showed this output:
Previous vibrations: , startTime: 95325556, effect: Waveform{mTimings=[0, 250], mAmplitudes=[0, -1], mRepeat=-1}, usageHint: 5, uid: 10122, opPkg: com.textra , startTime: 95346005, effect: Waveform{mTimings=[0, 250], mAmplitudes=[0, -1], mRepeat=-1}, usageHint: 5, uid: 10122, opPkg: com.textra , startTime: 95428005, effect: Waveform{mTimings=[0, 250], mAmplitudes=[0, -1], mRepeat=-1}, usageHint: 5, uid: 10122, opPkg: com.textra , startTime: 95516412, effect: OneShot{mTiming=50, mAmplitude=-1}, usageHint: 0, uid: 1001, opPkg: com.android.incallui , startTime: 95572994, effect: Waveform{mTimings=[0, 250], mAmplitudes=[0, -1], mRepeat=-1}, usageHint: 5, uid: 10122, opPkg: com.textra , startTime: 96868723, effect: Waveform{mTimings=[0, 250], mAmplitudes=[0, -1], mRepeat=-1}, usageHint: 0, uid: 1000, opPkg: android , startTime: 97144598, effect: OneShot{mTiming=200, mAmplitude=-1}, usageHint: 0, uid: 10130, opPkg: com.phonepe.app , startTime: 97187986, effect: OneShot{mTiming=200, mAmplitude=-1}, usageHint: 0, uid: 10130, opPkg: com.phonepe.app , startTime: 98229901, effect: Waveform{mTimings=[0, 300], mAmplitudes=[0, -1], mRepeat=-1}, usageHint: 0, uid: 10133, opPkg: com.arlosoft.macrodroid
The string next to opPkg:
is the package name of the app that caused the vibration at a certain time. The list is in chronological order with the most recent entry at the bottom. To get the app's name out of the package name, see my answer here.