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

[tor-commits] [orbot/master] tweak root preferences



commit d25b3d5de897cc191c7c78768b616f9cba04d518
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Sat Oct 29 11:33:45 2016 -0400

    tweak root preferences
---
 .../android/settings/SettingsPreferences.java           | 17 +++++++++++++++--
 app/src/main/res/xml/preferences.xml                    |  3 +--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java b/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java
index 00fd251..c14cb5a 100644
--- a/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java
+++ b/app/src/main/java/org/torproject/android/settings/SettingsPreferences.java
@@ -15,9 +15,11 @@ import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceActivity;
+import android.util.Log;
 
 import org.torproject.android.OrbotApp;
 import org.torproject.android.R;
+import org.torproject.android.service.transproxy.TorTransProxy;
 import org.torproject.android.ui.AppManager;
 import org.torproject.android.service.util.TorServiceUtils;
 
@@ -30,6 +32,8 @@ public class SettingsPreferences
 
 	private CheckBoxPreference prefCBTransProxy = null;
 	private CheckBoxPreference prefcBTransProxyAll = null;
+    private CheckBoxPreference prefcbTransTethering = null;
+
 	private Preference prefTransProxyFlush = null;
 	
 	private Preference prefTransProxyApps = null;
@@ -77,6 +81,7 @@ public class SettingsPreferences
 
         prefCBTransProxy = (CheckBoxPreference) findPreference("pref_transparent");
         prefcBTransProxyAll = (CheckBoxPreference) findPreference("pref_transparent_all");
+        prefcbTransTethering = (CheckBoxPreference) findPreference("pref_transparent_tethering");
 
         prefTransProxyFlush = (Preference) findPreference("pref_transproxy_flush");
         prefTransProxyFlush.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@@ -105,9 +110,9 @@ public class SettingsPreferences
         
         
         prefCBTransProxy.setEnabled(prefRequestRoot.isChecked());
-        
         prefcBTransProxyAll.setEnabled(prefCBTransProxy.isChecked());
-        
+        prefcbTransTethering.setEnabled(prefCBTransProxy.isChecked());
+
         if (prefCBTransProxy.isChecked())
         	prefTransProxyApps.setEnabled((!prefcBTransProxyAll.isChecked()));
         
@@ -132,8 +137,16 @@ public class SettingsPreferences
 			if (prefRequestRoot.isChecked())
 			{
 
+                try {
+                    TorTransProxy.testRoot();
                     prefCBTransProxy.setEnabled(true);
 
+                }
+                catch (Exception e)
+                {
+                    Log.d(OrbotApp.TAG,"root not yet enabled");
+                }
+
 			}
 		}
 		else if (preference == prefTransProxyApps)
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index f34548e..d2b5854 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -70,8 +70,7 @@ android:enabled="true"/>
 android:defaultValue="false" 
 android:key="pref_transparent_tethering"
 android:summary="@string/pref_transparent_tethering_summary"
-android:enabled="true" 
-android:dependency="has_root"
+android:enabled="true"
 android:title="@string/pref_transparent_tethering_title"/>
 
 



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