Pass unique_ptr of InputChannel to Connection

This gets us closer to the goal of storing unique_ptr of InputChannel
inside the InputPublisher.

In this CL, we are still allowing the "copy" and "dup" functions to
exist. Removing those requires significant refactoring on the Java side,
including the jni layer and object ownership models.

Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Bug: 161009324
Change-Id: If6f44d78c7fc9f3e12729068de1753847abf0ebb
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h
index d53e8c6..42dcd3c 100644
--- a/include/input/InputTransport.h
+++ b/include/input/InputTransport.h
@@ -301,6 +301,15 @@
     void copyTo(android::os::InputChannelCore& outChannel) const;
 
     /**
+     * Similar to "copyTo", but it takes ownership of the provided InputChannel (and after this is
+     * called, it destroys it).
+     * @param from the InputChannel that should be converted to InputChannelCore
+     * @param outChannel the pre-allocated InputChannelCore to which to transfer the 'from' channel
+     */
+    static void moveChannel(std::unique_ptr<InputChannel> from,
+                            android::os::InputChannelCore& outChannel);
+
+    /**
      * The connection token is used to identify the input connection, i.e.
      * the pair of input channels that were created simultaneously. Input channels
      * are always created in pairs, and the token can be used to find the server-side
@@ -333,7 +342,7 @@
     ~InputPublisher();
 
     /* Gets the underlying input channel. */
-    inline std::shared_ptr<InputChannel> getChannel() const { return mChannel; }
+    inline InputChannel& getChannel() const { return *mChannel; }
 
     /* Publishes a key event to the input channel.
      *