Look up source using & instead of equality
Source for an input device may be composite. On some devices, the source
is specified as TOUCHSCREEN | STYLUS. That means a regular lookup of a
MotionRange using just SOURCE_TOUCHSCREEN fails.
Update the code to allow composite sources.
Also, improve the source dump by printing words instead of numbers.
Bug: 198472780
Test: adb shell dumpsys input
Change-Id: I8d395f2bb5a6db031e5c2aa6c1f5152ff067a2bb
diff --git a/include/input/Input.h b/include/input/Input.h
index 7cc595a..263ade4 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -203,6 +203,10 @@
const char* inputEventTypeToString(int32_t type);
+std::string inputEventSourceToString(int32_t source);
+
+bool isFromSource(uint32_t source, uint32_t test);
+
/*
* Flags that flow alongside events in the input dispatch system to help with certain
* policy decisions such as waking from device sleep.