StartHidlServices wait for StartSensorService.
Otherwise, StartHidlServices waits for more than a second
while holding a lock, delaying window manager.
Test: boots
Test: SystemServerTiming_StartWindowManagerService does not regress
Logcat shows:
SystemServerTimingAsync: StartSensorService took to complete: 55ms
SystemServerTiming: StartWindowManagerService took to complete: 81ms
SystemServerTiming: StartHidlServices took to complete: 1ms
Test: lshal shows android.frameworks.sensorservice@1.0::ISensorManager
Bug: 36389997
Change-Id: Iab5cf0ad7059cf9736cc7db0567dff51cc427b58
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index e6e0242..2727465 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -619,7 +619,6 @@
startSensorService();
traceLog.traceEnd();
}, START_SENSOR_SERVICE);
-
}
/**
@@ -647,14 +646,6 @@
traceBeginAndSlog("StartWebViewUpdateService");
mWebViewUpdateService = mSystemServiceManager.startService(WebViewUpdateService.class);
traceEnd();
-
- // Start receiving calls from HIDL services. Start in in a separate thread
- // because it need to connect to SensorManager.
- SystemServerInitThreadPool.get().submit(() -> {
- traceBeginAndSlog(START_HIDL_SERVICES);
- startHidlServices();
- traceEnd();
- }, START_HIDL_SERVICES);
}
/**
@@ -813,6 +804,15 @@
ServiceManager.addService(Context.INPUT_SERVICE, inputManager);
traceEnd();
+ // Start receiving calls from HIDL services. Start in in a separate thread
+ // because it need to connect to SensorManager. This have to start
+ // after START_SENSOR_SERVICE is done.
+ SystemServerInitThreadPool.get().submit(() -> {
+ traceBeginAndSlog(START_HIDL_SERVICES);
+ startHidlServices();
+ traceEnd();
+ }, START_HIDL_SERVICES);
+
if (!disableVrManager) {
traceBeginAndSlog("StartVrManagerService");
mSystemServiceManager.startService(VrManagerService.class);