Refactored SystemServerInitThreadPool.get().submit() into just submit().
Bug: 141571552
Test: manual verification
Change-Id: I1c54e9b66c765956369de2d93063bc4760b79772
diff --git a/services/core/java/com/android/server/SystemServerInitThreadPool.java b/services/core/java/com/android/server/SystemServerInitThreadPool.java
index 19f4089..5ed94e3 100644
--- a/services/core/java/com/android/server/SystemServerInitThreadPool.java
+++ b/services/core/java/com/android/server/SystemServerInitThreadPool.java
@@ -67,23 +67,26 @@
}
/**
- * Gets the singleton.
+ * Submits a task for execution.
*
* @throws IllegalStateException if it hasn't been started or has been shut down already.
*/
- public static SystemServerInitThreadPool get() {
+ public static @NonNull Future<?> submit(@NonNull Runnable runnable,
+ @NonNull String description) {
+ Preconditions.checkNotNull(description, "description cannot be null");
+
+ SystemServerInitThreadPool instance;
synchronized (LOCK) {
Preconditions.checkState(sInstance != null, "Cannot get " + TAG
+ " - it has been shut down");
- return sInstance;
+ instance = sInstance;
}
+
+ return instance.submitTask(runnable, description);
}
- /**
- * Submits a task for execution.
- */
- public @NonNull Future<?> submit(@NonNull Runnable runnable, @NonNull String description) {
- Preconditions.checkNotNull(description, "description cannot be null");
+ private @NonNull Future<?> submitTask(@NonNull Runnable runnable,
+ @NonNull String description) {
synchronized (mPendingTasks) {
Preconditions.checkState(!mShutDown, TAG + " already shut down");
mPendingTasks.add(description);