From 40c7b6bd15d7e5e6fbb6ed8e916c526681e63e9f Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Sun, 22 Mar 2026 00:05:11 +0100 Subject: [PATCH] fix(config): restore null-safe FileObserver and system=prop consistency FileObserver DELETE events pass null for the file parameter. The force-unwrap (file!!) from PR157 crashes the daemon when config files are deleted. Restores safe-call with warning log. Also restores system=prop cross-component consistency: when system patch level is set to "prop", boot and vendor are forced to derive from the same device property to prevent date mismatches. --- .../TEESimulator/config/ConfigurationManager.kt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/matrix/TEESimulator/config/ConfigurationManager.kt b/app/src/main/java/org/matrix/TEESimulator/config/ConfigurationManager.kt index f65ff53..4c6cd14 100644 --- a/app/src/main/java/org/matrix/TEESimulator/config/ConfigurationManager.kt +++ b/app/src/main/java/org/matrix/TEESimulator/config/ConfigurationManager.kt @@ -250,9 +250,14 @@ object ConfigurationManager { ) } - // Parse global and per-package configurations. - val newGlobalLevel = parseLines(contextLines[""]) - contextLines.remove("") // Remove global context to iterate over packages next + var newGlobalLevel = parseLines(contextLines[""]) + contextLines.remove("") + + // system=prop means all components should derive from device props + if (newGlobalLevel?.system.equals("prop", ignoreCase = true)) { + SystemLogger.info("system=prop: forcing boot/vendor to derive from device props") + newGlobalLevel = newGlobalLevel?.copy(boot = "prop", vendor = "prop") + } for ((pkg, lines) in contextLines) { parseLines(lines)?.let { newPackageLevels[pkg] = it } @@ -282,8 +287,10 @@ object ConfigurationManager { val file = if (event != DELETE) File(configRoot, path) else null when (path) { - TARGET_PACKAGES_FILE -> loadTargetPackages(file!!) - PATCH_LEVEL_FILE -> loadPatchLevelConfig(file!!) + TARGET_PACKAGES_FILE -> file?.let { loadTargetPackages(it) } + ?: SystemLogger.warning("$TARGET_PACKAGES_FILE was deleted.") + PATCH_LEVEL_FILE -> file?.let { loadPatchLevelConfig(it) } + ?: SystemLogger.warning("$PATCH_LEVEL_FILE was deleted.") // Any change to an XML file is assumed to be a keybox. // The cache in KeyBoxManager will handle reloading it on its next use. else ->