The startup optimizations for Android are divided into three main parts:
(1) bootloader optimization
(2) Tailoring and optimization of Linux kernel
(3) Tailoring and optimization of Android OS parts
This article focuses on the start-up optimization of the Android OS section, and the noteworthy optimization points are described below:
1. Streamlining preload's classes and resource
As described earlier, since all Android applications are forked from the zygote process, in order to share some class and resourse resources, the zygote process initializes some of the common Java Class and resource files into the process's memory so that other applications fork out and do not have to be loaded again, thus increasing the startup speed of the application.
This process can be streamlined and optimized, you can reduce the loading of some classes and resource, thus speeding up the system boot speed. Documents involved in this process:
Frameworks/base/preload-classes
Frameworks/base/core/res/res/values/arrays.xml
2. Streamline native service and Java service
As described earlier, the launch of the Android OS is essentially a series of local services and Java services, all of which are indirectly provided by the Android system.
Many of these services do not have to be started, depending on the business requirements can be removed some of the documents involved in this process:
System/core/rootdir/init.rc
Frameworks/base/services/java/com/android/server/systemserver.java
3. Thin pre-installed APK file
During the system boot process, all apk files under the system's specified directory are scanned, and the process is time consuming, with fewer pre-installed APK files and faster system startup, so streamlining the pre-installed apk is one of the most important tools for optimizing system startup speed.
To reduce the pre-installed APK file, you need to analyze the system's build file, remove the unwanted APK compilation options, and the files involved in this procedure:
Build/target/product/xxxx.mk
Device/<company>/<product>/xxxx.mk
Vendor/..../xxxx.mk
4. Reduce the log print level of the kernel
Excessive log printing messages can significantly increase the system startup time, the log print level has many adjustments, it is recommended to modify the loglevel in the init.rc file to change the log print level.
System/core/rootdir/init.rc
5. Other means of optimization
Described above are the most commonly used optimization methods, in fact, there are many other ways, briefly listed as follows:
(1) Optimize start animation, reduce frame rate and picture size
(2) compact system, reduce boot.img file size, can significantly reduce the time of loading and decompression boot.img during startup
(3) Pre-create some directories and files instead of creating them during the init process
(4) Other ...
6. Summary
Here I give a foreign master optimization results as a comparison and reference (my optimization results only increased the start speed of 20%, far from achieving his effect):
Ext.: http://ticktick.blog.51cto.com/823160/1664754
Android Kernel Development: System boot Speed optimization-android OS boot optimization (RPM)