Thursday, March 2, 2017

applications - Can I grant permanent access to external storage to an app in Nougat?


I'm using OnePlus 5 running stock 7.1.1.


I use the OTG function to transfer file between my phone and my flash drive very often, and my preferred file manager is Root Explorer. Every time I try to copy stuff to flash drive, I must first grant it access.


Can I permanently grant Root Explorer access to external storage? I don't mind messing around with system configuration files (like packages.xml).




Answer



Manually granting permission


For rooted devices, there is a way to inject a specific permission inside the /data/system/packages.xml file, which details any and all installed apps, alongside their signatures and permissions.


The permission mentioned above is , which is usually granted to system apps only. This line must be added under the node of the package name one wishes to grant permanent access to the external storage, be it an SD card or a drive attached via OTG.


For Android to acknowledge the new permission, a reboot is needed.


Revoking permission


To revoke the abovementioned permission, one just needs to remove the line they themselves added.


Automated alternatives


If one does not want to manually edit packages.xml but has Xposed, it is possible to achieve a similar result by using the XInternalSD module. Upon activating it, enter its settings and disable any checkbox but the one next to Full access to external SD card.


This, depending on the Android version in use, is able to grant read-write access to external media. It is tested and running up to Nougat 7.1.2. This method is not granular, hence any app will be able to access any external media.



I am not affiliated to either XInternalSD, or to its developer.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...