summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorYu Shan Emily Lau <yslau@google.com>2009-09-14 18:41:05 -0700
committerYu Shan Emily Lau <yslau@google.com>2009-09-14 19:06:18 -0700
commitb1cc0de3c8e605f0eb242cd8c85c392d7c07eb3a (patch)
treef686842f888a2650aa178936ec3ad9fa9463b9c0 /cmds
parent48e8ca1f521d33a3d9051db08d06f435906199d6 (diff)
downloadandroid_development-b1cc0de3c8e605f0eb242cd8c85c392d7c07eb3a.tar.gz
android_development-b1cc0de3c8e605f0eb242cd8c85c392d7c07eb3a.tar.bz2
android_development-b1cc0de3c8e605f0eb242cd8c85c392d7c07eb3a.zip
modified: src/com/android/commands/monkey/MonkeySourceScript.java
Added the long press keyword and event. modified: src/com/android/commands/monkey/MonkeySourceScript.java modified: src/com/android/commands/monkey/MonkeySourceScript.java modified: src/com/android/commands/monkey/MonkeySourceScript.java
Diffstat (limited to 'cmds')
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
index a3d8b04f1..783dcf643 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
@@ -85,10 +85,12 @@ public class MonkeySourceScript implements MonkeyEventSource {
private static final String EVENT_KEYWORD_KEYPRESS = "DispatchPress";
private static final String EVENT_KEYWORD_ACTIVITY = "LaunchActivity";
private static final String EVENT_KEYWORD_WAIT = "UserWait";
+ private static final String EVENT_KEYWORD_LONGPRESS = "LongPress";
// a line at the end of the header
private static final String STARTING_DATA_LINE = "start data >>";
private boolean mFileOpened = false;
+ private static int LONGPRESS_WAIT_TIME = 2000; // wait time for the long press
FileInputStream mFStream;
DataInputStream mInputStream;
@@ -251,6 +253,16 @@ public class MonkeySourceScript implements MonkeyEventSource {
mQ.addLast(e);
e = new MonkeyKeyEvent(KeyEvent.ACTION_UP, keyCode);
mQ.addLast(e);
+ } else if (s.indexOf(EVENT_KEYWORD_LONGPRESS) >= 0) {
+ // handle the long press
+ MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN,
+ KeyEvent.KEYCODE_DPAD_CENTER);
+ mQ.addLast(e);
+ MonkeyWaitEvent we = new MonkeyWaitEvent(LONGPRESS_WAIT_TIME);
+ mQ.addLast(we);
+ e = new MonkeyKeyEvent(KeyEvent.ACTION_UP,
+ KeyEvent.KEYCODE_DPAD_CENTER);
+ mQ.addLast(e);
}
}