Storage space on smartphones tends to be at a premium, and it’s frustrating to have to constantly clear space for application updates, new applications, and even over-the-air (OTA) updates. It’s becoming less of a problem on high-end devices such as the Pixel 2 and LG V30, which offer a base 64GB of storage, but it’s still an issue on low-end and midrange device without as much built-in memory. Google’s solution? A new mechanism in Android 8.1 that frees up space by reducing application cache sizes.
An October 31 commit in the Android Open Source Project (AOSP) framework describes a space-saving feature that triggers automatically when a device is running low on space. After a length of time specified by Android’s sysprop pm.dexopt.unopt_after_inactive_days field, applications that haven’t been used in a while are marked as inactive by Android and downgraded. (Android considers applications active if they were recently in the foreground, or when they are in background while also being used by other packages.)
Here’s how it works: In Android 8.1, applications marked “inactive” aren’t run through dexopt, the Android tool that optimizes .dex files to produce an .odex file. (If you’re confused about what those terms mean, check out XDA Member cyanidekiller‘s excellent guide.) As a result, they don’t take up space in the Dalvik compiler’s cache.
It’s an elegant solution, but not a silver bullet — active applications take up the same amount of install space. And because the feature ships with Android 8.1 and most OEMs are beta-testing Android 8.0 right now, it might be a while before devices take advantage. One last wrinkle? OEMs have to manually enable the feature.
Still, it’s comforting to know that someday, you might finally be able to ditch the microSD card you’ve been forced to carry around.