summaryrefslogtreecommitdiffstats
path: root/src/android/jar
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-06-05 16:34:14 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2020-06-26 12:41:42 +0000
commit6f837d6f071e646282090c405ecfeb1e30454f42 (patch)
tree615d27df8c3c2513f48c881e9cc396c7d919b567 /src/android/jar
parentc644dc970085df9771012d4b3780640b7215e64b (diff)
Android: fix QDesktopServices::openUrl() error for file scheme path
If the url is a "file:" scheme url don't check for permissions which the file won't have, and then disable StrictMode for API >= 24 to be able to pass the "file:" path to the openUrl intent. Pick-to: 5.15 Fixes: QTBUG-67877 Change-Id: Ia3fecc24a67069dc76f866455277bf8b929e7697 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/android/jar')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 83e576095b..066352cedd 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -169,9 +169,11 @@ public class QtNative
try {
Uri parsedUri = Uri.parse(uri);
String scheme = parsedUri.getScheme();
- // We only want to check permissions for files and content Uris
- if (scheme.compareTo("file") != 0 && scheme.compareTo("content") != 0)
+
+ // We only want to check permissions for content Uris
+ if (scheme.compareTo("content") != 0)
return parsedUri;
+
List<UriPermission> permissions = context.getContentResolver().getPersistedUriPermissions();
String uriStr = parsedUri.getPath();
@@ -217,7 +219,7 @@ public class QtNative
} catch (UnsupportedOperationException e) {
Log.e(QtTAG, "openURL(): Unsupported operation for given Uri");
return false;
- } catch (ActivityNotFoundException e) {
+ } catch (Exception e) {
e.printStackTrace();
return false;
}