From 0b33e3e87670bcb4db809e751cea9f2da61f7fe3 Mon Sep 17 00:00:00 2001 From: ql Date: Tue, 13 Jul 2021 07:10:25 +0000 Subject: [PATCH] update services/samgr/native/source/sa_main.cpp. --- 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