[androidcontentfileengine] Catch SecurityException during file opening

resolver.openFileDescriptor throws a SecurityException when the caller doesn't have sufficient permissions to access the URL. This will make an application crash.

We should handle this case gracefully and report it to the user. I'm unsure if there is a better way to do this than simply logging the exception.

Change-Id: I36bfbd3e398c8176e57042a27740aa15bce63a7c
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
bb10
Nicolas Fella 2019-06-17 21:59:13 +02:00
parent 298f750cdb
commit 5ca2b081fe
1 changed files with 3 additions and 0 deletions

View File

@ -178,6 +178,9 @@ public class QtNative
return fdDesc.detachFd();
} catch (FileNotFoundException e) {
return -1;
} catch (SecurityException e) {
Log.e(QtTAG, "Exception when opening file", e);
return -1;
}
}