From 66d5b7ac5c78330dd7ad38f0319d432e2df7230f Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 7 Jul 2022 21:42:10 +0000 Subject: Add linkToDeath support for RPC binder so a client can act on disconnect This requires an incoming thread to be listening to the connection in order to be notified. Test: atest binderRpcTest Test: atest binderRpcTestSingleThreaded Bug: 182939380 Change-Id: I3746de6e8cff99bb267867c5dc60a6815b19fb92 --- libs/binder/RpcSession.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/binder/RpcSession.cpp') diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 80f6a37f51..e6dbd79ffb 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -223,6 +223,11 @@ bool RpcSession::shutdownAndWait(bool wait) { _l.unlock(); + if (status_t res = state()->sendObituaries(sp::fromExisting(this)); res != OK) { + ALOGE("Failed to send obituaries as the RpcSession is shutting down: %s", + statusToString(res).c_str()); + } + mRpcBinderState->clear(); return true; -- cgit v1.2.3-59-g8ed1b