[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] enable transproxy refresh feature, default off



commit ade617214501ec8e941445843ea5b8443ea56bfa
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Mon Aug 11 11:18:46 2014 -0400

    enable transproxy refresh feature, default off
---
 res/values/strings.xml                             |    3 +++
 res/xml/preferences.xml                            |    7 +++++++
 src/org/torproject/android/service/TorService.java |   15 +++++++++++----
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/res/values/strings.xml b/res/values/strings.xml
index 155dbdd..fa4a731 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -287,5 +287,8 @@
   <string name="please_disable_this_app_in_android_settings_apps_if_you_are_having_problems_with_orbot_">"Please disable this app in Android->Settings->Apps if you are having problems with Orbot: "</string>
   <string name="app_conflict">App Conflict</string>
   
+
+  <string name="pref_transproxy_refresh_title">Transproxy Auto-Refresh</string>
+  <string name="pref_transproxy_refresh_summary">Re-apply Transproxy rules when the network state changes</string>
   
 </resources>
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 2b10ac4..95d8f84 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -256,6 +256,13 @@ android:summary="@string/pref_disable_network_summary"
 android:enabled="true" 
 android:title="@string/pref_disable_network_title"/>
 
+<CheckBoxPreference
+android:defaultValue="false" 
+android:key="pref_transproxy_refresh"
+android:summary="@string/pref_transproxy_refresh_summary"
+android:enabled="true" 
+android:title="@string/pref_transproxy_refresh_title"/>
+
 
 <!-- 
 <CheckBoxPreference
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index c3b6b39..2736fbe 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -134,7 +134,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
     private boolean mEnableTransparentProxy = false;
     private boolean mTransProxyAll = false;
     private boolean mTransProxyTethering = false;
-
+    private boolean mTransProxyNetworkRefresh = false;
+    
     private ExecutorService mExecutor = Executors.newCachedThreadPool();
     
     public void debug(String msg)
@@ -719,9 +720,12 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 		SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
 
     	mHasRoot = prefs.getBoolean(PREF_HAS_ROOT,false);
- 		mEnableTransparentProxy = prefs.getBoolean("pref_transparent", false);
+ 		
+    	mEnableTransparentProxy = prefs.getBoolean("pref_transparent", false);
  		mTransProxyAll = prefs.getBoolean("pref_transparent_all", false);
 	 	mTransProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
+	 	mTransProxyNetworkRefresh = prefs.getBoolean("pref_transproxy_refresh", false);
+	 	
 	 	mShowExpandedNotifications  = prefs.getBoolean("pref_expanded_notifications", false);
 	 	
     	ENABLE_DEBUG_LOG = prefs.getBoolean("pref_enable_logging",false);
@@ -1843,8 +1847,11 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 							logNotice(context.getString(R.string.network_connectivity_is_good_waking_tor_up_));
 							showToolbarNotification(getString(R.string.status_activated),NOTIFY_ID,R.drawable.ic_stat_tor);
 
-							//if (mHasRoot && mEnableTransparentProxy)
-								//enableTransparentProxy(mTransProxyAll, mTransProxyTethering);
+							if (mHasRoot && mEnableTransparentProxy && mTransProxyNetworkRefresh)
+							{
+				    			disableTransparentProxy();
+								enableTransparentProxy(mTransProxyAll, mTransProxyTethering);
+							}
 							
 				        }
 					}



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits