Android 10 is the latest update to Android from Google, bringing along a fair few improvements to the mature OS. Most changes and new features on the newest update either get highlighted by Google themselves during Google I/O or are found shortly after public source release. But some notable changes do tend to slip under the radar, surfacing months later when someone accidentally stumbles upon them. That is what is happening in this case because as it turns out, Android 10 allows developers to ask their users if they want to retain app data before their app is uninstalled.

A recent report from AndroidPolice highlighted this functionality. Apps like WhatsApp and ASR Voice Recorder have begun offering Android 10 users an option to retain the data of an app that is about to be uninstalled.

Checking the box shown above retains the app data on the phone despite the app being uninstalled. When you reinstall the app, you will be back to the same state within the app as if you had never uninstalled it in the first place.

Mishaal did a little investigating on what is happening behind the scenes. To understand that, you need to understand first how apps on Android can store files on your device, and there are three main locations for storing files:

  • App-specific Directory in the internal (user-inaccessible without root) storage: These folders are located at /data/data and are not accessible to other apps, or when the user ordinarily plugs their phone into a PC. Apps do not need permission to write files to their own app-specific directory in this location.
  • App-specific Directory in the external (user-accessible) storage: These folders are located at /data/media/{user}/Android/data and are accessible to other apps with the right permission, and to the user when they ordinarily plug in their phone to a computer. Apps do not need permission to write files to their own app-specific directory in this location, but they do need permission to access data from other apps, as mentioned previously.
  • Any directory in the external (user-accessible) storage: Apps can request permission to access the external storage, allowing the app to create whatever folder it needs to on the external storage to store whatever it wants to store here.

Extending WhatsApp's example, WhatsApp's app-specific directory in internal storage resides at /data/data/com.whatsapp; its app-specific directory in external storage resides at /data/media/{user}/Android/data/com.whatsapp; and its custom directory in external storage resides at /data/media/{user}/WhatsApp.

Prior to Android 10 and prior to developers enabling this for their apps, when a user uninstalls an app, its app-specific directories in both internal (/data/data) and external (/data/media) storage are deleted by default. The extra directories on external storage are not deleted, and you need to manually get rid of them or use an app like SD Maid to do it for you.

With Android 10, app developers can add a special flag to their Manifest called "hasFragileUserData" that allows them to ask the user if they want to retain the app's data upon app uninstallation, which is what you see above in the screenshot. When you do uninstall an app with the checkbox toggled to retain the app data, Android will retain and not delete the app-specific directories in the internal and external storage. We confirmed this by checking the directories for apps that have not added the Manifest flag, and those like WhatsApp that have added the Manifest flag.


On the surface, having the option makes sense as users can temporarily uninstall apps and still go back to their previous state upon re-installation, which should save some hassles of backing up and restoring the app on the same device. But, keep in mind that /data/data is not accessible without root, so you as a user cannot use this process for root-free backup and restore across devices. It is also not possible for users to delete the files left behind in /data/data without root; so if you do want to clear the files in the future, you would need to reinstall the app, and then uninstall it without ticking the checkbox. Use this option for too many apps, and you'll likely forget which apps you as a user had chosen. Since this is optional for developers to include, and then optional for users to choose, we do feel this is an overall positive change that gives more power to the end user.