现在的位置: 首页 > 综合 > 正文

Android user defined service handling

2013年01月05日 ⁄ 综合 ⁄ 共 518字 ⁄ 字号 评论关闭

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 如下

http://p.blog.csdn.net/images/p_blog_csdn_net/stevenliyong/EntryImages/20091217/android_property633966458371326250.JPG

 

抱歉!评论已关闭.