summaryrefslogtreecommitdiffstats
path: root/services/input
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-01-19 18:41:38 -0800
committerJeff Brown <jeffbrown@google.com>2011-01-19 18:41:38 -0800
commit89de57a8d252a25ef2412a11a66089a9ff6ffe29 (patch)
tree26c27db9de6f06bfd9ea0e3bb6ddae805fcccbcb /services/input
parent2cb866b948c38923b31331a9b2f031eb9d791e6e (diff)
downloadframeworks_base-89de57a8d252a25ef2412a11a66089a9ff6ffe29.zip
frameworks_base-89de57a8d252a25ef2412a11a66089a9ff6ffe29.tar.gz
frameworks_base-89de57a8d252a25ef2412a11a66089a9ff6ffe29.tar.bz2
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
Diffstat (limited to 'services/input')
-rw-r--r--services/input/InputReader.cpp2
-rw-r--r--services/input/tests/InputReader_test.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 8e9a5a4..2e83256 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -744,7 +744,7 @@ SwitchInputMapper::~SwitchInputMapper() {
}
uint32_t SwitchInputMapper::getSources() {
- return 0;
+ return AINPUT_SOURCE_SWITCH;
}
void SwitchInputMapper::process(const RawEvent* rawEvent) {
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index 775747c..98d627d 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -1484,7 +1484,7 @@ TEST_F(SwitchInputMapperTest, GetSources) {
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) {