A specific resource or class that makes up the running context of an Android application
Packagemanager, ClassLoader, assert, etc.
The running context of the Android application window is described by the Contextimpl class, where each activity component is associated with a Contextimpl object. The Contextimpl class inherits the context class and its relationship to the activity component
This class diagram can be called decorative mode in design mode.
The activity component can then use this Contextimpl object to perform specific operations, such as starting the service component, registering the broadcast receiver, and launching the content provider component. At the same time, the Contextimpl class uses its own member variable Moutercontext to refer to an activity component associated with it, so that the Contextimpl class can also forward some operations to the activity component for processing.
In the previous Android application launch process source code Analysis article, we have analyzed the startup process of an activity component in detail. In this boot process, the final step is to create an activity instance in the application process through the member function of the Activitythread class Performlaunchactivity, and set the run context for it. That is, create a Contextimpl object for it. Next, we start with the member function performlaunchactivity of the Activitythread class, analyzing the creation of an activity instance so that we can understand the creation process of its running context:
Android Context Creation Process