summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2024-05-20 18:44:21 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-05-20 18:44:21 +0000
commit74e2556b7f38a83d0241d6cd0e2284a796fb4beb (patch)
treeaae1fd3065ef7131fedbf5a511bbb96853e26ac2
parentbcd8e5e3f772cc951587280d2c7c9d111853b51e (diff)
parentf5134e84889ba1ef5e8be1bae807c4bebaa67691 (diff)
Merge "InputDevice: Add IntDef annotation for input device source" into main
-rw-r--r--core/java/android/view/InputDevice.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index d22d2a52c8cc..e338bcf248e4 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -78,6 +78,7 @@ public final class InputDevice implements Parcelable {
private final InputDeviceIdentifier mIdentifier;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private final boolean mIsExternal;
+ @Source
private final int mSources;
private final int mKeyboardType;
private final KeyCharacterMap mKeyCharacterMap;
@@ -359,6 +360,28 @@ public final class InputDevice implements Parcelable {
*/
public static final int SOURCE_ANY = 0xffffff00;
+ /** @hide */
+ @IntDef(flag = true, prefix = { "SOURCE_" }, value = {
+ SOURCE_UNKNOWN,
+ SOURCE_KEYBOARD,
+ SOURCE_DPAD,
+ SOURCE_GAMEPAD,
+ SOURCE_TOUCHSCREEN,
+ SOURCE_MOUSE,
+ SOURCE_STYLUS,
+ SOURCE_BLUETOOTH_STYLUS,
+ SOURCE_TRACKBALL,
+ SOURCE_MOUSE_RELATIVE,
+ SOURCE_TOUCHPAD,
+ SOURCE_TOUCH_NAVIGATION,
+ SOURCE_ROTARY_ENCODER,
+ SOURCE_JOYSTICK,
+ SOURCE_HDMI,
+ SOURCE_SENSOR,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ @interface Source {}
+
/**
* Constant for retrieving the range of values for {@link MotionEvent#AXIS_X}.
*