mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 18:57:37 +00:00
Fix stub resources load on Android 5
This commit is contained in:
parent
636223b289
commit
babdfe80cb
@ -35,6 +35,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.zip.InflaterInputStream;
|
import java.util.zip.InflaterInputStream;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.CipherInputStream;
|
import javax.crypto.CipherInputStream;
|
||||||
@ -187,6 +188,16 @@ public class DownloadActivity extends Activity {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File dir = new File(getCodeCacheDir(), "res");
|
File dir = new File(getCodeCacheDir(), "res");
|
||||||
|
dir.mkdirs();
|
||||||
|
|
||||||
|
// addAssetPath requires a directory containing AndroidManifest.xml on Android 5
|
||||||
|
try (var stubApk = new ZipFile(getPackageCodePath());
|
||||||
|
var manifest = new FileOutputStream(new File(dir, "AndroidManifest.xml"))) {
|
||||||
|
var stubManifest = stubApk.getInputStream(
|
||||||
|
stubApk.getEntry("AndroidManifest.xml"));
|
||||||
|
APKInstall.transfer(stubManifest, manifest);
|
||||||
|
}
|
||||||
|
|
||||||
decryptResources(new FileOutputStream(new File(dir, "resources.arsc")));
|
decryptResources(new FileOutputStream(new File(dir, "resources.arsc")));
|
||||||
StubApk.addAssetPath(getResources(), dir.getPath());
|
StubApk.addAssetPath(getResources(), dir.getPath());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user