The amount of available memory on smartphones is usually quite limited, especially with active photo and video. So sometimes you need to clean up the built-in drive to install the OS update or new applications. On modern high-end devices, like Pixel 2 or LG V30 with a basic flash memory capacity of 64 GB, the problem is not so acute, but on cheaper devices it is up-to-date. What does Google offer? A new mechanism in Android 8.1, which clears memory by reducing the size of the application cache.
In the Android Open Source Project (AOSP), the function is described as automatic, which is activated when there is a shortage of flash memory. After the time specified in the Android sysprop parameters in the number of application days that have not been used for a long time will be marked inactive and their priority will decrease. The system considers active the software that was recently launched by the user or worked against the background.
Then in Android 8.1 “inactive” applications are not skipped through the dexopt tool, which optimizes .dex files and creates .odex. As a result, the latter will not take up space in the cache of the Dalvik virtual machine, inside of which Android applications run. The mechanism is described in more detail in the English-language manual of one of the participants of the XDA forum under the pseudonym cyanidekiller.
The solution is quite elegant, but still partial: active applications will still occupy redundant space in order to optimize performance. In addition, the function is part of Android 8.1, so in most modern smartphones it will not appear soon. Moreover, the manufacturer must manually activate it. But it’s nice to know that Google thinks about saving flash memory of mobile devices.