From e81595dde91427508d64944dd0b6d12063f2a784 Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 07:55:06 +0000 Subject: [PATCH 1/7] update services/samgr/native/source/sa_main.cpp. Signed-off-by: NEEN --- services/samgr/native/source/sa_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/source/sa_main.cpp b/services/samgr/native/source/sa_main.cpp index 030f394f..62a51811 100755 --- a/services/samgr/native/source/sa_main.cpp +++ b/services/samgr/native/source/sa_main.cpp @@ -26,7 +26,7 @@ using namespace OHOS; void startDBinderService(OHOS::sptr manager) { - int time = 15; + int time = 30; while (time-- > 0) { sleep(1); } -- Gitee From d919f6050fa6c736add7ef6ca5ba0e7a9a1d4827 Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 08:04:55 +0000 Subject: [PATCH 2/7] update services/samgr/native/source/sa_main.cpp. Signed-off-by: NEEN --- services/samgr/native/source/sa_main.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/services/samgr/native/source/sa_main.cpp b/services/samgr/native/source/sa_main.cpp index 62a51811..d5550c99 100755 --- a/services/samgr/native/source/sa_main.cpp +++ b/services/samgr/native/source/sa_main.cpp @@ -13,9 +13,6 @@ * limitations under the License. */ -#include -#include - #include "errors.h" #include "ipc_skeleton.h" #include "ipc_types.h" @@ -25,18 +22,6 @@ using namespace OHOS; -void startDBinderService(OHOS::sptr manager) { - int time = 30; - 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__); @@ -46,8 +31,6 @@ 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"); -- Gitee From 674790b9850f4bcac27c08f5b00ecfc2b649da21 Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 08:13:16 +0000 Subject: [PATCH 3/7] 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, 7 insertions(+) diff --git a/services/samgr/native/source/system_ability_manager.cpp b/services/samgr/native/source/system_ability_manager.cpp index a02647f3..53dc0b87 100755 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -772,6 +772,13 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp dBinderService_->RegisterRemoteProxy(strName, systemAbilityId); HILOGD("AddSystemAbility RegisterRemoteProxy, serviceId is %{public}d", systemAbilityId); } + if (systemAbilityId == SOFTBUS_SERVER_SA_ID && !isDbinderStart) { + if (dBinderService_ != nullptr) { + bool ret = dBinderService_->StartDBinderService(); + HILOGI("startd dbinder service result is %{public}s", ret ? "ok" : "fail"); + } + isDbinderStart = true; + } return ERR_OK; } -- Gitee From 288723e4bb24057a131f671e0def28a1aa39014d Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 08:14:15 +0000 Subject: [PATCH 4/7] update services/samgr/native/include/system_ability_manager.h. Signed-off-by: NEEN --- services/samgr/native/include/system_ability_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/services/samgr/native/include/system_ability_manager.h b/services/samgr/native/include/system_ability_manager.h index 883e0b81..e1e6953a 100755 --- a/services/samgr/native/include/system_ability_manager.h +++ b/services/samgr/native/include/system_ability_manager.h @@ -150,6 +150,7 @@ private: sptr localAbilityManagerDeath_; sptr systemReadyCallbackDeath_; sptr dBinderService_; + bool isDbinderStart = false; // must hold abilityMapLock_ never access other locks std::shared_mutex abilityMapLock_; -- Gitee From 3934042572670b2567a913ddebb8b4692c77b81a Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 09:05:35 +0000 Subject: [PATCH 5/7] 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 53dc0b87..e29b6351 100755 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -776,8 +776,8 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp if (dBinderService_ != nullptr) { bool ret = dBinderService_->StartDBinderService(); HILOGI("startd dbinder service result is %{public}s", ret ? "ok" : "fail"); + isDbinderStart_ = true; } - isDbinderStart = true; } return ERR_OK; } -- Gitee From 9bb1fcd7666a73b704b22fc298af59408a8f62fc Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 09:07:15 +0000 Subject: [PATCH 6/7] update services/samgr/native/include/system_ability_manager.h. Signed-off-by: NEEN --- services/samgr/native/include/system_ability_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/samgr/native/include/system_ability_manager.h b/services/samgr/native/include/system_ability_manager.h index e1e6953a..55583543 100755 --- a/services/samgr/native/include/system_ability_manager.h +++ b/services/samgr/native/include/system_ability_manager.h @@ -150,7 +150,7 @@ private: sptr localAbilityManagerDeath_; sptr systemReadyCallbackDeath_; sptr dBinderService_; - bool isDbinderStart = false; + bool isDbinderStart_ = false; // must hold abilityMapLock_ never access other locks std::shared_mutex abilityMapLock_; -- Gitee From 672c028aaf484b6f3312851ce22406da729dc670 Mon Sep 17 00:00:00 2001 From: ql Date: Mon, 26 Jul 2021 09:10:57 +0000 Subject: [PATCH 7/7] 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 e29b6351..82b08fa6 100755 --- a/services/samgr/native/source/system_ability_manager.cpp +++ b/services/samgr/native/source/system_ability_manager.cpp @@ -772,7 +772,7 @@ int32_t SystemAbilityManager::AddSystemAbility(int32_t systemAbilityId, const sp dBinderService_->RegisterRemoteProxy(strName, systemAbilityId); HILOGD("AddSystemAbility RegisterRemoteProxy, serviceId is %{public}d", systemAbilityId); } - if (systemAbilityId == SOFTBUS_SERVER_SA_ID && !isDbinderStart) { + if (systemAbilityId == SOFTBUS_SERVER_SA_ID && !isDbinderStart_) { if (dBinderService_ != nullptr) { bool ret = dBinderService_->StartDBinderService(); HILOGI("startd dbinder service result is %{public}s", ret ? "ok" : "fail"); -- Gitee