diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-08-07 00:05:02 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-08-07 00:05:02 +0200 |
commit | be8b263f543530eb2142f362d0d7346f013c57c3 (patch) | |
tree | 339b27c8cbfc6a1e0a79039afafa374805ae083c | |
parent | 5e857c81eb31b4f1f445cffc28b575359993e38d (diff) |
Always pass context when retrieving vpn config, don't try JB+ extra on ICS (closes issue #188)
-rw-r--r-- | AndroidManifest.xml | 8 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/LaunchVPN.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/LogWindow.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/core/OpenVpnService.java | 6 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/core/ProfileManager.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/Settings_Basic.java | 4 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/ShowConfigFragment.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/VPNProfileList.java | 4 |
8 files changed, 16 insertions, 14 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f3890ea7..4533aa32 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4,11 +4,11 @@ xmlns:tools="http://schemas.android.com/tools" package="de.blinkt.openvpn"> - <uses-permission android:name="android.permission.INTERNET" android:require="true" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" android:require="true"/> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> --> - <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" android:require="false"/> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:require="false" /> + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- <uses-permission android:name="com.android.vending.BILLING" /> --> diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index 5924e8ff..07cf323c 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -99,7 +99,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { String shortcutName = intent.getStringExtra( EXTRA_NAME); mhideLog = intent.getBooleanExtra(EXTRA_HIDELOG, false); - VpnProfile profileToConnect = ProfileManager.get(shortcutUUID); + VpnProfile profileToConnect = ProfileManager.get(this,shortcutUUID); if(shortcutName != null && profileToConnect ==null) profileToConnect = ProfileManager.getInstance(this).getProfileByName(shortcutName); diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java index 9a7e13fa..10f3c0ab 100644 --- a/src/de/blinkt/openvpn/LogWindow.java +++ b/src/de/blinkt/openvpn/LogWindow.java @@ -337,7 +337,7 @@ public class LogWindow extends ListActivity implements StateListener { if (requestCode == START_VPN_CONFIG && resultCode==RESULT_OK) { String configuredVPN = data.getStringExtra(VpnProfile.EXTRA_PROFILEUUID); - final VpnProfile profile = ProfileManager.get(configuredVPN); + final VpnProfile profile = ProfileManager.get(this,configuredVPN); ProfileManager.getInstance(this).saveProfile(this, profile); // Name could be modified, reset List adapter diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java index 6aacf891..438f4286 100644 --- a/src/de/blinkt/openvpn/core/OpenVpnService.java +++ b/src/de/blinkt/openvpn/core/OpenVpnService.java @@ -140,7 +140,9 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // Try to set the priority available since API 16 (Jellybean) - jbNotificationExtras(lowpriority, nbuilder); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) + jbNotificationExtras(lowpriority, nbuilder); + if(tickerText!=null && !tickerText.equals("")) nbuilder.setTicker(tickerText); @@ -298,7 +300,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac String nativelibdir = intent.getStringExtra(prefix + ".nativelib"); String profileUUID = intent.getStringExtra(prefix + ".profileUUID"); - mProfile = ProfileManager.get(profileUUID); + mProfile = ProfileManager.get(this,profileUUID); String startTitle = getString(R.string.start_vpn_title, mProfile.mName); String startTicker = getString(R.string.start_vpn_ticker, mProfile.mName); diff --git a/src/de/blinkt/openvpn/core/ProfileManager.java b/src/de/blinkt/openvpn/core/ProfileManager.java index d1c4afc1..27b64b90 100644 --- a/src/de/blinkt/openvpn/core/ProfileManager.java +++ b/src/de/blinkt/openvpn/core/ProfileManager.java @@ -36,7 +36,7 @@ public class ProfileManager { private static VpnProfile tmpprofile=null; - public static VpnProfile get(String key) { + private static VpnProfile get(String key) { if (tmpprofile!=null && tmpprofile.getUUIDString().equals(key)) return tmpprofile; diff --git a/src/de/blinkt/openvpn/fragments/Settings_Basic.java b/src/de/blinkt/openvpn/fragments/Settings_Basic.java index 5dc4e437..28c2ca38 100644 --- a/src/de/blinkt/openvpn/fragments/Settings_Basic.java +++ b/src/de/blinkt/openvpn/fragments/Settings_Basic.java @@ -73,7 +73,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String profileuuid =getArguments().getString(getActivity().getPackageName() + ".profileUUID"); - mProfile=ProfileManager.get(profileuuid); + mProfile=ProfileManager.get(getActivity(),profileuuid); getActivity().setTitle(getString(R.string.edit_profile_title, mProfile.getName())); } @@ -155,7 +155,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On public void onStart() { super.onStart(); String profileuuid =getArguments().getString(getActivity().getPackageName() + ".profileUUID"); - mProfile=ProfileManager.get(profileuuid); + mProfile=ProfileManager.get(getActivity(),profileuuid); loadPreferences(); } diff --git a/src/de/blinkt/openvpn/fragments/ShowConfigFragment.java b/src/de/blinkt/openvpn/fragments/ShowConfigFragment.java index ad077633..bf673288 100644 --- a/src/de/blinkt/openvpn/fragments/ShowConfigFragment.java +++ b/src/de/blinkt/openvpn/fragments/ShowConfigFragment.java @@ -20,7 +20,7 @@ public class ShowConfigFragment extends Fragment { public android.view.View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String profileUUID = getArguments().getString(getActivity().getPackageName() + ".profileUUID"); - final VpnProfile vp = ProfileManager.get(profileUUID); + final VpnProfile vp = ProfileManager.get(getActivity(),profileUUID); View v=inflater.inflate(R.layout.viewconfig, container,false); final TextView cv = (TextView) v.findViewById(R.id.configview); diff --git a/src/de/blinkt/openvpn/fragments/VPNProfileList.java b/src/de/blinkt/openvpn/fragments/VPNProfileList.java index d24aafc5..ccd8ef47 100644 --- a/src/de/blinkt/openvpn/fragments/VPNProfileList.java +++ b/src/de/blinkt/openvpn/fragments/VPNProfileList.java @@ -279,7 +279,7 @@ public class VPNProfileList extends ListFragment { if (requestCode == START_VPN_CONFIG) { String configuredVPN = data.getStringExtra(VpnProfile.EXTRA_PROFILEUUID); - VpnProfile profile = ProfileManager.get(configuredVPN); + VpnProfile profile = ProfileManager.get(getActivity(),configuredVPN); getPM().saveProfile(getActivity(), profile); // Name could be modified, reset List adapter setListAdapter(); @@ -293,7 +293,7 @@ public class VPNProfileList extends ListFragment { startActivityForResult(startImport, IMPORT_PROFILE); } else if(requestCode == IMPORT_PROFILE) { String profileUUID = data.getStringExtra(VpnProfile.EXTRA_PROFILEUUID); - mArrayadapter.add(ProfileManager.get(profileUUID)); + mArrayadapter.add(ProfileManager.get(getActivity(), profileUUID)); } } |