Service startup principle
Send a startService request to AMS
When startService, it will first get the Binder proxy object of AMS , and initiate a startService request to AMS :
AMS handles the startService request
Next, let's look at the AMS side processing the startService request of the application:
Recall the application process startup process:
Next, if the application process where the Service is located is not started, it will report to AMS after starting the application process, and how AMS handles the Service in the attchApplicationLocked() method after receiving the application report :