patch: add a patch to prevent sensor hidl from crashing

This commit is contained in:
Mister Oyster 2017-10-31 16:50:40 +01:00
parent dc1807f11b
commit 44c5124d9c
3 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,36 @@
From 1e135798ddfb54a51d73e571221385b2d6dbaf11 Mon Sep 17 00:00:00 2001
From: Mister Oyster <oysterized@gmail.com>
Date: Tue, 31 Oct 2017 16:46:31 +0100
Subject: [PATCH] hidl: sensors: fallback to API_1_0
Prevents such crashes :
10-29 09:05:04.292 885 885 F DEBUG : Abort message:
'Sensors.cpp:98] Check failed: getHalDeviceVersion() >= ((((1) & 0xff)
<< 24) | (((3) & 0xff) << 16) | ((1) & 0xffff))
(getHalDeviceVersion()=16777217, ((((1) & 0xff) << 24) | (((3) & 0xff)
<< 16) | ((1) & 0xffff))=16973825) '
Change-Id: I2e4e48d0d606c23860a61ccfcce53f736431f814
---
sensors/1.0/default/Sensors.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sensors/1.0/default/Sensors.cpp b/sensors/1.0/default/Sensors.cpp
index 1100dd6a..36a7b4a1 100644
--- a/sensors/1.0/default/Sensors.cpp
+++ b/sensors/1.0/default/Sensors.cpp
@@ -95,7 +95,11 @@ Sensors::Sensors()
// Require all the old HAL APIs to be present except for injection, which
// is considered optional.
+#ifdef MTK_HARDWARE
+ CHECK_GE(getHalDeviceVersion(), SENSORS_DEVICE_API_VERSION_1_0);
+#else
CHECK_GE(getHalDeviceVersion(), SENSORS_DEVICE_API_VERSION_1_3);
+#endif
if (getHalDeviceVersion() == SENSORS_DEVICE_API_VERSION_1_4) {
if (mSensorDevice->inject_sensor_data == nullptr) {
--
2.11.0

View File

@ -4,7 +4,7 @@ echo $1
rootdirectory="$PWD"
# ---------------------------------
dirs="build/make/core build/soong frameworks/base system/core"
dirs="build/make/core build/soong frameworks/base hardware/interfaces system/core"
# red + nocolor
RED='\033[0;31m'

View File

@ -4,7 +4,7 @@ echo $1
rootdirectory="$PWD"
# ---------------------------------
dirs="bionic build/make/core build/soong frameworks/base system/core"
dirs="bionic build/make/core build/soong frameworks/base hardware/interfaces system/core"
for dir in $dirs ; do
cd $rootdirectory