From 42e95bb38909745d0914324185217406439c53da Mon Sep 17 00:00:00 2001 From: zhangkaixiang Date: Fri, 7 Apr 2023 15:50:06 +0800 Subject: [PATCH] start and stop as needed Signed-off-by: zhangkaixiang --- services/5201.json | 30 +++++++++++++++++++ services/5201.xml | 27 ----------------- services/5204.json | 12 ++++++++ services/5204.xml | 30 ------------------- services/5205.json | 12 ++++++++ services/5205.xml | 26 ---------------- services/BUILD.gn | 6 ++-- services/distributedfile.cfg | 15 +++++++++- .../distributedfiledaemon/src/ipc/daemon.cpp | 2 +- 9 files changed, 72 insertions(+), 88 deletions(-) create mode 100644 services/5201.json delete mode 100644 services/5201.xml create mode 100644 services/5204.json delete mode 100644 services/5204.xml create mode 100644 services/5205.json delete mode 100644 services/5205.xml diff --git a/services/5201.json b/services/5201.json new file mode 100644 index 000000000..552af21b5 --- /dev/null +++ b/services/5201.json @@ -0,0 +1,30 @@ +{ + "process": "distributedfiledaemon", + "systemability": [ + { + "name": 5201, + "libpath": "libdistributedfiledaemon.z.so", + "run-on-create": false, + "depend": [ 4700 ], + "depend-time-out": 10000, + "distributed": true, + "dump-level": 1, + "start-on-demand":{ + "deviceonline":[ + { + "name": "deviceonline", + "value": "on" + } + ] + }, + "stop-on-demand":{ + "deviceonline":[ + { + "name": "deviceonline", + "value": "off" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/services/5201.xml b/services/5201.xml deleted file mode 100644 index 25b1b906e..000000000 --- a/services/5201.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - distributedfiledaemon - - 5201 - libdistributedfiledaemon.z.so - 3299;4802;4700 - 60000 - true - false - 1 - - diff --git a/services/5204.json b/services/5204.json new file mode 100644 index 000000000..04bd94163 --- /dev/null +++ b/services/5204.json @@ -0,0 +1,12 @@ +{ + "process": "cloudfiledaemon", + "systemability": [ + { + "name": 5204, + "libpath": "libcloudsync_sa.z.so", + "run-on-create": false, + "distributed": false, + "dump-level": 1 + } + ] +} diff --git a/services/5204.xml b/services/5204.xml deleted file mode 100644 index 212cf74d3..000000000 --- a/services/5204.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - distributedfiledaemon - - libcloudsync_sa.z.so - - - 5204 - libcloudsync_sa.z.so - - - false - false - 1 - - diff --git a/services/5205.json b/services/5205.json new file mode 100644 index 000000000..e3f4b52e9 --- /dev/null +++ b/services/5205.json @@ -0,0 +1,12 @@ +{ + "process": "cloudfiledaemon", + "systemability": [ + { + "name": 5205, + "libpath": "libcloudfiledaemon.z.so", + "run-on-create": true, + "distributed": false, + "dump-level": 1 + } + ] +} \ No newline at end of file diff --git a/services/5205.xml b/services/5205.xml deleted file mode 100644 index 5506608b2..000000000 --- a/services/5205.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - distributedfiledaemon - - 5205 - libcloudfiledaemon.z.so - 60000 - false - false - 1 - - diff --git a/services/BUILD.gn b/services/BUILD.gn index 13011f2d1..15aaf850a 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -16,9 +16,9 @@ import("//foundation/filemanagement/dfs_service/distributedfile.gni") ohos_sa_profile("distributedfile_sa_profile") { sources = [ - "5201.xml", - "5204.xml", - "5205.xml", + "5201.json", + "5204.json", + "5205.json", ] part_name = "dfs_service" } diff --git a/services/distributedfile.cfg b/services/distributedfile.cfg index 591bda611..3496baac3 100644 --- a/services/distributedfile.cfg +++ b/services/distributedfile.cfg @@ -4,7 +4,20 @@ }], "services": [{ "name": "distributedfiledaemon", - "path": ["/system/bin/sa_main", "/system/profile/distributedfiledaemon.xml"], + "path": ["/system/bin/sa_main", "/system/profile/distributedfiledaemon.json"], + "uid": "1009", + "gid": ["system", "dfs"], + "secon": "u:r:distributedfiledaemon:s0", + "apl": "system_basic", + "ondemand": true, + "permission" : [ + "ohos.permission.DISTRIBUTED_DATASYNC", + "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "ohos.permission.ACCESS_SERVICE_DM" + ] + }, { + "name": "cloudfiledaemon", + "path": ["/system/bin/sa_main", "/system/profile/cloudfiledaemon.json"], "uid": "1009", "gid": ["system", "dfs"], "secon": "u:r:distributedfiledaemon:s0", diff --git a/services/distributedfiledaemon/src/ipc/daemon.cpp b/services/distributedfiledaemon/src/ipc/daemon.cpp index 194fb0d50..29b7db6d4 100644 --- a/services/distributedfiledaemon/src/ipc/daemon.cpp +++ b/services/distributedfiledaemon/src/ipc/daemon.cpp @@ -30,7 +30,7 @@ namespace Storage { namespace DistributedFile { using namespace std; -REGISTER_SYSTEM_ABILITY_BY_ID(Daemon, FILEMANAGEMENT_DISTRIBUTED_FILE_DAEMON_SA_ID, true); +REGISTER_SYSTEM_ABILITY_BY_ID(Daemon, FILEMANAGEMENT_DISTRIBUTED_FILE_DAEMON_SA_ID, false); void Daemon::PublishSA() { -- Gitee