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

Commit 5dd239a1 authored by Luis Hector Chavez's avatar Luis Hector Chavez Committed by Vladislav Kaznacheev
Browse files

Make ZygoteInit not require CAP_BLOCK_SUSPEND

We are dropping CAP_BLOCK_SUSPEND since that prevents correct suspension in
Chrome OS.  This change makes it so that it only requests that capability if it
is not running inside a container.

TEST=Android boots correctly
BUG:24952794

(cherry picked from commit 5e38447a9bf81bb7d58d33c71498495e1e0f575f)
(cherry picked from commit dc3943951ee475ef09cc7a4825368f9b707e1344)

Change-Id: If39357f22955442d5532d1408ce74360384521bb
parent 32ab05c8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ public class ZygoteInit {
    private static final String TAG = "Zygote";

    private static final String PROPERTY_DISABLE_OPENGL_PRELOADING = "ro.zygote.disable_gl_preload";
    private static final String PROPERTY_RUNNING_IN_CONTAINER = "ro.boot.container";

    private static final String ANDROID_SOCKET_PREFIX = "ANDROID_SOCKET_";

@@ -503,7 +504,6 @@ public class ZygoteInit {
    private static boolean startSystemServer(String abiList, String socketName)
            throws MethodAndArgsCaller, RuntimeException {
        long capabilities = posixCapabilitiesAsBits(
            OsConstants.CAP_BLOCK_SUSPEND,
            OsConstants.CAP_KILL,
            OsConstants.CAP_NET_ADMIN,
            OsConstants.CAP_NET_BIND_SERVICE,
@@ -515,6 +515,10 @@ public class ZygoteInit {
            OsConstants.CAP_SYS_TIME,
            OsConstants.CAP_SYS_TTY_CONFIG
        );
        /* Containers run without this capability, so avoid setting it in that case */
        if (!SystemProperties.getBoolean(PROPERTY_RUNNING_IN_CONTAINER, false)) {
            capabilities |= posixCapabilitiesAsBits(OsConstants.CAP_BLOCK_SUSPEND);
        }
        /* Hardcoded command line to start the system server */
        String args[] = {
            "--setuid=1000",