[tor-commits] [orbot/master] update resource installer to handle different architecture
n8fr8 at torproject.org
n8fr8 at torproject.org
Mon Apr 13 12:38:26 UTC 2015
commit 4ab18548482ffd217f575e88b2a43087e55bdf67
Author: Nathan Freitas <nathan at freitas.net>
Date: Sat Apr 11 21:16:41 2015 -0400
update resource installer to handle different architecture
---
.../android/service/TorResourceInstaller.java | 39 ++++++++++++--------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java
index 139da02..3d99225 100644
--- a/src/org/torproject/android/service/TorResourceInstaller.java
+++ b/src/org/torproject/android/service/TorResourceInstaller.java
@@ -26,6 +26,7 @@ import org.torproject.android.OrbotConstants;
import org.torproject.android.R;
import android.content.Context;
+import android.os.Build;
import android.util.Log;
public class TorResourceInstaller implements TorServiceConstants {
@@ -86,33 +87,41 @@ public class TorResourceInstaller implements TorServiceConstants {
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false);
+ String cpuPath = null;
- is = context.getResources().openRawResource(R.raw.tor);
+ //only install if ARM (GoLang only supports ARM for now)
+ if (Build.CPU_ABI.contains("arm"))
+ {
+ is = context.getResources().openRawResource(R.raw.obfs4proxy);
+ outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
+ shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
+ streamToFile(is,outFile, false, true);
+
+ is = context.getResources().openRawResource(R.raw.meek);
+ outFile = new File(installFolder, MEEK_ASSET_KEY);
+ shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
+ streamToFile(is,outFile, false, true);
+
+ cpuPath = "armeabi";
+ }
+ else if (Build.CPU_ABI.contains("x86"))
+ cpuPath = "x86";
+
+ is = context.getAssets().open(cpuPath + "/tor.mp3");
outFile = new File(installFolder, TOR_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
- is = context.getResources().openRawResource(R.raw.polipo);
+ is = context.getAssets().open(cpuPath + "/polipo.mp3");
outFile = new File(installFolder, POLIPO_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
- is = context.getResources().openRawResource(R.raw.obfs4proxy);
- outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
- shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
- streamToFile(is,outFile, false, true);
-
-
- is = context.getResources().openRawResource(R.raw.meek);
- outFile = new File(installFolder, MEEK_ASSET_KEY);
- shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
- streamToFile(is,outFile, false, true);
-
- is = context.getResources().openRawResource(R.raw.xtables);
+ is = context.getAssets().open(cpuPath + "/xtables.mp3");
outFile = new File(installFolder, IPTABLES_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true);
-
+
return true;
}
More information about the tor-commits
mailing list