Can an app get a permission to a whole sub tree from SAF?

[亡魂溺海] 提交于 2019-12-07 21:37:25

问题


Can a third party app request a Storage provider through Storage Access Framework to grant it with premissions to delete files within\copy files to a directory or in any subtree underneath the tree Uri recieved onActivityResult by a call to startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE),14)?

If it can, how do you claim it on the third party app code?

I tried

getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

but when i try to delete a file in the subtree i get :

Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/tree/0403-0201%3ADCIM%2Fthai2%2FDSC_0024.JPG from pid=26781, uid=10749 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission()

EDIT : To explain my use case and maybe get other suggestions for it, I am developing an app that helps users manage photos they have on their device, if its by helping arrange them in albums or delete them fast and easy. That means that without premissions to manage files in the SD card it becomes almost useless (at least for me, as i got SD of 64gb with a nice amount of photos and barely 1gb free on the internal storage, and i am the most active user of this app i believe lol).

来源:https://stackoverflow.com/questions/35468298/can-an-app-get-a-permission-to-a-whole-sub-tree-from-saf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!