本篇文章主要介绍 Android 开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:
Android 开机时间信息Android 开机大致流程Android 开机震动添加方法(MTK 、展讯平台)Android 开机动画、铃声、LogoAndroid 开机动画预制规范要求1. Android 开机时间信息Android 开机时间信息保存在/proc/bootprof 文件中
MTK 平台开机时间信息如下:
----------------------------------------// 开机时间,单位:毫秒// 查看 /proc/bootprof 文件0 BOOT PROF (unit:msec)---------------------------------------- 3642 : preloader 3128 : lk (Start->Show logo: 2431)---------------------------------------- 247.401615 : ON 345.068846 : 1-swapper/0 : initcall: of_init 15.492693ms 371.293846 : 1-swapper/0 : initcall: wakeup_sources_debugfs_init 17.047077ms 413.275308 : 1-swapper/0 : initcall: init_mtk_governor 24.786154ms 457.631385 : 1-swapper/0 : initcall: mt_power_management_init 29.760539ms 494.448077 : 1-swapper/0 : initcall: arm64_device_init 23.147231ms 524.516923 : 1-swapper/0 : initcall: pm_sysrq_init 15.929154ms 558.130462 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtk_cmdq(ffffffc000f4f9a0) 15.886000ms 560.119077 : 1-swapper/0 : initcall: cmdq_init 18.013385ms 596.185846 : 1-swapper/0 : initcall: cfg80211_init 16.570923ms 625.054385 : 1-swapper/0 : initcall: event_trace_init 24.519000ms 657.458847 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-pmic(ffffffc000f43728) 30.178077ms 660.658154 : 1-swapper/0 : initcall: pmic_mt_init 33.671231ms 741.868924 : 1-swapper/0 : initcall: populate_rootfs 59.421461ms 788.594001 : 1-swapper/0 : initcall: emi_mpu_mod_init 16.172000ms 834.455078 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-gpufreq(ffffffc000f3bed0) 35.099077ms 836.039232 : 1-swapper/0 : initcall: _mt_gpufreq_init 37.713000ms 1031.716771 : 1-swapper/0 : probe: probe=i2c_device_probe drv=bq24157(ffffffc000f489f8) 139.402385ms 1035.834771 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-i2c(ffffffc000f41248) 147.644154ms 1059.699155 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-i2c(ffffffc000f41248) 22.310308ms 1068.703925 : 1-swapper/0 : initcall: mt_i2c_init 188.540693ms 9135.233944 : 1-swapper/0 : probe: probe=i2c_device_probe drv=mt6311(ffffffc000f48588) 8040.412481ms 9137.046328 : 1-swapper/0 : initcall: mt6311_init 8042.290019ms 9174.201252 : 1-swapper/0 : probe: probe=platform_drv_probe drv=musb-hdrc(ffffffc000f49398) 34.715769ms 9174.256328 : 1-swapper/0 : initcall: musb_init 36.110693ms 9314.109098 : 1-swapper/0 : probe: probe=mtkfb_probe drv=mtkfb(ffffffc000f59048) 136.957770ms 9315.811406 : 1-swapper/0 : initcall: mtkfb_init 138.848308ms 9392.238637 : 1-swapper/0 : initcall: BTIF_init 30.636923ms 9550.038560 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtk-msdc(ffffffc000f87d98) 78.343461ms 9599.435022 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtk-msdc(ffffffc000f87d98) 47.790000ms 9600.301022 : 1-swapper/0 : initcall: mt_msdc_init 128.833462ms 10270.174485 : 1-swapper/0 : probe: probe=i2c_device_probe drv=AP3426(ffffffc000f3fc18) 627.960386ms 10273.644870 : 1-swapper/0 : initcall: alsps_init 631.510309ms 10339.933177 : 1-swapper/0 : probe: probe=i2c_device_probe drv=BMA222(ffffffc000f400b0) 64.251307ms 10367.465639 : 1-swapper/0 : probe: probe=i2c_device_probe drv=KXTJ2_1009(ffffffc000f40340) 22.436462ms 10371.050716 : 1-swapper/0 : initcall: acc_init 96.290001ms 10392.674947 : 1-swapper/0 : probe: probe=i2c_device_probe drv=ITG-1010A(ffffffc000f409a8) 20.424462ms 10399.592485 : 1-swapper/0 : initcall: gyro_init 27.484692ms 10419.422024 : 1-swapper/0 : probe: probe=i2c_device_probe drv=akm09911(ffffffc000f40f10) 18.620385ms 10425.851870 : 1-swapper/0 : initcall: mag_init 25.190615ms 10479.256793 : 1-swapper/0 : initcall: init 43.196308ms 10742.598717 : 102-kworker/u8:1 : probe: probe=i2c_device_probe drv=fts_ts(ffffffc000f805a0) 261.157769ms 10758.893255 : 102-kworker/u8:1 : probe: probe=platform_drv_probe drv=mtk-tpd(ffffffc000f7ef40) 277.659001ms 10776.443255 : 1-swapper/0 : probe: probe=platform_drv_probe drv=battery-dts(ffffffc000f83c88) 15.676384ms 10787.399563 : 1-swapper/0 : initcall: battery_init 306.180693ms // Kernel 初始化时间 10822.916717 : 1-swapper/0 : Kernel_init_done 12234.037259 : 1-init : INIT:early-init 12686.109337 : 1-init : INIT:late-init // 挂载分区时间 12689.421183 : 1-init : INIT:Mount_START 13188.776876 : 1-init : INIT:Mount_END 13391.859800 : 1-init : INIT:post-fs 13696.683416 : 1-init : INIT:post-fs-data 13735.621493 : 1-init : post-fs-data: on modem start 14456.381110 : 302-ccci_mdinit : ccci_md3: md_init srv start 14487.479110 : 301-ccci_mdinit : ccci_md1: md_init srv start 14495.107418 : 1-init : INIT:boot 14529.856803 : 301-ccci_mdinit : ccci_md1: init 14739.916111 : 1-init : USB ready 14851.426342 : 328-vold : vold:decrypt_master_key:START 15067.036804 : 309-wmt_loader : probe: probe=platform_drv_probe drv=mtk_wmt(ffffffbffc077af8) 78.718769ms //预加载类所消耗时间,此时开始播放开机动画 15512.853420 : 360-SurfaceFlinger: : BOOT_Animation:START 15924.857652 : 328-vold : vold:decrypt_master_key:END 16848.649731 : 328-vold : vold:cryptfs_restart_internal:START 17057.320347 : 1-init : INIT:vold.decrypt=trigger_post_fs_data 17220.311578 : 1-init : INIT:post-fs-data 17283.306271 : 1-init : post-fs-data: on modem start 18290.475350 : 328-vold : vold:cryptfs_restart_internal:END 18635.030659 : 407-zygote64 : boot_progress_start 19415.810814 : 1-init : INIT:vold.decrypt=trigger_restart_framework 20770.849587 : 407-main : Zygote:Preload Start 21101.172588 : 408-main : Zygote:Preload End 21368.740358 : 301-ccci_mdinit : ccci_md1: decpyt ready 21381.859281 : 301-ccci_mdinit : ccci_md1: reset 21519.875358 : 301-ccci_mdinit : ccci_md1: bootup 22232.826513 : 407-main : Zygote:Preload 4715 classes in 1382ms 22370.672206 : 407-main : Zygote:Preload 64 obtain resources in 133ms 22391.764437 : 407-main : Zygote:Preload 41 resources in 20ms 22701.430976 : 301-ccci_mdinit : ccci_md1: ready 22870.447053 : 407-main : Zygote:Preload End 24925.980904 : 731-system_server : Android:SysServerInit_START 25700.308522 : 60-kworker/1:1 : USB configured //扫描手机安装包 27665.097911 : 731-system_server : Android:PackageManagerService_Start 31393.116074 : 731-system_server : Android:PMS_scan_START 31397.464381 : 731-system_server : Android:PMS_scan_data:/vendor/overlay 31434.082151 : 731-system_server : Android:PMS_scan_data:/system/framework 31537.897074 : 731-system_server : Android:PMS_scan_data:/system/priv-app 32270.121153 : 731-system_server : Android:PMS_scan_data:/system/app 32853.140154 : 731-system_server : Android:PMS_scan_data:/vendor/app 32915.019231 : 731-system_server : Android:PMS_scan_data:/system/presetapp 32940.047077 : 731-system_server : Android:PMS_scan_data:/data/app 33260.865386 : 731-system_server : Android:PMS_scan_END 33654.078541 : 731-system_server : PMS:reconcileAppsDataLI 34782.509390 : 731-system_server : Android:PMS_READY //AP端 初始化时间 36525.345624 : 408-main : Zygote:Preload 4715 classes in 935ms 36631.159548 : 408-main : Zygote:Preload 64 obtain resources in 102ms 36653.562702 : 408-main : Zygote:Preload 41 resources in 21ms 42223.695407 : 731-system_server : AMS:systemReady 42274.343715 : 731-system_server : AMS:AMS_READY //初始化输入法、systemUI 、网络、三方APK、多媒体、Dialer、Settings 42465.231177 : 731-system_server : AP_Init:[service]:[com.google.android.inputmethod.latin]:[com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME]:pid:1208 42511.370331 : 731-system_server : AP_Init:[service]:[com.android.systemui]:[com.android.systemui/.ImageWallpaper]:pid:1224:(PersistAP) 42982.213178 : 1011-system-server-i : AP_Init:[]:[WebViewLoader-armeabi-v7a]:pid:1261 43108.493640 : 1011-system-server-i : AP_Init:[]:[WebViewLoader-arm64-v8a]:pid:1280 43123.569563 : 731-system_server : SystemServer:NetworkStatsService systemReady 43833.242873 : 731-system_server : SystemServer:ConnectivityService systemReady 44152.714104 : 731-system_server : SystemServer:NetworkPolicyManagerServ systemReady 45144.738645 : 731-system_server : SystemServer:PhaseThirdPartyAppsCanStart 45191.636568 : 731-system_server : AP_Init:[added application]:[com.mediatek.ims]:[com.mediatek.ims]:pid:1357:(PersistAP) 45228.915953 : 731-system_server : AP_Init:[added application]:[com.android.phone]:[com.android.phone]:pid:1369:(PersistAP) 45453.339338 : 731-system_server : AP_Init:[activity]:[com.android.settings]:[com.android.settings/.FallbackHome]:pid:1387 45503.338184 : 731-system_server : Android:SysServerInit_END 46362.475494 : 1013-ActivityManager : AMS:ENABLE_SCREEN 52763.733971 : 1040-Binder:294_4 : BOOT_Animation:END //开机动画结束 52764.718663 : OFF--------------------------------------------------------------------------------// 开机时间,单位:毫秒// 查看 /proc/bootprof 文件0 BOOT PROF (unit:msec)---------------------------------------- 3642 : preloader 3128 : lk (Start->Show logo: 2431)---------------------------------------- 247.401615 : ON 345.068846 : 1-swapper/0 : initcall: of_init 15.492693ms 371.293846 : 1-swapper/0 : initcall: wakeup_sources_debugfs_init 17.047077ms 413.275308 : 1-swapper/0 : initcall: init_mtk_governor 24.786154ms 457.631385 : 1-swapper/0 : initcall: mt_power_management_init 29.760539ms 494.448077 : 1-swapper/0 : initcall: arm64_device_init 23.147231ms 524.516923 : 1-swapper/0 : initcall: pm_sysrq_init 15.929154ms 558.130462 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtk_cmdq(ffffffc000f4f9a0) 15.886000ms 560.119077 : 1-swapper/0 : initcall: cmdq_init 18.013385ms 596.185846 : 1-swapper/0 : initcall: cfg80211_init 16.570923ms 625.054385 : 1-swapper/0 : initcall: event_trace_init 24.519000ms 657.458847 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-pmic(ffffffc000f43728) 30.178077ms 660.658154 : 1-swapper/0 : initcall: pmic_mt_init 33.671231ms 741.868924 : 1-swapper/0 : initcall: populate_rootfs 59.421461ms 788.594001 : 1-swapper/0 : initcall: emi_mpu_mod_init 16.172000ms 834.455078 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-gpufreq(ffffffc000f3bed0) 35.099077ms 836.039232 : 1-swapper/0 : initcall: _mt_gpufreq_init 37.713000ms 1031.716771 : 1-swapper/0 : probe: probe=i2c_device_probe drv=bq24157(ffffffc000f489f8) 139.402385ms 1035.834771 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-i2c(ffffffc000f41248) 147.644154ms 1059.699155 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mt-i2c(ffffffc000f41248) 22.310308ms 1068.703925 : 1-swapper/0 : initcall: mt_i2c_init 188.540693ms 9135.233944 : 1-swapper/0 : probe: probe=i2c_device_probe drv=mt6311(ffffffc000f48588) 8040.412481ms 9137.046328 : 1-swapper/0 : initcall: mt6311_init 8042.290019ms 9174.201252 : 1-swapper/0 : probe: probe=platform_drv_probe drv=musb-hdrc(ffffffc000f49398) 34.715769ms 9174.256328 : 1-swapper/0 : initcall: musb_init 36.110693ms 9314.109098 : 1-swapper/0 : probe: probe=mtkfb_probe drv=mtkfb(ffffffc000f59048) 136.957770ms 9315.811406 : 1-swapper/0 : initcall: mtkfb_init 138.848308ms 9392.238637 : 1-swapper/0 : initcall: BTIF_init 30.636923ms 9550.038560 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtk-msdc(ffffffc000f87d98) 78.343461ms 9599.435022 : 1-swapper/0 : probe: probe=platform_drv_probe drv=mtk-msdc(ffffffc000f87d98) 47.790000ms 9600.301022 : 1-swapper/0 : initcall: mt_msdc_init 128.833462ms 10270.174485 : 1-swapper/0 : probe: probe=i2c_device_probe drv=AP3426(ffffffc000f3fc18) 627.960386ms 10273.644870 : 1-swapper/0 : initcall: alsps_init 631.510309ms 10339.933177 : 1-swapper/0 : probe: probe=i2c_device_probe drv=BMA222(ffffffc000f400b0) 64.251307ms 10367.465639 : 1-swapper/0 : probe: probe=i2c_device_probe drv=KXTJ2_1009(ffffffc000f40340) 22.436462ms 10371.050716 : 1-swapper/0 : initcall: acc_init 96.290001ms 10392.674947 : 1-swapper/0 : probe: probe=i2c_device_probe drv=ITG-1010A(ffffffc000f409a8) 20.424462ms 10399.592485 : 1-swapper/0 : initcall: gyro_init 27.484692ms 10419.422024 : 1-swapper/0 : probe: probe=i2c_device_probe drv=akm09911(ffffffc000f40f10) 18.620385ms 10425.851870 : 1-swapper/0 : initcall: mag_init 25.190615ms 10479.256793 : 1-swapper/0 : initcall: init 43.196308ms 10742.598717 : 102-kworker/u8:1 : probe: probe=i2c_device_probe drv=fts_ts(ffffffc000f805a0) 261.157769ms 10758.893255 : 102-kworker/u8:1 : probe: probe=platform_drv_probe drv=mtk-tpd(ffffffc000f7ef40) 277.659001ms 10776.443255 : 1-swapper/0 : probe: probe=platform_drv_probe drv=battery-dts(ffffffc000f83c88) 15.676384ms 10787.399563 : 1-swapper/0 : initcall: battery_init 306.180693ms // Kernel 初始化时间 10822.916717 : 1-swapper/0 : Kernel_init_done 12234.037259 : 1-init : INIT:early-init 12686.109337 : 1-init : INIT:late-init // 挂载分区时间 12689.421183 : 1-init : INIT:Mount_START 13188.776876 : 1-init : INIT:Mount_END 13391.859800 : 1-init : INIT:post-fs 13696.683416 : 1-init : INIT:post-fs-data 13735.621493 : 1-init : post-fs-data: on modem start 14456.381110 : 302-ccci_mdinit : ccci_md3: md_init srv start 14487.479110 : 301-ccci_mdinit : ccci_md1: md_init srv start 14495.107418 : 1-init : INIT:boot 14529.856803 : 301-ccci_mdinit : ccci_md1: init 14739.916111 : 1-init : USB ready 14851.426342 : 328-vold : vold:decrypt_master_key:START 15067.036804 : 309-wmt_loader : probe: probe=platform_drv_probe drv=mtk_wmt(ffffffbffc077af8) 78.718769ms //预加载类所消耗时间,此时开始播放开机动画 15512.853420 : 360-SurfaceFlinger: : BOOT_Animation:START 15924.857652 : 328-vold : vold:decrypt_master_key:END 16848.649731 : 328-vold : vold:cryptfs_restart_internal:START 17057.320347 : 1-init : INIT:vold.decrypt=trigger_post_fs_data 17220.311578 : 1-init : INIT:post-fs-data 17283.306271 : 1-init : post-fs-data: on modem start 18290.475350 : 328-vold : vold:cryptfs_restart_internal:END 18635.030659 : 407-zygote64 : boot_progress_start 19415.810814 : 1-init : INIT:vold.decrypt=trigger_restart_framework 20770.849587 : 407-main : Zygote:Preload Start 21101.172588 : 408-main : Zygote:Preload End 21368.740358 : 301-ccci_mdinit : ccci_md1: decpyt ready 21381.859281 : 301-ccci_mdinit : ccci_md1: reset 21519.875358 : 301-ccci_mdinit : ccci_md1: bootup 22232.826513 : 407-main : Zygote:Preload 4715 classes in 1382ms 22370.672206 : 407-main : Zygote:Preload 64 obtain resources in 133ms 22391.764437 : 407-main : Zygote:Preload 41 resources in 20ms 22701.430976 : 301-ccci_mdinit : ccci_md1: ready 22870.447053 : 407-main : Zygote:Preload End 24925.980904 : 731-system_server : Android:SysServerInit_START 25700.308522 : 60-kworker/1:1 : USB configured //扫描手机安装包 27665.097911 : 731-system_server : Android:PackageManagerService_Start 31393.116074 : 731-system_server : Android:PMS_scan_START 31397.464381 : 731-system_server : Android:PMS_scan_data:/vendor/overlay 31434.082151 : 731-system_server : Android:PMS_scan_data:/system/framework 31537.897074 : 731-system_server : Android:PMS_scan_data:/system/priv-app 32270.121153 : 731-system_server : Android:PMS_scan_data:/system/app 32853.140154 : 731-system_server : Android:PMS_scan_data:/vendor/app 32915.019231 : 731-system_server : Android:PMS_scan_data:/system/presetapp 32940.047077 : 731-system_server : Android:PMS_scan_data:/data/app 33260.865386 : 731-system_server : Android:PMS_scan_END 33654.078541 : 731-system_server : PMS:reconcileAppsDataLI 34782.509390 : 731-system_server : Android:PMS_READY //AP端 初始化时间 36525.345624 : 408-main : Zygote:Preload 4715 classes in 935ms 36631.159548 : 408-main : Zygote:Preload 64 obtain resources in 102ms 36653.562702 : 408-main : Zygote:Preload 41 resources in 21ms 42223.695407 : 731-system_server : AMS:systemReady 42274.343715 : 731-system_server : AMS:AMS_READY //初始化输入法、systemUI 、网络、三方APK、多媒体、Dialer、Settings 42465.231177 : 731-system_server : AP_Init:[service]:[com.google.android.inputmethod.latin]:[com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME]:pid:1208 42511.370331 : 731-system_server : AP_Init:[service]:[com.android.systemui]:[com.android.systemui/.ImageWallpaper]:pid:1224:(PersistAP) 42982.213178 : 1011-system-server-i : AP_Init:[]:[WebViewLoader-armeabi-v7a]:pid:1261 43108.493640 : 1011-system-server-i : AP_Init:[]:[WebViewLoader-arm64-v8a]:pid:1280 43123.569563 : 731-system_server : SystemServer:NetworkStatsService systemReady 43833.242873 : 731-system_server : SystemServer:ConnectivityService systemReady 44152.714104 : 731-system_server : SystemServer:NetworkPolicyManagerServ systemReady 45144.738645 : 731-system_server : SystemServer:PhaseThirdPartyAppsCanStart 45191.636568 : 731-system_server : AP_Init:[added application]:[com.mediatek.ims]:[com.mediatek.ims]:pid:1357:(PersistAP) 45228.915953 : 731-system_server : AP_Init:[added application]:[com.android.phone]:[com.android.phone]:pid:1369:(PersistAP) 45453.339338 : 731-system_server : AP_Init:[activity]:[com.android.settings]:[com.android.settings/.FallbackHome]:pid:1387 45503.338184 : 731-system_server : Android:SysServerInit_END 46362.475494 : 1013-ActivityManager : AMS:ENABLE_SCREEN 52763.733971 : 1040-Binder:294_4 : BOOT_Animation:END //开机动画结束 52764.718663 : OFF----------------------------------------2. Android 开机大致流程从打印的开机Log 信息可以总结出Android 开机的大致流程如下:
Android 开机大致流程
3. 开机震动添加方法(MTK 、展讯平台)一、MTK 平台lk 层添加开机震动的方法文件修改大致路径 以MT6739 平台为例,大致路径如下vendormediatekproprietaryootableootloaderlkplatformmt6739a. 修改platform.c文件在platform.c文件中的mboot_common_load_logo 方法显示开机Logo之前添加震动
platform.c
// add for lk viber vibr_Enable_HW();//开启震动 mdelay(80); //震动80ms vibr_Disable_HW();//关闭震动 // add for lk viber mboot_common_load_logo((unsigned long)mt_get_logo_db_addr_pa(), "logo"); // add for lk viber vibr_Enable_HW();//开启震动 mdelay(80); //震动80ms vibr_Disable_HW();//关闭震动 // add for lk viber mboot_common_load_logo((unsigned long)mt_get_logo_db_addr_pa(), "logo");b. 查看mt_pmic.h头文件