summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2017-06-21 20:42:24 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-06-21 20:42:26 +0000
commit8669acc97d7c5ab476a99ef4129055a57e0d0c9c (patch)
tree0df4089acbf40b0c820fa1c6d7d6942efc1fe653
parentf412b2b9fc04adade31a76185182d1debbc6edc1 (diff)
parent63fbab896e139654d035c14a92a2d22a57e9c3e2 (diff)
Merge "Check key before edit value in countFlushCompleteEventsLocked" into oc-dr1-dev
-rw-r--r--services/sensorservice/SensorEventConnection.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/services/sensorservice/SensorEventConnection.cpp b/services/sensorservice/SensorEventConnection.cpp
index fad046cf53..bfe4c09248 100644
--- a/services/sensorservice/SensorEventConnection.cpp
+++ b/services/sensorservice/SensorEventConnection.cpp
@@ -477,7 +477,14 @@ void SensorService::SensorEventConnection::countFlushCompleteEventsLocked(
// separately before the next batch of events.
for (int j = 0; j < numEventsDropped; ++j) {
if (scratch[j].type == SENSOR_TYPE_META_DATA) {
- FlushInfo& flushInfo = mSensorInfo.editValueFor(scratch[j].meta_data.sensor);
+ ssize_t index = mSensorInfo.indexOfKey(scratch[j].meta_data.sensor);
+ if (index < 0) {
+ ALOGW("%s: sensor 0x%x is not found in connection",
+ __func__, scratch[j].meta_data.sensor);
+ continue;
+ }
+
+ FlushInfo& flushInfo = mSensorInfo.editValueAt(index);
flushInfo.mPendingFlushEventsToSend++;
ALOGD_IF(DEBUG_CONNECTIONS, "increment pendingFlushCount %d",
flushInfo.mPendingFlushEventsToSend);