commit edc07b09b4c15df531e4f9448da00527498eaf99 Author: Unpublished unpublished@gmx.net Date: Fri May 18 11:56:26 2018 +0200
no previous zipping further reduces apk size
obfs4proxy.so and pdnsd.so must not be zipped with this --- BUILD | 7 +++---- .../java/org/torproject/android/service/util/NativeLoader.java | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/BUILD b/BUILD index bbbeaa8f..8e9b9b33 100644 --- a/BUILD +++ b/BUILD @@ -23,10 +23,9 @@ You then need to run "ndk-build" from: cd orbotservice/src/main ndk-build - mkdir -p assets/armeabi - zip assets/armeabi/pdnsd.mp3 libs/armeabi/pdnsd - mkdir -p assets/x86 - zip assets/x86/pdnsd.mp3 libs/x86/pdnsd + mv libs/armeabi/pdnsd libs/armeabi/pdnsd.so + mv libs/armeabi-v7a/pdnsd libs/armeabi-v7a/pdnsd.so + mv libs/x86/pdnsd libs/x86/pdnsd.so
This isn't enough though and we'll now sew up the binary into a small package that will handle basic Tor controlling features. diff --git a/orbotservice/src/main/java/org/torproject/android/service/util/NativeLoader.java b/orbotservice/src/main/java/org/torproject/android/service/util/NativeLoader.java index d6a25436..3e910cce 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/util/NativeLoader.java +++ b/orbotservice/src/main/java/org/torproject/android/service/util/NativeLoader.java @@ -21,16 +21,14 @@ public class NativeLoader {
ZipFile zipFile = null; - ZipInputStream stream = null; + InputStream stream = null; try { zipFile = new ZipFile(context.getApplicationInfo().sourceDir); ZipEntry entry = zipFile.getEntry("lib/" + folder + "/" + libName + ".so"); if (entry == null) { throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + libName); } - //the zip file entry is also zipped itself! - stream = new ZipInputStream(zipFile.getInputStream(entry)); - stream.getNextEntry(); + stream = zipFile.getInputStream(entry);
OutputStream out = new FileOutputStream(destLocalFile); byte[] buf = new byte[4096];