List of usage examples for android.hardware.input InputManager INJECT_INPUT_EVENT_MODE_ASYNC
int INJECT_INPUT_EVENT_MODE_ASYNC
To view the source code for android.hardware.input InputManager INJECT_INPUT_EVENT_MODE_ASYNC.
Click Source Link
From source file:com.android.tv.settings.accessories.AddAccessoryActivity.java
private void sendKeyEvent(int keyCode, boolean down) { InputManager iMgr = (InputManager) getSystemService(INPUT_SERVICE); if (iMgr != null) { long time = SystemClock.uptimeMillis(); KeyEvent evt = new KeyEvent(time, time, down ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP, keyCode, 0); iMgr.injectInputEvent(evt, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); }/*from w ww . j a v a2 s . co m*/ }