android8.1开机动画zip包分析

一般来说一个bootanimation.zip包中包含这些

 准备

desc.txt 文件的写法  

AOSP/frameworks/base/cmds/bootanimation/FORMAT.md

## zipfile layout

The `bootanimation.zip` archive file includes:

    desc.txt - a text file
    part0  \
    part1   \  directories full of PNG frames
    ...     /
    partN  /

## desc.txt format

The first line defines the general parameters of the animation:

    WIDTH HEIGHT FPS

  * **WIDTH:** animation width (pixels)
  * **HEIGHT:** animation height (pixels)
  * **FPS:** frames per second, e.g. 60

It is followed by a number of rows of the form:

    TYPE COUNT PAUSE PATH [#RGBHEX CLOCK]

  * **TYPE:** a single char indicating what type of animation segment this is:
      + `p` -- this part will play unless interrupted by the end of the boot
      + `c` -- this part will play to completion, no matter what
  * **COUNT:** how many times to play the animation, or 0 to loop forever until boot is complete
  * **PAUSE:** number of FRAMES to delay after this part ends
  * **PATH:** directory in which to find the frames for this part (e.g. `part0`)
  * **RGBHEX:** _(OPTIONAL)_ a background color, specified as `#RRGGBB`
  * **CLOCK:** _(OPTIONAL)_ the y-coordinate at which to draw the current time (for watches)

上述的意思是desc.txt 文件

第一行    宽、高、FPS 

第二行    TYPE    p:加载完成打断       c:执行完

               COUNT  循环几次 0无限循环

               PAUSE     part之间的间隔

               PATH      地址

               RGBHEX      颜色

               CLOCK         时钟坐标     

编写完成后将文件打包   这里要注意如果是在windows环境下  压缩zip一定要以存储的方式压缩

如果是linux环境下这里提供一个打包命令

zip -r -X -Z store bootanimation part*/* desc.txt

打包好之后将zip文件放置在AOSP/frameworks/base/cmds/bootanimation路径下

然后修改该路径下的mk  加一句代码

此代码的意思就是在该路径下找到bootanimation.zip 然后把它复制到out 对应的/system/media/路径下

$(shell cp $(LOCAL_PATH)/bootanimation.zip $(ANDROID_PRODUCT_OUT)/system/media/bootanimation.zip)

编译运行

你可能感兴趣的:(android)