简体   繁体   中英

How to turn off Vibration (in all apps) via ADB?

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM