Amlogic优化开机时间--zygote优化代码
1、预加载浏览器内核资源
2、删除不用的预加载图片文件和类库
--- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -74,7 +74,7 @@ public final class WebViewFactory { return false; // User has not modifed Developer Settings } - static WebViewFactoryProvider getProvider() { + public static WebViewFactoryProvider getProvider() { synchronized (sProviderLock) { // For now the main purpose of this function (and the factory abstraction) is to keep // us honest and minimize usage of WebView internals when binding the proxy. diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index d5498bd..004f697 100755 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -47,6 +47,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; +import android.webkit.WebViewFactory; /** * Startup class for the zygote process. @@ -641,7 +642,11 @@ public class ZygoteInit { } Log.i(TAG, "Accepting command socket connections"); - + Log.d(TAG, "Lazy preload resources!!!"); + long begintime = SystemClock.uptimeMillis(); + EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_START, begintime); + preload(); + WebViewFactory.getProvider(); gc(); android.os.Process.setThreadPriority( android.os.Process.THREAD_PRIORITY_DEFAULT); --- a/core/res/res/values/arrays.xml +++ b/core/res/res/values/arrays.xml @@ -23,48 +23,6 @@ the zygote process before it starts forking application processes. --> <array name="preloaded_drawables"> <item>@drawable/toast_frame</item> - <item>@drawable/btn_check_on_pressed_holo_light</item> - <item>@drawable/btn_check_on_pressed_holo_dark</item> - <item>@drawable/btn_check_on_holo_light</item> - <item>@drawable/btn_check_on_holo_dark</item> - <item>@drawable/btn_check_on_focused_holo_light</item> - <item>@drawable/btn_check_on_focused_holo_dark</item> - <item>@drawable/btn_check_on_disabled_holo_light</item> - <item>@drawable/btn_check_on_disabled_holo_dark</item> - <item>@drawable/btn_check_on_disabled_focused_holo_light</item> - <item>@drawable/btn_check_on_disabled_focused_holo_dark</item> - <item>@drawable/btn_check_off_pressed_holo_light</item> - <item>@drawable/btn_check_off_pressed_holo_dark</item> - <item>@drawable/btn_check_off_holo_light</item> - <item>@drawable/btn_check_off_holo_dark</item> - <item>@drawable/btn_check_off_focused_holo_light</item> - <item>@drawable/btn_check_off_focused_holo_dark</item> - <item>@drawable/btn_check_off_disabled_holo_light</item> - <item>@drawable/btn_check_off_disabled_holo_dark</item> - <item>@drawable/btn_check_off_disabled_focused_holo_light</item> - <item>@drawable/btn_check_off_disabled_focused_holo_dark</item> - <item>@drawable/btn_check_holo_light</item> - <item>@drawable/btn_check_holo_dark</item> - <item>@drawable/btn_radio_on_pressed_holo_light</item> - <item>@drawable/btn_radio_on_pressed_holo_dark</item> - <item>@drawable/btn_radio_on_holo_light</item> - <item>@drawable/btn_radio_on_holo_dark</item> - <item>@drawable/btn_radio_on_focused_holo_light</item> - <item>@drawable/btn_radio_on_focused_holo_dark</item> - <item>@drawable/btn_radio_on_disabled_holo_light</item> - <item>@drawable/btn_radio_on_disabled_holo_dark</item> - <item>@drawable/btn_radio_on_disabled_focused_holo_light</item> - <item>@drawable/btn_radio_on_disabled_focused_holo_dark</item> - <item>@drawable/btn_radio_off_pressed_holo_light</item> - <item>@drawable/btn_radio_off_pressed_holo_dark</item> - <item>@drawable/btn_radio_off_holo_light</item> - <item>@drawable/btn_radio_off_holo_dark</item> - <item>@drawable/btn_radio_off_focused_holo_light</item> - <item>@drawable/btn_radio_off_focused_holo_dark</item> - <item>@drawable/btn_radio_off_disabled_holo_light</item> - <item>@drawable/btn_radio_off_disabled_holo_dark</item> - <item>@drawable/btn_radio_off_disabled_focused_holo_light</item> - <item>@drawable/btn_radio_off_disabled_focused_holo_dark</item> <item>@drawable/btn_default_pressed_holo_light</item> <item>@drawable/btn_default_pressed_holo_dark</item> <item>@drawable/btn_default_normal_holo_light</item> @@ -77,48 +35,6 @@ <item>@drawable/btn_default_disabled_focused_holo_dark</item> <item>@drawable/btn_default_holo_dark</item> <item>@drawable/btn_default_holo_light</item> - <item>@drawable/btn_star_off_normal_holo_light</item> - <item>@drawable/btn_star_on_normal_holo_light</item> - <item>@drawable/btn_star_on_disabled_holo_light</item> - <item>@drawable/btn_star_off_disabled_holo_light</item> - <item>@drawable/btn_star_on_pressed_holo_light</item> - <item>@drawable/btn_star_off_pressed_holo_light</item> - <item>@drawable/btn_star_on_focused_holo_light</item> - <item>@drawable/btn_star_off_focused_holo_light</item> - <item>@drawable/btn_star_on_disabled_focused_holo_light</item> - <item>@drawable/btn_star_off_disabled_focused_holo_light</item> - <item>@drawable/btn_star_holo_light</item> - <item>@drawable/btn_star_off_normal_holo_dark</item> - <item>@drawable/btn_star_on_normal_holo_dark</item> - <item>@drawable/btn_star_on_disabled_holo_dark</item> - <item>@drawable/btn_star_off_disabled_holo_dark</item> - <item>@drawable/btn_star_on_pressed_holo_dark</item> - <item>@drawable/btn_star_off_pressed_holo_dark</item> - <item>@drawable/btn_star_on_focused_holo_dark</item> - <item>@drawable/btn_star_off_focused_holo_dark</item> - <item>@drawable/btn_star_on_disabled_focused_holo_dark</item> - <item>@drawable/btn_star_off_disabled_focused_holo_dark</item> - <item>@drawable/btn_star_holo_dark</item> - <item>@drawable/btn_toggle_on_pressed_holo_light</item> - <item>@drawable/btn_toggle_on_pressed_holo_dark</item> - <item>@drawable/btn_toggle_on_normal_holo_light</item> - <item>@drawable/btn_toggle_on_normal_holo_dark</item> - <item>@drawable/btn_toggle_on_focused_holo_light</item> - <item>@drawable/btn_toggle_on_focused_holo_dark</item> - <item>@drawable/btn_toggle_on_disabled_holo_light</item> - <item>@drawable/btn_toggle_on_disabled_holo_dark</item> - <item>@drawable/btn_toggle_on_disabled_focused_holo_light</item> - <item>@drawable/btn_toggle_on_disabled_focused_holo_dark</item> - <item>@drawable/btn_toggle_off_pressed_holo_light</item> - <item>@drawable/btn_toggle_off_pressed_holo_dark</item> - <item>@drawable/btn_toggle_off_normal_holo_light</item> - <item>@drawable/btn_toggle_off_normal_holo_dark</item> - <item>@drawable/btn_toggle_off_focused_holo_light</item> - <item>@drawable/btn_toggle_off_focused_holo_dark</item> - <item>@drawable/btn_toggle_off_disabled_holo_light</item> - <item>@drawable/btn_toggle_off_disabled_holo_dark</item> - <item>@drawable/btn_toggle_off_disabled_focused_holo_light</item> - <item>@drawable/btn_toggle_off_disabled_focused_holo_dark</item> <item>@drawable/btn_toggle_holo_light</item> <item>@drawable/btn_toggle_holo_dark</item> <item>@drawable/edit_text_holo_light</item> @@ -177,58 +93,7 @@ <item>@drawable/screen_background_selector_light</item> <item>@drawable/scrollbar_handle_holo_dark</item> <item>@drawable/scrollbar_handle_holo_light</item> - <item>@drawable/spinner_background_holo_dark</item> - <item>@drawable/spinner_background_holo_light</item> - <item>@drawable/spinner_ab_default_holo_dark</item> - <item>@drawable/spinner_ab_default_holo_light</item> - <item>@drawable/spinner_ab_disabled_holo_dark</item> - <item>@drawable/spinner_ab_disabled_holo_light</item> - <item>@drawable/spinner_ab_focused_holo_dark</item> - <item>@drawable/spinner_ab_focused_holo_light</item> - <item>@drawable/spinner_ab_pressed_holo_dark</item> - <item>@drawable/spinner_ab_pressed_holo_light</item> - <item>@drawable/spinner_ab_holo_dark</item> - <item>@drawable/spinner_ab_holo_light</item> - <item>@drawable/spinner_default_holo_dark</item> - <item>@drawable/spinner_default_holo_light</item> - <item>@drawable/spinner_disabled_holo_dark</item> - <item>@drawable/spinner_disabled_holo_light</item> - <item>@drawable/spinner_focused_holo_dark</item> - <item>@drawable/spinner_focused_holo_light</item> - <item>@drawable/spinner_pressed_holo_dark</item> - <item>@drawable/spinner_pressed_holo_light</item> <item>@drawable/cab_background_bottom_holo_dark</item> - <item>@drawable/cab_background_top_holo_light</item> - <item>@drawable/cab_background_bottom_holo_light</item> - <item>@drawable/ic_cab_done_holo_dark</item> - <item>@drawable/cab_background_top_holo_dark</item> - <item>@drawable/ic_cab_done_holo_light</item> - <item>@drawable/btn_cab_done_default_holo_dark</item> - <item>@drawable/btn_cab_done_focused_holo_light</item> - <item>@drawable/btn_cab_done_default_holo_light</item> - <item>@drawable/btn_cab_done_pressed_holo_dark</item> - <item>@drawable/btn_cab_done_focused_holo_dark</item> - <item>@drawable/btn_cab_done_pressed_holo_light</item> - <item>@drawable/btn_cab_done_holo_light</item> - <item>@drawable/btn_cab_done_holo_dark</item> - <item>@drawable/ic_menu_close_clear_cancel</item> - <item>@drawable/ic_menu_copy_holo_dark</item> - <item>@drawable/ic_menu_copy_holo_light</item> - <item>@drawable/ic_menu_cut_holo_dark</item> - <item>@drawable/ic_menu_cut_holo_light</item> - <item>@drawable/ic_menu_more</item> - <item>@drawable/ic_menu_moreoverflow_holo_dark</item> - <item>@drawable/ic_menu_moreoverflow_holo_light</item> - <item>@drawable/ic_menu_paste_holo_dark</item> - <item>@drawable/ic_menu_paste_holo_light</item> - <item>@drawable/ic_menu_selectall_holo_light</item> - <item>@drawable/ic_menu_selectall_holo_dark</item> - <item>@drawable/ic_clear</item> - <item>@drawable/ic_clear_disabled</item> - <item>@drawable/ic_clear_normal</item> - <item>@drawable/ic_search</item> - <item>@drawable/ic_go</item> - <item>@drawable/ic_voice_search</item> <item>@drawable/dialog_bottom_holo_dark</item> <item>@drawable/dialog_bottom_holo_light</item> <item>@drawable/dialog_full_holo_dark</item> @@ -237,11 +102,6 @@ <item>@drawable/dialog_middle_holo_light</item> <item>@drawable/dialog_top_holo_dark</item> <item>@drawable/dialog_top_holo_light</item> - <item>@drawable/ic_dialog_alert_holo_dark</item> - <item>@drawable/ic_dialog_alert_holo_light</item> - <item>@drawable/list_divider_holo_dark</item> - <item>@drawable/list_divider_holo_light</item> - <item>@drawable/list_divider_holo_light</item> <item>@drawable/ab_transparent_dark_holo</item> <item>@drawable/ab_stacked_transparent_dark_holo</item> <item>@drawable/ab_bottom_transparent_dark_holo</item> @@ -271,18 +131,6 @@ <item>@drawable/fastscroll_label_left_holo_light</item> <item>@drawable/fastscroll_label_right_holo_light</item> <item>@drawable/editbox_dropdown_background_dark</item> - <item>@drawable/textfield_searchview_holo_dark</item> - <item>@drawable/textfield_searchview_right_holo_dark</item> - <item>@drawable/textfield_searchview_holo_light</item> - <item>@drawable/textfield_searchview_right_holo_light</item> - <item>@drawable/textfield_search_selected_holo_dark</item> - <item>@drawable/textfield_search_default_holo_dark</item> - <item>@drawable/textfield_search_right_selected_holo_dark</item> - <item>@drawable/textfield_search_right_default_holo_dark</item> - <item>@drawable/textfield_search_selected_holo_light</item> - <item>@drawable/textfield_search_default_holo_light</item> - <item>@drawable/textfield_search_right_selected_holo_light</item> - <item>@drawable/textfield_search_right_default_holo_light</item> <item>@drawable/tab_indicator_holo</item> <item>@drawable/tab_unselected_holo</item> <item>@drawable/tab_selected_holo</item> @@ -290,12 +138,6 @@ <item>@drawable/tab_selected_focused_holo</item> <item>@drawable/tab_unselected_pressed_holo</item> <item>@drawable/tab_selected_pressed_holo</item> - <item>@drawable/quickcontact_badge_overlay_dark</item> - <item>@drawable/quickcontact_badge_overlay_normal_dark</item> - <item>@drawable/quickcontact_badge_overlay_pressed_dark</item> - <item>@drawable/quickcontact_badge_overlay_light</item> - <item>@drawable/quickcontact_badge_overlay_normal_light</item> - <item>@drawable/quickcontact_badge_overlay_pressed_light</item> </array> <!-- Do not translate. These are all of the color state list resources that should be diff --git a/preloaded-classes b/preloaded-classes old mode 100644 new mode 100755 index 467da25..24237cf --- a/preloaded-classes +++ b/preloaded-classes @@ -550,17 +550,6 @@ android.hardware.usb.UsbDevice android.hardware.usb.UsbDeviceConnection android.hardware.usb.UsbRequest android.inputmethodservice.ExtractEditText -android.location.GpsSatellite -android.location.GpsStatus -android.location.GpsStatus$1 -android.location.ILocationManager -android.location.ILocationManager$Stub -android.location.ILocationManager$Stub$Proxy -android.location.Location -android.location.Location$1 -android.location.LocationManager -android.location.LocationRequest -android.location.LocationRequest$1 android.media.AmrInputStream android.media.AudioFormat android.media.AudioManager @@ -585,7 +574,6 @@ android.media.JetPlayer android.media.MediaCodec android.media.MediaCodecList android.media.MediaCrypto -android.media.MediaDrm android.media.MediaExtractor android.media.MediaMetadataRetriever android.media.MediaMuxer @@ -598,21 +586,7 @@ android.media.MediaPlayer$OnPreparedListener android.media.MediaPlayer$OnSeekCompleteListener android.media.MediaRecorder android.media.MediaScanner -android.media.RemoteDisplay -android.media.ResampleInputStream android.media.SoundPool -android.media.ToneGenerator -android.media.videoeditor.MediaArtistNativeHelper -android.media.videoeditor.VideoEditorProfile -android.mtp.MtpDatabase -android.mtp.MtpDevice -android.mtp.MtpDeviceInfo -android.mtp.MtpObjectInfo -android.mtp.MtpPropertyGroup -android.mtp.MtpPropertyList -android.mtp.MtpServer -android.mtp.MtpStorage -android.mtp.MtpStorageInfo android.net.ConnectivityManager android.net.Credentials android.net.DhcpResults @@ -1362,19 +1336,6 @@ android.widget.Toast android.widget.Toast$TN android.widget.Toast$TN$1 android.widget.Toast$TN$2 -com.android.i18n.phonenumbers.PhoneNumberMatcher -com.android.i18n.phonenumbers.PhoneNumberUtil -com.android.internal.R$styleable -com.android.internal.app.ActionBarImpl -com.android.internal.app.ActionBarImpl$1 -com.android.internal.app.ActionBarImpl$2 -com.android.internal.app.AlertController -com.android.internal.app.AlertController$1 -com.android.internal.app.AlertController$AlertParams -com.android.internal.app.AlertController$ButtonHandler -com.android.internal.appwidget.IAppWidgetService -com.android.internal.appwidget.IAppWidgetService$Stub -com.android.internal.appwidget.IAppWidgetService$Stub$Proxy com.android.internal.content.NativeLibraryHelper com.android.internal.logging.AndroidConfig com.android.internal.logging.AndroidHandler @@ -1396,8 +1357,6 @@ com.android.internal.os.SamplingProfilerIntegration com.android.internal.os.SomeArgs com.android.internal.os.ZygoteConnection com.android.internal.os.ZygoteConnection$Arguments -com.android.internal.os.ZygoteInit -com.android.internal.os.ZygoteInit$MethodAndArgsCaller com.android.internal.policy.IPolicy com.android.internal.policy.PolicyManager com.android.internal.policy.impl.PhoneFallbackEventHandler @@ -1414,13 +1373,6 @@ com.android.internal.policy.impl.PhoneWindow$PanelFeatureState$SavedState$1 com.android.internal.policy.impl.PhoneWindow$RotationWatcher com.android.internal.policy.impl.PhoneWindow$RotationWatcher$1 com.android.internal.policy.impl.Policy -com.android.internal.telephony.ITelephony -com.android.internal.telephony.ITelephony$Stub -com.android.internal.telephony.ITelephony$Stub$Proxy -com.android.internal.telephony.ITelephonyRegistry -com.android.internal.telephony.ITelephonyRegistry$Stub -com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy -com.android.internal.telephony.PhoneConstants$State com.android.internal.textservice.ITextServicesManager com.android.internal.textservice.ITextServicesManager$Stub com.android.internal.util.ArrayUtils @@ -1477,18 +1429,6 @@ com.android.internal.view.menu.MenuView$ItemView com.android.internal.view.menu.SubMenuBuilder com.android.internal.widget.AbsActionBarView com.android.internal.widget.AbsActionBarView$VisibilityAnimListener -com.android.internal.widget.ActionBarContainer -com.android.internal.widget.ActionBarContextView -com.android.internal.widget.ActionBarOverlayLayout -com.android.internal.widget.ActionBarOverlayLayout$LayoutParams -com.android.internal.widget.ActionBarView -com.android.internal.widget.ActionBarView$1 -com.android.internal.widget.ActionBarView$2 -com.android.internal.widget.ActionBarView$3 -com.android.internal.widget.ActionBarView$ExpandedActionViewMenuPresenter -com.android.internal.widget.ActionBarView$HomeView -com.android.internal.widget.ActionBarView$SavedState -com.android.internal.widget.ActionBarView$SavedState$1 com.android.internal.widget.DialogTitle com.android.internal.widget.EditableInputConnection com.android.org.bouncycastle.asn1.ASN1Boolean
posted on 2018-10-24 16:46 world_hello!!!! 阅读(1055) 评论(0) 编辑 收藏 举报