summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2014-03-29 00:56:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-03-29 00:56:17 +0000
commite9eb58c9a0f48f1ea3afa60f01cfab1f539e5d8e (patch)
treee064b7b5a3cc99151cffc3616918904e9d6ed287
parentd020fd33d147c88a9cda4976d2fa559e55b4ab03 (diff)
parentd08c864784b5d416805aee502e5294b0188a7bd8 (diff)
downloadframeworks_base-e9eb58c9a0f48f1ea3afa60f01cfab1f539e5d8e.zip
frameworks_base-e9eb58c9a0f48f1ea3afa60f01cfab1f539e5d8e.tar.gz
frameworks_base-e9eb58c9a0f48f1ea3afa60f01cfab1f539e5d8e.tar.bz2
Merge "Add InputDevice#supportsSource(int)." into klp-modular-dev
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/view/InputDevice.java12
2 files changed, 13 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 4d49e79..5a23f53 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26684,6 +26684,7 @@ package android.view {
method public android.os.Vibrator getVibrator();
method public boolean[] hasKeys(int...);
method public boolean isVirtual();
+ method public boolean supportsSource(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int KEYBOARD_TYPE_ALPHABETIC = 2; // 0x2
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java
index 0b12cbe..ae5f37e 100644
--- a/core/java/android/view/InputDevice.java
+++ b/core/java/android/view/InputDevice.java
@@ -579,6 +579,18 @@ public final class InputDevice implements Parcelable {
}
/**
+ * Determines whether the input device supports the given source or sources.
+ *
+ * @param source The input source or sources to check against. This can be a generic device
+ * type such as {@link InputDevice#SOURCE_MOUSE}, a more generic device class, such as
+ * {@link InputDevice#SOURCE_CLASS_POINTER}, or a combination of sources bitwise ORed together.
+ * @return Whether the device can produce all of the given sources.
+ */
+ public boolean supportsSource(int source) {
+ return (mSources & source) == source;
+ }
+
+ /**
* Gets the keyboard type.
* @return The keyboard type.
*/