continued re-integration of VPN feature
This commit is contained in:
parent
1614921e34
commit
ca238c6521
|
@ -30,7 +30,6 @@ public class OrbotApp extends Application implements OrbotConstants
|
|||
Languages.setup(OrbotMainActivity.class, R.string.menu_settings);
|
||||
Languages.setLanguage(this, Prefs.getDefaultLocale(), true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,13 +4,18 @@ android {
|
|||
compileSdkVersion 23
|
||||
buildToolsVersion "23.0.3"
|
||||
|
||||
sourceSets.main.jni.srcDirs = []
|
||||
sourceSets {
|
||||
main {
|
||||
jni.srcDirs = []
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -22,7 +27,7 @@ android {
|
|||
|
||||
dependencies {
|
||||
compile project(':jsocksAndroid')
|
||||
compile 'com.android.support:appcompat-v7:23.+'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar','*.so'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
|
|
@ -182,8 +182,9 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
|||
if (mNotificationManager != null)
|
||||
mNotificationManager.cancelAll();
|
||||
|
||||
|
||||
if (mEventHandler != null)
|
||||
mEventHandler.getNodes().clear();
|
||||
|
||||
mNotificationShowing = false;
|
||||
}
|
||||
|
||||
|
@ -243,7 +244,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
|||
expandedView.setTextViewText(R.id.info, notifyMsg);
|
||||
}
|
||||
|
||||
if (mEventHandler.getNodes().size() > 0)
|
||||
if (mEventHandler != null && mEventHandler.getNodes().size() > 0)
|
||||
{
|
||||
Set<String> itBuiltNodes = mEventHandler.getNodes().keySet();
|
||||
for (String key : itBuiltNodes)
|
||||
|
@ -532,6 +533,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
|||
fileTorRc = new File(appBinHome, TorServiceConstants.TORRC_ASSET_KEY);
|
||||
filePdnsd = new File(appBinHome, TorServiceConstants.PDNSD_ASSET_KEY);
|
||||
|
||||
mEventHandler = new TorEventHandler(this);
|
||||
|
||||
if (mNotificationManager == null)
|
||||
{
|
||||
|
@ -735,7 +737,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
|||
try {
|
||||
|
||||
// make sure there are no stray daemons running
|
||||
killAllDaemons();
|
||||
// killAllDaemons();
|
||||
|
||||
sendCallbackStatus(STATUS_STARTING);
|
||||
sendCallbackLogMessage(getString(R.string.status_starting_up));
|
||||
|
@ -1146,16 +1148,16 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
|||
return result;
|
||||
}
|
||||
|
||||
public void addEventHandler () throws Exception
|
||||
public synchronized void addEventHandler () throws Exception
|
||||
{
|
||||
// We extend NullEventHandler so that we don't need to provide empty
|
||||
// implementations for all the events we don't care about.
|
||||
// ...
|
||||
logNotice( "adding control port event handler");
|
||||
|
||||
mEventHandler = new TorEventHandler(this);
|
||||
conn.setEventHandler(mEventHandler);
|
||||
|
||||
|
||||
conn.setEvents(Arrays.asList(new String[]{
|
||||
"ORCONN", "CIRC", "NOTICE", "WARN", "ERR","BW"}));
|
||||
// conn.setEvents(Arrays.asList(new String[]{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.torproject.android.service.vpn;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Application;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
|
@ -74,18 +75,19 @@ public class OrbotVpnManager implements Handler.Callback {
|
|||
private final static String DEFAULT_ACTUAL_DNS_HOST = "127.0.0.1";
|
||||
private final static int DEFAULT_ACTUAL_DNS_PORT = TorServiceConstants.TOR_DNS_PORT_DEFAULT;
|
||||
|
||||
|
||||
File filePdnsd = null;
|
||||
|
||||
private boolean isRestart = false;
|
||||
|
||||
private VpnService mService;
|
||||
|
||||
|
||||
static{
|
||||
System.loadLibrary("tun2socks");
|
||||
}
|
||||
|
||||
public OrbotVpnManager (VpnService service)
|
||||
{
|
||||
mService = service;
|
||||
filePdnsd = mService.getDir(TorServiceConstants.DIRECTORY_TOR_BINARY, Application.MODE_PRIVATE);
|
||||
|
||||
}
|
||||
|
||||
//public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
@ -394,12 +396,8 @@ public class OrbotVpnManager implements Handler.Callback {
|
|||
|
||||
}
|
||||
|
||||
File filePdnsd = null;
|
||||
|
||||
private void startDNS (String dns, int port) throws IOException, TimeoutException
|
||||
{
|
||||
File filePdnsd = null;//getDir(TorServiceConstants.DIRECTORY_TOR_BINARY, Application.MODE_PRIVATE);
|
||||
|
||||
makePdnsdConf(mService, dns, port,filePdnsd.getParentFile() );
|
||||
|
||||
ArrayList<String> customEnv = new ArrayList<String>();
|
||||
|
|
|
@ -30,6 +30,11 @@ import java.net.Socket;
|
|||
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
|
||||
public class Tun2Socks
|
||||
{
|
||||
|
||||
static{
|
||||
System.loadLibrary("tun2socks");
|
||||
}
|
||||
|
||||
public static interface IProtectSocket
|
||||
{
|
||||
boolean doVpnProtect(Socket socket);
|
||||
|
@ -52,8 +57,6 @@ public class Tun2Socks
|
|||
// than one instance due to the use of global state (the lwip
|
||||
// module, etc.) in the native code.
|
||||
|
||||
private static boolean mLibLoaded = false;
|
||||
|
||||
public static void Start(
|
||||
ParcelFileDescriptor vpnInterfaceFileDescriptor,
|
||||
int vpnInterfaceMTU,
|
||||
|
@ -64,12 +67,6 @@ public class Tun2Socks
|
|||
boolean udpgwTransparentDNS)
|
||||
{
|
||||
|
||||
if (!mLibLoaded)
|
||||
{
|
||||
System.loadLibrary("tun2socks");
|
||||
mLibLoaded = true;
|
||||
}
|
||||
|
||||
mVpnInterfaceFileDescriptor = vpnInterfaceFileDescriptor;
|
||||
mVpnInterfaceMTU = vpnInterfaceMTU;
|
||||
mVpnIpAddress = vpnIpAddress;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#APP_ABI := armeabi x86
|
||||
APP_ABI := armeabi
|
||||
APP_PLATFORM := android-10
|
||||
APP_PLATFORM := android-14
|
||||
APP_STL := stlport_static
|
||||
NDK_TOOLCHAIN_VERSION := 4.8
|
||||
|
|
Loading…
Reference in New Issue