2

I have a Moto G6 Play that vibrates like it is getting notifications but it's not. The vibration is inconsistant and seems random so I would like to know if there is a logcat or something I can run to log which app is calling the vibration so that I can shut it off? The same thing happens on my wife's phone, same model, and it does my head in. The device is running Android 9.

2

In addition to dumpsys vibrator | awk '/opPkg:/{print $NF}', 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
  • To clarify, will I need root access to run that command or will an up to date adb installation suffice? Thanks again. – Badger Aug 15 at 11:12
  • @Badger all commands work without root on adb shell, but not on a terminal emulator app. – Irfan Latif Aug 15 at 14:47
2

The next time your device vibrates, connect it to a PC with 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.

  • 1
    On Pie I get human readable time: startTime: Aug 10, 2019, 2:05:20 AM, effect: Prebaked{mEffectId=0, mEffectStrength=1, mFallback=true}, originalEffect: null, usageHint: 13, uid: 10151, opPkg: com.google.android.inputmethod.latin – Irfan Latif Aug 9 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.