diff options
author | Tyler Trephan <tylertrephan@google.com> | 2021-11-16 21:23:12 +0000 |
---|---|---|
committer | sinanmohd <pcmsinan@gmail.com> | 2023-01-05 21:27:38 +0530 |
commit | 4369c692e6d71ddf8cc7a0c170785a71a32d8291 (patch) | |
tree | 552c5660e61c825063a0dc40eed0edf016f1f8ad | |
parent | 05bab53a6ae4a40e421b933d05084596baa481ef (diff) |
veux: [partial-pick]: Updated multihal to use new sensors AIDL interface.
Test: make android.hardware.sensors@aidl-multihal
Fix: 206867060
Change-Id: I9b78a0f25117d11fdf4beb1e0913393c1c14620d
-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); |