Reconcile with jb-mr1-factory-release jb-mr1-release - do not merge

Change-Id: I8de173f6b24b2f82b20e568e577878d8539e5148
diff --git a/cryptfs.c b/cryptfs.c
index 67533a4..bcacc39 100644
--- a/cryptfs.c
+++ b/cryptfs.c
@@ -688,8 +688,12 @@
     property_set("vold.decrypt", "trigger_reset_main");
     SLOGD("Just asked init to shut down class main\n");
 
-    /* Give everything a chance to shutdown */
-    sleep(1);
+    /* Ugh, shutting down the framework is not synchronous, so until it
+     * can be fixed, this horrible hack will wait a moment for it all to
+     * shut down before proceeding.  Without it, some devices cannot
+     * restart the graphics services.
+     */
+    sleep(2);
 
     /* Now that the framework is shutdown, we should be able to umount()
      * the tmpfs filesystem, and mount the real one.
@@ -1275,6 +1279,13 @@
             goto error_shutting_down;
         }
 
+        /* Ugh, shutting down the framework is not synchronous, so until it
+         * can be fixed, this horrible hack will wait a moment for it all to
+         * shut down before proceeding.  Without it, some devices cannot
+         * restart the graphics services.
+         */
+        sleep(2);
+
         /* startup service classes main and late_start */
         property_set("vold.decrypt", "trigger_restart_min_framework");
         SLOGD("Just triggered restart_min_framework\n");