Fix car service recursive crashing
Bug:27366429
Change-Id: If28c7105f2c24235d2719aa120cf3c4bb7978d43
diff --git a/service/src/com/android/car/CarNavigationService.java b/service/src/com/android/car/CarNavigationService.java
index e8d47f9..b061a84 100644
--- a/service/src/com/android/car/CarNavigationService.java
+++ b/service/src/com/android/car/CarNavigationService.java
@@ -15,7 +15,6 @@
*/
package com.android.car;
-import android.car.Car;
import android.car.CarAppContextManager;
import android.car.cluster.NavigationRenderer;
import android.car.navigation.CarNavigationInstrumentCluster;
@@ -47,10 +46,9 @@
private final Context mContext;
private final boolean mRendererAvailable;
- public CarNavigationService(Context context) {
+ public CarNavigationService(Context context, AppContextService appContextService) {
mContext = context;
- mAppContextService = (AppContextService) ICarImpl.getInstance(mContext)
- .getCarService(Car.APP_CONTEXT_SERVICE);
+ mAppContextService = appContextService;
mRendererAvailable = InstrumentClusterRendererLoader.isRendererAvailable(mContext);
}
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index fe8d7ef..2166eff 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -90,7 +90,7 @@
mCarRadioService = new CarRadioService(serviceContext);
mCarNightService = new CarNightService(serviceContext);
mCarPackageManagerService = new CarPackageManagerService(serviceContext);
- mCarNavigationStatusService = new CarNavigationService(serviceContext);
+ mCarNavigationStatusService = new CarNavigationService(serviceContext, mAppContextService);
// Be careful with order. Service depending on other service should be inited later.
mAllServices = new CarServiceBase[] {