Sample Header Ad - 728x90

Primary Zygote (64-bit) only starts the System Services? And all Android apps are 32-bit?

1 vote
2 answers
427 views
As far as I know Zygote is started by app_process64 and app_process32 where 64 is for primary zygote that starts system services because of start-system-server flag. As we can see below in static void main method of frameworks/base/core/java/com/android/internal/os/ZygoteInit.java, it checks for start-system-server flag, run the forked System Server and exits due to return; statement below it, and never running the runSelectLoop that actually goes into infinite loop listening to connections that request to launch new applications. Only app_process32 without start-system-server flag will not enter the control statement to run the forked System Server, and instead, runs the runSelectLoop. Does it mean that all system services are inherently 64-bit while all Android apps are inherently 32-bit? This code is from AOSP branch: Android-14.0.0_r21:
// redacted above code

zygoteServer = new ZygoteServer(isPrimaryZygote);

if (startSystemServer) {
    Runnable r = forkSystemServer(abiList, zygoteSocketName, zygoteServer);

    // {@code r == null} in the parent (zygote) process, and {@code r != null} in the
    // child (system_server) process.
    if (r != null) {
        r.run();
        return;
    }
}

Log.i(TAG, "Accepting command socket connections");

// The select loop returns early in the child process after a fork and
// loops forever in the zygote.
caller = zygoteServer.runSelectLoop(abiList);

// redacted code below
Asked by Wei Minn (113 rep)
Jan 21, 2024, 07:28 AM
Last activity: Mar 18, 2024, 02:21 PM