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

Commit ffef668d authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Fix sp ownership in HidlSensorHalWrapper

Also rename SensorsCallback to distinguish from upcoming
AIDL SensorsCallback.

Bug: 195593357
Test: Load on device
Change-Id: Ib000849ffdad43e896538df9f632f04804ce30de
parent 914371c4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -76,11 +76,11 @@ void SensorsHalDeathReceiver::serviceDied(
    mHidlSensorHalWrapper->prepareForReconnect();
}

struct SensorsCallback : public ISensorsCallback {
struct HidlSensorsCallback : public ISensorsCallback {
    using Result = ::android::hardware::sensors::V1_0::Result;
    using SensorInfo = ::android::hardware::sensors::V2_1::SensorInfo;

    SensorsCallback(ISensorHalWrapper::SensorDeviceCallback* sensorDeviceCallback) {
    HidlSensorsCallback(ISensorHalWrapper::SensorDeviceCallback* sensorDeviceCallback) {
        mSensorDeviceCallback = sensorDeviceCallback;
    }

@@ -482,7 +482,7 @@ ISensorHalWrapper::HalConnectionStatus HidlSensorHalWrapper::initializeHidlServi
    CHECK(mSensors != nullptr && mWakeLockQueue != nullptr && mEventQueueFlag != nullptr &&
          mWakeLockQueueFlag != nullptr);

    mCallback = new SensorsCallback(mSensorDeviceCallback);
    mCallback = sp<HidlSensorsCallback>::make(mSensorDeviceCallback);
    status_t status =
            checkReturnAndGetStatus(mSensors->initialize(*mWakeLockQueue->getDesc(), mCallback));