The first boot process is as follows:
1. First, create a database
1. Create a database favorites table.
2. Load the default desktop configuration information from default_workspace.xml and write it to the database.
Ii. Load launcherapplication
1. Start the application subclass launcherapplication that the launcher has rewritten.
2. Create launchermodel and cache (used to cache the application icon and application title) in oncreate of application ).
3. Register broadcast and oberser related to package change (because launcher needs to update the application when it is installed or uninstalled ).
Note:
1. The launchermodel and cache are unrelated to the activity. their lifecycles are greater than those of the activity. When the activity is destroyed, the data in the launchermodel and cache can still be kept.
3. Start the launcher Activity
1. initialize the UI.
2. Call the startloader method of launchermodel to load the desktop and menu-related application information of launchermodel.
3. When launchermodel is loaded, launcher receives the relevant callback and initializes the UI Based on the loaded data information.
Note:
1. desktop icons can be customized, that is, they can be configured by users. Therefore, the information should be recorded, which is also in the database's favorites table.
2. the app of menu (all application pages) cannot be customized, and it is all the activities with the launcher attribute. That is to say, the data does not need to be specially stored, you only need to go to packagemanager every time you need it.
Simple collaboration Diagram
Loading the sequence of binding application data to the desktop and menu