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.
This commit is contained in:
Enginex0
2026-03-22 00:05:11 +01:00
parent 1df30b9345
commit 40c7b6bd15
@@ -250,9 +250,14 @@ object ConfigurationManager {
) )
} }
// Parse global and per-package configurations. var newGlobalLevel = parseLines(contextLines[""])
val newGlobalLevel = parseLines(contextLines[""]) contextLines.remove("")
contextLines.remove("") // Remove global context to iterate over packages next
// 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) { for ((pkg, lines) in contextLines) {
parseLines(lines)?.let { newPackageLevels[pkg] = it } parseLines(lines)?.let { newPackageLevels[pkg] = it }
@@ -282,8 +287,10 @@ object ConfigurationManager {
val file = if (event != DELETE) File(configRoot, path) else null val file = if (event != DELETE) File(configRoot, path) else null
when (path) { when (path) {
TARGET_PACKAGES_FILE -> loadTargetPackages(file!!) TARGET_PACKAGES_FILE -> file?.let { loadTargetPackages(it) }
PATCH_LEVEL_FILE -> loadPatchLevelConfig(file!!) ?: 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. // Any change to an XML file is assumed to be a keybox.
// The cache in KeyBoxManager will handle reloading it on its next use. // The cache in KeyBoxManager will handle reloading it on its next use.
else -> else ->