summaryrefslogtreecommitdiff
path: root/core/java/android/view/InputDevice.java
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-05-20 15:04:55 -0700
committerMichael Wright <michaelwr@google.com>2013-07-17 16:19:25 -0700
commit7ddd11035b25b0a2dbf09f9d9efd3fca701f0a79 (patch)
tree90453201ab65b9673dbd78e073254694a37b6498 /core/java/android/view/InputDevice.java
parentdc990e7c61430156b05563417b979e0858baf9da (diff)
Add input device property for buttons under touchpads
Bug: 8990644 Change-Id: I2cc10457595a861b707c0394bd435d60efa8405b
Diffstat (limited to 'core/java/android/view/InputDevice.java')
-rw-r--r--core/java/android/view/InputDevice.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 2a761c1b380f..34fa73df832f 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -51,6 +51,7 @@ public final class InputDevice implements Parcelable {
private final int mKeyboardType;
private final KeyCharacterMap mKeyCharacterMap;
private final boolean mHasVibrator;
+ private final boolean mHasButtonUnderPad;
private final ArrayList<MotionRange> mMotionRanges = new ArrayList<MotionRange>();
private Vibrator mVibrator; // guarded by mMotionRanges during initialization
@@ -343,7 +344,8 @@ public final class InputDevice implements Parcelable {
// Called by native code.
private InputDevice(int id, int generation, String name, String descriptor,
boolean isExternal, int sources,
- int keyboardType, KeyCharacterMap keyCharacterMap, boolean hasVibrator) {
+ int keyboardType, KeyCharacterMap keyCharacterMap,
+ boolean hasVibrator, boolean hasButtonUnderPad) {
mId = id;
mGeneration = generation;
mName = name;
@@ -353,6 +355,7 @@ public final class InputDevice implements Parcelable {
mKeyboardType = keyboardType;
mKeyCharacterMap = keyCharacterMap;
mHasVibrator = hasVibrator;
+ mHasButtonUnderPad = hasButtonUnderPad;
}
private InputDevice(Parcel in) {
@@ -365,6 +368,7 @@ public final class InputDevice implements Parcelable {
mKeyboardType = in.readInt();
mKeyCharacterMap = KeyCharacterMap.CREATOR.createFromParcel(in);
mHasVibrator = in.readInt() != 0;
+ mHasButtonUnderPad = in.readInt() != 0;
for (;;) {
int axis = in.readInt();
@@ -612,6 +616,15 @@ public final class InputDevice implements Parcelable {
}
/**
+ * Reports whether the device has a button under its touchpad
+ * @return Whether the device has a button under its touchpad
+ * @hide
+ */
+ public boolean hasButtonUnderPad() {
+ return mHasButtonUnderPad;
+ }
+
+ /**
* Provides information about the range of values for a particular {@link MotionEvent} axis.
*
* @see InputDevice#getMotionRange(int)
@@ -733,6 +746,7 @@ public final class InputDevice implements Parcelable {
out.writeInt(mKeyboardType);
mKeyCharacterMap.writeToParcel(out, flags);
out.writeInt(mHasVibrator ? 1 : 0);
+ out.writeInt(mHasButtonUnderPad ? 1 : 0);
final int numRanges = mMotionRanges.size();
for (int i = 0; i < numRanges; i++) {