Implement binder connection in CarWatchdogService
- Register CarWatchdogService as a mediator to carwatchdogd.
- Add vintf fragment to make car watchdog daemon visible to others.
- Add basic test cases.
- Include Sepolicy for car service test.
- TODO: health checking will be implemented.
- This one was once approved as ag/10266841, but caused pre-submit test
failure. Now, the test fail is fixed.
Bug: 148972624
Test: atest CarWatchdogServiceTest
Change-Id: I69d211cd622fb91a0cb2f6e62893cde76d9236d7
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 1923d9a..ceb6b6e 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -69,6 +69,7 @@
import com.android.car.user.CarUserService;
import com.android.car.user.UserMetrics;
import com.android.car.vms.VmsNewBrokerService;
+import com.android.car.watchdog.CarWatchdogService;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.car.ICarServiceHelper;
@@ -128,6 +129,7 @@
private final CarBugreportManagerService mCarBugreportManagerService;
private final CarStatsService mCarStatsService;
private final CarExperimentalFeatureServiceController mCarExperimentalFeatureServiceController;
+ private final CarWatchdogService mCarWatchdogService;
private final CarServiceBase[] mAllServices;
@@ -150,13 +152,14 @@
public ICarImpl(Context serviceContext, IVehicle vehicle, SystemInterface systemInterface,
CanBusErrorNotifier errorNotifier, String vehicleInterfaceName) {
this(serviceContext, vehicle, systemInterface, errorNotifier, vehicleInterfaceName,
- /* carUserService= */ null);
+ /* carUserService= */ null, /* carWatchdogService= */ null);
}
@VisibleForTesting
ICarImpl(Context serviceContext, IVehicle vehicle, SystemInterface systemInterface,
CanBusErrorNotifier errorNotifier, String vehicleInterfaceName,
- @Nullable CarUserService carUserService) {
+ @Nullable CarUserService carUserService,
+ @Nullable CarWatchdogService carWatchdogService) {
mContext = serviceContext;
mSystemInterface = systemInterface;
mHal = new VehicleHal(serviceContext, vehicle);
@@ -249,6 +252,11 @@
} else {
mCarExperimentalFeatureServiceController = null;
}
+ if (carWatchdogService == null) {
+ mCarWatchdogService = new CarWatchdogService(serviceContext);
+ } else {
+ mCarWatchdogService = carWatchdogService;
+ }
CarLocalServices.addService(CarPowerManagementService.class, mCarPowerManagementService);
CarLocalServices.addService(CarPropertyService.class, mCarPropertyService);
@@ -293,6 +301,7 @@
allServices.add(mCarMediaService);
allServices.add(mCarLocationService);
allServices.add(mCarBugreportManagerService);
+ allServices.add(mCarWatchdogService);
// Always put mCarExperimentalFeatureServiceController in last.
addServiceIfNonNull(allServices, mCarExperimentalFeatureServiceController);
mAllServices = allServices.toArray(new CarServiceBase[allServices.size()]);
@@ -517,6 +526,8 @@
return mCarBugreportManagerService;
case Car.CAR_USER_SERVICE:
return mCarUserService;
+ case Car.CAR_WATCHDOG_SERVICE:
+ return mCarWatchdogService;
default:
IBinder service = null;
if (mCarExperimentalFeatureServiceController != null) {