Androidwidgetservice. Java is the core class of the widget framework. It manages all widgets.
After the system server is started, the process will manage other services)
Creates an appwidgetservice instance and calls the systemready method of appwidgetservice.
In this method, the initialization and loading of widgets are completed, mainly through three tasks.
1. traverse all installation packages and find the qualified intent referers (Action = action_appwidget_update) and <meta_data Android: Name = "android. appwidget. provider"/>.
Parse related information and save it to local variables.
2. Read text data/system/appwidgets. xml. All the widgets installed on the desktop are saved in this file and the results are saved locally.
3. register to receive three messages: action_boot_completed (this message will be broadcast when the system starts to launcher), action_package_added (this message will be broadcast when the new APK is installed to the System), action_package_remover (this message is broadcasted when an application is deleted)
After the system starts to the desktop, appwidgetservice receives the action_boot_completed message, which checks local data. If a widget is installed with launcher, it sends action_apppwidget_enable and action_appwidget_update messages to start the widget.
In addition, if the updateperiodmills attribute is set for a widget, The action_appwidget_update message is reported at intervals to update the widget periodically.