This article was reproduced from: http://blog.csdn.net/dddxxxx/article/details/54343976
Reference article: http://blog.csdn.net/a345017062/article/details/6222962, http://bbs.gfan.com/android-146253-1-1.html.
Android system boot display is divided into two processes, the first process from the press power key to frameworks start. The second process starts from frameworks to completion until the Launcher program is started.
The first procedure shows a picture, and the second process shows an animation. Briefly record how to modify these two places in the source code.
1. Modify the boot screen
Find the source kernel\drivers\video\logo\ directory, in this directory you will find Logo_linux_ clut224.ppm file, this is the picture of the boot screen, if you want to replace their own logo, then the logo image (PNG format) into the PPM format, replace this file, while deleting logo_linux_clut224.c logo_linux_ CLUT224.O files, re-compile and burn.
Note: Change the PNG image to. ppm format. First you have a picture that is the same as your screen resolution or less than your screen resolution, such as Logo_linux_clut224.png
① convert PNG images to PNM
PNGTOPNM logo_linux_clut224.png >LOGO_LINUX_CLUT224.PNM
② limit the number of colors in a PNM picture to 224 colors
pnmquant 224 logo_linux_clut224.pnm > logo_linux_clut224_backup.pnm (the name generated here cannot be the same as the former, otherwise it will be an error)
③ convert PNM images into the ppm we need
PNMTOPLAINPNM LOGO_LINUX_CLUT224_BACKUP.PNM >logo_linux_clut224.ppm
2. Modify the Boot animation
In the source code and directory, execute find. -name "Bootanimation.zip" Find the path to the file, you can view the android.mk to understand the specific compilation process, the following first describes how to make the boot animation:
Boot animation is mainly composed of a zip format, compressed package contains a number of PNG format pictures, there is a desc.txt text document, press the desc.txt inside the command, the screen will be in the order of the file name sequential play a picture of Zhang,
It's like playing the original tape film, forming an animation.
Specifically this part of the picture how to come, to see a person like, I prefer to use flash to make their own desired animation and then the frame to export, and then in numerical order to the file number can be.
If you do not flash production is OK, recommend a software: Swf2video Pro, link I do not provide, I can Google search,
This software can be used to export flash frames into PNG format images. In other words, as long as you have the Flash animation you like, you can use this software to capture the screen to do your little stone boot animation. Export of PNG format software in other formats I will not explain, we have the opportunity to search.
Save the PNG images to remember to name them sequentially.
The following is a desc.txt of the commands in this file.
The command format inside the desc.txt is as follows:
480 427 30
P 1 0 part0
P 0 0 Part1
Let me explain it individually:
480 427 means that you start the animation in the screen first with the resolution of how much, be careful not to exceed the resolution of the milestone screen 480x854, otherwise your screen will not be completely displayed.
30 This number represents the number of frames played per second, take my this boot screen to play for example, Part0 folder inside a total of 76 pictures, playing time is 76/30=2.533333 seconds to play, of course, there will be a certain delay in the phone, especially when your picture file relatively large case, The phone wants to play fast, it's not going to get up, card.
The following section is the implementation of the screen repeat position
P 1 (represents play once) 0 (empty instruction) part0 * * This command means that the picture in this Part0 folder is played only once in the name order
P 0 (repeat) 0 (null instruction) part1 * * This instruction indicates that the picture in the Part1 folder will be looped over and over again.
There is also a directive is not commonly used, I will explain it.
P 0 part1 The one in this 10 represents the end of the Part1 folder after a pause, and then loop over again, pause a little, then play, and then pause a bit Repeat, go.
P 1 Part1 Similarly, this sentence represents a pause after playing the picture in the Part1 folder and then continues to scare a command.
If you want to make some special effects, you can take advantage of these commands, and then assign different pictures in each folder to achieve a variety of repetitions and loops.
The picture is ready, desc.txt inside the command ready, you can pack them together compressed into a zip format.
Remember, it is the zip format, not the RAR format. In addition to the compression of the time to note that compression when the compression method to choose storage, or power on the hand when the opportunity is not recognized. Of course not to change bricks, but when the boot will be black no animation until the desktop. Look at the picture:
After renaming the compressed file to Bootanimation.zip, put it in the corresponding directory of the source code to recompile, look at the file under the Out\target\product\la0910\system\media\ path, you can find that has been modified successfully, Re-burn the program to verify.
If you have previously used other non-default boot animations such as red eye, this file will already exist, just overwrite it.
Next, let's look at the relevant code:
The main control code is in the/framework/base/cmds/bootanimation/bootanimation.cpp. This file defines the parsing of the animation display rules, so we can easily define the animation display by the description file contained in the Bootanimation.zip. As long as the boot animation according to certain rules made Bootanimation.zip compression package stored in the system/oem/media/or/system/media/the two directories. When booting, the system detects any one of these two directories under the name of the Bootanimation.zip compression package, will extract and play the inside Custom animation. Detection sequence is the first detection/oem/media/re-detection/system/media/.
In addition, we can also modify the animation in another way, in/frameworks/base/core/res/assets/images/this directory, by default, The animation control code in BootAnimation.cpp uses the two images contained in the variable mandroid as a display animation. All we have to do is to do a good job of replacing the two files in/frameworks/base/core/res/assets/images/, the most important thing is to grasp the resolution of the picture.
If you just want to modify the resolution, you can achieve the appropriate effect by regenerating a new Bootanimation.zip method after modifying the resolution in the image.
In the source code to modify the Android boot screen and animation "Turn"