1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-26 09:48:46 +00:00
This commit is contained in:
Marco 2015-11-14 12:24:53 +01:00
commit e42a5b30d9

View file

@ -54,7 +54,7 @@ public class SinkholeService extends VpnService {
private boolean last_roaming; private boolean last_roaming;
private ParcelFileDescriptor vpn = null; private ParcelFileDescriptor vpn = null;
private boolean debug = false; private boolean debug = false;
private Thread thread = null; private Thread debugThread = null;
private volatile Looper mServiceLooper; private volatile Looper mServiceLooper;
private volatile ServiceHandler mServiceHandler; private volatile ServiceHandler mServiceHandler;
@ -71,7 +71,7 @@ public class SinkholeService extends VpnService {
synchronized private static PowerManager.WakeLock getLock(Context context) { synchronized private static PowerManager.WakeLock getLock(Context context) {
if (wlInstance == null) { if (wlInstance == null) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wlInstance = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, context.getString(R.string.app_name)); wlInstance = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, context.getString(R.string.app_name) + " wakelock");
wlInstance.setReferenceCounted(true); wlInstance.setReferenceCounted(true);
} }
return wlInstance; return wlInstance;
@ -155,7 +155,7 @@ public class SinkholeService extends VpnService {
// Build VPN service // Build VPN service
final Builder builder = new Builder(); final Builder builder = new Builder();
builder.setSession(getString(R.string.app_name)); builder.setSession(getString(R.string.app_name) + " session");
// TODO: make tunnel parameters configurable // TODO: make tunnel parameters configurable
builder.addAddress("10.1.10.1", 32); builder.addAddress("10.1.10.1", 32);
builder.addAddress("fd00:1:fd00:1:fd00:1:fd00:1", 64); builder.addAddress("fd00:1:fd00:1:fd00:1:fd00:1", 64);
@ -219,7 +219,7 @@ public class SinkholeService extends VpnService {
if (pfd == null || !debug) if (pfd == null || !debug)
return; return;
thread = new Thread(new Runnable() { debugThread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
FileInputStream in = null; FileInputStream in = null;
@ -282,13 +282,13 @@ public class SinkholeService extends VpnService {
} }
} }
} }
}); }, getString(R.string.app_name) + " debug");
thread.start(); debugThread.start();
} }
private void stopDebug() { private void stopDebug() {
if (thread != null) if (debugThread != null)
thread.interrupt(); debugThread.interrupt();
} }
private BroadcastReceiver interactiveStateReceiver = new BroadcastReceiver() { private BroadcastReceiver interactiveStateReceiver = new BroadcastReceiver() {
@ -345,7 +345,7 @@ public class SinkholeService extends VpnService {
super.onCreate(); super.onCreate();
Log.i(TAG, "Create"); Log.i(TAG, "Create");
HandlerThread thread = new HandlerThread(getString(R.string.app_name)); HandlerThread thread = new HandlerThread(getString(R.string.app_name) + " handler");
thread.start(); thread.start();
mServiceLooper = thread.getLooper(); mServiceLooper = thread.getLooper();