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

Commit 3f076da2 authored by Christian Wailes's avatar Christian Wailes Committed by android-build-merger
Browse files

Merge "Implemented native functions and types for blastula management." am: 5222bf36

am: c5cc5e52

Change-Id: I4eb03e2d0592aefa196be7f96687aa4f155c0022
parents 7a77e78a c5cc5e52
Loading
Loading
Loading
Loading
+34 −13
Original line number Original line Diff line number Diff line
@@ -94,7 +94,7 @@ public final class Zygote {
    private Zygote() {}
    private Zygote() {}


    /** Called for some security initialization before any fork. */
    /** 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
     * Forks a new VM instance.  The current VM must have been started
@@ -150,14 +150,19 @@ public final class Zygote {
        return pid;
        return pid;
    }
    }


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

    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);


    /**
    /**
     * Called to do any initialization before starting an application.
     * 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
     * Special method to start the system server process. In addition to the
@@ -188,7 +193,8 @@ public final class Zygote {
        // Resets nice priority for zygote process.
        // Resets nice priority for zygote process.
        resetNicePriority();
        resetNicePriority();
        int pid = nativeForkSystemServer(
        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.
        // Enable tracing as soon as we enter the system_server.
        if (pid == 0) {
        if (pid == 0) {
            Trace.setTracingEnabled(true, runtimeFlags);
            Trace.setTracingEnabled(true, runtimeFlags);
@@ -197,19 +203,34 @@ public final class Zygote {
        return pid;
        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);
            int[][] rlimits, long permittedCapabilities, long effectiveCapabilities);


    /**
    /**
     * Lets children of the zygote inherit open file descriptors to this path.
     * 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);


    /**
    /**
     * Zygote unmount storage space on initializing.
     * Zygote unmount storage space on initializing.
     * This method is called once.
     * 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() {
    private static void callPostForkSystemServerHooks() {
        // SystemServer specific post fork hooks run before child post fork hooks.
        // SystemServer specific post fork hooks run before child post fork hooks.