Android 12 may let you hibernate unused apps to free up space
It may be hard to believe, but we’re likely only a little over a month away from the release of the first Android 12 Developer Preview. After all, the first Android 11 Developer Preview was released back in February of 2020! We’ve been scouring the Android Open Source Project (AOSP) Gerrit for hints of new features coming to the next version of Android, and recently we’ve spotted evidence that Google is working on an app hibernation feature for Android 12.
Based on a couple of code changes submitted to AOSP, Google is adding a new app hibernation system service “that manages app hibernation state, a state apps can enter that means they are not being actively used and can be optimized for storage.”
Unfortunately, we don’t have any more details about this feature. For example, we don’t know how apps can enter this state. Is it automatically determined based on app usage statistics? Can users manually choose to force apps to hibernate? We also don’t know how apps will be optimized for storage, nor do we know how the OS will tell the user which apps have been hibernated.
Our guess is that app hibernation will be automatic like the auto-revoking permissions feature introduced in Android 11 and that optimization involves compression of the APK and other app resources, but we won’t know for sure until more code changes are submitted. We also don’t know for sure if this feature will actually make its way to Android 12 as the commits haven’t been merged yet. There’s still time for new features like this to be added, but the window is closing soon. Once we learn more about this app hibernation service or any other features coming to Android 12, we’ll share that information.
Thanks to XDA Recognized Developer luca020400 for the tip!
Update 1: Clearing App Cache
While the commits for the app hibernation feature have not yet been merged — meaning we still don’t know for sure if it’ll end up in Android 12 — we have now learned a bit more information about how the feature works. According to the code submitted in a new commit (once again spotted by XDA Recognized Developer luca020400), the app hibernation feature will automatically clear an app’s cache files. The amount of storage that will be freed up depends on the app in question — video streaming and messaging apps can cache hundreds of megabytes worth of data — but this is only one part of the app hibernation feature. In a comment, Google devs hint at more potential storage savings via “package level hibernation.” This could refer to compressing the app and its resources or to other actions to reduce the space taken up by an app’s installation.
Update 2: Deleting Compilation Artifacts
In a new commit submitted to the AOSP Gerrit late last week, Google engineers revealed how Android’s app hibernation feature will optimize storage space at the package/APK level. Comments left in the code changes reveal that, when an app is hibernated for all users, its compilation artifact files (.vdex/.odex) will be deleted. According to Google, vdex files contain the uncompressed DEX code of an APK, while odex files contain the ahead-of-time compiled code for methods in the APK. The amount of space that will be freed up by deleting these files likely won’t be a lot, especially when compared to the file sizes of cached images or videos. However, on lower-end devices with small amounts of internal storage, saving dozens of megabytes will free up space for dozens of additional photos.