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

Commit 24f2b4c0 authored by Brian Duddie's avatar Brian Duddie
Browse files

Restore sensor flush behavior for disabled clients

Add back code that blocks requests to flush a sensor from clients that
are disabled (e.g. UID is idle).

Also restore some conditional debug logs.

Fixes: 230704084
Test: CTS testBatchAndFlushUidIdle
Change-Id: I235f09b7bc79dd694fe6dc82ded9ec875e075822
parent bad4627a
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -612,8 +612,10 @@ int SensorDevice::getHalDeviceVersion() const {
    return SENSORS_DEVICE_API_VERSION_1_4;
}

status_t SensorDevice::flush(void* /*ident*/, int handle) {
status_t SensorDevice::flush(void* ident, int handle) {
    if (mHalWrapper == nullptr) return NO_INIT;
    if (isClientDisabled(ident)) return INVALID_OPERATION;
    ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w flush %d", handle);
    return mHalWrapper->flush(handle);
}

@@ -754,6 +756,13 @@ void SensorDevice::disableAllSensors() {

status_t SensorDevice::injectSensorData(const sensors_event_t* injected_sensor_event) {
    if (mHalWrapper == nullptr) return NO_INIT;
    ALOGD_IF(DEBUG_CONNECTIONS,
             "sensor_event handle=%d ts=%" PRId64 " data=%.2f, %.2f, %.2f %.2f %.2f %.2f",
             injected_sensor_event->sensor, injected_sensor_event->timestamp,
             injected_sensor_event->data[0], injected_sensor_event->data[1],
             injected_sensor_event->data[2], injected_sensor_event->data[3],
             injected_sensor_event->data[4], injected_sensor_event->data[5]);

    return mHalWrapper->injectSensorData(injected_sensor_event);
}