2018-12-12 13:50:08 2110瀏覽
今天扣丁學堂Android培訓老師給大家分享一下關于Andorid系統(tǒng)實現(xiàn)多種開機動畫和logo切換功能的詳細介紹,目前android開機畫面由三個部分(階段)組成,第一部分在bootloader啟動時顯示(靜態(tài)),第二部分在啟動kernel時顯示(靜態(tài)),第三部分在系統(tǒng)啟動時(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(){ //這是系統(tǒng)本來就有的 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; } } } }
【關注微信公眾號獲取更多學習資料】
查看更多關于“Android開發(fā)技術”的相關資訊>>