Always call ICarImpl::init in the main thread

Right now it can be called from CarTestService from binder thread which
results in crashes as TimingsTraceLog must be called in the same thread
it was created.

Test: runtest -x packages/services/Car/tests/carservice_test
Change-Id: I1b282637d8c3a900f354f285e26b991d113ec140
Fix: b/67499283
diff --git a/service/src/com/android/car/CarTestService.java b/service/src/com/android/car/CarTestService.java
index ec1606c..8c3f64d 100644
--- a/service/src/com/android/car/CarTestService.java
+++ b/service/src/com/android/car/CarTestService.java
@@ -100,7 +100,7 @@
         }
 
         if (mTokens.size() == 0) {
-            mICarImpl.init();
+            CarServiceUtils.runOnMain(mICarImpl::init);
         }
     }
 
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index d522deb..f612715 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -16,6 +16,7 @@
 
 package com.android.car;
 
+import android.annotation.MainThread;
 import android.app.UiModeManager;
 import android.car.Car;
 import android.car.ICar;
@@ -157,6 +158,7 @@
         mAllServices = allServices.toArray(new CarServiceBase[0]);
     }
 
+    @MainThread
     void init() {
         traceBegin("VehicleHal.init");
         mHal.init();
@@ -356,11 +358,13 @@
         new CarShellCommand().exec(args, writer);
     }
 
+    @MainThread
     private static void traceBegin(String name) {
         Slog.i(TAG, name);
         mBootTiming.traceBegin(name);
     }
 
+    @MainThread
     private static void traceEnd() {
         mBootTiming.traceEnd();
     }