summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/InputDevice.java
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2014-03-28 12:59:34 -0700
committerMichael Wright <michaelwr@google.com>2014-03-28 12:59:34 -0700
commitd08c864784b5d416805aee502e5294b0188a7bd8 (patch)
tree13b64ec9be3c2eba2984ee3391408aabfc7bbd75 /core/java/android/view/InputDevice.java
parent2b45d84e24946d0cbbcc577ca3e195c0db687c9a (diff)
downloadframeworks_base-d08c864784b5d416805aee502e5294b0188a7bd8.zip
frameworks_base-d08c864784b5d416805aee502e5294b0188a7bd8.tar.gz
frameworks_base-d08c864784b5d416805aee502e5294b0188a7bd8.tar.bz2
Add InputDevice#supportsSource(int).
This mirrors the InputEvent#isFromSource API. Change-Id: Ie4869cc52d22d49a71d4d3e22f1ae38b16367395
Diffstat (limited to 'core/java/android/view/InputDevice.java')
-rw-r--r--core/java/android/view/InputDevice.java12
1 files changed, 12 insertions, 0 deletions
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.
*/