Refactor the code

 * Split out classes for pixel buffer and virtual display
 * Move resize handling to appropriate classes
 * Use callbacks for orientation change and client resize
 * Remove unnecessary locking
diff --git a/src/main.cpp b/src/main.cpp
index c22f075..831268d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,10 @@
 
 #include "AndroidDesktop.h"
 
+#include <binder/IPCThreadState.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+
 #include <network/Socket.h>
 #include <network/TcpSocket.h>
 #include <rfb/Configuration.h>
@@ -13,6 +17,7 @@
 #include <rfb/util.h>
 
 using namespace vncflinger;
+using namespace android;
 
 static char* gProgramName;
 static bool gCaughtSignal = false;
@@ -67,6 +72,9 @@
         usage();
     }
 
+    sp<ProcessState> self = ProcessState::self();
+    self->startThreadPool();
+
     std::list<network::TcpListener*> listeners;
 
     try {
@@ -157,6 +165,7 @@
             uint64_t eventVal;
             int status = read(eventFd, &eventVal, sizeof(eventVal));
             if (status > 0 && eventVal > 0) {
+                ALOGV("status=%d eventval=%lu", status, eventVal);
                 desktop->processFrames();
             }
         }