mirror of
https://github.com/ponces/treble_aosp.git
synced 2024-11-24 19:06:23 +00:00
37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
From 85f11fd68459dade2683da86b5aebaacaefe5cc5 Mon Sep 17 00:00:00 2001
|
|
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
|
|
Date: Tue, 18 Apr 2023 23:48:15 +0000
|
|
Subject: [PATCH 2/3] Fix light sensor crash on Xiaomi 13
|
|
|
|
SensorService expects a scalar, but Xiaomi HAL returns a pose6DOF vector encapsulation
|
|
Thanks @phhusson for the analysis
|
|
|
|
Change-Id: Ie358321d5328d01541f455d6af86944ff413c9c9
|
|
---
|
|
sensors/aidl/convert/convert.cpp | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/sensors/aidl/convert/convert.cpp b/sensors/aidl/convert/convert.cpp
|
|
index 2dc7a177a0..be3833dfa7 100644
|
|
--- a/sensors/aidl/convert/convert.cpp
|
|
+++ b/sensors/aidl/convert/convert.cpp
|
|
@@ -162,7 +162,14 @@ void convertToSensorEvent(const Event& src, sensors_event_t* dst) {
|
|
case SensorType::MOTION_DETECT:
|
|
case SensorType::HEART_BEAT:
|
|
case SensorType::LOW_LATENCY_OFFBODY_DETECT: {
|
|
- dst->data[0] = src.payload.get<Event::EventPayload::scalar>();
|
|
+ if (src.payload.getTag() == Event::EventPayload::pose6DOF) {
|
|
+ auto d = src.payload.get<Event::EventPayload::pose6DOF>();
|
|
+ auto dstr = ::android::internal::ToString(d);
|
|
+ // ALOGE("Received 6DOF for expected scalar %s", dstr.c_str());
|
|
+ dst->data[0] = d.values[0];
|
|
+ } else {
|
|
+ dst->data[0] = src.payload.get<Event::EventPayload::scalar>();
|
|
+ }
|
|
break;
|
|
}
|
|
|
|
--
|
|
2.34.1
|
|
|