libbinder: RPC skip init on /dev/null

This started breaking the fuzzer, since we can't do a socket operation
on /dev/null.

Bug: N/A # yet!
Test: fuzzer no longer crashes
Change-Id: I881f63b85108ff488cb5798b1f0b96629b592329
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 3599427..a8f3fa8 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -313,7 +313,7 @@
         }
 
         if (reverse) {
-            LOG_ALWAYS_FATAL_IF(!session->addOutgoingConnection(std::move(clientFd)),
+            LOG_ALWAYS_FATAL_IF(!session->addOutgoingConnection(std::move(clientFd), true),
                                 "server state must already be initialized");
             return;
         }
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 931a876..4f55eef 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -100,7 +100,7 @@
         return false;
     }
 
-    return addOutgoingConnection(std::move(serverFd));
+    return addOutgoingConnection(std::move(serverFd), false);
 }
 
 sp<IBinder> RpcSession::getRootObject() {
@@ -432,7 +432,7 @@
             LOG_ALWAYS_FATAL_IF(!ownershipTransferred);
             return true;
         } else {
-            return addOutgoingConnection(std::move(serverFd));
+            return addOutgoingConnection(std::move(serverFd), true);
         }
     }
 
@@ -440,7 +440,7 @@
     return false;
 }
 
-bool RpcSession::addOutgoingConnection(unique_fd fd) {
+bool RpcSession::addOutgoingConnection(unique_fd fd, bool init) {
     sp<RpcConnection> connection = sp<RpcConnection>::make();
     {
         std::lock_guard<std::mutex> _l(mMutex);
@@ -458,7 +458,10 @@
         mOutgoingConnections.push_back(connection);
     }
 
-    status_t status = mState->sendConnectionInit(connection, sp<RpcSession>::fromExisting(this));
+    status_t status = OK;
+    if (init) {
+        mState->sendConnectionInit(connection, sp<RpcSession>::fromExisting(this));
+    }
 
     {
         std::lock_guard<std::mutex> _l(mMutex);
diff --git a/libs/binder/include/binder/RpcSession.h b/libs/binder/include/binder/RpcSession.h
index 1548e76..69c2a1a 100644
--- a/libs/binder/include/binder/RpcSession.h
+++ b/libs/binder/include/binder/RpcSession.h
@@ -223,7 +223,7 @@
     [[nodiscard]] bool setupSocketClient(const RpcSocketAddress& address);
     [[nodiscard]] bool setupOneSocketConnection(const RpcSocketAddress& address,
                                                 const RpcAddress& sessionId, bool server);
-    [[nodiscard]] bool addOutgoingConnection(base::unique_fd fd);
+    [[nodiscard]] bool addOutgoingConnection(base::unique_fd fd, bool init);
     [[nodiscard]] bool setForServer(const wp<RpcServer>& server,
                                     const wp<RpcSession::EventListener>& eventListener,
                                     const RpcAddress& sessionId);