Where are the Android system services started?

2019-07-02 04:32发布

问题:

In the book Embedded Android, it says

In init.rc, only an action results in the execution of commands. Service declarations only serve to describe services, they do not actually start anything... (page 246).

So, where are the Android system services (e.g., servicemanager, vold) started? I thought they were started in init.rc by the following lines. But according to the book, I was wrong.

service servicemanager \/system/bin/servicemanager

service vold /system/bin/vold

回答1:

I found the answer.

The statement "Service declarations only serve to describe services, they do not actually start anything" is correct. The native daemons are actually started in init.rc by following lines: (lines 371-372 in https://android.googlesource.com/platform/system/core/+/master/rootdir/init.rc)

  • class_start core
  • class_start main

where all daemons that belong to class core and class main are started respectively.