do not sleep if it is shutting down

- Various sleep(5) for vold shutdown can increase shutdown time a lot.
- If it is shutting down, do not sleep at all. init will take care of
  active partitions if not unmounted.

bug: 64143519
Test: reboot and check logs from vold, check if "ShutdownThread: Shutdown wait timed out" happens.
Change-Id: I7cb91427ad2205fe23a054d255caf7ffdfd9f6c3
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 4ba0c36..8398498 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -89,6 +89,8 @@
  */
 const char *VolumeManager::LOOPDIR           = "/mnt/obb";
 
+bool VolumeManager::shutting_down = false;
+
 static const char* kPathUserMount = "/mnt/user";
 static const char* kPathVirtualDisk = "/data/misc/vold/virtual_disk";
 
@@ -704,12 +706,14 @@
     if (mInternalEmulated == nullptr) {
         return 0; // already shutdown
     }
+    shutting_down = true;
     mInternalEmulated->destroy();
     mInternalEmulated = nullptr;
     for (const auto& disk : mDisks) {
         disk->destroy();
     }
     mDisks.clear();
+    shutting_down = false;
     return 0;
 }