I'm creating tests with UiAutomator
and Vibration is used in app, but don't need it in tests.
I'm doing so:
InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand("adb shell cmd appops set <app package name> VIBRATE ignore")
but this command is not working for me, maybe its because vibration goes from notification.
You just need to remove adb shell
from the string provided to executeShellCommand
method. The working statement will be:
InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand("cmd appops set <app package name> VIBRATE ignore")