Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82ce4091 authored by Arthur Ishiguro's avatar Arthur Ishiguro Committed by Automerger Merge Worker
Browse files

Revert "Fail on flush if no sensors are found" am: fb64fca3 am: 3c1b3d92...

Revert "Fail on flush if no sensors are found" am: fb64fca3 am: 3c1b3d92 am: 25ff4750 am: 266de0e4

Change-Id: Icb9fd5df2b8d2c9c7974be6bb25f3ba71ce5a0a8
parents 8b3aa5fb 266de0e4
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -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,