summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorSiarhei Vishniakou <svv@google.com>2018-10-30 14:04:57 -0700
committerSiarhei Vishniakou <svv@google.com>2019-02-26 13:22:24 -0800
commitccf973fa9f22dbafe7e98952773ec2dc2b3e90a5 (patch)
tree822b1e73877365cb9237bfa9356405932e4eb9ec /core/java/android
parent983469bab51743f044a62a72182ffc7b60b1a7a2 (diff)
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
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Activity.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index dc8863ae9ffa..d93ffd6f51f3 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -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;