summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Xu <pengxu@google.com>2015-10-27 22:31:50 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-10-27 22:31:50 +0000
commitffb07f645e12b5c32479bba74b3310353edf691a (patch)
tree5a3c8b1157ab37af4a2c3a57796608c02e070147
parent5ce90247a20536091505b449a4d386c21034d842 (diff)
parenta78c2e65e13cace4fdbb0295beca5b11de9fde06 (diff)
downloadframeworks_native-ffb07f645e12b5c32479bba74b3310353edf691a.zip
frameworks_native-ffb07f645e12b5c32479bba74b3310353edf691a.tar.gz
frameworks_native-ffb07f645e12b5c32479bba74b3310353edf691a.tar.bz2
Merge "Avoiding flush on-change sensors at subscription" into mnc-dr-dev
am: a78c2e65e1 * commit 'a78c2e65e13cace4fdbb0295beca5b11de9fde06': Avoiding flush on-change sensors at subscription
-rw-r--r--services/sensorservice/SensorService.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 40b21a9..fd72b23 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -912,10 +912,15 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
status_t err = sensor->batch(connection.get(), handle, 0, samplingPeriodNs,
maxBatchReportLatencyNs);
- // Call flush() before calling activate() on the sensor. Wait for a first flush complete
- // event before sending events on this connection. Ignore one-shot sensors which don't
- // support flush(). Also if this sensor isn't already active, don't call flush().
- if (err == NO_ERROR && sensor->getSensor().getReportingMode() != AREPORTING_MODE_ONE_SHOT &&
+ // Call flush() before calling activate() on the sensor. Wait for a first
+ // flush complete event before sending events on this connection. Ignore
+ // one-shot sensors which don't support flush(). Ignore on-change sensors
+ // to maintain the on-change logic (any on-change events except the initial
+ // one should be trigger by a change in value). Also if this sensor isn't
+ // already active, don't call flush().
+ if (err == NO_ERROR &&
+ sensor->getSensor().getReportingMode() != AREPORTING_MODE_ONE_SHOT &&
+ sensor->getSensor().getReportingMode() != AREPORTING_MODE_ON_CHANGE &&
rec->getNumConnections() > 1) {
connection->setFirstFlushPending(handle, true);
status_t err_flush = sensor->flush(connection.get(), handle);