Cleanup some of the thread merging.

Adds an optimization for checking whether a looper is stuck,
with a new Looper method to see if its thread is currently
idle.  This will allow us to put a large number of loopers
in the monitor efficiently, since we generally won't have to
do a context switch on each of them (since most looper threads
spend most of their time idle waiting for work).

Also change things so the system process's main thread
is actually running on the main thread.  Because Jeff
asked for this, and who am I to argue? :)

Change-Id: I12999e6f9c4b056c22dd652cb78c2453c391061f
diff --git a/services/java/com/android/server/IoThread.java b/services/java/com/android/server/IoThread.java
index b443578..09f2af7 100644
--- a/services/java/com/android/server/IoThread.java
+++ b/services/java/com/android/server/IoThread.java
@@ -47,14 +47,14 @@
     }
 
     public static IoThread get() {
-        synchronized (UiThread.class) {
+        synchronized (IoThread.class) {
             ensureThreadLocked();
             return sInstance;
         }
     }
 
     public static Handler getHandler() {
-        synchronized (UiThread.class) {
+        synchronized (IoThread.class) {
             ensureThreadLocked();
             return sHandler;
         }