Search

Android Boot Time Optimization

November 11, 2020


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 a variety of 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 impacts 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 e.g. 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 to the time when the devices’ home screen is displayed.  Android boot process typically involves steps depicted in the diagram below:

        Android-Boot-Time-Optimization-Process

Depending on the usages 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, 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

  1. Starting Zygote as early as possible
  2. Parallel scanning of apk files
  3. In Zygote, loading only the classes essential for Zygote and loading the rest of the classes on demand
  4. 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 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 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 subsequent optimization achieved:

Component

Improvement

Bootloader

•        Saved 1.6s by removing UART log

•        Saved 0.4s by changing to LZ4 from GZIP

Device kernel

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

•        Saved 0.3s with dm-verity prefetch optimization

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

•        Saved 0.12s to remove CONFIG_CC_OPTIMIZE_FOR_SIZE

I/O tuning

•        Saved 2s on normal boot

•        Saved 25s on first boot

init.*.rc

•        Saved 1.5s by paralleling init commands

•        Saved 0.25s by starting zygote early

•        Saved 0.22s 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 0.2s on by genfscon

 

References:






No Comments




Add Comment

 
 

We use cookies (including third party cookies) to ensure you get the best experience while visiting our website. Click "Accept Cookies" to accept the cookie usage. Click "Cookie Settings" to adjust cookie settings.

Mandatory Cookies

These cookies cannot be disabled

These cookies are necessary for the website to function and cannot be switched off.

Cookies:
  • .ASPXANONYMOUS
  • .DOTNETNUKE
  • __RequestVerificationToken
  • authentication
  • dnn_IsMobile
  • language
  • LastPageId
  • NADevGDPRCookieConsent_portal_0
  • userBrowsingCookie

Analytics Cookies

These cookies allow us to monitor traffic to our website so we can improve the performance and content of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited or how you navigated around our website.

Cookies:
  • _ga
  • _gat
  • _gid

Functional Cookies

These cookies enable the website to provide enhanced functionality and content. They may be set by the website or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.

Cookies:
  • __atuvc
  • euconsent

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.

Cookies:

Not used.