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>
This commit is contained in:
parent
c644dc9700
commit
6f837d6f07
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user