diff options
| author | Bill Napier <napier@google.com> | 2009-08-07 11:34:12 -0700 |
|---|---|---|
| committer | Bill Napier <napier@google.com> | 2009-08-07 11:34:12 -0700 |
| commit | a68dbdb1c31c486f489f38291eea05b3c621ae36 (patch) | |
| tree | 0ba88a13e0855f5ff8ef6be2f58ae816216c3843 /cmds/monkey/README.NETWORK.txt | |
| parent | 36e0ac795e9ec37323e25e0acf04b3090fe4c266 (diff) | |
| download | android_development-a68dbdb1c31c486f489f38291eea05b3c621ae36.tar.gz android_development-a68dbdb1c31c486f489f38291eea05b3c621ae36.tar.bz2 android_development-a68dbdb1c31c486f489f38291eea05b3c621ae36.zip | |
Added in simple command scripting to monkey over a TCP socket.
This allows a host program to talk to the monkey over TCP (via adb) and script up specific commands to run.
Diffstat (limited to 'cmds/monkey/README.NETWORK.txt')
| -rw-r--r-- | cmds/monkey/README.NETWORK.txt | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/cmds/monkey/README.NETWORK.txt b/cmds/monkey/README.NETWORK.txt new file mode 100644 index 000000000..ccf741b52 --- /dev/null +++ b/cmds/monkey/README.NETWORK.txt @@ -0,0 +1,86 @@ +MONKEY NETWORK SCRIPT + +The Monkey Network Script was designed to be a low-level way to +programmability inject KeyEvents and MotionEvents into the input +system. The idea is that a process will run on a host computer that +will support higher-level operations (like conditionals, etc.) and +will talk (via TCP over ADB) to the device in Monkey Network Script. +For security reasons, the Monkey only binds to localhost, so you will +need to use adb to setup port forwarding to actually talk to the +device. + +INITIAL SETUP + +Setup port forwarding from a local port on your machine to a port on +the device: + +$ adb forward tcp:1080 tcp:1080 + +Start the monkey server + +$ adb shell monkey --port 1080 + +Now you're ready to run commands + +COMMAND LIST + +Individual commands are separated by newlines. The Monkey will +respond to every command with a line starting with OK for commands +that executed without a problem, or a line starting with ERROR for +commands that had problems being run. The Monkey may decide to return +more information about command execution. That information would come +on the same line after the OK or ERROR. A possible example: + +key down menu +OK +touch monkey +ERROR: monkey not a number + +The complete list of commands follows: + +key [down|up] keycode + +This command injects KeyEvent's into the input system. The keycode +parameter refers to the KEYCODE list in the KeyEvent class +(http://developer.android.com/reference/android/view/KeyEvent.html). +The format of that parameter is quite flexible. Using the menu key as +an example, it can be 82 (the integer value of the keycode), +KEYCODE_MENU (the name of the keycode), or just menu (and the Monkey +will add the KEYCODE part). Do note that this last part doesn't work +for things like KEYCODE_1 for obvious reasons. + +Note that sending a full button press requires sending both the down +and the up event for that key + +touch [down|up|move] x y + +This command injects a MotionEvent into the input system that +simulates a user touching the touchscreen (or a pointer event). x and +y specify coordinates on the display (0 0 being the upper left) for +the touch event to happen. Just like key events, touch events at a +single location require both a down and an up. To simulate dragging, +send a "touch down", then a series of "touch move" events (to simulate +the drag), followed by a "touch up" at the final location. + +trackball dx dy + +This command injects a MotionEvent into the input system that +simulates a user using the trackball. dx and dy indicates the amount +of change in the trackball location (as opposed to exact coordinates +that the touch events use) + +flip [open|close] + +This simulates the opening or closing the keyboard (like on dream). + +OTHER NOTES + +There are some convenience features added to allow running without +needing a host process. + +Lines starting with a # character are considered comments. The Monkey +eats them and returns no indication that it did anything (no ERROR and +no OK). + +You can put the Monkey to sleep by using the "sleep" command with a +single argument, how many ms to sleep. |
