summaryrefslogtreecommitdiffstats
path: root/services/inputflinger/InputReader.cpp
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2014-08-29 14:31:32 -0700
committerMichael Wright <michaelwr@google.com>2014-08-29 14:31:32 -0700
commitbcbf97ef8fb6eaf527014ed9e7d979ad4fe9fdd2 (patch)
treedd32514f9828c4ae00a39d5e84db015e5565d758 /services/inputflinger/InputReader.cpp
parent8b17ac6bd6b5114babac619cad3ff03fbf10a953 (diff)
downloadframeworks_native-bcbf97ef8fb6eaf527014ed9e7d979ad4fe9fdd2.zip
frameworks_native-bcbf97ef8fb6eaf527014ed9e7d979ad4fe9fdd2.tar.gz
frameworks_native-bcbf97ef8fb6eaf527014ed9e7d979ad4fe9fdd2.tar.bz2
Add logging for switch state
Bug: 17004602 Change-Id: I15c9feb7b28274183742936c20e34e7fb07e0b70
Diffstat (limited to 'services/inputflinger/InputReader.cpp')
-rw-r--r--services/inputflinger/InputReader.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 8295c4c..b7c7ff4 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -1815,7 +1815,7 @@ void InputMapper::dumpRawAbsoluteAxisInfo(String8& dump,
// --- SwitchInputMapper ---
SwitchInputMapper::SwitchInputMapper(InputDevice* device) :
- InputMapper(device), mUpdatedSwitchValues(0), mUpdatedSwitchMask(0) {
+ InputMapper(device), mSwitchValues(0), mUpdatedSwitchMask(0) {
}
SwitchInputMapper::~SwitchInputMapper() {
@@ -1841,7 +1841,9 @@ void SwitchInputMapper::process(const RawEvent* rawEvent) {
void SwitchInputMapper::processSwitch(int32_t switchCode, int32_t switchValue) {
if (switchCode >= 0 && switchCode < 32) {
if (switchValue) {
- mUpdatedSwitchValues |= 1 << switchCode;
+ mSwitchValues |= 1 << switchCode;
+ } else {
+ mSwitchValues &= ~(1 << switchCode);
}
mUpdatedSwitchMask |= 1 << switchCode;
}
@@ -1849,10 +1851,10 @@ void SwitchInputMapper::processSwitch(int32_t switchCode, int32_t switchValue) {
void SwitchInputMapper::sync(nsecs_t when) {
if (mUpdatedSwitchMask) {
- NotifySwitchArgs args(when, 0, mUpdatedSwitchValues, mUpdatedSwitchMask);
+ int32_t updatedSwitchValues = mSwitchValues & mUpdatedSwitchMask;
+ NotifySwitchArgs args(when, 0, updatedSwitchValues, mUpdatedSwitchMask);
getListener()->notifySwitch(&args);
- mUpdatedSwitchValues = 0;
mUpdatedSwitchMask = 0;
}
}
@@ -1861,6 +1863,10 @@ int32_t SwitchInputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCod
return getEventHub()->getSwitchState(getDeviceId(), switchCode);
}
+void SwitchInputMapper::dump(String8& dump) {
+ dump.append(INDENT2 "Switch Input Mapper:\n");
+ dump.appendFormat(INDENT3 "SwitchValues: %x\n", mSwitchValues);
+}
// --- VibratorInputMapper ---