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

Commit bdacd7d1 authored by Adnan Begovic's avatar Adnan Begovic Committed by Sam Mortimer
Browse files

services: Kick off to LineageSystemServer for external service init.

Change-Id: I2dfe51a4cadfe02f0295be36fb30a304219047ff
parent 780ee17c
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -161,6 +161,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.concurrent.CountDownLatch;
@@ -920,6 +923,9 @@ public final class SystemServer {
            throw new RuntimeException();
        }

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

        try {
            final String SECONDARY_ZYGOTE_PRELOAD = "SecondaryZygotePreload";
            // We start the preload ~1s before the webview factory preparation, to
@@ -1908,6 +1914,24 @@ public final class SystemServer {
        mSystemServiceManager.startService(AppBindingService.Lifecycle.class);
        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...

        traceBeginAndSlog("MakeVibratorServiceReady");