mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-09-16 06:22:26 +00:00
d98f33a337
TODO: - f/w/b - settings Signed-off-by: Tavi <tavi@divested.dev>
32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
|
Date: Tue, 26 Dec 2023 21:59:58 +0200
|
|
Subject: [PATCH] exempt system processes from OTHER_SENSORS permission
|
|
enforcement
|
|
|
|
---
|
|
services/sensorservice/SensorService.cpp | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
|
|
index fbf4facbc6..e454033675 100644
|
|
--- a/services/sensorservice/SensorService.cpp
|
|
+++ b/services/sensorservice/SensorService.cpp
|
|
@@ -2261,6 +2261,16 @@ bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation,
|
|
canAccess = true;
|
|
}
|
|
} else {
|
|
+ if (sensor.getRequiredPermission() == "android.permission.OTHER_SENSORS") {
|
|
+ if (IPCThreadState::self()->getCallingUid() < AID_APP_START) {
|
|
+ // System processes do not expect that sensors that are protected by OTHER_SENSORS
|
|
+ // on GrapheneOS require a permission.
|
|
+ //
|
|
+ // The lack of this check led to crashes of the closed-source gpsd daemon.
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
int targetSdkVersion = getTargetSdkVersion(opPackageName);
|
|
if (targetSdkVersion > 0 && targetSdkVersion <= __ANDROID_API_P__ &&
|
|
(sensor.getType() == SENSOR_TYPE_STEP_COUNTER ||
|