Merge "Fixed when SystemServerInitThreadPool.shutdown() is called." into rvc-dev
diff --git a/services/core/java/com/android/server/SystemServerInitThreadPool.java b/services/core/java/com/android/server/SystemServerInitThreadPool.java
index 94d6b13..c061137 100644
--- a/services/core/java/com/android/server/SystemServerInitThreadPool.java
+++ b/services/core/java/com/android/server/SystemServerInitThreadPool.java
@@ -133,9 +133,11 @@
     /**
      * Shuts it down.
      *
-     * <p>Note:</p> should only be called by {@link SystemServer}.
+     * <p>Note:</p> should only be called *after* {@code PHASE_BOOT_COMPLETED} is sent to the
+     * {@link SystemService system services}.
      */
     static void shutdown() {
+        Slog.d(TAG, "Shutdown requested");
         synchronized (LOCK) {
             TimingsTraceAndSlog t = new TimingsTraceAndSlog();
             t.traceBegin("WaitInitThreadPoolShutdown");
diff --git a/services/core/java/com/android/server/SystemServiceManager.java b/services/core/java/com/android/server/SystemServiceManager.java
index d2e12b5..197a2ce 100644
--- a/services/core/java/com/android/server/SystemServiceManager.java
+++ b/services/core/java/com/android/server/SystemServiceManager.java
@@ -222,6 +222,7 @@
         if (phase == SystemService.PHASE_BOOT_COMPLETED) {
             final long totalBootTime = SystemClock.uptimeMillis() - mRuntimeStartUptime;
             t.logDuration("TotalBootTime", totalBootTime);
+            SystemServerInitThreadPool.shutdown();
         }
     }
 
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index fa3f330..2a200fb 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -590,7 +590,6 @@
             startBootstrapServices(t);
             startCoreServices(t);
             startOtherServices(t);
-            SystemServerInitThreadPool.shutdown();
         } catch (Throwable ex) {
             Slog.e("System", "******************************************");
             Slog.e("System", "************ Failure starting system services", ex);