diff --git a/services/samgr/native/source/sa_main.cpp b/services/samgr/native/source/sa_main.cpp index d5550c990e12e4a9feb3592d250e6ff06e4e7dbb..030f394fe303dab0f8a30a7718ffdd9575ba9be5 100755 --- a/services/samgr/native/source/sa_main.cpp +++ b/services/samgr/native/source/sa_main.cpp @@ -13,6 +13,9 @@ * limitations under the License. */ +#include +#include + #include "errors.h" #include "ipc_skeleton.h" #include "ipc_types.h" @@ -22,6 +25,18 @@ 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,6 +46,8 @@ 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");