2018-12-12 13:50:08 568浏览
今天扣丁学堂Android培训老师给大家分享一下关于Andorid系统实现多种开机动画和logo切换功能的详细介绍,目前android开机画面由三个部分(阶段)组成,第一部分在bootloader启动时显示(静态),第二部分在启动kernel时显示(静态),第三部分在系统启动时(bootanimation)显示(动画)。
2.在vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk下修改RESOURCE_OBJ_LIST列表,如图:
private void createOrDeleteFile(String str){
String sDir = "/protect_f";
File fDir = new File(sDir);
if (fDir.exists()){
try {
Runtime.getRuntime().exec("chmod 777"+sDir);
} catch (IOException e) {
e.printStackTrace();
}
}
File mFile = new File(sDir,File_moto_logo);
if (mFile.exists()){
mFile.delete();
}
mFile = new File(sDir,File_samsun_logo);
if (mFile.exists()){
mFile.delete();
}
mFile = new File(sDir,"sysBoot_logo_null.dat");
if (mFile.exists()){
mFile.delete();
}
if (str != null){
mFile = new File(sDir,str);
if (!mFile.exists()){
try {
mFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
const char LOGO_ON5_ANI[] = "/protect_f/sysBoot_logo_moto.dat";
const char LOGO_I7_ANI[] = "/protect_f/sysBoot_logo_samsun.dat";
/*
* Show kernel logo when phone boot up
*
*/
void show_kernel_logo(){ //这是系统本来就有的
SLOGD("[libshowlogo: %s %d]show kernel logo, index = 38 \n",__FUNCTION__,__LINE__);
if (error_flag == 0) {
if(open(LOGO_ON5_ANI,O_RDONLY) >= 0){
anim_show_logo(kernel_logo_position+1);
property_set("ani_type","custom");
property_set("animation_num","On5_Ani");
}else if (open(LOGO_I7_ANI,O_RDONLY) >= 0) {
anim_show_logo(kernel_logo_position+2);
property_set("ani_type","custom");
property_set("animation_num","I7_Ani");
}else{
anim_show_logo(kernel_logo_position);
property_set("ani_type","android");
property_set("animtion_num","android");
}
}
}
char anitype[PROPERTY_VALUE_MAX];
char aninum[PROPERTY_VALUE_MAX];
property_get("ani_type",anitype,"");
property_get("animation_num",aninum,"");
if (strcmp("custom",anitype) == 0) {
if (strcmp("On5_Ani", aninum)==0) {
if (access("/system/media/bootanimation_custom.zip", R_OK) == 0) {
if ((zipFile = ZipFileRO::open("/system/media/bootanimation_custom.zip")) != NULL) {
mZip = zipFile;
}
}
}else if (strcmp("I7_Ani", aninum)==0){
if (access("/system/media/bootanimation_s6.zip", R_OK) == 0) {
if ((zipFile = ZipFileRO::open("/system/media/bootanimation_s6.zip")) != NULL) {
mZip = zipFile;
}
}
}
}
【关注微信公众号获取更多学习资料】