Merge "Crash car service when vhal crashes" into qt-qpr1-dev
diff --git a/service/src/com/android/car/CarService.java b/service/src/com/android/car/CarService.java
index 509ecdd..fdc4995 100644
--- a/service/src/com/android/car/CarService.java
+++ b/service/src/com/android/car/CarService.java
@@ -25,6 +25,7 @@
import android.os.Build;
import android.os.IBinder;
import android.os.IHwBinder.DeathRecipient;
+import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
@@ -41,6 +42,8 @@
public class CarService extends Service {
+ private static final boolean RESTART_CAR_SERVICE_WHEN_VHAL_CRASH = true;
+
private static final long WAIT_FOR_VEHICLE_HAL_TIMEOUT_MS = 10_000;
private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
@@ -178,7 +181,13 @@
@Override
public void serviceDied(long cookie) {
- Log.w(CarLog.TAG_SERVICE, "Vehicle HAL died.");
+ if (RESTART_CAR_SERVICE_WHEN_VHAL_CRASH) {
+ Log.wtf(CarLog.TAG_SERVICE, "***Vehicle HAL died. Car service will restart***");
+ Process.killProcess(Process.myPid());
+ return;
+ }
+
+ Log.wtf(CarLog.TAG_SERVICE, "***Vehicle HAL died.***");
try {
mVehicle.unlinkToDeath(this);