diff options
author | Adnan Begovic <adnan@cyngn.com> | 2016-04-26 16:56:49 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-05-31 17:28:55 -0700 |
commit | 70d2082f7d7253f8cf5d578507f44fd6e28ce706 (patch) | |
tree | 074accc2495227377d9efa404f03d1810295f9e4 /services/java | |
parent | 9a23f2e7800b99861eb745a04a2e04488788c29a (diff) | |
download | frameworks_base-70d2082f7d7253f8cf5d578507f44fd6e28ce706.zip frameworks_base-70d2082f7d7253f8cf5d578507f44fd6e28ce706.tar.gz frameworks_base-70d2082f7d7253f8cf5d578507f44fd6e28ce706.tar.bz2 |
services: Kick off to CMSystemServer for external service init.
Change-Id: I2dfe51a4cadfe02f0295be36fb30a304219047ff
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 5169607..671bf89 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -99,6 +99,9 @@ import cyanogenmod.providers.CMSettings; import dalvik.system.VMRuntime; import java.io.File; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Locale; import java.util.Timer; import java.util.TimerTask; @@ -455,8 +458,8 @@ public final class SystemServer { boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false); boolean disableNetworkTime = SystemProperties.getBoolean("config.disable_networktime", false); boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1"); - String[] externalServices = context.getResources().getStringArray( - org.cyanogenmod.platform.internal.R.array.config_externalCMServices); + String externalServer = context.getResources().getString( + org.cyanogenmod.platform.internal.R.string.config_externalSystemServer); try { Slog.i(TAG, "Reading configuration..."); @@ -1052,13 +1055,22 @@ public final class SystemServer { // MMS service broker mmsService = mSystemServiceManager.startService(MmsServiceBroker.class); - for (String service : externalServices) { - try { - Slog.i(TAG, service); - mSystemServiceManager.startService(service); - } catch (Throwable e) { - reportWtf("starting " + service , e); - } + 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) { + Slog.wtf(TAG, "Unable to start " + externalServer); + Slog.wtf(TAG, e); } // It is now time to start up the app processes... |