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

Commit b4be5cdf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implemented native functions and types for blastula management."

parents 1655f989 aa1c962d
Loading
Loading
Loading
Loading
+34 −13
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public final class Zygote {
    private Zygote() {}

    /** Called for some security initialization before any fork. */
    native static void nativeSecurityInit();
    static native void nativeSecurityInit();

    /**
     * Forks a new VM instance.  The current VM must have been started
@@ -184,15 +184,20 @@ public final class Zygote {
        return pid;
    }

    native private static int nativeForkAndSpecialize(int uid, int gid, int[] gids,int runtimeFlags,
            int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
            int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir,
            String packageName, String[] packagesForUid, String[] visibleVolIds);
    private static native int nativeForkAndSpecialize(int uid, int gid, int[] gids,
            int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName,
            int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet,
            String appDataDir, String packageName, String[] packagesForUid, String[] visibleVolIds);

    private static native void nativeSpecializeBlastula(int uid, int gid, int[] gids,
            int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName,
            boolean startChildZygote, String instructionSet, String appDataDir, String packageName,
            String[] packagesForUid, String[] visibleVolIds);

    /**
     * Called to do any initialization before starting an application.
     */
    native static void nativePreApplicationInit();
    static native void nativePreApplicationInit();

    /**
     * Special method to start the system server process. In addition to the
@@ -223,7 +228,8 @@ public final class Zygote {
        // Resets nice priority for zygote process.
        resetNicePriority();
        int pid = nativeForkSystemServer(
                uid, gid, gids, runtimeFlags, rlimits, permittedCapabilities, effectiveCapabilities);
                uid, gid, gids, runtimeFlags, rlimits,
                permittedCapabilities, effectiveCapabilities);
        // Enable tracing as soon as we enter the system_server.
        if (pid == 0) {
            Trace.setTracingEnabled(true, runtimeFlags);
@@ -232,13 +238,13 @@ public final class Zygote {
        return pid;
    }

    native private static int nativeForkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
    private static native int nativeForkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
            int[][] rlimits, long permittedCapabilities, long effectiveCapabilities);

    /**
     * Lets children of the zygote inherit open file descriptors to this path.
     */
    native protected static void nativeAllowFileAcrossFork(String path);
    protected static native void nativeAllowFileAcrossFork(String path);

    /**
     * Installs a seccomp filter that limits setresuid()/setresgid() to the passed-in range
@@ -251,7 +257,22 @@ public final class Zygote {
     * Zygote unmount storage space on initializing.
     * This method is called once.
     */
    native protected static void nativeUnmountStorageOnInit();
    protected static native void nativeUnmountStorageOnInit();

    protected static native void nativeGetSocketFDs(boolean isPrimary);

    private static native int nativeGetBlastulaPoolCount();

    private static native int nativeGetBlastulaPoolEventFD();

    private static native int nativeForkBlastula(int readPipeFD,
                                                 int writePipeFD,
                                                 int[] sessionSocketRawFDs);

    private static native int[] nativeGetBlastulaPipeFDs();

    private static native boolean nativeRemoveBlastulaTableEntry(int blastulaPID);


    private static void callPostForkSystemServerHooks() {
        // SystemServer specific post fork hooks run before child post fork hooks.