1

So, as you all know, even though they are they're installed in internal app memory, some apps tend to store some of its data in internal SD and some in external SD card. (To be more precise, in "/sdcard/Android/data/" and "/extSdCard/Android/data/" folder, respectively.)

Now, I was wondering if there was any way to prevent this, so that they store their data only in the app's private folder (in "/data/data/app-package/")? Or at least prevent writing data into the external SD card and just use internal SD for the purpose?

Info: - Model: Samsung s3 - OS: Android 4.4 stock ROM (rooted)

  • You could revoke their write access to the SD card using pm, but that will most likely make them crash every time they tried to write the card. – matega Nov 4 '14 at 18:52
  • You also could mount --bind their SD card folders to internal memory folders. This has to be done on every boot, though, and Android's mount system is messy enough as it is. – matega Nov 4 '14 at 18:57
1

Since the device is rooted you can install XPrivacy from Play Store. For this app to work you need to install Xposed Framework. Once this framework is installed, you'll have to enable XPrivacy's module in Xposed framework which will require a reboot.

  • Once XPrivacy is installed and device rebooted, launch the app and tap any app icon amongst the list of apps icons(say Facebook app icon).
  • Scroll down to Storage and tap it to list permissions inside it.
  • Two entries there requires our attention:
    • getExternalStorageState -- Returns the current state of the primary "external" storage device.
    • sdcard (aka [(READ/WRITE/ACCESS_ALL)_EXTERNAL_STORAGE]) -- Allows an application to read/write from and into external storage.

Now that it is obvious from the context I mentioned around these two entries, you can go ahead restricting them for the apps you desire.

Note that there could be repercussions for restricting them, and the obvious would be the app failing to launch or crashing intermittently. It is advised to take a nandroid backup as well as an app backup.

XPrivacy allows et al.:

  • Creating a template of permissions which can be applied on apps individually rather than selecting the permissions by going into every app individually. The pro version allows applying this template on multiple apps simultaneously.

  • Restrict on Demand feature which will seek user's discretion every time a selected app is launched.

  • Automatic default template implementation on any new user installed app.


About XPrivacy

Privacy can prevent applications from leaking privacy sensitive data by restricting the categories of data an application can access. XPrivacy feeds applications fake data or no data at all. It can restrict several data categories, such as contacts or location. For example, if you restrict an application's access to contacts, that application will receive an empty contacts list. Similarly, restricting an application's access to your location will send a fake location to that application.

XPrivacy doesn't revoke or block permissions from an application, so most applications will continue to work as before and won't force close (crash).

About Xposed Framework

Xposed is a framework for modules that can change the behavior of the system and apps without touching any APKs. That's great because it means that modules can work for different versions and even ROMs without any changes (as long as the original code was not changed too much). It's also easy to undo. As all changes are done in the memory, you just need to deactivate the module and reboot to get your original system back. There are many other advantages, but here is just one more: Multiple modules can do changes to the same part of the system or app. With modified APKs, you to decide for one. No way to combine them, unless the author builds multiple APKs with different combinations.

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.