libgui: Remove RefBase from BitTube

Removes RefBase from BitTube, since because it is not a Binder object,
it doesn't need to be reference-counted in this way.

In the process, we rename IDisplayEventConnection::getDataChannel to
IDEC::stealReceiveChannel to make it clearer that this is a non-const
operation on the remote end that removes its access to the receive
channel.

This also adds a couple of methods for moving the receive file
descriptor out of one BitTube and into another, since this is the
essence of the IDisplayEventConnection::stealReceiveChannel method,
and now with C++11 move semantics, we can do this without needing to
return an sp<> from EventThread's implementation of stealReceiveChannel.

Test: m -j + manual testing
Change-Id: Ibaaca2a14fb6155052fe5434c14bc3e671b43743
diff --git a/libs/gui/IDisplayEventConnection.cpp b/libs/gui/IDisplayEventConnection.cpp
index d3ee39c..a197426 100644
--- a/libs/gui/IDisplayEventConnection.cpp
+++ b/libs/gui/IDisplayEventConnection.cpp
@@ -22,7 +22,11 @@
 
 namespace android {
 
-enum { GET_DATA_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, SET_VSYNC_RATE, REQUEST_NEXT_VSYNC };
+enum {
+    STEAL_RECEIVE_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
+    SET_VSYNC_RATE,
+    REQUEST_NEXT_VSYNC
+};
 
 class BpDisplayEventConnection : public BpInterface<IDisplayEventConnection> {
 public:
@@ -31,11 +35,11 @@
 
     ~BpDisplayEventConnection() override;
 
-    status_t getDataChannel(sp<gui::BitTube>* outChannel) const override {
+    status_t stealReceiveChannel(gui::BitTube* outChannel) override {
         Parcel data, reply;
         data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
-        remote()->transact(GET_DATA_CHANNEL, data, &reply);
-        *outChannel = new gui::BitTube(reply);
+        remote()->transact(STEAL_RECEIVE_CHANNEL, data, &reply);
+        outChannel->readFromParcel(&reply);
         return NO_ERROR;
     }
 
@@ -63,11 +67,11 @@
 status_t BnDisplayEventConnection::onTransact(uint32_t code, const Parcel& data, Parcel* reply,
                                               uint32_t flags) {
     switch (code) {
-        case GET_DATA_CHANNEL: {
+        case STEAL_RECEIVE_CHANNEL: {
             CHECK_INTERFACE(IDisplayEventConnection, data, reply);
-            sp<gui::BitTube> channel;
-            getDataChannel(&channel);
-            channel->writeToParcel(reply);
+            gui::BitTube channel;
+            stealReceiveChannel(&channel);
+            channel.writeToParcel(reply);
             return NO_ERROR;
         }
         case SET_VSYNC_RATE: {