summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Arthur Ishiguro <arthuri@google.com> 2020-04-14 11:28:11 -0700
committer Arthur Ishiguro <arthuri@google.com> 2020-04-14 11:28:36 -0700
commitfb64fca3da4633a0fc96c41da2a6622f3875532c (patch)
tree1ed436fea201ceb802477f629f9295c83c9ce7b6
parenta96235081c2cc8453c9dbefb96fa96c02dca241c (diff)
Revert "Fail on flush if no sensors are found"
This reverts commit 6eb75be73c6e368a8c2b9293b125b669429030f7. Bug: 74395023 Test: Revert Change-Id: I140b5502ab8ed1e37b7774236d8190dde774a6b7
-rw-r--r--services/sensorservice/SensorService.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 92c27b1c25..86ab0f85cc 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -1755,22 +1755,17 @@ status_t SensorService::flushSensor(const sp<SensorEventConnection>& connection,
const int halVersion = dev.getHalDeviceVersion();
status_t err(NO_ERROR);
Mutex::Autolock _l(mLock);
-
- size_t numSensors = 0;
// Loop through all sensors for this connection and call flush on each of them.
for (int handle : connection->getActiveSensorHandles()) {
sp<SensorInterface> sensor = getSensorInterfaceFromHandle(handle);
if (sensor == nullptr) {
continue;
}
- numSensors++;
-
if (sensor->getSensor().getReportingMode() == AREPORTING_MODE_ONE_SHOT) {
ALOGE("flush called on a one-shot sensor");
err = INVALID_OPERATION;
continue;
}
-
if (halVersion <= SENSORS_DEVICE_API_VERSION_1_0 || isVirtualSensor(handle)) {
// For older devices just increment pending flush count which will send a trivial
// flush complete event.
@@ -1788,8 +1783,7 @@ status_t SensorService::flushSensor(const sp<SensorEventConnection>& connection,
err = (err_flush != NO_ERROR) ? err_flush : err;
}
}
-
- return (numSensors == 0) ? INVALID_OPERATION : err;
+ return err;
}
bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation,