UPDATE: My initial question may be misleading so I want to rephrase it: I want to traverse through the hierarchy tree from an MTP connected device through Android\'s Storage
The flags added before start activity for result do nothing.
I do not understand that you use DocumentsContract. The user picks a directory. From the uri you get you can construct a DocumentFile
for that directory.
After that use DocumentFile::listFiles()
on that instance to get a list of subdirectories and files.