Reproduced Android System Boot screen implementation

Source: Internet
Author: User

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

1, boot Image: Android kernel is based on the standard kernel, Linux is familiar with, especially in the Development Board to transplant the Linux system people know that in the kernel boot process will show a small penguin picture, this is the first stage of the boot image, I believe you know how to modify it. Android1.5 and the above version are canceled the display of this image, specific to see the kernel-related code to know;

2, Boot text: Android system will appear "A N D R O I D" This line of words, I believe everyone is not unfamiliar, then this how to modify it? Related files in the Android system source code (not the Android kernel source) system/core/init/init.c, the following code snippet:

  1. if (Load_565rle_image (Init_image_file)) {
  2. FD = open ("/dev/tty0", o_wronly);
  3. if (FD >= 0) {
  4. const char *msg;
  5. msg = "\ n"
  6. "\ n"
  7. "\ n"
  8. "\ n"
  9. "\ n"
  10. "\ n"
  11. "\ n"//console is cols x lines
  12. "\ n"
  13. "\ n"
  14. "\ n"
  15. "\ n"
  16. "\ n"
  17. "\ n"
  18. "\ n"
  19. "A N D R O I D";
  20. Write (FD, MSG, strlen (msg));
  21. Close (FD);
  22. }
  23. }

Everyone will know how to change it here. But the point to mention here is that the above code fragment has an if statement, is to detect in the file system root directory to implement the boot animation, if not exist, then display this text information instead, so, this stage can realize the display of the picture, and the format of the picture is. rle format. If it doesn't exist, you can choose to have your own text, that is, modify the word "A N d R O I D". You can also choose to display the picture, but you have to provide a reference to the root directory of the file system, the name of the specific picture is defined in the Init.h file:

    1. #define Init_image_file "/initlogo.rle"
    2. int Load_565rle_image (char *file_name);

See the macro definition above everybody understand, as to how to make RLE format, this use some software is good.

3, boot animation: This stage is everyone can see the system during the boot process, www.linuxidc.com display "A n d r o i d" after the words displayed pictures, similar to the progress bar, the picture content is "a n d r o i d" words. How do you change it here?

In fact, this part of the animation is the use of two images displayed, the specific picture file path is: frameworks/base/core/res/assets/images, we look at the know, also know how to modify. But it's not over yet.

And this part of the relevant source files are mainly the following: Frameworks/base/cmds/bootanimation the following several files are, you can look at the contents of the BootAnimation.cpp file, there are the following code snippet:

    1. BOOL Bootanimation::android ()
    2. {
    3. Inittexture (&mandroid[0], massets, "images/android-logo-mask.png");
    4. Inittexture (&mandroid[1], massets, "images/android-logo-shine.png");

This is where the foreground and background images are set to appear.

And then look at the following code:

    1. #define User_bootanimation_file "/data/local/bootanimation.zip"
    2. #define System_bootanimation_file "/system/media/bootanimation.zip"
    3. #define System_encrypted_bootanimation_file "/system/media/bootanimation-encrypted.zip"

Look at the macro name believe that everyone will know, this is the name of the set animation file. Why does it show the picture again and animate it, this Android version is related. Showing two images: foreground and background images are used in the 1.5 version, then changed to set the animation file, that is: Bootanimation.zip, is the zip format, this file contains three content: two directories: Part0 and Part1, a file desc.txt.

Two directories are used to contain the pictures to be displayed, divided into the first and second phases. The rest of the file is to set information about how to display

Examples are as follows:

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 recycling till handset power on finished, I believe you understand! Oh.

You can make your own bootanimation.zip files placed in the appropriate directory, this can replace the default boot interface: Here the right directory is the above macro definition, we all know ^_^!

How to make Bootanimation.zip file? Create two directories and a file as above, then use the software or a command-line package to

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

At this point, the custom boot screen is complete!

Reproduced Android System Boot screen implementation

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.