update to use faux .so shared library method for loading tor binary
This commit is contained in:
parent
9abac285db
commit
1b1f64d376
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.android.tools.build:gradle:3.1.1'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#Wed May 09 12:39:36 EDT 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '26.0.2'
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion '27.0.3'
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
|
@ -13,7 +13,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 27
|
||||
versionCode 3210
|
||||
versionName "0.3.2.10"
|
||||
|
||||
|
@ -27,7 +27,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar','*.so'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.so'])
|
||||
}
|
||||
|
||||
apply plugin: 'maven'
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org.torproject.android.binary;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -15,6 +16,7 @@ import java.util.zip.ZipEntry;
|
|||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -50,7 +52,6 @@ public class TorResourceInstaller implements TorServiceConstants {
|
|||
}
|
||||
}
|
||||
|
||||
private final static String MP3_EXT = ".mp3";
|
||||
//
|
||||
/*
|
||||
* Extract the Tor resources from the APK file using ZIP
|
||||
|
@ -58,24 +59,30 @@ public class TorResourceInstaller implements TorServiceConstants {
|
|||
public boolean installResources () throws IOException, TimeoutException
|
||||
{
|
||||
|
||||
String cpuPath = "armeabi";
|
||||
|
||||
if (Build.CPU_ABI.contains("x86"))
|
||||
cpuPath = "x86";
|
||||
|
||||
deleteDirectory(installFolder);
|
||||
|
||||
installFolder.mkdirs();
|
||||
|
||||
assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false);
|
||||
|
||||
assetToFile(cpuPath + '/' + TOR_ASSET_KEY + MP3_EXT, TOR_ASSET_KEY, true, true);
|
||||
InputStream is = new FileInputStream(new File(getNativeLibraryDir(context),TOR_ASSET_KEY + ".so"));
|
||||
File outFile = new File(installFolder, TOR_ASSET_KEY);
|
||||
streamToFile(is,outFile, false, true);
|
||||
setExecutable(outFile);
|
||||
|
||||
installGeoIP();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Return Full path to the directory where native JNI libraries are stored.
|
||||
private static String getNativeLibraryDir(Context context) {
|
||||
ApplicationInfo appInfo = context.getApplicationInfo();
|
||||
return appInfo.nativeLibraryDir;
|
||||
}
|
||||
|
||||
|
||||
public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException
|
||||
{
|
||||
if (fileTorRcCustom.exists())
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
libs
|
Loading…
Reference in New Issue