Inject long press documentation
Clarify usage of Activity.onKeyLongPress(..). It is not obvious at all that onKeyDown should be used in order for OnKeyLongPress to work. Direct readers to the other api to make sure that this nuance is not missed. Bug: 21451760 Test: atest KeyEventInjectionTest Change-Id: Ic73f6fe06b2108a3967ac590d22acfb283a700e1
This commit is contained in:
@@ -196,7 +196,7 @@ public class Input extends BaseCommand {
|
||||
int repeatCount = 0;
|
||||
|
||||
KeyEvent event = new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, repeatCount,
|
||||
0 /*metaState*/, KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /*scancode*/, 0/*flags*/,
|
||||
0 /*metaState*/, KeyCharacterMap.VIRTUAL_KEYBOARD, 0 /*scancode*/, 0 /*flags*/,
|
||||
inputSource);
|
||||
event.setDisplayId(displayId);
|
||||
|
||||
|
||||
@@ -3522,6 +3522,12 @@ public class Activity extends ContextThemeWrapper
|
||||
* Default implementation of {@link KeyEvent.Callback#onKeyLongPress(int, KeyEvent)
|
||||
* KeyEvent.Callback.onKeyLongPress()}: always returns false (doesn't handle
|
||||
* the event).
|
||||
*
|
||||
* To receive this callback, you must return true from onKeyDown for the current
|
||||
* event stream.
|
||||
*
|
||||
* @see KeyEvent.Callback#onKeyLongPress()
|
||||
* @see KeyEvent.Callback#onKeyLongPress(int, KeyEvent)
|
||||
*/
|
||||
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user