From 4369c692e6d71ddf8cc7a0c170785a71a32d8291 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Tue, 16 Nov 2021 21:23:12 +0000 Subject: veux: [partial-pick]: Updated multihal to use new sensors AIDL interface. Test: make android.hardware.sensors@aidl-multihal Fix: 206867060 Change-Id: I9b78a0f25117d11fdf4beb1e0913393c1c14620d --- sensors/HalProxy.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'sensors') 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 HalProxy::initialize_2_1( std::unique_ptr queue = std::make_unique(eventQueue); - return initializeCommon(queue, wakeLockDescriptor, dynamicCallback); + // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions. + auto hidlWakeLockQueue = + std::make_unique(wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr wakeLockQueue = + std::make_unique(hidlWakeLockQueue); + + return initializeCommon(queue, wakeLockQueue, dynamicCallback); } Return HalProxy::initialize( @@ -209,12 +215,18 @@ Return HalProxy::initialize( std::unique_ptr queue = std::make_unique(eventQueue); - return initializeCommon(queue, wakeLockDescriptor, dynamicCallback); + // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions. + auto hidlWakeLockQueue = + std::make_unique(wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr wakeLockQueue = + std::make_unique(hidlWakeLockQueue); + + return initializeCommon(queue, wakeLockQueue, dynamicCallback); } Return HalProxy::initializeCommon( std::unique_ptr& eventQueue, - const ::android::hardware::MQDescriptorSync& wakeLockDescriptor, + std::unique_ptr& wakeLockQueue, const sp& sensorsCallback) { Result result = Result::OK; @@ -239,8 +251,7 @@ Return 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(wakeLockDescriptor, true /* resetPointers */); + mWakeLockQueue = std::move(wakeLockQueue); if (mEventQueueFlag != nullptr) { EventFlag::deleteEventFlag(&mEventQueueFlag); -- cgit v1.2.3