android scoped storage: default to hack the uri manually in getParentUri

If DocumentsContract.Path.getPath() fails, try to hack the uri manually
instead of returning null/empty (android 10)
This commit is contained in:
Flyinghead 2023-10-21 21:40:13 +02:00
parent 35b7be3905
commit 8ba5e05421
1 changed files with 0 additions and 2 deletions

View File

@ -102,8 +102,6 @@ public class AndroidStorage {
List<String> comps = path.getPath(); List<String> comps = path.getPath();
if (comps.size() > 1) if (comps.size() > 1)
return DocumentsContract.buildDocumentUriUsingTree(uri, comps.get(comps.size() - 2)).toString(); return DocumentsContract.buildDocumentUriUsingTree(uri, comps.get(comps.size() - 2)).toString();
else
return "";
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// Happens for root storage uri: // Happens for root storage uri:
// DocumentsContract: Failed to find path: Invalid URI: content://com.android.externalstorage.documents/tree/primary%3AFlycast // DocumentsContract: Failed to find path: Invalid URI: content://com.android.externalstorage.documents/tree/primary%3AFlycast