Help
Change theme
Press space for more information.
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Copy issue ID
Show links for this issue (Shortcut: i, l)
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
View issue level access limits(Press Alt + Right arrow for more information)
Pending code changes (auto-populated)
Notification menu
Vote: I am impacted
Unintended behavior
View staffing
Description
Path:
/extSdCard/_documentTest
Uri:
content://com.android.externalstorage.documents/tree/0000-0000%3A/document/0000-0000%3A_documentTest
SingleDocumentFile doesn't support any write features, so we are left with TreeDocumentFile which is created with:
public static DocumentFile fromTreeUri(Context context, Uri treeUri) {
final int version = Build.VERSION.SDK_INT;
if (version >= 21) {
return new TreeDocumentFile(null, context,
DocumentsContractApi21.prepareTreeUri(treeUri));
} else {
return null;
}
}
However DocumentsContractApi21.prepareTreeUri(treeUri) truncates the document id returning a DocumentFile pointing to:
content://com.android.externalstorage.documents/tree/0000-0000%3A/document/0000-0000%3A
This is NOT the same URI! It simply truncated this URI down to the tree root...
I cannot see a workaround without reflection into TreeDocumentFile.