1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 12:06:19 +00:00
treble_evolution/patches/trebledroid/platform_frameworks_base/0033-Detect-Moto-dynamic-hardware-feature.patch
2024-03-10 06:48:11 +00:00

49 lines
2.3 KiB
Diff

From d279589139d305d44b7f62241b42ddb82dd77291 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Wed, 5 Jul 2023 10:50:36 -0400
Subject: [PATCH 33/56] Detect Moto dynamic hardware feature
Moto added a custom node in sysconfig XMLs:
<unavailable-feature-conditional />
This node reads a property and enables a feature based on it.
Take those into account to enable NFC on Moto devices which have
NFC-less variants
---
.../java/com/android/server/SystemConfig.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/services/core/java/com/android/server/SystemConfig.java b/services/core/java/com/android/server/SystemConfig.java
index 7fae31c0bb4b..6da8e9397829 100644
--- a/services/core/java/com/android/server/SystemConfig.java
+++ b/services/core/java/com/android/server/SystemConfig.java
@@ -939,6 +939,25 @@ public class SystemConfig {
}
XmlUtils.skipCurrentTag(parser);
} break;
+ case "unavailable-feature-conditional": {
+ if (allowFeatures) {
+ String fname = parser.getAttributeValue(null, "name");
+ String prop = parser.getAttributeValue(null, "prop");
+ if (fname == null || prop == null) {
+ Slog.w(TAG, "<" + name + "> without name in " + permFile
+ + " at " + parser.getPositionDescription());
+ } else {
+ if(android.os.SystemProperties.getBoolean(prop, false)) {
+ addFeature(fname, 0);
+ } else {
+ mUnavailableFeatures.add(fname);
+ }
+ }
+ } else {
+ logNotAllowedInPartition(name, permFile, parser);
+ }
+ XmlUtils.skipCurrentTag(parser);
+ } break;
case "allow-in-power-save-except-idle": {
if (allowOverrideAppRestrictions) {
String pkgname = parser.getAttributeValue(null, "package");
--
2.25.1