Android performance optimization

Follow the instructions in this section to ensure your Android devices minimize resource use and optimize performance. Also take advantage of the many tests and tools described in Evaluating Performance as part of your work getting the most out of Android.

APK caching

This document describes the design of an APK caching solution for rapid installation of preloaded apps on a device that supports A/B partitions. OEMs can place preloads and popular apps in the APK cache stored in the mostly empty B partition on new A/B-partitioned devices without affecting any user-facing data space.

Boot times

Android 8.0 allows for reduced boot times by supporting several improvements across a range of components. This document provides partner guidance for improving boot times for specific Android devices.

Health

Android 9 includes android.hardware.health HAL 2.0, a major version upgrade from health@1.0 HAL. This new HAL offers cleaner separation between framework and vendor code, greater degrees of freedom for vendor customization in health information reports, and more device health information than just battery.

Low memory killer

The userspace lmkd process implements the same functionality but with already existing kernel mechanisms to detect and estimate memory pressure. It uses vmpressure events generated by the kernel to get notifications about memory pressure levels.

Profile-guided optimization

The Android build system supports using Clang's profile-guided optimization (PGO) on native Android modules that have blueprint build rules.

R8 code and resource optimization

The Android build system uses the R8 compiler to shrink, optimize, and strip unused code and resources from DEX targets (android_app, android_test, and installable java_library modules). On static libraries (android_library and static java_library), Soong uses the optimize block to attach and export consumer keep rules.

For more information about configuring R8 optimization and keep rules, see Optimize platform code and resources with R8.

Task snapshots

Task snapshots is infrastructure introduced in Android 8.0 that combines screenshots for Recents Thumbnails as well as Saved Surfaces from Window Manager. Recents Thumbnails represent the last state of a task in the Recents view.

Write-ahead logging

Android 9 introduces a special mode of SQLiteDatabase called Compatibility WAL (write-ahead logging) that allows a database to use journal_mode=WAL while preserving the behavior of keeping a maximum of one connection per database.

NPU manager

Android 17 and higher supports the Neural Processing Unit (NPU) Manager, which coordinates resource allocations, prioritizes workloads, and tracks execution status to maintain system stability and optimize device performance.