Start android.frameworks.sensorservice@1.0 in system_server

Bug: 35219747
Test: marlin boots
Test: lshal -ipm | grep android.frameworks.sensorservice@1.0

Change-Id: I67dfb217d1b568e140cefce0bdba3f8f4dbe679c
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index a8423e2..a707761 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -235,16 +235,24 @@
     private final boolean mRuntimeRestart;
 
     private static final String START_SENSOR_SERVICE = "StartSensorService";
+    private static final String START_HIDL_SERVICES = "StartHidlServices";
+
+
     private Future<?> mSensorServiceStart;
     private Future<?> mZygotePreload;
 
-
     /**
      * Start the sensor service. This is a blocking call and can take time.
      */
     private static native void startSensorService();
 
     /**
+     * Start all HIDL services that are run inside the system server. This
+     * may take some time.
+     */
+    private static native void startHidlServices();
+
+    /**
      * The main entry point from zygote.
      */
     public static void main(String[] args) {
@@ -610,6 +618,7 @@
             startSensorService();
             traceLog.traceEnd();
         }, START_SENSOR_SERVICE);
+
     }
 
     /**
@@ -637,6 +646,14 @@
         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);
     }
 
     /**