Android launcher-Detailed description of the Startup Process

Source: Internet
Author: User

Launcherapplication-> oncreate
-- 1. // set the minimum heap memory to 4 MB
-- 2. // create an application Icon cache
-- 3. // create launchermodel
-- 4. // register intent. action_package_added, intent. action_package_removed, intent. action_package_changed event listener
Launchermodel listens to events in the preceding 3 as a broadcast Receiver
-- 5. // Add a Data Change listener to the desktop favorites content provider
2 launcher-> oncreate
-- 1. Get the objects initialized by launcherapplication, such as launcherapplication launchermodel miconcache.
-- 2. Create a drag-and-drop controller new dragcontroller (this)
-- 4. // obtain the Desktop component manager and start the Desktop component host
-- To be studied in depth
-- 5. // load all hotseats from array. hotseats (hotkeys such as the hanging button, Google browser)
-- To be studied in depth
-- 6. Load local settings from launcher. preferences
-- 7. // set the wallpaper size width = display. getwidth () * wallpaper_screens_span, Height = display. getheight ()
-- 8. // load the layout File
-- 9. // Initialize all controls
-- 10. // obtain the desktop persistent data from bundle savedinstancestate and set mrestoring to true;
-- 11. If mrestoring = false, call launchermodel to load the desktop item Mmodel. startloader (this, true, isw.agechange );
-- A. launchermodel. loader. startloader () Code Synchronization
-- B. Create the launchermodel. loader. loaderthread thread and start the thread (for details, see Step 3)
-- 12. Register intent. action_close_system_dialogs broadcast listener
Three desktop items load launchermodel. loader. loaderthread. Run: New thread execution
-- 1. Wait until the main thread finishes running to start loading.
-- 2. Determine whether to load the desktop first; loadworkspacefirst = CBK! = NULL? (! CBK. isallpolicvisible (): true;
-- 3. loadworkspacefirst = true
-- A. loadandbindworkspace ()
-- Loadworkspace (): Constructs iteminfo objects of corresponding types from all the desktop items in the database launcher. DB query and saves them
List of mitems, mappwidgets, and mfolders.
-- Bindworkspace ():
-- 1. laucher. startbinding (), asynchronous call, handle in the main thread
// Do no things
-- 2. laucher. binditems (), asynchronous call, handle in the main thread
-- 1. Create a desktop icon view object based on the iteminfo object
-- 2. Obtain item. screen, item. cellx, item. celly, spanx, spany,
Call workspace. addinscreen to add the cell to the corresponding desktop.
-- 1. Reset the layoutparam (type: celllayout. layoutparam) of the desktop icon view)
-- 2. Obtain the celllayout object of the desktop based on item. screen, that is, one of the five users' desktops in the workspace.
-- 3. Call the celllayout. addview method to add the desktop icon view object as the child of celllayout, that is, to add a desktop icon to the user's desktop.
-- 4. Add onlongclicklistener = laucher to the desktop icon view object, which listens to the longclick event of the desktop icon view.
-- 5. If the desktop icon is a droptarget object, drag and drop the Controller mdragcontroller to add the view to the drop-and-drop destination list.
-- 3. laucher. bindfolders (), asynchronous call, handle in the main thread
// Launcher. mfolders. putall (mfolders );
-- 4. laucher. bindappwidget (), asynchronous call, handle in the main thread
-- 1. Get the appwidgetid of launcherappwidgetinfo
-- 2. Get appwidgetproviderinfo appwidgetinfo mappwidgetmanager. getappwidgetinfo (appwidgetid)
-- 3. Create a view appwidgethostview object for the Desktop component based on appwidgetinfo
-- 4. Call workspace. addinscreen to add the cell to the corresponding desktop.
-- 5. laucher. finishbindingitems (), asynchronous call, handle in the main thread
-- Mworkspaceloading = false
-- B. loadandbindallapps ();
If apps are not loaded or the language settings are changed
Loadall1_bybatch ();
-- 1. // set the package query condition intent. action_main intent. category_launcher
-- 2. // clear mallcategory list. Clear ();
-- 3. // packagemanager query all pakages applications
-- 4. Batch apply pakages to mall1_list. Add in batches
-- 5. laucher. bindallapplications () // asynchronous call
-- Mallappsgrid. setapps (Apps)
-- 6. If laucher. bindincluadded () is loaded in multiple batches, // asynchronous call
-- Mallappsgrid. addapps (Apps );
Otherwise
Onlybindallapps ();
-- 1. mallmedialist. Data. Clone ();
-- 2. laucher. bindallapplications () // asynchronous call
-- Mallappsgrid. setapps (Apps)
-- 4. loadworkspacefirst = false
-- A. loadandbindallapps ();
-- B. loadandbindworkspace ();

Original article: http://blog.csdn.net/stonecao/article/details/6536083

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.