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

Commit 4e2e9c2b authored by Adnan Begovic's avatar Adnan Begovic Committed by Eamon Powell
Browse files

services: Kick off to LineageSystemServer for external service init.

Change-Id: I2dfe51a4cadfe02f0295be36fb30a304219047ff
parent 1309eb1e
Loading
Loading
Loading
Loading
+24 −0
Original line number Original line Diff line number Diff line
@@ -186,6 +186,9 @@ import com.google.android.startop.iorap.IorapForwardingService;


import java.io.File;
import java.io.File;
import java.io.IOException;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Locale;
import java.util.Timer;
import java.util.Timer;
@@ -1054,6 +1057,9 @@ public final class SystemServer {
            throw new RuntimeException();
            throw new RuntimeException();
        }
        }


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

        try {
        try {
            final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload";
            final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload";
            // We start the preload ~1s before the webview factory preparation, to
            // We start the preload ~1s before the webview factory preparation, to
@@ -2096,6 +2102,24 @@ public final class SystemServer {
        mSystemServiceManager.startService(AppBindingService.Lifecycle.class);
        mSystemServiceManager.startService(AppBindingService.Lifecycle.class);
        t.traceEnd();
        t.traceEnd();


        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...
        // It is now time to start up the app processes...


        t.traceBegin("MakeVibratorServiceReady");
        t.traceBegin("MakeVibratorServiceReady");