enable transproxy refresh feature, default off

This commit is contained in:
Nathan Freitas 2014-08-11 11:18:46 -04:00
parent 0d424797a2
commit ade6172145
3 changed files with 21 additions and 4 deletions

View File

@ -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>

View File

@ -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

View File

@ -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);
}
}
}