You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
AssetManager: use AndroidManifest.xml to identify apks
resources.arsc may be missing in rare cases
This commit is contained in:
@@ -110,7 +110,7 @@ public final class AssetManager {
|
|||||||
Log.v(TAG, "New asset manager: " + this);
|
Log.v(TAG, "New asset manager: " + this);
|
||||||
// ensureSystemAssets()
|
// ensureSystemAssets()
|
||||||
try {
|
try {
|
||||||
Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources("resources.arsc");
|
Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources("AndroidManifest.xml");
|
||||||
ArrayList<String> paths = new ArrayList<String>();
|
ArrayList<String> paths = new ArrayList<String>();
|
||||||
paths.add(null); // reserve first slot for framework-res.apk
|
paths.add(null); // reserve first slot for framework-res.apk
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
@@ -123,7 +123,7 @@ public final class AssetManager {
|
|||||||
}
|
}
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
path = path.substring(path.indexOf("file:") + 5, path.indexOf("!/resources.arsc"));
|
path = path.substring(path.indexOf("file:") + 5, path.indexOf("!/AndroidManifest.xml"));
|
||||||
addAssetPath(path);
|
addAssetPath(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user