diff --git a/services/BUILD.gn b/services/BUILD.gn index 8f75903c18fd8e7f7210876d75dd5e5edae9c0d6..a1eddf3f9f71b8ab068fec49b5d205cb59221e10 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -141,6 +141,21 @@ if (defined(ohos_lite)) { part_name = "init" } + group("startup_init") { + deps = [ + ":init", + ":init_etc", + ":updaterueventd", + "//base/startup/init_lite/interfaces/innerkits/socket:libsocket", + "//base/startup/init_lite/services/param:getparam", + "//base/startup/init_lite/services/param:paramclient", + "//base/startup/init_lite/services/param:paramservice", + "//base/startup/init_lite/services/param:setparam", + "//base/startup/init_lite/services/reboot:reboot", + ] + } + + # init etc files group ohos_prebuilt_etc("init.cfg") { source = "//base/startup/init_lite/services/etc/init.cfg" part_name = "init" @@ -167,26 +182,18 @@ if (defined(ohos_lite)) { } ohos_prebuilt_etc("init.Hi3516DV300.usb.cfg") { - source = "//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.usb.cfg" + source = + "//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.usb.cfg" part_name = "init" } - - group("startup_init") { + group("init_etc") { deps = [ - ":init", - ":init.cfg", - ":passwd", ":init.Hi3516DV300.cfg", + ":init.Hi3516DV300.usb.cfg", + ":init.cfg", ":init.usb.cfg", ":init.usb.configfs.cfg", - ":init.Hi3516DV300.usb.cfg", - ":updaterueventd", - "//base/startup/init_lite/services/param:getparam", - "//base/startup/init_lite/services/param:paramclient", - "//base/startup/init_lite/services/param:paramservice", - "//base/startup/init_lite/services/param:setparam", - "//base/startup/init_lite/services/reboot:reboot", - "//base/startup/init_lite/interfaces/innerkits/socket:libsocket", + ":passwd", ] } } diff --git a/services/etc/init.cfg b/services/etc/init.cfg index cf96169dee08efeb3127930c706b2302ffa31db0..10f128c7267df1f8f752acdae03871bfc487fbfa 100755 --- a/services/etc/init.cfg +++ b/services/etc/init.cfg @@ -187,7 +187,7 @@ "start vndservicemanager" ] }, { - "name" : "property:sys.boot_from_charger_mode=1", + "name" : "param:sys.boot_from_charger_mode=1", "condition" : "sys.boot_from_charger_mode=1", "cmds" : [ "trigger post-init" @@ -467,7 +467,7 @@ "cmds" : [ ] }, { - "name" : "property:sys.init_log_level=*", + "name" : "param:sys.init_log_level=*", "condition" : "sys.init_log_level=*", "cmds" : [ ] @@ -476,7 +476,7 @@ "cmds" : [ ] }, { - "name" : "property:vold.decrypt=trigger_load_persist_props", + "name" : "param:vold.decrypt=trigger_load_persist_props", "condition" : "vold.decrypt=trigger_load_persist_props", "cmds" : [ "load_persist_params load_persist_params", @@ -484,48 +484,48 @@ "start logd-reinit" ] }, { - "name" : "property:vold.decrypt=trigger_post_fs_data", + "name" : "param:vold.decrypt=trigger_post_fs_data", "condition" : "vold.decrypt=trigger_post_fs_data", "cmds" : [ "trigger post-fs-data", "trigger zygote-start" ] }, { - "name" : "property:vold.decrypt=trigger_restart_min_framework", + "name" : "param:vold.decrypt=trigger_restart_min_framework", "condition" : "vold.decrypt=trigger_restart_min_framework", "cmds" : [ ] }, { - "name" : "property:vold.decrypt=trigger_restart_framework", + "name" : "param:vold.decrypt=trigger_restart_framework", "condition" : "vold.decrypt=trigger_restart_framework", "cmds" : [ "setparam service.bootanim.exit 0", "start bootanim" ] }, { - "name" : "property:vold.decrypt=trigger_shutdown_framework", + "name" : "param:vold.decrypt=trigger_shutdown_framework", "condition" : "vold.decrypt=trigger_shutdown_framework", "cmds" : [ ] }, { - "name" : "property:sys.boot_completed=1", + "name" : "param:sys.boot_completed=1", "condition" : "sys.boot_completed=1", "cmds" : [ ] }, { - "name" : "property:sys.sysctl.extra_free_kbytes=*", + "name" : "param:sys.sysctl.extra_free_kbytes=*", "condition" : "sys.sysctl.extra_free_kbytes=*", "cmds" : [ "write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}" ] }, { - "name" : "property:sys.sysctl.tcp_def_init_rwnd=*", + "name" : "param:sys.sysctl.tcp_def_init_rwnd=*", "condition" : "sys.sysctl.tcp_def_init_rwnd=*", "cmds" : [ "write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}" ] }, { - "name" : "property:security.perf_harden=0", + "name" : "param:security.perf_harden=0", "condition" : "security.perf_harden=0", "cmds" : [ "write /proc/sys/kernel/perf_event_paranoid 1", @@ -534,13 +534,13 @@ "write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}" ] }, { - "name" : "property:security.perf_harden=1", + "name" : "param:security.perf_harden=1", "condition" : "security.perf_harden=1", "cmds" : [ "write /proc/sys/kernel/perf_event_paranoid 3" ] }, { - "name" : "property:ro.debuggable=1", + "name" : "param:ro.debuggable=1", "condition" : "ro.debuggable=1", "cmds" : [ "chmod 0773 /data/misc/trace", diff --git a/services/etc/init.usb.cfg b/services/etc/init.usb.cfg index a71a74418ded0d35632cbbd9f4cfc13de772dd87..2dbac3d11df78e29db61a41a130540ead3489da8 100755 --- a/services/etc/init.usb.cfg +++ b/services/etc/init.usb.cfg @@ -16,7 +16,7 @@ "setparam sys.usb.configfs 0" ] }, { - "name" : "property:sys.usb.config=none && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=none && param:sys.usb.configfs=0", "condition" : "sys.usb.config=none && sys.usb.configfs=0", "cmds" : [ "stop adbd", @@ -25,7 +25,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=adb && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=adb && param:sys.usb.configfs=0", "condition" : "sys.usb.config=adb && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -37,7 +37,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=0", "condition" : "sys.usb.config=accessory && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -48,7 +48,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory,adb && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=accessory,adb && param:sys.usb.configfs=0", "condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -60,7 +60,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=audio_source && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=0", "condition" : "sys.usb.config=audio_source && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -71,7 +71,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=0", "condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -83,7 +83,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=0", "condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -94,7 +94,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=0", + "name" : "param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=0", "condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=0", "cmds" : [ "write /sys/class/android_usb/android0/enable 0", @@ -106,42 +106,42 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.typec.mode=dfp", + "name" : "param:sys.usb.typec.mode=dfp", "condition" : "sys.usb.typec.mode=dfp", "cmds" : [ "write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}", "setparam sys.usb.typec.state ${sys.usb.typec.mode}" ] }, { - "name" : "property:sys.usb.typec.mode=ufp", + "name" : "param:sys.usb.typec.mode=ufp", "condition" : "sys.usb.typec.mode=ufp", "cmds" : [ "write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}", "setparam sys.usb.typec.state ${sys.usb.typec.mode}" ] }, { - "name" : "property:sys.usb.typec.data_role=device", + "name" : "param:sys.usb.typec.data_role=device", "condition" : "sys.usb.typec.data_role=device", "cmds" : [ "write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}", "setparam sys.usb.typec.state ${sys.usb.typec.data_role}" ] }, { - "name" : "property:sys.usb.typec.data_role=host", + "name" : "param:sys.usb.typec.data_role=host", "condition" : "sys.usb.typec.data_role=host", "cmds" : [ "write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}", "setparam sys.usb.typec.state ${sys.usb.typec.data_role}" ] }, { - "name" : "property:sys.usb.typec.power_role=source", + "name" : "param:sys.usb.typec.power_role=source", "condition" : "sys.usb.typec.power_role=source", "cmds" : [ "write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}", "setparam sys.usb.typec.state ${sys.usb.typec.power_role}" ] }, { - "name" : "property:sys.usb.typec.power_role=sink", + "name" : "param:sys.usb.typec.power_role=sink", "condition" : "sys.usb.typec.power_role=sink", "cmds" : [ "write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}", diff --git a/services/etc/init.usb.configfs.cfg b/services/etc/init.usb.configfs.cfg index 823cbfaa6217575dc76d6692e8499c6738c498a6..14eb2236ff4666e22d9536bd0d08138562663dec 100755 --- a/services/etc/init.usb.configfs.cfg +++ b/services/etc/init.usb.configfs.cfg @@ -1,6 +1,6 @@ { "jobs" : [{ - "name" : "property:sys.usb.config=none && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=none && param:sys.usb.configfs=1", "condition" : "sys.usb.config=none && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/UDC \"none\"", @@ -16,19 +16,19 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:init.svc.adbd=stopped", + "name" : "param:init.svc.adbd=stopped", "condition" : "init.svc.adbd=stopped", "cmds" : [ "setparam sys.usb.ffs.ready 0" ] }, { - "name" : "property:sys.usb.config=adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"adb\"", @@ -37,7 +37,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=mtp && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=mtp && param:sys.usb.configfs=1", "condition" : "sys.usb.config=mtp && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp\"", @@ -46,13 +46,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=mtp,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=mtp,adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp_adb\"", @@ -62,7 +62,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=ptp && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=ptp && param:sys.usb.configfs=1", "condition" : "sys.usb.config=ptp && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp\"", @@ -71,13 +71,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=ptp,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=ptp,adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp_adb\"", @@ -87,7 +87,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=1", "condition" : "sys.usb.config=accessory && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory\"", @@ -96,13 +96,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_adb\"", @@ -112,7 +112,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=audio_source && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=1", "condition" : "sys.usb.config=audio_source && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource\"", @@ -121,13 +121,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=audio_source,adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource_adb\"", @@ -137,7 +137,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=1", "condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource\"", @@ -147,13 +147,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource_adb\"", @@ -164,7 +164,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=midi && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=midi && param:sys.usb.configfs=1", "condition" : "sys.usb.config=midi && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi\"", @@ -173,13 +173,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=midi,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=midi,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=midi,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=midi,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=midi,adb && sys.usb.configfs=1", "cmds" : [ "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi_adb\"", @@ -189,7 +189,7 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=rndis && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=rndis && param:sys.usb.configfs=1", "condition" : "sys.usb.config=rndis && sys.usb.configfs=1", "cmds" : [ "mkdir /config/usb_gadget/g1/functions/rndis.gs4", @@ -199,13 +199,13 @@ "setparam sys.usb.state ${sys.usb.config}" ] }, { - "name" : "property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.config=rndis,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.config=rndis,adb && sys.usb.configfs=1", "cmds" : [ "start adbd" ] }, { - "name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1", + "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=rndis,adb && param:sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1", "cmds" : [ "mkdir /config/usb_gadget/g1/functions/rndis.gs4", diff --git a/services/param/trigger/trigger_manager.c b/services/param/trigger/trigger_manager.c index 9440a18a5b9de76d1c7d8cbca9a6f37798ed044b..d446075301fa55854d5e1cf93a6cca461d1fa0f1 100644 --- a/services/param/trigger/trigger_manager.c +++ b/services/param/trigger/trigger_manager.c @@ -31,7 +31,7 @@ #include "trigger_checker.h" #define LABEL "Trigger" -#define TRIGGER_AREA_SPACE 1024*64 +#define TRIGGER_AREA_SPACE 1024*128 #define TRIGGER_EXECUTE_QUEUE 64 #define BUFFER_SIZE 256 #define CHECK_INDEX_VALID(workSpace, index) \ @@ -196,22 +196,11 @@ static u_int32_t AddTrigger(TriggerWorkSpace *workSpace, int type, const char *n static int GetTriggerIndex(const char *type) { - if (strncmp("param", type, strlen("param")) == 0) { + if (strncmp("param:", type, strlen("param:")) == 0) { return TRIGGER_PROPERTY; + } else { + return TRIGGER_BOOT; } - static const char *triggerType[] = { - "pre-init", "boot", "early-init", "init", "early-init", "late-init", "post-init", - "early-fs", "post-fs", "late-fs", "post-fs-data", - "nonencrypted", - "firmware_mounts_complete", - "load_persist_params_action" - }; - for (size_t i = 0; i < sizeof(triggerType) / sizeof(char*); i++) { - if (strncmp(triggerType[i], type, strlen(triggerType[i])) == 0) { - return TRIGGER_BOOT; - } - } - return TRIGGER_BOOT; } static int CheckBootTriggerMatch(TriggerNode *trigger, void *content, u_int32_t contentSize) diff --git a/services/param/trigger/trigger_processor.c b/services/param/trigger/trigger_processor.c index 3ac1b3d8b9c7de14e1e10a1167ea75a697505e02..5c241b6bbe03a8bdbe116df81932565935e77a25 100644 --- a/services/param/trigger/trigger_processor.c +++ b/services/param/trigger/trigger_processor.c @@ -23,7 +23,7 @@ #include "uv.h" #define LABEL "Trigger" -#define MAX_TRIGGER_COUNT_RUN_ONCE 10 +#define MAX_TRIGGER_COUNT_RUN_ONCE 20 #define SYS_POWER_CTRL "sys.powerctrl=" static TriggerWorkSpace g_triggerWorkSpace = {}; diff --git a/services/src/init_service.c b/services/src/init_service.c index fc52e5ed76fde737afa6f17e9652cc37e61fd601..664cc642445f88a63f08f32b807c57d218505728 100644 --- a/services/src/init_service.c +++ b/services/src/init_service.c @@ -33,9 +33,16 @@ #include "init_adapter.h" #include "init_cmds.h" #include "init_log.h" +#ifndef OHOS_LITE +#include "init_param.h" +#endif #include "init_perms.h" #include "init_service_socket.h" #include "init_utils.h" +#include "securec.h" +#ifndef OHOS_LITE +#include "sys_param.h" +#endif #define CAP_NUM 2 #define WAIT_MAX_COUNT 10 @@ -144,7 +151,10 @@ int ServiceStart(Service *service) INIT_LOGE("start service failed! null ptr.\n"); return SERVICE_FAILURE; } - + if (service->pid > 0) { + INIT_LOGI("service : %s had started already.\n", service->name); + return SERVICE_SUCCESS; + } if (service->attribute & SERVICE_ATTR_INVALID) { INIT_LOGE("start service %s invalid.\n", service->name); return SERVICE_FAILURE; @@ -220,6 +230,13 @@ int ServiceStart(Service *service) } service->pid = pid; +#ifndef OHOS_LITE + char paramName[PARAM_NAME_LEN_MAX] = {0}; + if (snprintf_s(paramName, PARAM_NAME_LEN_MAX, PARAM_NAME_LEN_MAX - 1, "init.svc.%s", service->name) < 0) { + INIT_LOGE("snprintf_s paramName error %d \n", errno); + } + SystemWriteParam(paramName, "running"); +#endif return SERVICE_SUCCESS; } @@ -240,7 +257,13 @@ int ServiceStop(Service *service) INIT_LOGE("stop service %s pid %d failed! err %d.\n", service->name, service->pid, errno); return SERVICE_FAILURE; } - +#ifndef OHOS_LITE + char paramName[PARAM_NAME_LEN_MAX] = {0}; + if (snprintf_s(paramName, PARAM_NAME_LEN_MAX, PARAM_NAME_LEN_MAX - 1, "init.svc.%s", service->name) < 0) { + INIT_LOGE("snprintf_s paramName error %d \n", errno); + } + SystemWriteParam(paramName, "stopping"); +#endif INIT_LOGI("stop service %s, pid %d.\n", service->name, service->pid); return SERVICE_SUCCESS; } @@ -291,12 +314,19 @@ void ServiceReap(Service *service) return; } + service->pid = -1; +#ifndef OHOS_LITE + char paramName[PARAM_NAME_LEN_MAX] = {0}; + if (snprintf_s(paramName, PARAM_NAME_LEN_MAX, PARAM_NAME_LEN_MAX - 1, "init.svc.%s", service->name) < 0) { + INIT_LOGE("snprintf_s paramName error %d \n", errno); + } + SystemWriteParam(paramName, "stopped"); +#endif if (service->attribute & SERVICE_ATTR_INVALID) { INIT_LOGE("ServiceReap service %s invalid.\n", service->name); return; } - service->pid = -1; // stopped by system-init itself, no need to restart even if it is not one-shot service if (service->attribute & SERVICE_ATTR_NEED_STOP) { service->attribute &= (~SERVICE_ATTR_NEED_STOP);