AssetManager: fix resource loading if APK path contains spaces

Spaces will get encoded to %20 by the ClassLoader. We need to decode
them again to get the original path.
This commit is contained in:
Julian Winkler
2024-11-01 17:49:20 +01:00
parent 8734a7ef2b
commit acdd3c88cc

View File

@@ -28,6 +28,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -114,6 +115,7 @@ public final class AssetManager {
paths.add(null); // reserve first slot for framework-res.apk
while (resources.hasMoreElements()) {
String path = resources.nextElement().getPath();
path = URLDecoder.decode(path, "UTF-8");
if (path.contains("framework-res.apk")) // needs to be first, so it can be overridden
paths.set(0, path);
else if (!path.contains("com.google.android.gms")) // microg resources can not be merged