Android system boot screen Modification

Source: Internet
Author: User

The boot screen of the Android system is divided into the following three phases:

1. Boot Image: the android kernel is based on the standard kernel and familiar with Linux, especially those who have transplanted the Linux system on the Development Board will know that a picture of a penguin will be displayed during the kernel boot process. This is the first-stage boot image, I believe everyone knows how to modify it. Android1.5 and later versions cancel the display of this image. You can see the specific kernel-related code;

2. Boot text: the Android system opened the opportunity to see the "a n d r o I d" line. I believe everyone is familiar with it. How can I modify this? The relevant files are in the Android system source code (not the android kernel source code) system/CORE/init. C, the following code snippet:


[CPP] If (load_565rle_image (init_image_file )){
FD = open ("/dev/tty0", o_wronly );
If (FD> = 0 ){
Const char * MSG;
MSG = "\ n"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N" // console is 40 Cols x 30 lines
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"A n d r o I d ";
Write (FD, MSG, strlen (MSG ));
Close (FD );
}
}
If (load_565rle_image (init_image_file )){
FD = open ("/dev/tty0", o_wronly );
If (FD> = 0 ){
Const char * MSG;
MSG = "\ n"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N" // console is 40 Cols x 30 lines
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"\ N"
"A n d r o I d ";
Write (FD, MSG, strlen (MSG ));
Close (FD );
}
} You will know how to modify it here. However, the above code snippet has an if statement that first checks whether there is a boot animation to be implemented under the root directory of the file system. If not, in this case, the text information is displayed instead. Therefore, the image can be displayed at this stage, and the image format is. rle format. If it does not exist, the text will be displayed, so you can choose your own text, that is, modify the words "a n d r o I D. You can also select to display the image, but you must provide the image extraction in the root directory of the file system. The specific image name is defined in the init. h file:


[CPP] <span style = "font-size: 16px;"> # define init_image_file "/initlogo. RLE"
 
Int load_565rle_image (char * file_name); </span>
<Span style = "font-size: 16px;"> # define init_image_file "/initlogo. RLE"

Int load_565rle_image (char * file_name); </span> you can understand the macro definition above. As for how to create the RLE format, use some software. Www.2cto.com

3. Boot Animation: in this phase, you can see the pictures displayed after the words "a n d r o I d" are displayed during system startup, similar to the progress bar, the image content is also "a n d r o I D. How can I modify it here?

In fact, this part of the animation is displayed using two images. The specific path of the image file is: Frameworks/base/CORE/RES/assets/images. You can see it later, you will know how to modify it. But not yet.

The source code files related to this Part are mainly as follows: several files under frameworks/base/cmds/bootanimation are available. You can check bootanimation. the content of the CPP file contains the following code snippets:


[Java] <span style = "font-size: 16px;"> bool bootanimation: Android ()
{
Inittexture (& mandroid [0], massets, "images/android-logo-mask.png ");
Inittexture (& mandroid [1], massets, "images/android-logo-shine.png"); </span>
<Span style = "font-size: 16px;"> bool bootanimation: Android ()
{
Inittexture (& mandroid [0], massets, "images/android-logo-mask.png ");
Inittexture (& mandroid [1], massets, "images/android-logo-shine.png"); </span> This is set to display foreground and background pictures.

See the following code:


[CPP] <span style = "font-size: 16px;"> # define user_bootanimation_file "/data/local/bootanimation.zip"
# Define system_bootanimation_file "/system/Media/bootanimation.zip"
# Define system_encrypted_bootanimation_file "/system/Media/bootanimation-encrypted.zip" </span>
<Span style = "font-size: 16px;"> # define user_bootanimation_file "/data/local/bootanimation.zip"
# Define system_bootanimation_file "/system/Media/bootanimation.zip"
# Define system_encrypted_bootanimation_file "/system/Media/bootanimation-encrypted.zip" </span> to see the macro name I believe you will know, this is set the name of the animation file. Why does it show images and set animated display? This Android version is related. Two images are displayed: the foreground and background images are used in version 1.5, and later changed to the animation file bootanimation.zip, which is in the ZIP format and contains three content: two directories: part0and Part1: desc.txt.

The two directories are used to contain the images to be displayed. They are divided into the first and second stages. The remaining files are used to set information about how to display them:

Example:

480 800 15
P 1 0 part0
P 0 0 Part1


The specific meanings are as follows:

480 -- width of the image, 800 -- height of the image, 15 -- frames of second
P 1, display one time
P 0, display reconfiguring till handset power on finished, I believe everyone understands! Haha.


You can make a simple bootanimation.zip file and place it in the appropriate Directory, which can replace the default boot interface: the appropriate directory here is the macro definition above. Everyone knows ^_^!

What about producer bootanimation.zip? Create two directories and one file as above, and then use the software or command line package.

Zip-r-0 bootanimation.zip part0 Part1 desc.txt


Now, the custom boot screen is complete!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.