summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-01-20 21:46:27 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-20 21:46:27 -0800
commitf40ea5cfd9523f1303d1711dbf7df3ccb5697a0a (patch)
treea12e841e284b2296aec730e59a0ffcaa1e993993 /cmds
parent8215de789a5678f67bc5fc4af062b151263eabdd (diff)
parent98ab321927f1ea9ebb7ba6b5506ac6748b005555 (diff)
downloadandroid_development-f40ea5cfd9523f1303d1711dbf7df3ccb5697a0a.tar.gz
android_development-f40ea5cfd9523f1303d1711dbf7df3ccb5697a0a.tar.bz2
android_development-f40ea5cfd9523f1303d1711dbf7df3ccb5697a0a.zip
am 98ab3219: Prevent monkey from turning off the screen. (DO NOT MERGE)
* commit '98ab321927f1ea9ebb7ba6b5506ac6748b005555': Prevent monkey from turning off the screen. (DO NOT MERGE)
Diffstat (limited to 'cmds')
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
index f1edae11c..3d7834c0f 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
@@ -479,7 +479,7 @@ public class MonkeySourceRandom implements MonkeyEventSource {
}
// The remaining event categories are injected as key events
- do {
+ for (;;) {
if (cls < mFactors[FACTOR_NAV]) {
lastKey = NAV_KEYS[mRandom.nextInt(NAV_KEYS.length)];
} else if (cls < mFactors[FACTOR_MAJORNAV]) {
@@ -499,7 +499,13 @@ public class MonkeySourceRandom implements MonkeyEventSource {
} else {
lastKey = 1 + mRandom.nextInt(KeyEvent.getMaxKeyCode() - 1);
}
- } while (!PHYSICAL_KEY_EXISTS[lastKey]);
+
+ if (lastKey != KeyEvent.KEYCODE_POWER
+ && lastKey != KeyEvent.KEYCODE_ENDCALL
+ && PHYSICAL_KEY_EXISTS[lastKey]) {
+ break;
+ }
+ }
MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN, lastKey);
mQ.addLast(e);