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

Commit 2969a453 authored by doheon1.lee's avatar doheon1.lee Committed by android-build-merger
Browse files

Merge "Changes of root storage space unmounting time on Zygote Process"

am: 2a874935

* commit '2a874935':
  Changes of root storage space unmounting time on Zygote Process
parents 85fddcf8 2a874935
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -145,6 +145,12 @@ public final class Zygote {
    native private static int nativeForkSystemServer(int uid, int gid, int[] gids, int debugFlags,
            int[][] rlimits, long permittedCapabilities, long effectiveCapabilities);

    /**
     * Zygote unmount storage space on initializing.
     * This method is called once.
     */
    native protected static void nativeUnmountStorageOnInit();

    private static void callPostForkChildHooks(int debugFlags, boolean isSystemServer,
            String instructionSet) {
        VM_HOOKS.postForkChild(debugFlags, isSystemServer, instructionSet);
+3 −0
Original line number Diff line number Diff line
@@ -621,6 +621,9 @@ public class ZygoteInit {
            // Zygote.
            Trace.setTracingEnabled(false);

            // Zygote process unmounts root storage spaces.
            Zygote.nativeUnmountStorageOnInit();

            if (startSystemServer) {
                startSystemServer(abiList, socketName);
            }
+13 −4
Original line number Diff line number Diff line
@@ -302,9 +302,6 @@ static bool MountEmulatedStorage(uid_t uid, jint mount_mode,
        return false;
    }

    // Unmount storage provided by root namespace and mount requested view
    UnmountTree("/storage");

    String8 storageSource;
    if (mount_mode == MOUNT_EXTERNAL_DEFAULT) {
        storageSource = "/mnt/runtime/default";
@@ -663,12 +660,24 @@ static jint com_android_internal_os_Zygote_nativeForkSystemServer(
  return pid;
}

static void com_android_internal_os_Zygote_nativeUnmountStorageOnInit(JNIEnv* env, jclass) {
    // Zygote process unmount root storage space initially before every child processes are forked.
    // Every forked child processes (include SystemServer) only mount their own root storage space
    // And no need unmount storage operation in MountEmulatedStorage method.
    // Zygote process does not utilize root storage spaces and unshared its mount namespace from the ART.

    UnmountTree("/storage");
    return;
}

static const JNINativeMethod gMethods[] = {
    { "nativeForkAndSpecialize",
      "(II[II[[IILjava/lang/String;Ljava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I",
      (void *) com_android_internal_os_Zygote_nativeForkAndSpecialize },
    { "nativeForkSystemServer", "(II[II[[IJJ)I",
      (void *) com_android_internal_os_Zygote_nativeForkSystemServer }
      (void *) com_android_internal_os_Zygote_nativeForkSystemServer },
    { "nativeUnmountStorageOnInit", "()V",
      (void *) com_android_internal_os_Zygote_nativeUnmountStorageOnInit }
};

int register_com_android_internal_os_Zygote(JNIEnv* env) {