am fd6a2b4d: Merge "Really don\'t send POWER or ENDCALL." into honeycomb

* commit 'fd6a2b4d2552f4a6179ac6f5f499e48310a8d813':
  Really don't send POWER or ENDCALL.
This commit is contained in:
Ed Heyl
2011-01-20 21:42:01 -08:00
committed by Android Git Automerger

View File

@@ -391,7 +391,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]) {
@@ -412,11 +412,12 @@ public class MonkeySourceRandom implements MonkeyEventSource {
lastKey = 1 + mRandom.nextInt(KeyEvent.getMaxKeyCode() - 1);
}
if (lastKey == KeyEvent.KEYCODE_POWER || lastKey == KeyEvent.KEYCODE_ENDCALL) {
// Make sure we don't inadvertently turn off the device.
continue;
if (lastKey != KeyEvent.KEYCODE_POWER
&& lastKey != KeyEvent.KEYCODE_ENDCALL
&& PHYSICAL_KEY_EXISTS[lastKey]) {
break;
}
} while (!PHYSICAL_KEY_EXISTS[lastKey]);
}
MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN, lastKey);
mQ.addLast(e);