Really don't send POWER or ENDCALL.

Change-Id: If55c6bc7565a9a6b493da16fac5c7ad3c621684f
This commit is contained in:
Jeff Brown
2011-01-20 17:41:18 -08:00
parent 8a2659dc0d
commit 82df76b040

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);