Monkey has a number of undocumented options, including --pct-rotation
. Add that switch to your command and watch your screen rotate like it's possessed by demons:
Up to (including) adb version 1.0.31:
adb shell monkey -p com.example.app -v --pct-rotation=70 500
Since adb version 1.0.32:
adb shell monkey -p com.example.app -v --pct-rotation 70 500
Look in the processOptions() method of the monkey command to see all of the supported options: https://android.googlesource.com/platform/development.git/+/master/cmds/monkey/src/com/android/commands/monkey/Monkey.java
Look at the constructor for the MonkeySourceRandom class to see the default percentages for all of the event types. These are the current values in the master branch at the time of this post. Note that the default for rotation is 0:
// default values for random distributions
// note, these are straight percentages, to match user input (cmd line args)
// but they will be converted to 0..1 values before the main loop runs.
mFactors[FACTOR_TOUCH] = 15.0f;
mFactors[FACTOR_MOTION] = 10.0f;
mFactors[FACTOR_TRACKBALL] = 15.0f;
// Adjust the values if we want to enable rotation by default.
mFactors[FACTOR_ROTATION] = 0.0f;
mFactors[FACTOR_NAV] = 25.0f;
mFactors[FACTOR_MAJORNAV] = 15.0f;
mFactors[FACTOR_SYSOPS] = 2.0f;
mFactors[FACTOR_APPSWITCH] = 2.0f;
mFactors[FACTOR_FLIP] = 1.0f;
mFactors[FACTOR_ANYTHING] = 13.0f;
mFactors[FACTOR_PINCHZOOM] = 2.0f;
https://android.googlesource.com/platform/development.git/+/master/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java