From fc5304075e0a8f0711cea15cd96733bc2a5a11a3 Mon Sep 17 00:00:00 2001 From: felipeal Date: Mon, 11 May 2020 10:20:43 -0700 Subject: [PATCH] Fixed when SystemServerInitThreadPool.shutdown() is called. The class' Javadoc says it's shut down after P HASE_BOOT_COMPLETED, whic was not the case. Test: manual verification / boot Fixes: 156257347 Change-Id: I3c8b24c6855c7c83cdf1eacc637b8e064a121fe3 --- .../java/com/android/server/SystemServerInitThreadPool.java | 4 +++- .../core/java/com/android/server/SystemServiceManager.java | 1 + services/java/com/android/server/SystemServer.java | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/SystemServerInitThreadPool.java b/services/core/java/com/android/server/SystemServerInitThreadPool.java index 94d6b135e554d..c0611374679b6 100644 --- a/services/core/java/com/android/server/SystemServerInitThreadPool.java +++ b/services/core/java/com/android/server/SystemServerInitThreadPool.java @@ -133,9 +133,11 @@ public class SystemServerInitThreadPool { /** * Shuts it down. * - *

Note:

should only be called by {@link SystemServer}. + *

Note:

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 d2e12b52ba357..197a2cef0a62b 100644 --- a/services/core/java/com/android/server/SystemServiceManager.java +++ b/services/core/java/com/android/server/SystemServiceManager.java @@ -222,6 +222,7 @@ public class SystemServiceManager { 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 fa3f33067e8e5..2a200fb0ae2c2 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -590,7 +590,6 @@ public final class SystemServer { startBootstrapServices(t); startCoreServices(t); startOtherServices(t); - SystemServerInitThreadPool.shutdown(); } catch (Throwable ex) { Slog.e("System", "******************************************"); Slog.e("System", "************ Failure starting system services", ex);