1
0
mirror of https://github.com/ChonDoit/treble_superior_patches.git synced 2024-11-22 08:46:23 +00:00
treble_superiorOS/patches/trebledroid/platform_hardware_interfaces/0003-Fix-crash-on-Samsung-S23-using-stock-properties-beca.patch
2024-10-02 21:56:49 -03:00

29 lines
1.2 KiB
Diff

From dce503981d424772049cf9f7f7066d9da0435dfb Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Tue, 24 Oct 2023 04:59:57 -0400
Subject: [PATCH 3/3] Fix crash on Samsung S23 using stock properties, because
of sensor reporting vec3 instead of scalar. Likely the device orientation
sensor
---
sensors/aidl/convert/convert.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sensors/aidl/convert/convert.cpp b/sensors/aidl/convert/convert.cpp
index be3833dfa7..c56b30475c 100644
--- a/sensors/aidl/convert/convert.cpp
+++ b/sensors/aidl/convert/convert.cpp
@@ -167,6 +167,9 @@ void convertToSensorEvent(const Event& src, sensors_event_t* dst) {
auto dstr = ::android::internal::ToString(d);
// ALOGE("Received 6DOF for expected scalar %s", dstr.c_str());
dst->data[0] = d.values[0];
+ } else if (src.payload.getTag() == Event::EventPayload::vec3) {
+ auto d = src.payload.get<Event::EventPayload::vec3>();
+ dst->data[0] = d.x;
} else {
dst->data[0] = src.payload.get<Event::EventPayload::scalar>();
}
--
2.34.1