From 76c5f06596c361ed12d304d7682132d96483a7d9 Mon Sep 17 00:00:00 2001 From: qianli <847171309@qq.com> Date: Mon, 5 Jul 2021 16:27:31 +0800 Subject: [PATCH] Get SA Change-Id: I2bbe9e38da921faffa8c7fc50343f39c0c725a65 --- .../libdbinder/include/dbinder_service.h | 1 + .../dbinder_service/src/dbinder_service.cpp | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/interfaces/innerkits/libdbinder/include/dbinder_service.h b/interfaces/innerkits/libdbinder/include/dbinder_service.h index 0b09341..91fd83c 100755 --- a/interfaces/innerkits/libdbinder/include/dbinder_service.h +++ b/interfaces/innerkits/libdbinder/include/dbinder_service.h @@ -104,6 +104,7 @@ public: sptr MakeRemoteBinder(const std::u16string &serviceName, const std::string &deviceID, binder_uintptr_t binderObject, uint64_t pid = 0); bool RegisterRemoteProxy(std::u16string serviceName, sptr binderObject); + bool RegisterRemoteProxy(std::u16string serviceName, int32_t systemAbilityId); bool OnRemoteMessageTask(const struct DHandleEntryTxRx *message); std::shared_ptr QuerySessionObject(binder_uintptr_t stub); bool DetachDeathRecipient(sptr object); diff --git a/services/dbinder/dbinder_service/src/dbinder_service.cpp b/services/dbinder/dbinder_service/src/dbinder_service.cpp index 761959f..1e41c6d 100755 --- a/services/dbinder/dbinder_service/src/dbinder_service.cpp +++ b/services/dbinder/dbinder_service/src/dbinder_service.cpp @@ -564,6 +564,26 @@ bool DBinderService::RegisterRemoteProxy(std::u16string serviceName, sptr lockGuard(remoteBinderMutex_); + + // clear historical remnants, Don't care if it succeeds + (void)mapRemoteBinderObjects_.erase(serviceName); + auto result = mapRemoteBinderObjects_.insert(std::pair(serviceName, binder)); + return result.second; +} + bool DBinderService::OnRemoteMessageTask(const struct DHandleEntryTxRx *message) { if (message == nullptr) { -- GitLab