development
Revision | e0dfaf68b4710b88f45548b35404cff6be7b365e (tree) |
---|---|
Time | 2011-01-21 14:42:01 |
Author | Ed Heyl <edheyl@goog...> |
Commiter | Android Git Automerger |
am fd6a2b4d: Merge "Really don\'t send POWER or ENDCALL." into honeycomb
* commit 'fd6a2b4d2552f4a6179ac6f5f499e48310a8d813':
@@ -391,7 +391,7 @@ public class MonkeySourceRandom implements MonkeyEventSource { | ||
391 | 391 | } |
392 | 392 | |
393 | 393 | // The remaining event categories are injected as key events |
394 | - do { | |
394 | + for (;;) { | |
395 | 395 | if (cls < mFactors[FACTOR_NAV]) { |
396 | 396 | lastKey = NAV_KEYS[mRandom.nextInt(NAV_KEYS.length)]; |
397 | 397 | } else if (cls < mFactors[FACTOR_MAJORNAV]) { |
@@ -412,11 +412,12 @@ public class MonkeySourceRandom implements MonkeyEventSource { | ||
412 | 412 | lastKey = 1 + mRandom.nextInt(KeyEvent.getMaxKeyCode() - 1); |
413 | 413 | } |
414 | 414 | |
415 | - if (lastKey == KeyEvent.KEYCODE_POWER || lastKey == KeyEvent.KEYCODE_ENDCALL) { | |
416 | - // Make sure we don't inadvertently turn off the device. | |
417 | - continue; | |
415 | + if (lastKey != KeyEvent.KEYCODE_POWER | |
416 | + && lastKey != KeyEvent.KEYCODE_ENDCALL | |
417 | + && PHYSICAL_KEY_EXISTS[lastKey]) { | |
418 | + break; | |
418 | 419 | } |
419 | - } while (!PHYSICAL_KEY_EXISTS[lastKey]); | |
420 | + } | |
420 | 421 | |
421 | 422 | MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN, lastKey); |
422 | 423 | mQ.addLast(e); |