From bbeab27f1190b4e2d65f54af90ec7a55de61b4f4 Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Tue, 19 May 2026 05:10:59 +0100 Subject: [PATCH] fix(spoof): skip empty PIF source files resolvePifPatch selected the last existing file regardless of size. A 0-byte file picked up by lastOrNull caused JSONObject("") to throw, the catch silently fell back to SystemProperties, and a preceding non-empty PIF was ignored. Filter out zero-length files so the lookup walks past them to the next valid candidate. --- .../java/org/matrix/TEESimulator/config/PatchLevelManager.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt b/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt index 2d8a1e6..d13c57f 100644 --- a/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt +++ b/app/src/main/java/org/matrix/TEESimulator/config/PatchLevelManager.kt @@ -93,7 +93,9 @@ object PatchLevelManager { } private fun resolvePifPatch(): String? { - val source = PIF_SOURCES.map(::File).lastOrNull { it.exists() } ?: return null + val source = + PIF_SOURCES.map(::File).lastOrNull { it.exists() && it.length() > 0 } + ?: return null return try { val text = source.readText() val parsed =