Android Setting startup process summary

  to sum up:

  First, find the Settings directory, open the file AndroidManifest, determine the class Settings.java called when Setting start. Settings Inheritance in SettingsActivity, defined inside the other subclasses, inherit Settings in the Activity, annotations can be known from this that the internal mode is defined subclasses can independently call jump to the corresponding interface.

 /*
    * Settings subclasses for launching independently.
    */

 

  Open SettingsActivity.java, SettingsActivity inherited from SettingsDrawerActivity, SettingDrawerActivity main installation package is added at initialization, remove, modify, and monitor registration and start broadcasting thread updates category updated. Further, SettingDrawerActivity setContentView overwriting a method that subclasses can add to the view R.id.content_framet vessel.

  Complete package path back SettingsActivity the onCreate method, pay attention getMetaData methods for getting Activity of meta-data fields, and then assigned to mFragmentClass, which is to be displayed Fragment of. SettingsActivity overwritten in the method to fill getIntent transfer interface assigned to EXTRA_SHOW_FRAGMENT, when setContentView interface will be displayed are determined, Setting root interface and subclasses interface will call different layout, then calls each of the different loading methods switchToFragment content.

  Load content DashboardSummary.java example, first saw onCreateView method, R.layout.dashboard itself is a recyclerview layout, remove the basic interface and recyclerview settings, see rebuildUI direct method, which calls the updateCategory method. CategoryKey.CATEGORY_HOMEPAGE actually com.android.settings.category.ia.homepage, that is to say category parse <meta-data android from AndroidManifest file: name = "com.android.settings.category" attribute value corresponding to com. android.settings.category.ia.homepage of Activity to get. See below getTilesForCategory this method, which is an interface DashboardFeatureProvider a method in which implementing class is DashboardFeatureProviderImpl.java reading the code can be found inside the return getTilesForCategory actually CategoryManager.getTilesByCategory this method. getTilesByCategory method called TileUtils.getCategories method, walked snippet

   getTilesForAction(context, user, SETTINGS_ACTION, cache, null, tiles, true,
                        settingPkg);
                getTilesForAction(context, user, OPERATOR_SETTINGS, cache,
                        OPERATOR_DEFAULT_CATEGORY, tiles, false, true, settingPkg);
                getTilesForAction(context, user, MANUFACTURER_SETTINGS, cache,
                        MANUFACTURER_DEFAULT_CATEGORY, tiles, false, true, settingPkg);
            }
            if (setup) {
                getTilesForAction(context, user, EXTRA_SETTINGS_ACTION, cache, null, tiles, false,
                        settingPkg);
                if (!categoryDefinedInManifest) {
                    getTilesForAction(context, user, IA_SETTINGS_ACTION, cache, null, tiles, false,
                            settingPkg);
                    if (extraAction != null) {
                        getTilesForAction(context, user, extraAction, cache, null, tiles, false,
                                settingPkg);
                    }

  It can be seen that to fill parse subclass Activity Action corresponding file from AndroidManifest determined.

Guess you like

Origin www.cnblogs.com/nextbug/p/12145276.html