InputDevice: Add IntDef annotation for input device source

IntDefs are used to extract constant names to be used by Winscope.

Bug: 210460522
Bug: 332714237
Test: build
Change-Id: I3f6c6e409b46e46ecf32872a05b428fcf9d3179d
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index d22d2a5..e338bcf 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -78,6 +78,7 @@
     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 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}.
      *