6

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).

7

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 <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />, which is usually granted to system apps only. This line must be added under the <perms> 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 <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" /> 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.

  • I agree for sure. – iBug Nov 5 '17 at 15:21
  • I edited the packages.xml for an app called Termux, as per your suggestion but I still can't write to the External SD card from the app. I am not really familiar with Xposed and would rather not go down that road. Any other suggestions? – Sruly Mar 8 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.