How to send key events to a headless emulator in an instrumentation test?
问题 We are currently working on an instrumentation test suite which runs on our build server, but while the tests pass on a dev machine using a normal Android emulator, the builds fail on the build server since there we only run a headless emulator with the -no-window flag. The failure occurs when trying to invoke the InstrumentationTestCase.sendKeys() method to programmatically open the options menu. The error is: Permission denied: injecting key event from pid 646 uid 10026 to window Window