diff options
Diffstat (limited to 'core/java/android/view/InputDevice.java')
-rw-r--r-- | core/java/android/view/InputDevice.java | 90 |
1 files changed, 53 insertions, 37 deletions
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index e829116..0b12cbe 100644 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -17,6 +17,7 @@ package android.view; import android.content.Context; +import android.hardware.input.InputDeviceIdentifier; import android.hardware.input.InputManager; import android.os.Parcel; import android.os.Parcelable; @@ -49,6 +50,7 @@ public final class InputDevice implements Parcelable { private final int mVendorId; private final int mProductId; private final String mDescriptor; + private final InputDeviceIdentifier mIdentifier; private final boolean mIsExternal; private final int mSources; private final int mKeyboardType; @@ -61,7 +63,7 @@ public final class InputDevice implements Parcelable { /** * A mask for input source classes. - * + * * Each distinct input source constant has one or more input source class bits set to * specify the desired interpretation for its input events. */ @@ -77,46 +79,46 @@ public final class InputDevice implements Parcelable { /** * The input source has buttons or keys. * Examples: {@link #SOURCE_KEYBOARD}, {@link #SOURCE_DPAD}. - * + * * A {@link KeyEvent} should be interpreted as a button or key press. - * + * * Use {@link #getKeyCharacterMap} to query the device's button and key mappings. */ public static final int SOURCE_CLASS_BUTTON = 0x00000001; - + /** * The input source is a pointing device associated with a display. * Examples: {@link #SOURCE_TOUCHSCREEN}, {@link #SOURCE_MOUSE}. - * + * * A {@link MotionEvent} should be interpreted as absolute coordinates in * display units according to the {@link View} hierarchy. Pointer down/up indicated when * the finger touches the display or when the selection button is pressed/released. - * + * * Use {@link #getMotionRange} to query the range of the pointing device. Some devices permit * touches outside the display area so the effective range may be somewhat smaller or larger * than the actual display size. */ public static final int SOURCE_CLASS_POINTER = 0x00000002; - + /** * The input source is a trackball navigation device. * Examples: {@link #SOURCE_TRACKBALL}. - * + * * A {@link MotionEvent} should be interpreted as relative movements in device-specific * units used for navigation purposes. Pointer down/up indicates when the selection button * is pressed/released. - * + * * Use {@link #getMotionRange} to query the range of motion. */ public static final int SOURCE_CLASS_TRACKBALL = 0x00000004; - + /** * The input source is an absolute positioning device not associated with a display * (unlike {@link #SOURCE_CLASS_POINTER}). - * + * * A {@link MotionEvent} should be interpreted as absolute coordinates in * device-specific surface units. - * + * * Use {@link #getMotionRange} to query the range of positions. */ public static final int SOURCE_CLASS_POSITION = 0x00000008; @@ -134,7 +136,7 @@ public final class InputDevice implements Parcelable { * The input source is unknown. */ public static final int SOURCE_UNKNOWN = 0x00000000; - + /** * The input source is a keyboard. * @@ -145,10 +147,10 @@ public final class InputDevice implements Parcelable { * @see #SOURCE_CLASS_BUTTON */ public static final int SOURCE_KEYBOARD = 0x00000100 | SOURCE_CLASS_BUTTON; - + /** * The input source is a DPad. - * + * * @see #SOURCE_CLASS_BUTTON */ public static final int SOURCE_DPAD = 0x00000200 | SOURCE_CLASS_BUTTON; @@ -163,16 +165,16 @@ public final class InputDevice implements Parcelable { /** * The input source is a touch screen pointing device. - * + * * @see #SOURCE_CLASS_POINTER */ public static final int SOURCE_TOUCHSCREEN = 0x00001000 | SOURCE_CLASS_POINTER; - + /** * The input source is a mouse pointing device. * This code is also used for other mouse-like pointing devices such as trackpads * and trackpoints. - * + * * @see #SOURCE_CLASS_POINTER */ public static final int SOURCE_MOUSE = 0x00002000 | SOURCE_CLASS_POINTER; @@ -199,15 +201,15 @@ public final class InputDevice implements Parcelable { /** * The input source is a trackball. - * + * * @see #SOURCE_CLASS_TRACKBALL */ public static final int SOURCE_TRACKBALL = 0x00010000 | SOURCE_CLASS_TRACKBALL; - + /** * The input source is a touch pad or digitizer tablet that is not * associated with a display (unlike {@link #SOURCE_TOUCHSCREEN}). - * + * * @see #SOURCE_CLASS_POSITION */ public static final int SOURCE_TOUCHPAD = 0x00100000 | SOURCE_CLASS_POSITION; @@ -239,7 +241,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_X}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_X} instead. */ @@ -248,7 +250,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_Y}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_Y} instead. */ @@ -257,7 +259,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_PRESSURE}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_PRESSURE} instead. */ @@ -266,7 +268,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_SIZE}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_SIZE} instead. */ @@ -275,7 +277,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_TOUCH_MAJOR}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_TOUCH_MAJOR} instead. */ @@ -284,7 +286,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_TOUCH_MINOR}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_TOUCH_MINOR} instead. */ @@ -293,7 +295,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_TOOL_MAJOR}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_TOOL_MAJOR} instead. */ @@ -302,7 +304,7 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_TOOL_MINOR}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_TOOL_MINOR} instead. */ @@ -311,24 +313,24 @@ public final class InputDevice implements Parcelable { /** * Constant for retrieving the range of values for {@link MotionEvent#AXIS_ORIENTATION}. - * + * * @see #getMotionRange * @deprecated Use {@link MotionEvent#AXIS_ORIENTATION} instead. */ @Deprecated public static final int MOTION_RANGE_ORIENTATION = MotionEvent.AXIS_ORIENTATION; - + /** * There is no keyboard. */ public static final int KEYBOARD_TYPE_NONE = 0; - + /** * The keyboard is not fully alphabetic. It may be a numeric keypad or an assortment * of buttons that are not mapped as alphabetic keys suitable for text input. */ public static final int KEYBOARD_TYPE_NON_ALPHABETIC = 1; - + /** * The keyboard supports a complement of alphabetic keys. */ @@ -361,6 +363,7 @@ public final class InputDevice implements Parcelable { mKeyCharacterMap = keyCharacterMap; mHasVibrator = hasVibrator; mHasButtonUnderPad = hasButtonUnderPad; + mIdentifier = new InputDeviceIdentifier(descriptor, vendorId, productId); } private InputDevice(Parcel in) { @@ -377,6 +380,7 @@ public final class InputDevice implements Parcelable { mKeyCharacterMap = KeyCharacterMap.CREATOR.createFromParcel(in); mHasVibrator = in.readInt() != 0; mHasButtonUnderPad = in.readInt() != 0; + mIdentifier = new InputDeviceIdentifier(mDescriptor, mVendorId, mProductId); for (;;) { int axis = in.readInt(); @@ -396,7 +400,7 @@ public final class InputDevice implements Parcelable { public static InputDevice getDevice(int id) { return InputManager.getInstance().getInputDevice(id); } - + /** * Gets the ids of all input devices in the system. * @return The input device ids. @@ -441,6 +445,18 @@ public final class InputDevice implements Parcelable { } /** + * The set of identifying information for type of input device. This + * information can be used by the system to configure appropriate settings + * for the device. + * + * @return The identifier object for this device + * @hide + */ + public InputDeviceIdentifier getIdentifier() { + return mIdentifier; + } + + /** * Gets a generation number for this input device. * The generation number is incremented whenever the device is reconfigured and its * properties may have changed. @@ -553,7 +569,7 @@ public final class InputDevice implements Parcelable { public String getName() { return mName; } - + /** * Gets the input sources supported by this input device as a combined bitfield. * @return The supported input sources. @@ -561,7 +577,7 @@ public final class InputDevice implements Parcelable { public int getSources() { return mSources; } - + /** * Gets the keyboard type. * @return The keyboard type. @@ -569,7 +585,7 @@ public final class InputDevice implements Parcelable { public int getKeyboardType() { return mKeyboardType; } - + /** * Gets the key character map associated with this input device. * @return The key character map. |