diff --git a/services/samgr/native/source/sa_main.cpp b/services/samgr/native/source/sa_main.cpp index 9811be2c1802d56df427c10b3c1e67456fe4b6a6..7928759593117ef67c678175d57757381bdb6ef4 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