sm8350-common: sensors: Updated multihal to use new sensors AIDL interface.

Test: make android.hardware.sensors@aidl-multihal
Fix: 206867060
Change-Id: I9b78a0f25117d11fdf4beb1e0913393c1c14620d
This commit is contained in:
Tyler Trephan 2021-11-16 21:23:12 +00:00 committed by AdarshGrewal
parent 380fa0ba2c
commit 0247e26e19

View File

@ -193,7 +193,13 @@ Return<Result> HalProxy::initialize_2_1(
std::unique_ptr<EventMessageQueueWrapperBase> queue = std::unique_ptr<EventMessageQueueWrapperBase> queue =
std::make_unique<EventMessageQueueWrapperV2_1>(eventQueue); 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( Return<Result> HalProxy::initialize(
@ -209,12 +215,18 @@ Return<Result> HalProxy::initialize(
std::unique_ptr<EventMessageQueueWrapperBase> queue = std::unique_ptr<EventMessageQueueWrapperBase> queue =
std::make_unique<EventMessageQueueWrapperV1_0>(eventQueue); 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( Return<Result> HalProxy::initializeCommon(
std::unique_ptr<EventMessageQueueWrapperBase>& eventQueue, std::unique_ptr<EventMessageQueueWrapperBase>& eventQueue,
const ::android::hardware::MQDescriptorSync<uint32_t>& wakeLockDescriptor, std::unique_ptr<WakeLockMessageQueueWrapperBase>& wakeLockQueue,
const sp<ISensorsCallbackWrapperBase>& sensorsCallback) { const sp<ISensorsCallbackWrapperBase>& sensorsCallback) {
Result result = Result::OK; 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 // 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. // events have been successfully read and handled by the framework.
mWakeLockQueue = mWakeLockQueue = std::move(wakeLockQueue);
std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */);
if (mEventQueueFlag != nullptr) { if (mEventQueueFlag != nullptr) {
EventFlag::deleteEventFlag(&mEventQueueFlag); EventFlag::deleteEventFlag(&mEventQueueFlag);