libbinder: RpcSession exposes sp<RpcServer>

This object guarantees a strong pointer IFF it is associated with a
server. The wp<> return type here previously was for convenience (idk?)
but users of it shouldn't be concerned with the underlying memory
situation.

Bug: 167966510
Test: binderRpcTest
Change-Id: I6578c3a4246e1bd07f7697c11d4b56899b50245b
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 3dbd11f..f953a05 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -312,8 +312,13 @@
     }
 }
 
-wp<RpcServer> RpcSession::server() {
-    return mForServer;
+sp<RpcServer> RpcSession::server() {
+    RpcServer* unsafeServer = mForServer.unsafe_get();
+    sp<RpcServer> server = mForServer.promote();
+
+    LOG_ALWAYS_FATAL_IF((unsafeServer == nullptr) != (server == nullptr),
+                        "wp<> is to avoid strong cycle only");
+    return server;
 }
 
 bool RpcSession::setupSocketClient(const RpcSocketAddress& addr) {