Add MountService tests and fix a bug it found

Add some MountService tests that are based partially on some stuff done
in PackageManagerTests. This allows us to test the OBB changes in an
easy way.

Also, it found some bugs in the DefaultContainerService connection state
machine, so fix those while we're at it.

Change-Id: I18f38593be754eb32fb6e842f88eec47e2beefce
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 8e5cdc2..df42c5b 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -1743,15 +1743,9 @@
                             action.handleError();
                             return;
                         }
-
-                        mActions.add(action);
-                        break;
                     }
 
-                    // Once we bind to the service, the first
-                    // pending request will be processed.
                     mActions.add(action);
-                    mObbActionHandler.sendEmptyMessage(OBB_MCS_BOUND);
                     break;
                 }
                 case OBB_MCS_BOUND: {
@@ -1821,6 +1815,7 @@
                     if (DEBUG_OBB)
                         Slog.i(TAG, "OBB_MCS_GIVE_UP");
                     mActions.remove(0);
+                    mObbActionHandler.sendEmptyMessage(OBB_MCS_BOUND);
                     break;
                 }
             }
@@ -1879,6 +1874,7 @@
                 if (DEBUG_OBB)
                     Slog.d(TAG, "Error handling OBB action", e);
                 handleError();
+                mObbActionHandler.sendEmptyMessage(OBB_MCS_UNBIND);
             }
         }