This answer has some good information on using ACTION_OPEN_DOCUMENT_TREE:
How to use the new SD card access API presented for Android 5.0 (Lollipop)?
In this answer is the statement "Yep, the ACTION_OPEN_DOCUMENT_TREE intent gives you recursive access to both existing and newly created files and directories."
I'm not entirely certain I'm interpreting this correctly because this is not what I am finding in my experience. When the user selects a root directory, I am persisting the permission for:
content://com.android.externalstorage.documents/tree/primary%3A
Later on I want to access a child path at:
content://com.android.externalstorage.documents/tree/primary%3APictures%2FScreenshots
I then try to access the DocumentFile as follows:
DocumentFile fromDir = DocumentFile.fromTreeUri(this, fromUri);
boolean canRead = fromDir.canRead();
I am unable to read the fromDir and I can only read from the root directory that I have granted permission for.
Is there anything that I am missing that I need to do to request recursive permission or any other easy way to achieve this?