mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-28 22:47:39 +00:00
Update proguard to minimize APK size
This commit is contained in:
parent
821726e7c0
commit
00d655f346
4
proguard-rules.pro
vendored
4
proguard-rules.pro
vendored
@ -20,7 +20,9 @@
|
||||
-keepnames class ** { *; }
|
||||
|
||||
# BouncyCastle
|
||||
-keep class org.bouncycastle.jcajce.provider.** { *; }
|
||||
-keep class org.bouncycastle.jcajce.provider.asymmetric.rsa.**SHA1** { *; }
|
||||
-keep class org.bouncycastle.jcajce.provider.asymmetric.RSA** { *; }
|
||||
-keep class org.bouncycastle.jcajce.provider.digest.SHA1** { *; }
|
||||
-dontwarn javax.naming.**
|
||||
|
||||
# Gson
|
||||
|
@ -7,10 +7,12 @@ import com.topjohnwu.crypto.SignAPK;
|
||||
import com.topjohnwu.magisk.MagiskManager;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@ -56,14 +58,24 @@ public class ZipUtils {
|
||||
}
|
||||
|
||||
public static void signZip(InputStream is, File output, boolean minSign) throws Exception {
|
||||
signZip(new JarMap(is, false), output, minSign);
|
||||
try (JarMap map = new JarMap(is, false)) {
|
||||
signZip(map, output, minSign);
|
||||
}
|
||||
}
|
||||
|
||||
public static void signZip(File input, File output, boolean minSign) throws Exception {
|
||||
signZip(new JarMap(input, false), output, minSign);
|
||||
try (JarMap map = new JarMap(input, false)) {
|
||||
signZip(map, output, minSign);
|
||||
}
|
||||
}
|
||||
|
||||
public static void signZip(JarMap input, File output, boolean minSign) throws Exception {
|
||||
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(output))) {
|
||||
signZip(input, out, minSign);
|
||||
}
|
||||
}
|
||||
|
||||
public static void signZip(JarMap input, OutputStream output, boolean minSign) throws Exception {
|
||||
AssetManager assets = MagiskManager.get().getAssets();
|
||||
SignAPK.signZip(
|
||||
assets.open(Const.PUBLIC_KEY_NAME), assets.open(Const.PRIVATE_KEY_NAME),
|
||||
|
Loading…
x
Reference in New Issue
Block a user