!2333 【ADD】cloudfiledaemon 新增 bootevent

Merge pull request !2333 from 刘昊天/daemon_stop
This commit is contained in:
openharmony_ci 2024-11-21 12:56:03 +00:00 committed by Gitee
commit 878ed850cb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 92 additions and 18 deletions

View File

@ -26,6 +26,14 @@ group("services_target") {
"${services_path}/cloudsyncservice:cloudsync_sa",
"${services_path}/distributedfiledaemon:libdistributedfiledaemon",
]
if (dfs_service_feature_enable_cloud_adapter) {
deps += [
"${services_path}:clouddaemon.para",
"${services_path}:clouddaemon.para.dac",
"${services_path}:clouddaemon_etc",
]
}
}
group("cloudsync_kit_inner_target") {

View File

@ -53,3 +53,24 @@ ohos_prebuilt_etc("cloudsyncservice.para.dac") {
module_install_dir = "etc/param"
subsystem_name = "filemanagement"
}
ohos_prebuilt_etc("clouddaemon_etc") {
source = "clouddaemon.cfg"
relative_install_dir = "init"
part_name = "dfs_service"
subsystem_name = "filemanagement"
}
ohos_prebuilt_etc("clouddaemon.para") {
source = "clouddaemon.para"
part_name = "dfs_service"
module_install_dir = "etc/param"
subsystem_name = "filemanagement"
}
ohos_prebuilt_etc("clouddaemon.para.dac") {
source = "clouddaemon.para.dac"
part_name = "dfs_service"
module_install_dir = "etc/param"
subsystem_name = "filemanagement"
}

24
services/clouddaemon.cfg Normal file
View File

@ -0,0 +1,24 @@
{
"services": [{
"name": "cloudfiledaemon",
"path": ["/system/bin/sa_main", "/system/profile/cloudfiledaemon.json"],
"uid": "1009",
"gid": ["dfs", "user_data_rw", "system", "ddms", "netsys_socket", "dfs_share"],
"sandbox": 0,
"secon": "u:r:cloudfiledaemon:s0",
"apl": "system_basic",
"bootevents": [
"bootevent.cloudfiledaemon.ready"
],
"permission" : [
"ohos.permission.CLOUDFILE_SYNC",
"ohos.permission.DISTRIBUTED_DATASYNC",
"ohos.permission.MANAGE_LOCAL_ACCOUNTS",
"ohos.permission.ACCESS_SERVICE_DM",
"ohos.permission.INTERNET",
"ohos.permission.USE_CLOUD_DRIVE_SERVICE",
"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS",
"ohos.permission.GET_BUNDLE_INFO"
]
}]
}

14
services/clouddaemon.para Normal file
View File

@ -0,0 +1,14 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
bootevent.cloudfiledaemon.ready = false

View File

@ -0,0 +1,14 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
bootevent.cloudfiledaemon.ready = dfs:user_data_rw:0777

View File

@ -149,6 +149,15 @@ void HandleStartMove(int32_t userId)
system::SetParameter(moveFile, "true");
}
void HandleDaemonStarted()
{
const string serviceReady = "bootevent.cloudfiledaemon.ready";
if (!system::GetBoolParameter(serviceReady, false)) {
system::SetParameter(serviceReady, "true");
LOGI("set cloudfiledaemon service started true");
}
}
void CloudDaemon::OnStop()
{
LOGI("Begin to stop");
@ -196,6 +205,8 @@ int32_t CloudDaemon::StartFuse(int32_t userId, int32_t devFd, const string &path
std::thread([userId]() {
HandleStartMove(userId);
}).detach();
} else {
HandleDaemonStarted();
}
return E_OK;
}

View File

@ -24,24 +24,6 @@
"ohos.permission.MONITOR_DEVICE_NETWORK_STATE"
],
"permission_acls" : ["ohos.permission.MONITOR_DEVICE_NETWORK_STATE"]
}, {
"name": "cloudfiledaemon",
"path": ["/system/bin/sa_main", "/system/profile/cloudfiledaemon.json"],
"uid": "1009",
"gid": ["dfs", "user_data_rw", "system", "ddms", "netsys_socket", "dfs_share"],
"sandbox": 0,
"secon": "u:r:cloudfiledaemon:s0",
"apl": "system_basic",
"permission" : [
"ohos.permission.CLOUDFILE_SYNC",
"ohos.permission.DISTRIBUTED_DATASYNC",
"ohos.permission.MANAGE_LOCAL_ACCOUNTS",
"ohos.permission.ACCESS_SERVICE_DM",
"ohos.permission.INTERNET",
"ohos.permission.USE_CLOUD_DRIVE_SERVICE",
"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS",
"ohos.permission.GET_BUNDLE_INFO"
]
}, {
"name": "cloudfileservice",
"path": ["/system/bin/sa_main", "/system/profile/cloudfileservice.json"],