Just because storage space in mobile devices are getting larger doesn’t mean platform makers and app developers can start becoming lazy and careless. In fact, it should even challenge them more to optimize for both space and performance in order to squeeze in as many apps and files in still constrained environments. Fortunately, Google is indeed still on the case of shrinking app sizes. And in Android 8.1, it might shrink less used apps even more, mirroring a step Apple has taken in iOS 11.
iOS 11 introduced a new space-saving feature that “offloaded” infrequently used apps when storage runs low. Technically, it uninstalls those apps but keeps their data around. The app’s icon is grayed out on the home screen and tapping it will redownload and reinstalls the app, which may or may not be large, and simply restores the settings and data associated with the app. Users of the now discontinued Nextbit Robin will be familiar with such a feature.
Android 8.1’s version is a bit less drastic but also less effective in some way. It doesn’t actually uninstall unused apps. It simply doesn’t extract them from their compressed form. This has the advantage of saving you time and bandwidth since you don’t have to download the app again. Unfortunately, that app will still take up some space on storage.
The way this space reduction works is closely tied to how Android works with app packages and, in a way, how Java works. Android packages, or APKs, come in a compressed format that include, among other things, a DEX file that contains compiled versions of the Java classes used by the app. In order to speed up application start up times and performance, these DEX files are extracted from its APK and optimized into an ODEX file that is then placed in a separate location. This means that an app will have a ODEX file in addition to a DEX file inside the APK, both of which take up space when they are used.
A new feature in the Android Open Source Project will mark apps that haven’t been used for days as “inactive”. These apps will not have an ODEX file generated for them. The one minor catch here is that the inactive app does still take up some space, though now less than before. The even bigger catch is that it is a feature meant for a still unreleased Android 8.1 version, and one that OEMs will have to enable themselves.