From 280fd70dc4bb8ad5c0274d69695f286cb15dda3f Mon Sep 17 00:00:00 2001 From: Brian Duddie Date: Mon, 18 Apr 2022 12:41:44 -0700 Subject: [PATCH] Fix sub-HAL handle in dynamic sensor meta events Need to apply the sub-HAL index byte to ensure handles provided in DYNAMIC_SENSOR_META events align properly with the [dis]connected callbacks. Bug: 228879057 Test: try on device with dynamic sensors sub-HAL at index > 0 Change-Id: Ic7290b51733bb829a5494ef41e9430b51dc6074e --- sensors/common/default/2.X/multihal/HalProxyCallback.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sensors/common/default/2.X/multihal/HalProxyCallback.cpp b/sensors/common/default/2.X/multihal/HalProxyCallback.cpp index 3c1b17c8f0..addefe8d09 100644 --- a/sensors/common/default/2.X/multihal/HalProxyCallback.cpp +++ b/sensors/common/default/2.X/multihal/HalProxyCallback.cpp @@ -68,6 +68,10 @@ std::vector HalProxyCallbackBase::processEvents(const std::vector eventsOut; for (V2_1::Event event : events) { event.sensorHandle = setSubHalIndex(event.sensorHandle, mSubHalIndex); + if (event.sensorType == V2_1::SensorType::DYNAMIC_SENSOR_META) { + event.u.dynamic.sensorHandle = + setSubHalIndex(event.u.dynamic.sensorHandle, mSubHalIndex); + } eventsOut.push_back(event); const V2_1::SensorInfo& sensor = mCallback->getSensorInfo(event.sensorHandle); if ((sensor.flags & V1_0::SensorFlagBits::WAKE_UP) != 0) {