Author: n8fr8 Date: 2011-05-17 03:09:12 +0000 (Tue, 17 May 2011) New Revision: 24763
Modified: projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java Log: fixed handling of 'EntryNodes' preference
Modified: projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java =================================================================== --- projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java 2011-05-17 03:08:30 UTC (rev 24762) +++ projects/android/trunk/Orbot/src/org/torproject/android/SettingsPreferences.java 2011-05-17 03:09:12 UTC (rev 24763) @@ -28,6 +28,9 @@ private boolean hasRoot = false; + + private final static int HIDDEN_SERVICE_PREF_IDX = 6; + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -77,12 +80,11 @@ } - int hiddenGroupIdx = 6; - prefHiddenServices = ((CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(hiddenGroupIdx)).getPreference(0)); + prefHiddenServices = ((CheckBoxPreference)((PreferenceCategory)this.getPreferenceScreen().getPreference(HIDDEN_SERVICE_PREF_IDX)).getPreference(0)); prefHiddenServices.setOnPreferenceClickListener(this); - ((PreferenceCategory)this.getPreferenceScreen().getPreference(hiddenGroupIdx)).getPreference(1).setEnabled(prefHiddenServices.isChecked()); - ((PreferenceCategory)this.getPreferenceScreen().getPreference(hiddenGroupIdx)).getPreference(2).setEnabled(prefHiddenServices.isChecked()); + ((PreferenceCategory)this.getPreferenceScreen().getPreference(HIDDEN_SERVICE_PREF_IDX)).getPreference(1).setEnabled(prefHiddenServices.isChecked()); + ((PreferenceCategory)this.getPreferenceScreen().getPreference(HIDDEN_SERVICE_PREF_IDX)).getPreference(2).setEnabled(prefHiddenServices.isChecked()); }; @@ -113,8 +115,8 @@ else if (preference == prefHiddenServices) { - ((PreferenceCategory)this.getPreferenceScreen().getPreference(5)).getPreference(1).setEnabled(prefHiddenServices.isChecked()); - ((PreferenceCategory)this.getPreferenceScreen().getPreference(5)).getPreference(2).setEnabled(prefHiddenServices.isChecked()); + ((PreferenceCategory)this.getPreferenceScreen().getPreference(HIDDEN_SERVICE_PREF_IDX)).getPreference(1).setEnabled(prefHiddenServices.isChecked()); + ((PreferenceCategory)this.getPreferenceScreen().getPreference(HIDDEN_SERVICE_PREF_IDX)).getPreference(2).setEnabled(prefHiddenServices.isChecked()); } else
Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java =================================================================== --- projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java 2011-05-17 03:08:30 UTC (rev 24762) +++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorService.java 2011-05-17 03:09:12 UTC (rev 24763) @@ -1137,18 +1137,12 @@ if (value == null || value.length() == 0) { resetBuffer.add(name); - /* - if (conn != null) - { - try { - conn.resetConf(Arrays.asList(new String[]{name})); - } catch (IOException e) { - Log.w(TAG, "Unable to reset conf",e); - } - }*/ + } else + { configBuffer.add(name + ' ' + value); + } return false; } @@ -1289,13 +1283,10 @@ boolean enableHiddenServices = prefs.getBoolean("pref_hs_enable", false);
boolean enableStrictNodes = prefs.getBoolean("pref_strict_nodes", false); - String entranceNodes = prefs.getString("pref_entrance_nodes", ""); - String exitNodes = prefs.getString("pref_exit_nodes", ""); - String excludeNodes = prefs.getString("pref_exclude_nodes", ""); + String entranceNodes = prefs.getString("pref_entrance_nodes", null); + String exitNodes = prefs.getString("pref_exit_nodes", null); + String excludeNodes = prefs.getString("pref_exclude_nodes", null);
- - //boolean enableTransparentProxy = prefs.getBoolean(TorConstants.PREF_TRANSPARENT, false); - if (currentStatus == STATUS_ON) { //reset iptables rules in active mode @@ -1310,10 +1301,10 @@ } }
- mBinder.updateConfiguration("EntranceNodes", entranceNodes, false); + mBinder.updateConfiguration("EntryNodes", entranceNodes, false); mBinder.updateConfiguration("ExitNodes", exitNodes, false); mBinder.updateConfiguration("ExcludeNodes", excludeNodes, false); - mBinder.updateConfiguration("StrictExitNodes", enableStrictNodes ? "1" : "0", false); + mBinder.updateConfiguration("StrictNodes", enableStrictNodes ? "1" : "0", false); if (useBridges) {
tor-commits@lists.torproject.org