search icon
Android Boot Time Optimization

Android Boot Time Optimization

Google launched Android in 2008 as an operating system for Mobile devices. Since then, Android is increasingly being used as an operating system of choice for various devices. Google officially supports mobile, tablet, TV, watch, and Automotive devices; however, Android is being used in lots of other types of embedded devices, including medical devices, toys, infotainment, home gateways, gaming consoles, and so on

With every new release, Google introduces new features in Android. Some of those features impact the boot time of Android devices. Android devices typically take 20 seconds to about a minute to boot. Longer boot time can have a negative impact on user experience. For some of the devices eg. IVI and medical devices, longer boot time may be problematic.

Boot time for an Android device can be defined as the time between powering on a device and when the devices’ home screen is displayed. Android boot process typically involves steps depicted in the diagram below:

android-boot-time-optimization

Depending on the usage of the device, different strategies may be followed to reduce the boot time. Here are three popular approaches for doing the same:

  • Remove unused services
  • Hibernation
  • Standby mode

The first boot optimization technique involves removing the services/applications that are not needed for the target use case of the device. For example, a gaming console may not need location services, or a smart toy without a screen may not need UI-related services. Once redundant services are removed, the boot process can be analyzed using tools like “boot chart” to identify the critical paths where optimization is needed/possible. Based on this analysis, out of the services that are needed for the device use case, only the essential services/application can be started during boot, and the start-up of the rest of the services can be delayed. Processes that hogg CPU/memory during boot time should be identified and optimized. Something as harmless as boot animation may impact boot time if it consumes more CPU/RAM, or it may delay the user’s access to the home screen if animation continues even when the rest of the system is booted. Some of the other possible optimizations are

  • Starting Zygote as early as possible
  • Parallel scanning of apk files
  • In Zygote, loading only the classes essential for Zygote and loading the rest of the classes on demand
  • Record I/O for processes during boot using Google tools and optimizing process with too much I/O

Hibernation based approach involves saving the system memory and hardware registers snapshot in flash storage at the time of device shutdown and restoring it back to memory on power on

The Standby mode approach may be used in IVI systems. In this approach, by doing ignition “off”, the device screen and other peripherals are switched off; however, the device may remain powered on. At the time of ignition “on”, the screen and peripherals of the device are switched on, giving the impression of quick bootup

Google Modifications and Improvement in Optimization

Google has been working on improving the Android boot time. Android provided significant improvement in the timing of the first boot.

The following table lists the modifications done by Google and the subsequent optimization achieved:

Component Improvement
Bootloader • Saved 16s by removing UART log

• Saved 04s by changing to LZ4 from GZIP

Device kernel • Saved 03s by removing unused kernel configs and reducing driver size

• Saved 03s with dm-verity prefetch optimization

• Saved 015s to remove unnecessary wait/test in driver

• Saved 012s to remove CONFIG_CC_OPTIMIZE_FOR_SIZE

I/O tuning • Saved 2s on normal boot

• Saved 25s on first boot

init*rc • Saved 15s by paralleling init commands

• Saved 025s by starting zygote early

• Saved 022s by cpuset tune

Boot animation Started 2s earlier on boot without fsck triggered, much bigger on boot with fsck triggered boot

Saved 5s on Pixel XL with the immediate shutdown of the boot animation

SELinux policy Saved 02s on by genfscon
X
Subscribe Form
X
Subscribe Form

More Blogs

×

Enquire Now


We will treat any information you submit with us as confidential

arrow back top