The research code starts with: Androidmanifest.xml, custom Application.java.
When the Android system starts, the system needs a home application to be responsible for displaying the applications, that is, the application is intended to be the first application launched by the Android system. On Android, this default home application is launcher.
To use an application as a home, simply add a category to the Android.xml file:
<intent-filter> <action android:name= "Android.intent.action.MAIN"/> <category android: Name= "Android.intent.category.DEFAULT"/> <category android:name= "Android.intent.category.HOME"/> <category android:name= "Com.aliyun.ushell.action.detailpage"/></intent-filter>
For several property descriptions in the Androidmanifest.xml file:
<manifest xmlns:android= "http://schemas.android.com/apk/res/android" package= "Com.aliyun.ushell" coreapp= "true" android:shareduserid= "Android.uid.system" android:versioncode= "2" android: Versionname= "1.2.3" >
Where Android:shareduserid decides whether a system signature is required, Android:theme determines the theme and style;andrid:debuggable of the entire application and determines whether the application is in debug mode.
Questions:
1. How is the launcher activated? Why does the Android system start launcher by default when booting?
2. What is the main job of launcher?
Android System opening Launcher,launcher is initiated by Activitymanager, while Activitymanager is initiated by Systemserver.
The value of the Intent-filter attribute added in the Androidmanifest.xml file is used here: Category_home. General bindings use the above three categories, that is, keywords: main/default/home.
The main work of launcher is to monitor the application's installation, update, deletion and other actions that cause launcher database changes. Launcher data is the use of ContentProvider to provide data, that is, the need to customize Contentresolver listen to the changes in the specified URI data.
private final contentobserver mobserver = new Contentobserver (new Handler ()) {@Ov Erride public void OnChange (Boolean selfchange, Uri uri) {final int nightswitch = Global.getint (Ushellapplicati On.this.getContentResolver (), Switch_key,-1); Final int nighton = Global.getint (UShellApplication.this.getContentResolver (), On_key,-1); Final Boolean Wallpaperon = (Global.getint (UShellApplication.this.getContentResolver (), Wallpaper_key, Default_ wallpaper) = = 1); Mwallpaperon = Wallpaperon; if (Readtime () | | Nightswitch! = Mnightswitch | | Nighton! = Mnighton) {mnightswitch = Nightswitch; Mnighton = Nighton; if (! Utilities.is_zhonghong) {ontimechanged (); } else {onzhchanged (null); } } }};
Launcher start the process is to load the interface data and then display, the interface data are system app related data (may contain launcher database).
Android Launcher startup process "Launcher partial START process"