From e66b35409cff37433af11693673145406029356f Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 7 Nov 2013 17:48:18 +0100 Subject: =?UTF-8?q?I=20think=20the=20hacks=20that=20were=20needed=20for=20?= =?UTF-8?q?earlier=20Android=20version=20should=20not=20be=20needed=20anym?= =?UTF-8?q?ore.=20Don=E2=80=99t=20show=20them=20in=20the=20General=20setti?= =?UTF-8?q?ngs=20menu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/blinkt/openvpn/core/OpenVpnService.java | 4 +++- .../blinkt/openvpn/fragments/GeneralSettings.java | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java index 92e44e53..e4437d2c 100644 --- a/src/de/blinkt/openvpn/core/OpenVpnService.java +++ b/src/de/blinkt/openvpn/core/OpenVpnService.java @@ -480,7 +480,9 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac } catch (Exception e) { VpnStatus.logError(R.string.tun_open_error); VpnStatus.logError(getString(R.string.error) + e.getLocalizedMessage()); - VpnStatus.logError(R.string.tun_error_helpful); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) { + VpnStatus.logError(R.string.tun_error_helpful); + } return null; } diff --git a/src/de/blinkt/openvpn/fragments/GeneralSettings.java b/src/de/blinkt/openvpn/fragments/GeneralSettings.java index a78c31f6..2e486dfe 100644 --- a/src/de/blinkt/openvpn/fragments/GeneralSettings.java +++ b/src/de/blinkt/openvpn/fragments/GeneralSettings.java @@ -9,9 +9,12 @@ import android.content.DialogInterface.OnClickListener; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Build; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; +import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import de.blinkt.openvpn.R; import de.blinkt.openvpn.api.ExternalAppDatabase; @@ -28,14 +31,29 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC // Load the preferences from an XML resource addPreferencesFromResource(R.xml.general_settings); - Preference loadtun = findPreference("loadTunModule"); - if(!isTunModuleAvailable()) + + PreferenceCategory devHacks = (PreferenceCategory) findPreference("device_hacks"); + + + Preference loadtun = findPreference("loadTunModule"); + if(!isTunModuleAvailable()) { loadtun.setEnabled(false); + devHacks.removePreference(loadtun); + } + + CheckBoxPreference cm9hack = (CheckBoxPreference) findPreference("useCM9Fix"); + if (!cm9hack.isChecked() && (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1)) { + devHacks.removePreference(cm9hack); + } mExtapp = new ExternalAppDatabase(getActivity()); Preference clearapi = findPreference("clearapi"); clearapi.setOnPreferenceClickListener(this); + + if(devHacks.getPreferenceCount()==0) + getPreferenceScreen().removePreference(devHacks); + setClearApiSummary(); } -- cgit v1.2.3