mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-23 07:50:24 +00:00
commit
79160d3456
@ -104,6 +104,8 @@ public:
|
||||
sptr<DBinderServiceStub> MakeRemoteBinder(const std::u16string &serviceName,
|
||||
const std::string &deviceID, binder_uintptr_t binderObject, uint64_t pid = 0);
|
||||
bool RegisterRemoteProxy(std::u16string serviceName, sptr<IRemoteObject> binderObject);
|
||||
bool RegisterRemoteProxy(std::u16string serviceName, int32_t systemAbilityId);
|
||||
bool RegisterRemoteProxyInner(std::u16string serviceName, binder_uintptr_t binder);
|
||||
bool OnRemoteMessageTask(const struct DHandleEntryTxRx *message);
|
||||
std::shared_ptr<struct SessionInfo> QuerySessionObject(binder_uintptr_t stub);
|
||||
bool DetachDeathRecipient(sptr<IRemoteObject> object);
|
||||
|
@ -555,9 +555,25 @@ bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, sptr<IRemot
|
||||
|
||||
binder_uintptr_t binder = (binder_uintptr_t)binderObject.GetRefPtr();
|
||||
DBINDER_LOGI("register remote proxy");
|
||||
return RegisterRemoteProxyInner(serviceName, binder);
|
||||
}
|
||||
|
||||
bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, int32_t systemAbilityId)
|
||||
{
|
||||
DBINDER_LOGI("register remote proxy, service name = %{public}s", Str16ToStr8(serviceName).c_str());
|
||||
|
||||
if (serviceName.length() == 0 || systemAbilityId <= 0) {
|
||||
DBINDER_LOGE("serviceName.length() = %zu", serviceName.length());
|
||||
return false;
|
||||
}
|
||||
|
||||
binder_uintptr_t binder = (binder_uintptr_t)systemAbilityId;
|
||||
return RegisterRemoteProxyInner(serviceName, binder);
|
||||
}
|
||||
|
||||
bool DBinderService::RegisterRemoteProxyInner(std::u16string serviceName, binder_uintptr_t 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));
|
||||
|
Loading…
Reference in New Issue
Block a user