Skip to content

Commit

Permalink
Android: Only check for uri permissions when it is a file or content
Browse files Browse the repository at this point in the history
This amends f36b042 to only check
permissions for uris that are going to be local to the device itself.
Other uris, such as http, https etc, should go through fine without a
check.

Change-Id: If05caadb6e0712d9db8f57185ef017d724d9e172
Reviewed-by: Assam Boudjelthia <[email protected]>
  • Loading branch information
AndyShawQt committed Apr 14, 2020
1 parent 504b37e commit e7eff98
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/android/jar/src/org/qtproject/qt5/android/QtNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,13 @@ public static QtServiceDelegate serviceDelegate()
private static Uri getUriWithValidPermission(Context context, String uri, String openMode)
{
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)
return parsedUri;
List<UriPermission> permissions = context.getContentResolver().getPersistedUriPermissions();
String uriStr = Uri.parse(uri).getPath();
String uriStr = parsedUri.getPath();

for (int i = 0; i < permissions.size(); ++i) {
Uri iterUri = permissions.get(i).getUri();
Expand Down

0 comments on commit e7eff98

Please sign in to comment.