libgui: Normalize IDisplayEventConnection methods

This change modifies the IDisplayEventConnection API such that every
synchronous method returns a status_t (to be able to return transport
errors). This required changing getDataChannel to return its channel by
output parameter rather than return type.

Currently no more error messages are checked than before, but this will
both enable calling code to check error messages if it desires and,
more importantly, allow the Bp/Bn code to be semi-automatically
generated using SafeInterface.

Test: libgui_tests + manual testing
Change-Id: I8d5bc5ef0475cee07b638a97079b234f0384c022
diff --git a/libs/gui/DisplayEventReceiver.cpp b/libs/gui/DisplayEventReceiver.cpp
index 07e07e0..16b06e9 100644
--- a/libs/gui/DisplayEventReceiver.cpp
+++ b/libs/gui/DisplayEventReceiver.cpp
@@ -37,7 +37,7 @@
     if (sf != NULL) {
         mEventConnection = sf->createDisplayEventConnection();
         if (mEventConnection != NULL) {
-            mDataChannel = mEventConnection->getDataChannel();
+            mEventConnection->getDataChannel(&mDataChannel);
         }
     }
 }
diff --git a/libs/gui/IDisplayEventConnection.cpp b/libs/gui/IDisplayEventConnection.cpp
index 4d2d7e9..2de2f8a 100644
--- a/libs/gui/IDisplayEventConnection.cpp
+++ b/libs/gui/IDisplayEventConnection.cpp
@@ -29,23 +29,25 @@
     explicit BpDisplayEventConnection(const sp<IBinder>& impl)
           : BpInterface<IDisplayEventConnection>(impl) {}
 
-    virtual ~BpDisplayEventConnection();
+    ~BpDisplayEventConnection() override;
 
-    virtual sp<BitTube> getDataChannel() const {
+    status_t getDataChannel(sp<BitTube>* outChannel) const override {
         Parcel data, reply;
         data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
         remote()->transact(GET_DATA_CHANNEL, data, &reply);
-        return new BitTube(reply);
+        *outChannel = new BitTube(reply);
+        return NO_ERROR;
     }
 
-    virtual void setVsyncRate(uint32_t count) {
+    status_t setVsyncRate(uint32_t count) override {
         Parcel data, reply;
         data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
         data.writeUint32(count);
         remote()->transact(SET_VSYNC_RATE, data, &reply);
+        return NO_ERROR;
     }
 
-    virtual void requestNextVsync() {
+    void requestNextVsync() override {
         Parcel data, reply;
         data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
         remote()->transact(REQUEST_NEXT_VSYNC, data, &reply, IBinder::FLAG_ONEWAY);
@@ -63,7 +65,8 @@
     switch (code) {
         case GET_DATA_CHANNEL: {
             CHECK_INTERFACE(IDisplayEventConnection, data, reply);
-            sp<BitTube> channel(getDataChannel());
+            sp<BitTube> channel;
+            getDataChannel(&channel);
             channel->writeToParcel(reply);
             return NO_ERROR;
         }