Android 控制用户定义 service
1.
修改/etc/init.rc
添加用户定义service 定义
service xxx /usr/sbin/xxx
user root
disabled
oneshot
2.
Android init 启动后会调用
init.c 来实现init.rc文件的解析。并启动android property service.
3.
用户可以在代码中通过调用property_service.c 中函数
property_set("ctl.start",xxx)
property_set("ctl.stop",xxx)
来使得android property service 去开启或结束 xxx service.
当然用户也可以在控制台直接使用命令
#setprop ctl.start xxx
#setprop ctl.stop xxx
来做同样的事情
4.
sequence diagram 如下