Merge "Prevent monkey from turning off the screen." into honeycomb

This commit is contained in:
Jeff Brown
2011-01-19 19:56:18 -08:00
committed by Android (Google) Code Review

View File

@@ -411,6 +411,11 @@ public class MonkeySourceRandom implements MonkeyEventSource {
} else {
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;
}
} while (!PHYSICAL_KEY_EXISTS[lastKey]);
MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN, lastKey);