diff options
author | Arne Schwabe <arne@rfc2549.org> | 2019-04-08 17:24:06 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2019-08-05 16:01:34 +0200 |
commit | c6a64e1749ef8f5d947bf08a035f36883cff9152 (patch) | |
tree | ce9ad61c4c50991dc5e61d36f9c9d0e8a04fc50b /main/src | |
parent | 03d93d1fb7281da7d57af9a21f9b16dd580b276b (diff) |
Do allow custom file chooser on Android Q+ since it will not work
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java | 19 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/Utils.java | 5 |
2 files changed, 16 insertions, 8 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java b/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java index 48bae757..88c46e6e 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java @@ -70,6 +70,13 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC devHacks.removePreference(useInternalFS); } + /* Android P does not allow access to the file storage anymore */ + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) + { + Preference useInternalFileSelector = findPreference("useInternalFileSelector"); + devHacks.removePreference(useInternalFileSelector); + } + mExtapp = new ExternalAppDatabase(getActivity()); Preference clearapi = findPreference("clearapi"); clearapi.setOnPreferenceClickListener(this); @@ -133,15 +140,13 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC ApplicationInfo app; PackageManager pm = getActivity().getPackageManager(); - String applist=null; + StringBuilder applist = new StringBuilder(); for (String packagename : mExtapp.getExtAppList()) { try { app = pm.getApplicationInfo(packagename, 0); - if (applist==null) - applist = ""; - else - applist += delim; - applist+=app.loadLabel(pm); + if (applist.length() != 0) + applist.append(delim); + applist.append(app.loadLabel(pm)); } catch (NameNotFoundException e) { // App not found. Remove it from the list @@ -149,7 +154,7 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC } } - return applist; + return applist.toString(); } private boolean isTunModuleAvailable() { diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java index 0fa89540..abdc45f5 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java @@ -153,8 +153,11 @@ public class Utils { public static boolean alwaysUseOldFileChooser(Context c) { - SharedPreferences prefs = Preferences.getDefaultSharedPreferences(c); + /* Android P does not allow access to the file storage anymore */ + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) + return false; + SharedPreferences prefs = Preferences.getDefaultSharedPreferences(c); return prefs.getBoolean("useInternalFileSelector", false); } |