From 8e250e0b5d427229abf654944da171960a094738 Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Wed, 11 May 2016 02:06:21 +0200 Subject: Fixed 'Orbot appears not to be running' (#1792) --- OpenKeychain/src/main/AndroidManifest.xml | 6 + .../keychain/util/Preferences.java | 3 + .../keychain/util/orbot/OrbotHelper.java | 10 +- .../keychain/util/orbot/OrbotStatusReceiver.java | 78 +++++++++++ .../keychain/util/orbot/TorServiceUtils.java | 156 --------------------- 5 files changed, 94 insertions(+), 159 deletions(-) create mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotStatusReceiver.java delete mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/TorServiceUtils.java diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index bead69c58..0ab1e6aff 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -104,6 +104,12 @@ + + + + + + Date: Wed, 11 May 2016 13:37:34 +0200 Subject: Removed authorship, added license etc. --- .../keychain/util/orbot/OrbotStatusReceiver.java | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotStatusReceiver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotStatusReceiver.java index 743fbdf16..29a058f0a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotStatusReceiver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotStatusReceiver.java @@ -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 . + */ + package org.sufficientlysecure.keychain.util.orbot; import android.content.BroadcastReceiver; @@ -5,16 +20,14 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.util.Log; /** - * Created by vanitas on 11.05.16. * BroadcastReceiver that receives Orbots status */ public class OrbotStatusReceiver extends BroadcastReceiver { - private static final String TAG = "OrbStatRec"; - //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. 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() { - if(instance == null) instance = new OrbotStatusReceiver(); + if(instance == null) { + instance = new OrbotStatusReceiver(); + } return instance; } @@ -40,22 +55,22 @@ public class OrbotStatusReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { 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) + ")"; 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){ Bundle extras = intent.getExtras(); if (extras.containsKey(EXTRA_PROXY_PORT_HTTP)) { 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)) { 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); } } } -- cgit v1.2.3