don't attempt to figure out file path on Android 11+

fixes #117
This commit is contained in:
Daniel Gultsch 2023-10-05 20:28:47 +02:00
parent d9c9baf516
commit 95aea4291e
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 8 additions and 5 deletions

View file

@ -648,8 +648,13 @@ public class FileBackend {
}
}
public String getOriginalPath(Uri uri) {
return FileUtils.getPath(mXmppConnectionService, uri);
public String getOriginalPath(final Uri uri) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// On Android 11+ we dont have access to the original file
return null;
} else {
return FileUtils.getPath(mXmppConnectionService, uri);
}
}
private void copyFileToPrivateStorage(File file, Uri uri) throws FileCopyException {

View file

@ -34,10 +34,8 @@ public class FileUtils {
return null;
}
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
if (DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);