Remove QEMU-ism from UI code.

This gets rid of qemu_set_fd_handler() users in the UI
program. We can remove its implementation from vl-android-ui.c

+ Really remove qemu-timer-ui.c :-)

Change-Id: I490df8ad5d5eea36b332bf54e2b156f6b5872bf4
diff --git a/android/protocol/ui-commands-impl.c b/android/protocol/ui-commands-impl.c
index 2ca4194..f07a1ad 100644
--- a/android/protocol/ui-commands-impl.c
+++ b/android/protocol/ui-commands-impl.c
@@ -16,7 +16,7 @@
  * from the Core.
  */
 
-#include "console.h"
+#include <unistd.h>
 #include "android/looper.h"
 #include "android/async-utils.h"
 #include "android/sync-utils.h"
@@ -44,6 +44,9 @@
     /* Socket descriptor for the UI service. */
     int             sock;
 
+    /* Custom i/o handler */
+    LoopIo          io[1];
+
     /* Command reader state. */
     UICmdImplState  reader_state;
 
@@ -113,7 +116,7 @@
  *  opaque - UICmdImpl instance.
  */
 static void
-_uiCmdImpl_io_read(void* opaque)
+_uiCmdImpl_io_callback(void* opaque, int fd, unsigned events)
 {
     UICmdImpl* uicmd = opaque;
     int status;
@@ -181,7 +184,7 @@
 }
 
 int
-uiCmdImpl_create(SockAddress* console_socket)
+uiCmdImpl_create(SockAddress* console_socket, Looper* looper)
 {
     char* handshake = NULL;
 
@@ -203,16 +206,10 @@
 
     // Initialize UI command reader.
     _uiCmdImpl.sock = core_connection_get_socket(_uiCmdImpl.core_connection);
-    if (qemu_set_fd_handler(_uiCmdImpl.sock, _uiCmdImpl_io_read, NULL,
-                            &_uiCmdImpl)) {
-        derror("Unable to set up UI _uiCmdImpl_io_read callback: %s\n",
-               errno_str);
-        uiCmdImpl_destroy();
-        if (handshake != NULL) {
-            free(handshake);
-        }
-        return -1;
-    }
+    loopIo_init(_uiCmdImpl.io, looper, _uiCmdImpl.sock,
+                _uiCmdImpl_io_callback,
+                &_uiCmdImpl);
+    loopIo_wantRead(_uiCmdImpl.io);
 
     fprintf(stdout, "core-ui-control is now connected to the core at %s.",
             sock_address_to_string(console_socket));
@@ -232,7 +229,7 @@
 {
     if (_uiCmdImpl.core_connection != NULL) {
         // Disable I/O callbacks.
-        qemu_set_fd_handler(_uiCmdImpl.sock, NULL, NULL, NULL);
+        loopIo_done(_uiCmdImpl.io);
         core_connection_close(_uiCmdImpl.core_connection);
         core_connection_free(_uiCmdImpl.core_connection);
         _uiCmdImpl.core_connection = NULL;