android 7.1 开机速度优化记录
調試過程中做一些記錄:平臺msm8953 ,android 7.1(部分參考網絡大神的記錄和翻譯老外的文章)
一、
0、驅動層的裁剪? Android native層服務的裁剪 Android frameworks層服務的裁剪? Android APP層的裁剪
1、lk優化,去掉Lk里面的各種延時,目前啟動時間1.3s左右
lk階段可以把顯示部分的初始化去掉,不再顯示logo圖片,節約0.2s左右
2、kernel優化 ,使用user版本的kernel,init進程啟動時間在1s左右,需要繼續裁剪Kernel大小,這樣lk加載內核時間也會縮短
(1) 減少Log輸出
(2)移除不必要的驅動,文件系統,子文件系統,查看 /dev /sys下的節點,移除不必要的功能。例子:如果wlan通過pcie鏈接,sdio接口驅動可以去掉
(3)裁剪設備樹里面不必要的硬件設備。查看生成的.config,移除不必要的選項
(4)優化驅動的probe功能,減少不必要的延時
(5)bootgraph 用來分析內核功能, 在kernel cmdline 增加 initcall_debug ,然后dmesg > boot.log? bootgraph.pl boot.log >? boot.svg
BoardConfig-common.mk:BOARD_KERNEL_CMDLINE += initcall_debug ignore_logleveldriver:.probe_type = PROBE_PREFER_ASYNCHRONOUS,(6)電源優化
on init# Disable UFS powersavingwrite /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 0write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 0write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0write /sys/module/lpm_levels/parameters/sleep_disabled Y on property:sys.boot_completed=1# Enable UFS powersavingwrite /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1write /sys/module/lpm_levels/parameters/sleep_disabled N on charger# Enable UFS powersavingwrite /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1write /sys/class/typec/port0/port_type sinkwrite /sys/module/lpm_levels/parameters/sleep_disabled N參考:google pixel 手機
CONFIG_ANDROID_LOGGER=y CONFIG_IMX134=y CONFIG_IMX132=y CONFIG_OV9724=y CONFIG_OV5648=y CONFIG_GC0339=y CONFIG_OV8825=y CONFIG_OV8865=y CONFIG_s5k4e1=y CONFIG_OV12830=y CONFIG_USB_EHCI_HCD=y CONFIG_IOMMU_IO_PGTABLE_FAST_SELFTEST=y CONFIG_IKCONFIG=y CONFIG_RD_BZIP2=y CONFIG_RD_LZMA=y CONFIG_TI_DRV2667=y CONFIG_CHR_DEV_SCH=y CONFIG_MMC=y CONFIG_MMC_PERF_PROFILING=y CONFIG_MMC_CLKGATE=y CONFIG_MMC_PARANOID_SD_INIT=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_TEST=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MMC_SDHCI_MSM=y CONFIG_MMC_SDHCI_MSM_ICE=y CONFIG_MMC_CQ_HCI=y CONFIG_MSDOS_FS=y # CONFIG_SYSFS_SYSCALL is not set CONFIG_EEPROM_AT24=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_HBTP_INPUT=y # CONFIG_VGA_ARB is not set CONFIG_USB_MON=y CONFIG_USB_STORAGE_DATAFAB=y CONFIG_USB_STORAGE_FREECOM=y CONFIG_USB_STORAGE_ISD200=y CONFIG_USB_STORAGE_USBAT=y CONFIG_USB_STORAGE_SDDR09=y CONFIG_USB_STORAGE_SDDR55=y CONFIG_USB_STORAGE_JUMPSHOT=y CONFIG_USB_STORAGE_ALAUDA=y CONFIG_USB_STORAGE_KARMA=y CONFIG_USB_STORAGE_CYPRESS_ATACB=y CONFIG_SW_SYNC_USER=y CONFIG_SEEMP_CORE=y CONFIG_MSM_SMEM_LOGGING=y CONFIG_IOMMU_DEBUG=y CONFIG_IOMMU_DEBUG_TRACKING=y CONFIG_IOMMU_TESTS=y CONFIG_MOBICORE_DRIVER=y # CONFIG_DEBUG_PREEMPT is not set?
二、android os部分優化
1、使用bootchart 生成圖片的方式,結果生成的圖片只有可憐的幾項,跟網上相比丟失太多,原因未知。
2、決定使用Logcat來判斷
三、zygote 預加載優化
diff --git a/base/preloaded-classes b/base/preloaded-classes
index fe2fba5..934a089 100644
--- a/base/preloaded-classes
+++ b/base/preloaded-classes
@@ -247,25 +247,25 @@
?[[S
?[[[I
?android.R$styleable
-android.accounts.Account
-android.accounts.Account$1
-android.accounts.AccountManager
-android.accounts.AccountManager$1
-android.accounts.AccountManager$11
-android.accounts.AccountManager$AmsTask
-android.accounts.AccountManager$AmsTask$1
-android.accounts.AccountManager$AmsTask$Response
-android.accounts.AccountManagerCallback
-android.accounts.AccountManagerFuture
-android.accounts.AccountsException
-android.accounts.AuthenticatorException
-android.accounts.IAccountManager
-android.accounts.IAccountManager$Stub
-android.accounts.IAccountManager$Stub$Proxy
-android.accounts.IAccountManagerResponse
-android.accounts.IAccountManagerResponse$Stub
-android.accounts.OnAccountsUpdateListener
-android.accounts.OperationCanceledException
+#android.accounts.Account
+#android.accounts.Account$1
+#android.accounts.AccountManager
+#android.accounts.AccountManager$1
+#android.accounts.AccountManager$11
+#android.accounts.AccountManager$AmsTask
+#android.accounts.AccountManager$AmsTask$1
+#android.accounts.AccountManager$AmsTask$Response
+#android.accounts.AccountManagerCallback
+#android.accounts.AccountManagerFuture
+#android.accounts.AccountsException
+#android.accounts.AuthenticatorException
+#android.accounts.IAccountManager
+#android.accounts.IAccountManager$Stub
+#android.accounts.IAccountManager$Stub$Proxy
+#android.accounts.IAccountManagerResponse
+#android.accounts.IAccountManagerResponse$Stub
+#android.accounts.OnAccountsUpdateListener
+#android.accounts.OperationCanceledException
?android.animation.AnimationHandler
?android.animation.AnimationHandler$1
?android.animation.AnimationHandler$2
@@ -963,15 +963,15 @@ android.hardware.Camera
?android.hardware.Camera$CameraInfo
?android.hardware.Camera$Face
?android.hardware.ConsumerIrManager
-android.hardware.Sensor
-android.hardware.SensorEvent
-android.hardware.SensorEventListener
-android.hardware.SensorManager
+#android.hardware.Sensor
+#android.hardware.SensorEvent
+#android.hardware.SensorEventListener
+#android.hardware.SensorManager
?android.hardware.SerialManager
?android.hardware.SerialPort
-android.hardware.SystemSensorManager
-android.hardware.SystemSensorManager$BaseEventQueue
-android.hardware.SystemSensorManager$SensorEventQueue
+#android.hardware.SystemSensorManager
+#android.hardware.SystemSensorManager$BaseEventQueue
+#android.hardware.SystemSensorManager$SensorEventQueue
?android.hardware.camera2.CameraCharacteristics$Key
?android.hardware.camera2.CameraManager
?android.hardware.camera2.CaptureRequest$Key
@@ -991,7 +991,7 @@ android.hardware.display.IDisplayManager$Stub$Proxy
?android.hardware.display.IDisplayManagerCallback
?android.hardware.display.IDisplayManagerCallback$Stub
?android.hardware.fingerprint.FingerprintManager
-android.hardware.hdmi.HdmiControlManager
+#android.hardware.hdmi.HdmiControlManager
?android.hardware.input.IInputDevicesChangedListener
?android.hardware.input.IInputDevicesChangedListener$Stub
?android.hardware.input.IInputManager
@@ -1009,27 +1009,27 @@ android.hardware.location.ContextHubManager
?android.hardware.location.ContextHubService
?android.hardware.location.IContextHubService
?android.hardware.location.IContextHubService$Stub
-android.hardware.radio.RadioManager
-android.hardware.radio.RadioManager$AmBandConfig
-android.hardware.radio.RadioManager$AmBandConfig$1
-android.hardware.radio.RadioManager$AmBandDescriptor
-android.hardware.radio.RadioManager$AmBandDescriptor$1
-android.hardware.radio.RadioManager$BandConfig
-android.hardware.radio.RadioManager$BandConfig$1
-android.hardware.radio.RadioManager$BandDescriptor
-android.hardware.radio.RadioManager$BandDescriptor$1
-android.hardware.radio.RadioManager$FmBandConfig
-android.hardware.radio.RadioManager$FmBandConfig$1
-android.hardware.radio.RadioManager$FmBandDescriptor
-android.hardware.radio.RadioManager$FmBandDescriptor$1
-android.hardware.radio.RadioManager$ModuleProperties
-android.hardware.radio.RadioManager$ModuleProperties$1
-android.hardware.radio.RadioManager$ProgramInfo
-android.hardware.radio.RadioManager$ProgramInfo$1
-android.hardware.radio.RadioMetadata
-android.hardware.radio.RadioMetadata$1
-android.hardware.radio.RadioModule
-android.hardware.radio.RadioTuner
+#android.hardware.radio.RadioManager
+#android.hardware.radio.RadioManager$AmBandConfig
+#android.hardware.radio.RadioManager$AmBandConfig$1
+#android.hardware.radio.RadioManager$AmBandDescriptor
+#android.hardware.radio.RadioManager$AmBandDescriptor$1
+#android.hardware.radio.RadioManager$BandConfig
+#android.hardware.radio.RadioManager$BandConfig$1
+#android.hardware.radio.RadioManager$BandDescriptor
+#android.hardware.radio.RadioManager$BandDescriptor$1
+#android.hardware.radio.RadioManager$FmBandConfig
+#android.hardware.radio.RadioManager$FmBandConfig$1
+#android.hardware.radio.RadioManager$FmBandDescriptor
+#android.hardware.radio.RadioManager$FmBandDescriptor$1
+#android.hardware.radio.RadioManager$ModuleProperties
+#android.hardware.radio.RadioManager$ModuleProperties$1
+#android.hardware.radio.RadioManager$ProgramInfo
+#android.hardware.radio.RadioManager$ProgramInfo$1
+#android.hardware.radio.RadioMetadata
+#android.hardware.radio.RadioMetadata$1
+#android.hardware.radio.RadioModule
+#android.hardware.radio.RadioTuner
?android.hardware.soundtrigger.SoundTrigger
?android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel
?android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel$1
@@ -1555,24 +1555,24 @@ android.net.wifi.WifiSsid
?android.net.wifi.WifiSsid$1
?android.net.wifi.nan.WifiNanManager
?android.net.wifi.p2p.WifiP2pManager
-android.nfc.IAppCallback
-android.nfc.IAppCallback$Stub
-android.nfc.INfcAdapter
-android.nfc.INfcAdapter$Stub
-android.nfc.INfcAdapter$Stub$Proxy
-android.nfc.INfcCardEmulation
-android.nfc.INfcCardEmulation$Stub
-android.nfc.INfcCardEmulation$Stub$Proxy
-android.nfc.INfcFCardEmulation
-android.nfc.INfcFCardEmulation$Stub
-android.nfc.INfcFCardEmulation$Stub$Proxy
-android.nfc.INfcTag
-android.nfc.INfcTag$Stub
-android.nfc.INfcTag$Stub$Proxy
-android.nfc.NfcActivityManager
-android.nfc.NfcAdapter
-android.nfc.NfcAdapter$1
-android.nfc.NfcManager
+#android.nfc.IAppCallback
+#android.nfc.IAppCallback$Stub
+#android.nfc.INfcAdapter
+#android.nfc.INfcAdapter$Stub
+#android.nfc.INfcAdapter$Stub$Proxy
+#android.nfc.INfcCardEmulation
+#android.nfc.INfcCardEmulation$Stub
+#android.nfc.INfcCardEmulation$Stub$Proxy
+#android.nfc.INfcFCardEmulation
+#android.nfc.INfcFCardEmulation$Stub
+#android.nfc.INfcFCardEmulation$Stub$Proxy
+#android.nfc.INfcTag
+#android.nfc.INfcTag$Stub
+#android.nfc.INfcTag$Stub$Proxy
+#android.nfc.NfcActivityManager
+#android.nfc.NfcAdapter
+#android.nfc.NfcAdapter$1
+#android.nfc.NfcManager
?android.opengl.EGL14
?android.opengl.EGLConfig
?android.opengl.EGLContext
四、app相關優化
1、去除不需要的app以及相關庫
diff --git a/target/product/core.mk b/target/product/core.mk
index c315bb4..7e7c612 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -21,21 +21,13 @@
?# core_tiny.mk in addition to core_minimal.mk.
?
?PRODUCT_PACKAGES += \
-??? BasicDreams \
???? BlockedNumberProvider \
???? BookmarkProvider \
-??? Browser2 \
-??? Calendar \
-??? CalendarProvider \
???? CaptivePortalLogin \
???? CertInstaller \
???? Contacts \
-??? DeskClock \
???? DocumentsUI \
???? DownloadProviderUi \
-??? Email \
-??? ExactCalculator \
-??? Exchange2 \
???? ExternalStorageProvider \
???? FusedLocation \
???? InputDevices \
@@ -48,12 +40,9 @@ PRODUCT_PACKAGES += \
???? PicoTts \
???? PacProcessor \
???? libpac \
-??? PrintSpooler \
???? PrintRecommendationService \
???? ProxyHandler \
-??? QuickSearchBox \
???? Settings \
-??? SharedStorageBackup \
???? StorageManager \
???? Telecom \
???? TeleService \
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index 03d33e1..d02b058 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -33,7 +33,6 @@ PRODUCT_PACKAGES += \
???? libfilterpack_imageproc \
???? libgabi++ \
???? libmdnssd \
-??? libnfc_ndef \
???? libpowermanager \
???? libspeexresampler \
???? libstagefright_soft_aacdec \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index 65bdf0f..2f8eef5 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -25,17 +25,12 @@ PRODUCT_PACKAGES := \
???? libWnnEngDic \
???? libWnnJpnDic \
???? libwnndict \
-??? WAPPushManager
?
?PRODUCT_PACKAGES += \
-??? Galaxy4 \
???? HoloSpiralWallpaper \
-??? LiveWallpapers \
-??? LiveWallpapersPicker \
???? MagicSmokeWallpapers \
???? NoiseField \
???? PhaseBeam \
-??? PhotoTable
?
?# Additional settings used in all AOSP builds
?PRODUCT_PROPERTY_OVERRIDES := \
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 5c48358..be3ed0d 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -21,7 +21,6 @@ PRODUCT_PACKAGES := \
???? Bluetooth \
???? BluetoothMidiService \
???? Camera2 \
-??? Gallery2 \
???? Music \
???? MusicFX \
???? OneTimeInitializer \
diff --git a/target/product/telephony.mk b/target/product/telephony.mk
index e840ba1..60ede56 100644
--- a/target/product/telephony.mk
+++ b/target/product/telephony.mk
@@ -21,7 +21,6 @@ PRODUCT_PACKAGES := \
???? CarrierConfig \
???? Dialer \
???? CallLogBackup \
-??? CellBroadcastReceiver \
???? EmergencyInfo \
???? rild
2、languages_full.mk,locales_full.mk: 去除不需要的語言設置(可以去除res包的大小)
五、Bootanimation
控制動畫包中資源數量及大小,另外考慮縮短循環播放和結尾的時間。
調試手段:
禁用開機動畫:將”debug.sf.nobootanimation”設為”1” device/qcom/msm8996/system.prop
禁用鎖屏:將”def_lockscreen_disabled”設為”true” frameworks/base/packages/SettingsProvider/res/values/defaults.xml
六、提升CPU頻率 - 將所有CPU切換至性能模式
adb shell stop perf-hal-1-0adb shell "echo 1 > /sys/devices/system/cpu/cpu0/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu1/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu2/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu3/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu4/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu5/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu6/online" adb shell "echo 1 > /sys/devices/system/cpu/cpu7/online"adb shell "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor" adb shell "echo performance > /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor"adb shell "echo performance > /sys/class/devfreq/soc:qcom,cpubw/governor" adb shell "echo performance > /sys/class/devfreq/soc:qcom,mincpubw/governor" adb shell "echo performance > /sys/class/devfreq/soc:qcom,memlat-cpu0/governor" adb shell "echo performance > /sys/class/devfreq/soc:qcom, memlat-cpu6/governor"七、提升GPU頻率
adb shell "echo 0 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel" adb shell "echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on" adb shell "echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor"八、
?
?
?
總結
以上是生活随笔為你收集整理的android 7.1 开机速度优化记录的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 云服务器带宽解释及下载速度分析
- 下一篇: MLW模型的matlab实现(已修复)