From c46aaa34f87c126482bee96b61741b4cead24023 Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Tue, 19 May 2026 17:45:37 +0100 Subject: [PATCH] fix(config): isAutoMode reads raw package mode getPackageModeForUid collapses AUTO -> PATCH/GENERATE at the call site based on DeviceAttestationService.isTeeFunctional, so isAutoMode never observed Mode.AUTO and always returned false. That made the isAuto-gated dispatch arms in KeyMintSecurityLevelInterceptor and the entire raceTeePatch path unreachable. Iterate packageModes directly with the same priority order as getPackageModeForUid: first non-null mode wins. AUTO returns true, PATCH and GENERATE return false. Activates raceTeePatch for AUTO packages on the first generateKey per security level. --- .../TEESimulator/config/ConfigurationManager.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 db1ed97..91f1e45 100644 --- a/app/src/main/java/org/matrix/TEESimulator/config/ConfigurationManager.kt +++ b/app/src/main/java/org/matrix/TEESimulator/config/ConfigurationManager.kt @@ -93,7 +93,16 @@ object ConfigurationManager { fun shouldSkipUid(uid: Int): Boolean = getPackageModeForUid(uid) == null - fun isAutoMode(uid: Int): Boolean = getPackageModeForUid(uid) == Mode.AUTO + fun isAutoMode(uid: Int): Boolean { + for (pkg in getPackagesForUid(uid)) { + when (packageModes[pkg]) { + Mode.GENERATE, Mode.PATCH -> return false + Mode.AUTO -> return true + null -> continue + } + } + return false + } private fun getPackageModeForUid(uid: Int): Mode? { val packages = getPackagesForUid(uid)