Expose display manager client event fd

This will allow the display manager client to use epoll to wait and
respond to changes in the current set of VR display surfaces.

Bug: None
Test: Compiled and ran with simple standalone binary application.
Change-Id: I7680f5a56348abfb686e78d13e0e737466735ac6
diff --git a/libs/vr/libdisplay/display_manager_client.cpp b/libs/vr/libdisplay/display_manager_client.cpp
index f454b08..8fd3627 100644
--- a/libs/vr/libdisplay/display_manager_client.cpp
+++ b/libs/vr/libdisplay/display_manager_client.cpp
@@ -41,6 +41,23 @@
   delete client;
 }
 
+int dvrDisplayManagerClientGetEventFd(DvrDisplayManagerClient* client) {
+  return client->client->event_fd();
+}
+
+int dvrDisplayManagerClientTranslateEpollEventMask(
+    DvrDisplayManagerClient* client, int in_events, int* out_events) {
+  auto result = client->client->GetChannel()->GetEventMask(in_events);
+
+  if (!result) {
+    return -EIO;
+  }
+
+  *out_events = result.get();
+
+  return 0;
+}
+
 int dvrDisplayManagerClientGetSurfaceList(
     DvrDisplayManagerClient* client,
     DvrDisplayManagerClientSurfaceList** surface_list) {
diff --git a/libs/vr/libdisplay/include/private/dvr/display_manager_client.h b/libs/vr/libdisplay/include/private/dvr/display_manager_client.h
index f28c1e4..8ba9175 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_manager_client.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_manager_client.h
@@ -19,6 +19,21 @@
 
 void dvrDisplayManagerClientDestroy(DvrDisplayManagerClient* client);
 
+// Return an event fd for checking if there was an event on the server
+// Note that the only event which will be flagged is POLLIN. You must use
+// dvrDisplayManagerClientTranslateEpollEventMask in order to get the real
+// event flags.
+// @return the fd
+int dvrDisplayManagerClientGetEventFd(DvrDisplayManagerClient* client);
+
+// Once you have received an epoll event, you must translate it to its true
+// flags. This is a workaround for working with UDS.
+// @param in_events pass in the epoll revents that were initially returned
+// @param on success, this value will be overwritten with the true epoll values
+// @return 0 on success, non-zero otherwise
+int dvrDisplayManagerClientTranslateEpollEventMask(
+    DvrDisplayManagerClient* client, int in_events, int* out_events);
+
 // If successful, populates |surface_list| with a list of application
 // surfaces the display is currently using.
 //
diff --git a/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h b/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
index 645ccce..4ecd8d4 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
@@ -20,6 +20,9 @@
   int GetSurfaceBuffers(
       int surface_id, std::vector<std::unique_ptr<BufferConsumer>>* consumers);
 
+  using Client::event_fd;
+  using Client::GetChannel;
+
  private:
   friend BASE;