Snap for 6622447 from 54d664184037610948d3e91e4de6efe98595d8ce to mainline-release
Change-Id: I59cadb8e8f71c1594f6eec47b32403aeef33fb06
diff --git a/src/com/android/internal/car/CarServiceHelperService.java b/src/com/android/internal/car/CarServiceHelperService.java
index d2d6fea..cd3c4f9 100644
--- a/src/com/android/internal/car/CarServiceHelperService.java
+++ b/src/com/android/internal/car/CarServiceHelperService.java
@@ -76,7 +76,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.car.ExternalConstants.ICarConstants;
import com.android.internal.os.IResultReceiver;
-import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemService;
import com.android.server.Watchdog;
import com.android.server.am.ActivityManagerService;
@@ -899,7 +898,19 @@
@VisibleForTesting
void runAsync(Runnable r) {
- SystemServerInitThreadPool.submit(r, "CarServiceHelperManagePreCreatedUsers");
+ // We cannot use SystemServerInitThreadPool because user pre-creation can take too long,
+ // which would crash the SystemServer on SystemServerInitThreadPool.shutdown();
+ String threadName = TAG + ".AsyncTask";
+ Slog.i(TAG, "Starting thread " + threadName);
+ new Thread(() -> {
+ try {
+ r.run();
+ Slog.i(TAG, "Finishing thread " + threadName);
+ } catch (RuntimeException e) {
+ Slog.e(TAG, "runAsync() failed", e);
+ throw e;
+ }
+ }, threadName).start();
}
@Nullable