Removed authorship, added license etc.
This commit is contained in:
@@ -1,3 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.util.orbot;
|
package org.sufficientlysecure.keychain.util.orbot;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -5,16 +20,14 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by vanitas on 11.05.16.
|
|
||||||
* BroadcastReceiver that receives Orbots status
|
* BroadcastReceiver that receives Orbots status
|
||||||
*/
|
*/
|
||||||
public class OrbotStatusReceiver extends BroadcastReceiver {
|
public class OrbotStatusReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
private static final String TAG = "OrbStatRec";
|
|
||||||
|
|
||||||
//TODO: These two Strings are missing in older versions of NetCipher.
|
//TODO: These two Strings are missing in older versions of NetCipher.
|
||||||
//TODO: Once they are present in OrbotHelper (not ProxyHelper) point to OrbotHelpers Strings instead.
|
//TODO: Once they are present in OrbotHelper (not ProxyHelper) point to OrbotHelpers Strings instead.
|
||||||
public final static String EXTRA_PROXY_PORT_HTTP = "org.torproject.android.intent.extra.HTTP_PROXY_PORT";
|
public final static String EXTRA_PROXY_PORT_HTTP = "org.torproject.android.intent.extra.HTTP_PROXY_PORT";
|
||||||
@@ -32,7 +45,9 @@ public class OrbotStatusReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static OrbotStatusReceiver getInstance() {
|
public static OrbotStatusReceiver getInstance() {
|
||||||
if(instance == null) instance = new OrbotStatusReceiver();
|
if(instance == null) {
|
||||||
|
instance = new OrbotStatusReceiver();
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,22 +55,22 @@ public class OrbotStatusReceiver extends BroadcastReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (OrbotHelper.ACTION_STATUS.equals(intent.getAction())) {
|
if (OrbotHelper.ACTION_STATUS.equals(intent.getAction())) {
|
||||||
Log.i(TAG, context.getPackageName() + " received intent : " + intent.getAction() + " " + intent.getPackage());
|
Log.i(Constants.TAG, context.getPackageName() + " received intent : " + intent.getAction() + " " + intent.getPackage());
|
||||||
String status = intent.getStringExtra(OrbotHelper.EXTRA_STATUS) + " (" + intent.getStringExtra(OrbotHelper.EXTRA_PACKAGE_NAME) + ")";
|
String status = intent.getStringExtra(OrbotHelper.EXTRA_STATUS) + " (" + intent.getStringExtra(OrbotHelper.EXTRA_PACKAGE_NAME) + ")";
|
||||||
this.torRunning = (intent.getStringExtra(OrbotHelper.EXTRA_STATUS).equals(OrbotHelper.STATUS_ON));
|
this.torRunning = (intent.getStringExtra(OrbotHelper.EXTRA_STATUS).equals(OrbotHelper.STATUS_ON));
|
||||||
|
|
||||||
Log.d(TAG, "Orbot status: "+status);
|
Log.d(Constants.TAG, "Orbot status: "+status);
|
||||||
if(torRunning){
|
if(torRunning){
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
|
|
||||||
if (extras.containsKey(EXTRA_PROXY_PORT_HTTP)) {
|
if (extras.containsKey(EXTRA_PROXY_PORT_HTTP)) {
|
||||||
this.proxy_port_http = extras.getInt(EXTRA_PROXY_PORT_HTTP, -1);
|
this.proxy_port_http = extras.getInt(EXTRA_PROXY_PORT_HTTP, -1);
|
||||||
Log.i(TAG, "Http proxy set to "+proxy_port_http);
|
Log.i(Constants.TAG, "Http proxy set to "+proxy_port_http);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extras.containsKey(EXTRA_PROXY_PORT_SOCKS)) {
|
if (extras.containsKey(EXTRA_PROXY_PORT_SOCKS)) {
|
||||||
this.proxy_port_socks = extras.getInt(EXTRA_PROXY_PORT_SOCKS, -1);
|
this.proxy_port_socks = extras.getInt(EXTRA_PROXY_PORT_SOCKS, -1);
|
||||||
Log.i(TAG, "Socks proxy set to "+proxy_port_socks);
|
Log.i(Constants.TAG, "Socks proxy set to "+proxy_port_socks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user