Add config resource to specify device specific services
The new string resource contains class names of device specific services
and referred by SystemServer.java.
Bug: 63893131
Test: Manually added device specific service and see if it's launched
Change-Id: I0cf88de5dfcf86dad459c0909073dce7fbfa57b9
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 49dd5285..b950191 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1656,6 +1656,25 @@
mSystemServiceManager.setSafeMode(safeMode);
+ // Start device specific services
+ traceBeginAndSlog("StartDeviceSpecificServices");
+ final String[] classes = mSystemContext.getResources().getStringArray(
+ R.array.config_deviceSpecificSystemServices);
+ for (final String className : classes) {
+ traceBeginAndSlog("StartDeviceSpecificServices " + className);
+ try {
+ mSystemServiceManager.startService(className);
+ } catch (Throwable e) {
+ reportWtf("starting " + className, e);
+ }
+ traceEnd();
+ }
+ traceEnd();
+
+ traceBeginAndSlog("StartBootPhaseDeviceSpecificServicesReady");
+ mSystemServiceManager.startBootPhase(SystemService.PHASE_DEVICE_SPECIFIC_SERVICES_READY);
+ traceEnd();
+
// These are needed to propagate to the runnable below.
final NetworkManagementService networkManagementF = networkManagement;
final NetworkStatsService networkStatsF = networkStats;