diff options
author | 2021-09-14 17:07:39 +0000 | |
---|---|---|
committer | 2021-09-14 17:07:39 +0000 | |
commit | dcaed9ba8ebdc467880bf06aec4359af34dfa875 (patch) | |
tree | 53e9a8c77db457a49a636a5a061599ccd7685506 /libs/binder/RpcSession.cpp | |
parent | f4b83741a8170c7e21b6a3003cac76eed533d702 (diff) | |
parent | d612489ad404f5f193b35a649790d7734f4a7314 (diff) |
Merge changes I89e4de2e,I673d7a4c,Icfb454c2,I5924a82c am: a54c861843 am: d612489ad4
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1825953
Change-Id: Iefab3593ba5f4b4b4e7b3ba8de3490af7f369acf
Diffstat (limited to 'libs/binder/RpcSession.cpp')
-rw-r--r-- | libs/binder/RpcSession.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 9395b505e1..38958c93cb 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -29,6 +29,7 @@ #include <android-base/hex.h> #include <android-base/macros.h> #include <android_runtime/vm.h> +#include <binder/BpBinder.h> #include <binder/Parcel.h> #include <binder/RpcServer.h> #include <binder/RpcTransportRaw.h> @@ -191,7 +192,7 @@ bool RpcSession::shutdownAndWait(bool wait) { if (wait) { LOG_ALWAYS_FATAL_IF(mShutdownListener == nullptr, "Shutdown listener not installed"); - mShutdownListener->waitForShutdown(_l); + mShutdownListener->waitForShutdown(_l, sp<RpcSession>::fromExisting(this)); LOG_ALWAYS_FATAL_IF(!mThreads.empty(), "Shutdown failed"); } @@ -215,6 +216,10 @@ status_t RpcSession::transact(const sp<IBinder>& binder, uint32_t code, const Pa sp<RpcSession>::fromExisting(this), reply, flags); } +status_t RpcSession::sendDecStrong(const BpBinder* binder) { + return sendDecStrong(binder->getPrivateAccessor().rpcAddress()); +} + status_t RpcSession::sendDecStrong(uint64_t address) { ExclusiveConnection connection; status_t status = ExclusiveConnection::find(sp<RpcSession>::fromExisting(this), @@ -245,17 +250,19 @@ status_t RpcSession::readId() { void RpcSession::WaitForShutdownListener::onSessionAllIncomingThreadsEnded( const sp<RpcSession>& session) { (void)session; - mShutdown = true; } void RpcSession::WaitForShutdownListener::onSessionIncomingThreadEnded() { mCv.notify_all(); } -void RpcSession::WaitForShutdownListener::waitForShutdown(std::unique_lock<std::mutex>& lock) { - while (!mShutdown) { +void RpcSession::WaitForShutdownListener::waitForShutdown(std::unique_lock<std::mutex>& lock, + const sp<RpcSession>& session) { + while (session->mIncomingConnections.size() > 0) { if (std::cv_status::timeout == mCv.wait_for(lock, std::chrono::seconds(1))) { - ALOGE("Waiting for RpcSession to shut down (1s w/o progress)."); + ALOGE("Waiting for RpcSession to shut down (1s w/o progress): %zu incoming connections " + "still.", + session->mIncomingConnections.size()); } } } |