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!

 

From the column chenlong12580

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.