关于如何向android2.1版本定制加入自己的开机动画
frameworks/base/libs/surfaceflinger/SurfaceFlinger.cpp
SurfaceFlinger::readyToRun()
==> property_set("ctl.start", "bootanim"); // start boot animation
system/core/rootdir/init.rc:327:service bootanim /system/bin/bootanimation
frameworks/base/cmds/bootanimation/Android.mk:30:LOCAL_MODULE:= bootanimation
frameworks/base/cmds/bootanimation/BootAnimation.cpp
BootAnimation::readyToRun()
==> 程序会尝试打开/data/local/bootanimation.zip和/system/media/bootanimation.zip文件
如果2个文件都不存在,那么mAndroidAnimation将为true
mAndroidAnimation = false;
status_t err = mZip.open("/data/local/bootanimation.zip");
if (err != NO_ERROR) {
err = mZip.open("/system/media/bootanimation.zip");
if (err != NO_ERROR) {
mAndroidAnimation = true;
}
}
于是最终将在下面threadLoop()函数中
BootAnimation::threadLoop()
if (mAndroidAnimation) {
r = android(); // 执行android字体闪动的图片
} else {
r = movie(); // 执行bootanimation.zip中提供的动画图片
}
==> BootAnimation::android()会加载"images/android-logo-mask.png"和"images/android-logo-shine.png"
==> BootAnimation::movie()会加载bootanimation.zip中的内容
而bootanimation.zip中内容格式为
bootanimation.zip
|-- desc.txt
|-- part0
`-- part1
其中desc.txt为描述文件
120 180 30
p 1 0 part0
p 0 0 part1
120和180分别对应图像宽、高像素数,30表示将按照30fps速度播放图片[gliethttp]
p表示part,也就是含有png图片的目录为part0(part1)
然后part0,part1目录下内容结构为
|-- desc.txt
|-- part0
| `-- bootanim_static_0000.png
`-- part1
|-- bootanim_0000.png
|-- bootanim_0001.png
|-- bootanim_0002.png
|-- bootanim_0003.png
|-- bootanim_0004.png
|-- bootanim_0005.png
|-- bootanim_0006.png
`-- bootanim_0007.png
最后我们来压缩
对于linux下的压缩方法为:(加入-0的意思是indicates no compression (store all files))
luther@gliethttp:~/bootanim$ zip -0 -r ../bootanimation.zip *
adding: desc.txt (stored 0%)
adding: part0/ (stored 0%)
adding: part0/bootanim_static_0000.png (stored 0%)
adding: part1/ (stored 0%)
adding: part1/bootanim_00003.png (stored 0%)
adding: part1/bootanim_00007.png (stored 0%)
adding: part1/bootanim_00002.png (stored 0%)
adding: part1/bootanim_00004.png (stored 0%)
adding: part1/bootanim_00008.png (stored 0%)
adding: part1/bootanim_00001.png (stored 0%)
adding: part1/bootanim_00005.png (stored 0%)
adding: part1/bootanim_00006.png (stored 0%)
对于windows的压缩方法为:
1.“右键”==>“新建”==>Winzip File 然重命名为bootanimation.zip最后打开
2. 将desc.txt,part0,part1拖拽到bootanimation.zip中
3. 选择"Compression / Let me choose the specific compression method / Zip: No Compression"
一切搞定,将bootanimation.zip放到/system/media/或者/data/local/目录下即可[gliethttp]
阅读(2231) | 评论(2) | 转发(0) |