1、desc.txt文件参数传解析
The system selects a boot animation zipfile from the following locations, in order:
/system/media/bootanimation-encrypted.zip (if getprop("vold.decrypt") = '1')
/system/media/bootanimation.zip
/oem/media/bootanimation.zip
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 //动画结束后,停留几帧,0就是不停
- PATH: directory in which to find the frames for this part (e.g.
part0
) //地址 - RGBHEX: (OPTIONAL) a background color, specified as
#RRGGBB
//(可选)RGB 背景颜色参数 - CLOCK: (OPTIONAL) the y-coordinate at which to draw the current time (for watches)//(可选)坐标参数 在哪个位置
There is also a special TYPE, $SYSTEM
, that loads /system/media/bootanimation.zip
and plays that.
desc.txt文件示例->
1080 360 60
c 1 0 part0 #ffee00 c c
c 0 0 part1 #ffee00 c c
c 1 0 part2 #ffee00 c c
c 1 1 part3 #ffee00 c c
c 1 0 part4 #ffee00 c c
2、操作流程
- 1、使用命令行(Linux下以存储方式压缩成zip文件)生成bootanimation.zip。
命令:zip -r -X -Z store bootanimation part*/* desc.txt
-
2、将制作的bootanimation.zip拷贝到…\frameworks\base\cmds\bootanimation目录下
-
3、在Android.mk下
4、编译