Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbcfb9b2 authored by Adnan Begovic's avatar Adnan Begovic Committed by Steve Kondik
Browse files

services: Kick off to CMSystemServer for external service init.

Change-Id: I2dfe51a4cadfe02f0295be36fb30a304219047ff
parent 8d9cd14e
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -102,6 +102,9 @@ import dalvik.system.VMRuntime;

import java.io.File;
import java.io.IOException;
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;
@@ -544,6 +547,9 @@ public final class SystemServer {
                false);
        boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");

        String externalServer = context.getResources().getString(
                org.cyanogenmod.platform.internal.R.string.config_externalSystemServer);

        try {
            Slog.i(TAG, "Reading configuration...");
            SystemConfig.getInstance();
@@ -1177,6 +1183,24 @@ public final class SystemServer {
        // MMS service broker
        mmsService = mSystemServiceManager.startService(MmsServiceBroker.class);

        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...

        Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeVibratorServiceReady");