亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android 系統(tǒng)實(shí)現(xiàn)多種開(kāi)機(jī)動(dòng)畫(huà)和logo切換功能

 更新時(shí)間:2022年06月29日 17:05:39   作者:mikao12  
這篇文章主要介紹了android 系統(tǒng)實(shí)現(xiàn)多種開(kāi)機(jī)動(dòng)畫(huà)和logo切換功能,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

前言

基于mtk6580,添加多l(xiāng)ogo和開(kāi)關(guān)機(jī)動(dòng)畫(huà)切換

描述

目前android開(kāi)機(jī)畫(huà)面由三個(gè)部分(階段)組成,第一部分在bootloader啟動(dòng)時(shí)顯示(靜態(tài)),第二部分在啟動(dòng)kernel時(shí)顯示(靜態(tài)),第三部分在系統(tǒng)啟動(dòng)時(shí)(bootanimation)顯示(動(dòng)畫(huà))。

添加資源

1.在device/tangxun/tx6580_weg_m/ProjectConfig.mk,找到BOOT_LOGO=這項(xiàng),記住這項(xiàng)內(nèi)容(如hd720,),在vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/目錄下找到BOOT_LOGO=對(duì)應(yīng)的文件夾把你的圖片放進(jìn)去,圖片我是這樣命名的hd720_kernel_i7.bmp.(如果你只是替換的話更換hd720_kernel.bmp和hd720_uboot.bmp這兩張圖片即可,新圖片的名字需與舊圖片一致)

2.在vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk下修改RESOURCE_OBJ_LIST列表,如圖:

在這里插入圖片描述

最后兩項(xiàng)就是我添加的

3.同目錄下update文件中添加

在這里插入圖片描述

添加標(biāo)識(shí)區(qū)分不同logo

思路:首先我們添加的標(biāo)識(shí),不能被輕易清除,包括恢復(fù)出廠設(shè)置情況下。所以我選擇在protect_f分區(qū)下創(chuàng)建空文件的方式,在show logo的時(shí)候判斷相應(yīng)文件是否存在,來(lái)展示不同的logo和動(dòng)畫(huà)。

1.選擇一種要展示的logo和動(dòng)畫(huà),在protect_f分區(qū)下創(chuàng)建.dat后綴的文件,刪除其他類(lèi)型動(dòng)畫(huà)在protect_f分區(qū)下的相應(yīng)文件

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();
    }
   }
  }
 }

2.在vendor/mediatek/proprietary/external/libshowlogo/charging_animation.cpp文件中,添加logo切換

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)本來(lái)就有的
 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");
  }
 }
}

3.framworks/base/cmds/bootanimation/BootAnimation.cpp文件中,在void BootAnimation::initBootanimationZip()方法中添加切換動(dòng)畫(huà)

 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;
    }
   }
  }
 }
 if (zipFile == NULL) {

總結(jié)

以上所述是小編給大家介紹的Andorid 系統(tǒng)實(shí)現(xiàn)多種開(kāi)機(jī)動(dòng)畫(huà)和logo切換功能,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論