summaryrefslogtreecommitdiffstats
path: root/src/android/jar/src
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-06-05 16:34:14 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-26 15:10:58 +0000
commitf938ed38d2f60e105b8b24ad7b154e62c6c2952c (patch)
tree79937370bfdd6ab2df6433d4f87572b63cc6b8fc /src/android/jar/src
parent217cc72e10a64e668bdd80b7c50a66d3c8eb4a2d (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. Fixes: QTBUG-67877 Change-Id: Ia3fecc24a67069dc76f866455277bf8b929e7697 Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 6f837d6f071e646282090c405ecfeb1e30454f42) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/android/jar/src')
-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 166c6c8309..43433d00c7 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -167,9 +167,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();
@@ -215,7 +217,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;
}