From 693524a5cd4928dd274226747ba14eb11088c295 Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:14:16 +0000 Subject: [PATCH 1/6] update services/samgr/native/source/sa_main.cpp. Signed-off-by: NEEN --- services/samgr/native/source/sa_main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/services/samgr/native/source/sa_main.cpp b/services/samgr/native/source/sa_main.cpp index 9811be2c..79287595 100755 --- a/services/samgr/native/source/sa_main.cpp +++ b/services/samgr/native/source/sa_main.cpp @@ -19,9 +19,23 @@ #include "iservice_registry.h" #include "sam_log.h" #include "system_ability_manager.h" +#include +#include using namespace OHOS; +void startDBinderService(OHOS::sptr manager) { + int time = 15; + while (time-- > 0) { + sleep(1); + } + auto dBinder = manager->GetDBinder(); + if (dBinder != nullptr) { + bool ret = dBinder->StartDBinderService(); + HILOGI("started dbinder service result is %{public}s", ret ? "ok" : "fail"); + } +} + int main(int argc, char *argv[]) { HILOGI("%{public}s called, enter System Ability Manager ", __func__); @@ -31,9 +45,11 @@ int main(int argc, char *argv[]) // Tell IPCThreadState we're the service manager OHOS::sptr serv = manager->AsObject(); IPCSkeleton::SetContextObject(serv); + std::thread th(startDBinderService, manager); + th.detach(); // Create IPCThreadPool and join in. HILOGI("start System Ability Manager Loop"); OHOS::IPCSkeleton::JoinWorkThread(); return -1; -} +} \ No newline at end of file -- Gitee From 6d149e2df729918881756f739d1d84ff01d3dbf9 Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:16:49 +0000 Subject: [PATCH 2/6] update services/samgr/native/source/system_ability_manager.cpp. Signed-off-by: NEEN --- services/samgr/native/source/system_ability_manager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index b3b77bae..5710e072 100755 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -194,8 +194,11 @@ sptr SystemAbilityManager::CheckSystemAbility(int32_t systemAbili if (dBinderService_ != nullptr) { string strName = to_string(systemAbilityId); remoteBinder = dBinderService_->MakeRemoteBinder(Str8ToStr16(strName), deviceId, systemAbilityId, 0); - HILOGI("CheckSystemAbility, MakeRemoteBinder, systemAbilityId is %{public}d, deviceId is %s", - systemAbilityId, AnonymizeDeviceId(deviceId).c_str()); + HILOGI("CheckSystemAbility, MakeRemoteBinder, systemAbilityId is %{public}d, deviceId is %s", + systemAbilityId, deviceId.c_str()); + if (remoteBinder == nullptr) { + HILOGE("MakeRemoteBinder error, remoteBinder is null"); + } } return remoteBinder; } -- Gitee From 857a43ad25a38f8f0e43229129957c5fd149d6c2 Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:18:11 +0000 Subject: [PATCH 3/6] update services/samgr/native/source/system_ability_manager.cpp. Signed-off-by: NEEN --- services/samgr/native/source/system_ability_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index 5710e072..a02647f3 100755 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -769,7 +769,7 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp FindSystemAbilityManagerNotify(systemAbilityId, ADD_SYSTEM_ABILITY_TRANSACTION); u16string strName = Str8ToStr16(to_string(systemAbilityId)); if (extraProp.isDistributed && dBinderService_ != nullptr) { - dBinderService_->RegisterRemoteProxy(strName, ability); + dBinderService_->RegisterRemoteProxy(strName, systemAbilityId); HILOGD("AddSystemAbility RegisterRemoteProxy, serviceId is %{public}d", systemAbilityId); } return ERR_OK; -- Gitee From cf45ce9444651e6e0966c818ab85b372ef83d45d Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:19:43 +0000 Subject: [PATCH 4/6] update services/samgr/native/BUILD.gn. Signed-off-by: NEEN --- services/samgr/native/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn index e73d97c5..0325880a 100755 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -65,6 +65,7 @@ ohos_executable("samgr") { "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//utils/native/base:utils", ] + configs = [ ":sam_config", "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr:config_samgr", -- Gitee From 9e96c411f4abfa9a0c59e640c223ad71f4d59fb5 Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:37:01 +0000 Subject: [PATCH 5/6] update services/samgr/native/BUILD.gn. Signed-off-by: NEEN --- services/samgr/native/BUILD.gn | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn index 0325880a..9b7e4a4e 100755 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -42,10 +42,12 @@ group("etc") { ohos_prebuilt_etc("samgr.rc") { relative_install_dir = "init" - if (is_standard_system) { + if (use_musl) { + source = "samgr_L2.cfg" + } else { source = "samgr_L2.rc" - part_name = "samgr_L2" } + part_name = "samgr_L2" subsystem_name = "distributedschedule" } -- Gitee From a84e1612e20c722ec4f53986e8079deeecf97564 Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:38:14 +0000 Subject: [PATCH 6/6] add services/samgr/native/samgr_L2.cfg. Signed-off-by: NEEN --- services/samgr/native/samgr_L2.cfg | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 services/samgr/native/samgr_L2.cfg diff --git a/services/samgr/native/samgr_L2.cfg b/services/samgr/native/samgr_L2.cfg new file mode 100644 index 00000000..1e8e8552 --- /dev/null +++ b/services/samgr/native/samgr_L2.cfg @@ -0,0 +1,22 @@ +{ + "jobs" : [{ + "name" : "init", + "cmds" : [ + "mkdir /data/sadata_de", + "chmod 755 /data/sadata_de", + "chown system system /data/sadata_de", + "mkdir /data/sadata_de/samgr", + "chmod 755 /data/sadata_de/samgr", + "chown system system /data/sadata_de/samgr", + "start samgr" + ] + } + ], + "services" : [{ + "name" : "samgr", + "path" : ["/system/bin/samgr"], + "uid" : "system", + "gid" : ["system"] + } + ] +} \ No newline at end of file -- Gitee