Merge "libbinder: RPC avoid FdTrigger shutdown race" am: 13ba6f3c3f

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1838242

Change-Id: I5c31e71b6da92233a86e7dfaea89fddba4e119f7
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 5733993..4c61a59 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -205,8 +205,11 @@
     }
 
     mShutdownTrigger->trigger();
+
     for (auto& [id, session] : mSessions) {
         (void)id;
+        // server lock is a more general lock
+        std::lock_guard<std::mutex> _lSession(session->mMutex);
         session->mShutdownTrigger->trigger();
     }