Let's have a look how the middle manager surveys is started.
So as we already see most of these system services are started from the system server.
So within system server we have these three methods which are basically responsible for starting all
the system services within Android.
So the window manager service is started from START other services method.
So within START the services method here we can see it starts the window manager service here we can
see that it's creating an instance of window manager by calling the main method of window manager service.
So if we go inside the main method you could see it is passing in context input manager service.
So both messages window manager policy and activity task manager service.
So we are passing in these instances to the main and within the main.
Within the main method, we are getting the handler of the display thread and we are running this piece
of code within this thread.
So if we go to the run with Scissors method, we could see that it's basically executing and creating
an instance of window manager service.
So since Window Manager is of high priority, it will basically kind of block this thread and create
the window manager service and come back.
So that's what is happening within this run with scissors method.
So our interesting part is within this constructor of Window Manager Service.
So if we go inside Window Manager Service constructor, then we could see it's initializing a lot of
objects which are required for managing the windows for the window manager service.
So in the window manager constructor could see that it initializes a lot of objects.
It picks a lot of configurations from the XML files and here it initializes the input manager.
So Window Management Service is also responsible for handling the input management.
So the input management is done by input management service, but it does this through window manager
service because of course the touch has to be part of the window and it's a property within the window.
So that's the reason.
Window Manager Service has the input manager service object within the constructor and then we have
the surface control actually.
So as we said, Window Manager is also responsible for creating the surfaces on which the windows are
drawn.
So it has an instance of the surface factory and then animator.
It's also responsible for managing the animations.
Here we have the policy object which handles the display policies and the display manager.
So it handles the display and the power manager.
And here we can find some logic to handle the power management.
So in this case, when there is a low power mode detected, it's basically trying to disable or enable
the animations.
Then it has an object of the activity manager, activity task manager and many other objects as well.
Here, then here it initializes the display area policy provider.
So this is a new internal API which is added recently in Android, and then the block controller is
also added recently in Android to all the blah feature within the windows.
So in short, the window manager service initializes many objects which are necessary for managing the
windows.
So to summarize, in this session, we had a look how the window manager services started.
So the Window Manager Services started from START other services method here and here we initialize
the window manager service with the main method and within the main method we call this method run with
scissor within the display thread and initializes the instance of the window manager service.
And as we have seen in Window Manager Service, we are initializing all these objects which are necessary
for handling the window properties or managing the windows.
And here we have seen some of the important services like input manager or face control factory animator,
display manager, power manager, activity manager, activity task manager, display area policy provider,
block controller and so on.