提交 3b79d653 编写于 作者: Q ql 提交者: Gitee

update services/dbinder/dbinder_service/src/dbinder_service.cpp.

上级 76c5f065
...@@ -555,29 +555,25 @@ bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, sptr<IRemot ...@@ -555,29 +555,25 @@ bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, sptr<IRemot
binder_uintptr_t binder = (binder_uintptr_t)binderObject.GetRefPtr(); binder_uintptr_t binder = (binder_uintptr_t)binderObject.GetRefPtr();
DBINDER_LOGI("register remote proxy"); DBINDER_LOGI("register remote proxy");
return RegisterRemoteProxyInner(serviceName, binder);
std::unique_lock<std::shared_mutex> lockGuard(remoteBinderMutex_);
// clear historical remnants, Don't care if it succeeds
(void)mapRemoteBinderObjects_.erase(serviceName);
auto result = mapRemoteBinderObjects_.insert(std::pair<std::u16string, binder_uintptr_t>(serviceName, binder));
return result.second;
} }
bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, int32_t systemAbilityId) bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, int32_t systemAbilityId)
{ {
DBINDER_LOGI("register remote proxy, service name = %{public}s", Str16ToStr8(serviceName).c_str()); DBINDER_LOGI("register remote proxy, service name = %{public}s", Str16ToStr8(serviceName).c_str());
if (serviceName.length() == 0) { if (serviceName.length() == 0 || systemAbilityId <= 0) {
DBINDER_LOGE("serviceName.length() = %zu", serviceName.length()); DBINDER_LOGE("serviceName.length() = %zu", serviceName.length());
return false; return false;
} }
binder_uintptr_t binder = (binder_uintptr_t)systemAbilityId; binder_uintptr_t binder = (binder_uintptr_t)systemAbilityId;
DBINDER_LOGI("register remote proxy"); return RegisterRemoteProxyInner(serviceName, binder);
}
bool DBinderService::RegisterRemoteProxyInner(std::u16string serviceName, binder_uintptr_t binder)
{
std::unique_lock<std::shared_mutex> lockGuard(remoteBinderMutex_); std::unique_lock<std::shared_mutex> lockGuard(remoteBinderMutex_);
// clear historical remnants, Don't care if it succeeds // clear historical remnants, Don't care if it succeeds
(void)mapRemoteBinderObjects_.erase(serviceName); (void)mapRemoteBinderObjects_.erase(serviceName);
auto result = mapRemoteBinderObjects_.insert(std::pair<std::u16string, binder_uintptr_t>(serviceName, binder)); auto result = mapRemoteBinderObjects_.insert(std::pair<std::u16string, binder_uintptr_t>(serviceName, binder));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册