services: Kick off to OmniRomSystemServer for external service init.
Change-Id: I2dfe51a4cadfe02f0295be36fb30a304219047ff
diff --git a/services/Android.bp b/services/Android.bp
index 653cd3c3..fe02479 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -260,6 +260,7 @@
"service-permission.stubs.system_server",
"service-rkp.stubs.system_server",
"service-sdksandbox.stubs.system_server",
+ "omnirom.internal",
],
soong_config_variables: {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 3b334ec..1c69b2d 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -300,6 +300,9 @@
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
@@ -2872,6 +2875,26 @@
mSystemServiceManager.startService(TracingServiceProxy.class);
t.traceEnd();
+ // OmniRom Services
+ String externalServer = context.getResources().getString(
+ org.omnirom.omnilib.R.string.config_externalSystemServer);
+ final Class<?> serverClazz;
+ try {
+ serverClazz = Class.forName(externalServer);
+ final Constructor<?> constructor = serverClazz.getDeclaredConstructor(Context.class);
+ constructor.setAccessible(true);
+ final Object baseObject = constructor.newInstance(mSystemContext);
+ final Method method = baseObject.getClass().getDeclaredMethod("run");
+ method.setAccessible(true);
+ method.invoke(baseObject);
+ } catch (ClassNotFoundException
+ | IllegalAccessException
+ | InvocationTargetException
+ | InstantiationException
+ | NoSuchMethodException e) {
+ reportWtf("Making " + externalServer + " ready", e);
+ }
+
// It is now time to start up the app processes...
t.traceBegin("MakeLockSettingsServiceReady");