patches/system/core/0003-init-Don-t-override-ro.apex.updatable-for-newer-devi.patch

39 lines
1.6 KiB
Diff

From 896473ddb7ddc7eed869360ab2e06af6c5f882e1 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Fri, 15 Dec 2023 22:47:32 -0500
Subject: [PATCH 3/3] init: Don't override ro.apex.updatable for newer devices
...where apexes may be required for hardware features to work.
Change-Id: Ieed7de617231c93419f03aa31c9182018df131ec
---
init/property_service.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 0680b8e06..5edf246a1 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -33,6 +33,7 @@
#include <sys/select.h>
#include <sys/types.h>
#include <sys/un.h>
+#include <sys/utsname.h>
#include <unistd.h>
#include <wchar.h>
@@ -787,7 +788,9 @@ static void LoadProperties(char* data, const char* filter, const char* filename,
} else if (it->second != value) {
LOG(WARNING) << "Overriding previous property '" << key << "':'" << it->second
<< "' with new value '" << value << "'";
- if (strcmp("ro.apex.updatable", key) == 0 || strcmp("ro.control_privapp_permissions", key) == 0
+ struct utsname uts;
+ if ((strcmp("ro.apex.updatable", key) == 0 && !(uname(&uts) == 0 && atoi(uts.release) >= 5))
+ || strcmp("ro.control_privapp_permissions", key) == 0
|| strstr(key, "adb") || strstr(key, "secure")) {
LOG(WARNING) << "... Ignored";
} else {
--
2.41.0