[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] added support for unpacking split binary into one tor exe; supports devices with 1M raw resource limit



commit 0bfad80ca64fa205bd7d9b36acf7e8b49601d732
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Mon Jul 25 10:50:03 2011 -0400

    added support for unpacking split binary into one tor exe; supports devices with 1M raw resource limit
---
 .../android/service/TorBinaryInstaller.java        |   31 +++++++++++++-------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/org/torproject/android/service/TorBinaryInstaller.java b/src/org/torproject/android/service/TorBinaryInstaller.java
index 9260c09..3c4907d 100644
--- a/src/org/torproject/android/service/TorBinaryInstaller.java
+++ b/src/org/torproject/android/service/TorBinaryInstaller.java
@@ -58,18 +58,26 @@ public class TorBinaryInstaller implements TorServiceConstants {
 	{
 		
 			
-			InputStream is = context.getResources().openRawResource(R.raw.tor);			
-			streamToFile(is,installPath + TOR_BINARY_ASSET_KEY);
+			InputStream is = context.getResources().openRawResource(R.raw.toraa);			
+			streamToFile(is,installPath + TOR_BINARY_ASSET_KEY, false);
+		
+			is = context.getResources().openRawResource(R.raw.torab);			
+			streamToFile(is,installPath + TOR_BINARY_ASSET_KEY, true);
+		
+			is = context.getResources().openRawResource(R.raw.torac);			
+			streamToFile(is,installPath + TOR_BINARY_ASSET_KEY, true);
+		
+			is = context.getResources().openRawResource(R.raw.torad);			
+			streamToFile(is,installPath + TOR_BINARY_ASSET_KEY, true);
 		
-			
 			is = context.getResources().openRawResource(R.raw.torrc);			
-			streamToFile(is,installPath + TORRC_ASSET_KEY);
+			streamToFile(is,installPath + TORRC_ASSET_KEY, false);
 
 			is = context.getResources().openRawResource(R.raw.privoxy);			
-			streamToFile(is,installPath + PRIVOXY_ASSET_KEY);
+			streamToFile(is,installPath + PRIVOXY_ASSET_KEY, false);
 
 			is = context.getResources().openRawResource(R.raw.privoxy_config);			
-			streamToFile(is,installPath + PRIVOXYCONFIG_ASSET_KEY);
+			streamToFile(is,installPath + PRIVOXYCONFIG_ASSET_KEY, false);
 
 			
 			
@@ -77,9 +85,8 @@ public class TorBinaryInstaller implements TorServiceConstants {
 	
 		
 	}
+	
 	/*
-	 * Extract the Tor binary from the APK file using ZIP
-	 */
 	private void installFromZip ()
 	{
 		
@@ -89,7 +96,7 @@ public class TorBinaryInstaller implements TorServiceConstants {
 			ZipFile zip = new ZipFile(apkPath);
 	
 			ZipEntry zipen = zip.getEntry(ASSETS_BASE + TOR_BINARY_ASSET_KEY);
-			streamToFile(zip.getInputStream(zipen),installPath + TOR_BINARY_ASSET_KEY);
+			streamToFile(zip.getInputStream(zipen),installPath + TOR_BINARY_ASSET_KEY, false);
 			
 			zipen = zip.getEntry(ASSETS_BASE + TORRC_ASSET_KEY);
 			streamToFile(zip.getInputStream(zipen),installPath + TORRC_ASSET_KEY);
@@ -115,11 +122,12 @@ public class TorBinaryInstaller implements TorServiceConstants {
 		
 		}
 	}
+	*/
 	
 	/*
 	 * Write the inputstream contents to the file
 	 */
-    private static void streamToFile(InputStream stm, String targetFilename)
+    private static void streamToFile(InputStream stm, String targetFilename, boolean append)
 
     {
 
@@ -133,7 +141,8 @@ public class TorBinaryInstaller implements TorServiceConstants {
         File outFile = new File(targetFilename);
         
         try {
-            outFile.createNewFile();
+           if (!append)
+        	   outFile.createNewFile();
 
         	stmOut = new FileOutputStream(outFile);
         }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits