Loading services/sensorservice/HidlSensorHalWrapper.cpp +11 −9 Original line number Original line Diff line number Diff line Loading @@ -281,7 +281,7 @@ status_t HidlSensorHalWrapper::injectSensorData(const sensors_event_t* event) { } } status_t HidlSensorHalWrapper::registerDirectChannel(const sensors_direct_mem_t* memory, status_t HidlSensorHalWrapper::registerDirectChannel(const sensors_direct_mem_t* memory, int32_t* /*channelHandle*/) { int32_t* outChannelHandle) { if (mSensors == nullptr) return NO_INIT; if (mSensors == nullptr) return NO_INIT; SharedMemType type; SharedMemType type; Loading Loading @@ -309,10 +309,12 @@ status_t HidlSensorHalWrapper::registerDirectChannel(const sensors_direct_mem_t* .memoryHandle = memory->handle, .memoryHandle = memory->handle, }; }; status_t ret; status_t ret = OK; checkReturn(mSensors->registerDirectChannel(mem, [&ret](auto result, auto channelHandle) { checkReturn(mSensors->registerDirectChannel(mem, [&ret, &outChannelHandle](auto result, auto channelHandle) { if (result == Result::OK) { if (result == Result::OK) { ret = channelHandle; *outChannelHandle = channelHandle; } else { } else { ret = statusFromResult(result); ret = statusFromResult(result); } } Loading services/sensorservice/HidlSensorHalWrapper.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -112,7 +112,7 @@ public: virtual status_t injectSensorData(const sensors_event_t* event) override; virtual status_t injectSensorData(const sensors_event_t* event) override; virtual status_t registerDirectChannel(const sensors_direct_mem_t* memory, virtual status_t registerDirectChannel(const sensors_direct_mem_t* memory, int32_t* channelHandle) override; int32_t* outChannelHandle) override; virtual status_t unregisterDirectChannel(int32_t channelHandle) override; virtual status_t unregisterDirectChannel(int32_t channelHandle) override; Loading services/sensorservice/SensorDevice.cpp +7 −1 Original line number Original line Diff line number Diff line Loading @@ -766,7 +766,13 @@ int32_t SensorDevice::registerDirectChannel(const sensors_direct_mem_t* memory) if (mHalWrapper == nullptr) return NO_INIT; if (mHalWrapper == nullptr) return NO_INIT; Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); return mHalWrapper->registerDirectChannel(memory, nullptr); int32_t channelHandle; status_t status = mHalWrapper->registerDirectChannel(memory, &channelHandle); if (status != OK) { channelHandle = -1; } return channelHandle; } } void SensorDevice::unregisterDirectChannel(int32_t channelHandle) { void SensorDevice::unregisterDirectChannel(int32_t channelHandle) { Loading Loading
services/sensorservice/HidlSensorHalWrapper.cpp +11 −9 Original line number Original line Diff line number Diff line Loading @@ -281,7 +281,7 @@ status_t HidlSensorHalWrapper::injectSensorData(const sensors_event_t* event) { } } status_t HidlSensorHalWrapper::registerDirectChannel(const sensors_direct_mem_t* memory, status_t HidlSensorHalWrapper::registerDirectChannel(const sensors_direct_mem_t* memory, int32_t* /*channelHandle*/) { int32_t* outChannelHandle) { if (mSensors == nullptr) return NO_INIT; if (mSensors == nullptr) return NO_INIT; SharedMemType type; SharedMemType type; Loading Loading @@ -309,10 +309,12 @@ status_t HidlSensorHalWrapper::registerDirectChannel(const sensors_direct_mem_t* .memoryHandle = memory->handle, .memoryHandle = memory->handle, }; }; status_t ret; status_t ret = OK; checkReturn(mSensors->registerDirectChannel(mem, [&ret](auto result, auto channelHandle) { checkReturn(mSensors->registerDirectChannel(mem, [&ret, &outChannelHandle](auto result, auto channelHandle) { if (result == Result::OK) { if (result == Result::OK) { ret = channelHandle; *outChannelHandle = channelHandle; } else { } else { ret = statusFromResult(result); ret = statusFromResult(result); } } Loading
services/sensorservice/HidlSensorHalWrapper.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -112,7 +112,7 @@ public: virtual status_t injectSensorData(const sensors_event_t* event) override; virtual status_t injectSensorData(const sensors_event_t* event) override; virtual status_t registerDirectChannel(const sensors_direct_mem_t* memory, virtual status_t registerDirectChannel(const sensors_direct_mem_t* memory, int32_t* channelHandle) override; int32_t* outChannelHandle) override; virtual status_t unregisterDirectChannel(int32_t channelHandle) override; virtual status_t unregisterDirectChannel(int32_t channelHandle) override; Loading
services/sensorservice/SensorDevice.cpp +7 −1 Original line number Original line Diff line number Diff line Loading @@ -766,7 +766,13 @@ int32_t SensorDevice::registerDirectChannel(const sensors_direct_mem_t* memory) if (mHalWrapper == nullptr) return NO_INIT; if (mHalWrapper == nullptr) return NO_INIT; Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); return mHalWrapper->registerDirectChannel(memory, nullptr); int32_t channelHandle; status_t status = mHalWrapper->registerDirectChannel(memory, &channelHandle); if (status != OK) { channelHandle = -1; } return channelHandle; } } void SensorDevice::unregisterDirectChannel(int32_t channelHandle) { void SensorDevice::unregisterDirectChannel(int32_t channelHandle) { Loading