Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you disable animations at the system level for an android device/emulator using adb with API 23?

Tags:

Based on reading, the values window_animation_scale, transition_animation_scale and animator_duration_scale need to be set to 0

The following works for API 22 but not for API 23:

adb shell settings put global window_animation_scale 0.0 

Even the below command did not work for API 23

adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="window_animation_scale"' 

We want to disable animations to prevent flaky visual test failures only. We do not want to introduce this logic in the application and hence want to apply it at the system level rather than through the application.

like image 768
Mikhail Advani Avatar asked Mar 28 '17 04:03

Mikhail Advani


People also ask

How do I turn off animations on Android?

Open Settings . Scroll down and select Accessibility. Scroll down to Display and tap Text and display. Tap the toggle switch for Remove animations to turn it on.

How do I disable adb on Android?

To stop the adb server, use the adb kill-server command. You can then restart the server by issuing any other adb command.

Should I disable animations Android?

If you're trying to make a lower resource handset feel a bit snappier, go ahead and disable all animations completely. That should both make the phone feel faster and be less taxing on the limited hardware.

Can I Enable USB debugging using adb?

The answer to this question is no. You cannot enable USB debugging using an ADB command. This is because executing an ADB command requires you to already have USB debugging enabled on your phone. If USB debugging is not turned on, ADB cannot communicate with your device.


2 Answers

You can execute the following adb commands to disable the animations:

adb shell settings put global window_animation_scale 0 adb shell settings put global transition_animation_scale 0 adb shell settings put global animator_duration_scale 0 

Also, you could take a look at this repo

Build the project and download the generated .apk file and follow the instructions mentioned in that project to disable the animations and you should have a smooth sailing afterwards. You could also download the same .apk file from a lot of other sources (go google!).

Once you have the .apk file then issue the following commands:

 adb install -r android_emulator_hacks.apk  adb shell pm grant no.finn.android_emulator_hacks android.permission.SET_ANIMATION_SCALE  adb shell am start -n no.finn.android_emulator_hacks/no.finn.android_emulator_hacks.HackActivity 
like image 66
mark w. Avatar answered Oct 14 '22 03:10

mark w.


The answer by Mark W should be accepted You can also save it as a shell script for convenience, i.e.:

#!/bin/sh adb shell settings put global window_animation_scale 0.0 adb shell settings put global transition_animation_scale 0.0 adb shell settings put global animator_duration_scale 0.0 

then in terminal just call

sh path/to/file.sh 

Or go one step further and save an alias shortcut in your bash profile :)

like image 40
Emmaaa Avatar answered Oct 14 '22 01:10

Emmaaa