Fix getSwitchState.

InputReader::getSwitchState always returns AKEY_STATE_UNKNOWN
because SwitchInputMapper::getSources() returns 0 which cannot
match any source mask including AINPUT_SOURCE_ANY.  As a result
initial lid switch detection is broken.

This change adds a new source constant AINPUT_SOURCE_SWITCH
that indicates that the source has switches.

Change-Id: I5321ecf0ce84f1c2b4535f6c163d3f4dcf9b7a9b
diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp
index 3197ab2..8000b2d 100644
--- a/libs/ui/InputReader.cpp
+++ b/libs/ui/InputReader.cpp
@@ -806,7 +806,7 @@
 }
 
 uint32_t SwitchInputMapper::getSources() {
-    return 0;
+    return AINPUT_SOURCE_SWITCH;
 }
 
 void SwitchInputMapper::process(const RawEvent* rawEvent) {
diff --git a/libs/ui/tests/InputReader_test.cpp b/libs/ui/tests/InputReader_test.cpp
index de4b05a..c53d9c0 100644
--- a/libs/ui/tests/InputReader_test.cpp
+++ b/libs/ui/tests/InputReader_test.cpp
@@ -1356,7 +1356,7 @@
     SwitchInputMapper* mapper = new SwitchInputMapper(mDevice);
     addMapperAndConfigure(mapper);
 
-    ASSERT_EQ(uint32_t(0), mapper->getSources());
+    ASSERT_EQ(uint32_t(AINPUT_SOURCE_SWITCH), mapper->getSources());
 }
 
 TEST_F(SwitchInputMapperTest, GetSwitchState) {