diff options
-rw-r--r-- | sensors/HalProxy.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sensors/HalProxy.cpp b/sensors/HalProxy.cpp index 1a73265..58509eb 100644 --- a/sensors/HalProxy.cpp +++ b/sensors/HalProxy.cpp @@ -193,7 +193,13 @@ Return<Result> HalProxy::initialize_2_1( std::unique_ptr<EventMessageQueueWrapperBase> queue = std::make_unique<EventMessageQueueWrapperV2_1>(eventQueue); - return initializeCommon(queue, wakeLockDescriptor, dynamicCallback); + // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions. + auto hidlWakeLockQueue = + std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr<WakeLockMessageQueueWrapperBase> wakeLockQueue = + std::make_unique<WakeLockMessageQueueWrapperHidl>(hidlWakeLockQueue); + + return initializeCommon(queue, wakeLockQueue, dynamicCallback); } Return<Result> HalProxy::initialize( @@ -209,12 +215,18 @@ Return<Result> HalProxy::initialize( std::unique_ptr<EventMessageQueueWrapperBase> queue = std::make_unique<EventMessageQueueWrapperV1_0>(eventQueue); - return initializeCommon(queue, wakeLockDescriptor, dynamicCallback); + // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions. + auto hidlWakeLockQueue = + std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr<WakeLockMessageQueueWrapperBase> wakeLockQueue = + std::make_unique<WakeLockMessageQueueWrapperHidl>(hidlWakeLockQueue); + + return initializeCommon(queue, wakeLockQueue, dynamicCallback); } Return<Result> HalProxy::initializeCommon( std::unique_ptr<EventMessageQueueWrapperBase>& eventQueue, - const ::android::hardware::MQDescriptorSync<uint32_t>& wakeLockDescriptor, + std::unique_ptr<WakeLockMessageQueueWrapperBase>& wakeLockQueue, const sp<ISensorsCallbackWrapperBase>& sensorsCallback) { Result result = Result::OK; @@ -239,8 +251,7 @@ Return<Result> HalProxy::initializeCommon( // Create the Wake Lock FMQ that is used by the framework to communicate whenever WAKE_UP // events have been successfully read and handled by the framework. - mWakeLockQueue = - std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */); + mWakeLockQueue = std::move(wakeLockQueue); if (mEventQueueFlag != nullptr) { EventFlag::deleteEventFlag(&mEventQueueFlag); |