启动和停止init.rc中的服务

来源:互联网 发布:建信优化配置基金净值 编辑:程序博客网 时间:2024/06/07 21:26

实例演示

关闭和启动init.rc中的console 服务

service console /system/bin/sh
    class core
    console
    disabled
    user shell
    group log

 

 

代码实现

shell :

setprop ctl.start service_name

setprop ctl.stop service_name

JNI:

property_set("ctl.start", service_name);

property_set("ctl.stop", service_name);

 

权限

uid == AID_SYSTEM || uid == AID_ROOT

参见 system/core/init/property_service.c中check_control_perms函数

 

 

 

0 0