Create an app window one, create a Activity1. The application window must correspond to the ACTIVITY,AMS notification client Activitythread start activity. Reflection Create Activity Object
Second, create Window2. The Activity.attach () method sets the internal variable. 3. The Activity.attach () method creates a Window object. Policymanager.makenewwindow () Create (via Com.android.internal.policy.impl.Policy configuration) Create Phonewondow, assign to Activity.mwindow settings Setcallback () [ The Calback of window is the current activity, which is why the user message can be passed to the activity for the reason]4. The Window.mwindowmanager is assigned a value. WindowManager is an interface, two implementation class Window.localwindowmanager (is a shell, its implementation in its internal windowmanagerimpl) and Windowmanagerimpl
Third, create VIEWROOT5. Add a view, call Callactivityoncreate from inside Performlaunchactivity, and eventually call Setcontentview in OnCreate. Setcontentview source Getwidnow.setcontentview () Installdecor () create title bar, etc. 6. Setcontentview source code, analysis theme related Settings 7. When the activity is ready, notify Ams,ams final call to Activity.makevisible () 8. Activity.makevisible () Source Code, window type is type_application. Viewgroup.addview "level" Judge WindowManager level 9. Localwindowmanager.addview (Windowmanagerimpl.addview an app has only one this object), which contains 3 arrays. Complete key additions through Viewroot.setview.
Four, the window added 10. Array mviews, mroots, mparams save view, Viewroot, Windowmanager.layoutparams11. Perform Viewroot.setview to complete the final window add work. Mattachinfo assignment, Requestlayout issue interface re-layout request Swindowsession.add notify WMS Add window
Resources:
"Android Kernel Anatomy" chapter 8th 8.3 Creating an application window
Graphical android-android GUI System (2)-Window management (View, Canvas, window manager)
android window mechanism analysis------UI Management System (Window level)
Android window three create an app windows