Loading core/java/android/os/Process.java +5 −2 Original line number Diff line number Diff line Loading @@ -730,13 +730,14 @@ public class Process { whitelistedDataInfoMap, boolean bindMountAppsData, boolean bindMountAppStorageDirs, boolean bindMountSystemOverrides, @Nullable String[] zygoteArgs) { return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, packageName, zygotePolicyFlags, isTopApp, disabledCompatChanges, pkgDataInfoMap, whitelistedDataInfoMap, bindMountAppsData, bindMountAppStorageDirs, zygoteArgs); bindMountAppStorageDirs, bindMountSystemOverrides, zygoteArgs); } /** @hide */ Loading @@ -753,6 +754,7 @@ public class Process { @Nullable String invokeWith, @Nullable String packageName, @Nullable long[] disabledCompatChanges, boolean bindMountSyspropOverrides, @Nullable String[] zygoteArgs) { // Webview zygote can't access app private data files, so doesn't need to know its data // info. Loading @@ -761,7 +763,8 @@ public class Process { abi, instructionSet, appDataDir, invokeWith, packageName, /*zygotePolicyFlags=*/ ZYGOTE_POLICY_FLAG_EMPTY, /*isTopApp=*/ false, disabledCompatChanges, /* pkgDataInfoMap */ null, /* whitelistedDataInfoMap */ null, false, false, zygoteArgs); /* whitelistedDataInfoMap */ null, /* bindMountAppsData */ false, /* bindMountAppStorageDirs */ false, bindMountSyspropOverrides, zygoteArgs); } /** Loading core/java/android/os/ZygoteProcess.java +9 −2 Original line number Diff line number Diff line Loading @@ -355,6 +355,7 @@ public class ZygoteProcess { allowlistedDataInfoList, boolean bindMountAppsData, boolean bindMountAppStorageDirs, boolean bindOverrideSysprops, @Nullable String[] zygoteArgs) { // TODO (chriswailes): Is there a better place to check this value? if (fetchUsapPoolEnabledPropWithMinInterval()) { Loading @@ -367,7 +368,7 @@ public class ZygoteProcess { abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/ false, packageName, zygotePolicyFlags, isTopApp, disabledCompatChanges, pkgDataInfoMap, allowlistedDataInfoList, bindMountAppsData, bindMountAppStorageDirs, zygoteArgs); bindMountAppStorageDirs, bindOverrideSysprops, zygoteArgs); } catch (ZygoteStartFailedEx ex) { Log.e(LOG_TAG, "Starting VM process through Zygote failed"); Loading Loading @@ -638,6 +639,7 @@ public class ZygoteProcess { allowlistedDataInfoList, boolean bindMountAppsData, boolean bindMountAppStorageDirs, boolean bindMountOverrideSysprops, @Nullable String[] extraArgs) throws ZygoteStartFailedEx { ArrayList<String> argsForZygote = new ArrayList<>(); Loading Loading @@ -753,6 +755,10 @@ public class ZygoteProcess { argsForZygote.add(Zygote.BIND_MOUNT_APP_DATA_DIRS); } if (bindMountOverrideSysprops) { argsForZygote.add(Zygote.BIND_MOUNT_SYSPROP_OVERRIDES); } if (disabledCompatChanges != null && disabledCompatChanges.length > 0) { StringBuilder sb = new StringBuilder(); sb.append("--disabled-compat-changes="); Loading Loading @@ -1306,7 +1312,8 @@ public class ZygoteProcess { ZYGOTE_POLICY_FLAG_SYSTEM_PROCESS /* zygotePolicyFlags */, false /* isTopApp */, null /* disabledCompatChanges */, null /* pkgDataInfoMap */, null /* allowlistedDataInfoList */, true /* bindMountAppsData*/, /* bindMountAppStorageDirs */ false, extraArgs); /* bindMountAppStorageDirs */ false, /*bindMountOverrideSysprops */ false, extraArgs); } catch (ZygoteStartFailedEx ex) { throw new RuntimeException("Starting child-zygote through Zygote failed", ex); Loading core/java/com/android/internal/os/Zygote.java +18 −7 Original line number Diff line number Diff line Loading @@ -236,6 +236,9 @@ public final class Zygote { /** Bind mount app storage dirs to lower fs not via fuse */ public static final String BIND_MOUNT_APP_DATA_DIRS = "--bind-mount-data-dirs"; /** Bind the system properties to an alternate set, for appcompat reasons */ public static final String BIND_MOUNT_SYSPROP_OVERRIDES = "--bind-mount-sysprop-overrides"; /** * An extraArg passed when a zygote process is forking a child-zygote, specifying a name * in the abstract socket namespace. This socket name is what the new child zygote Loading Loading @@ -353,6 +356,8 @@ public final class Zygote { * @param allowlistedDataInfoList Like pkgDataInfoList, but it's for allowlisted apps. * @param bindMountAppDataDirs True if the zygote needs to mount data dirs. * @param bindMountAppStorageDirs True if the zygote needs to mount storage dirs. * @param bindMountSyspropOverrides True if the zygote needs to mount the override system * properties * * @return 0 if this is the child, pid of the child * if this is the parent, or -1 on error. Loading @@ -361,14 +366,15 @@ public final class Zygote { int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs) { boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides) { ZygoteHooks.preFork(); int pid = nativeForkAndSpecialize( uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose, fdsToIgnore, startChildZygote, instructionSet, appDataDir, isTopApp, pkgDataInfoList, allowlistedDataInfoList, bindMountAppDataDirs, bindMountAppStorageDirs); bindMountAppStorageDirs, bindMountSyspropOverrides); if (pid == 0) { // Note that this event ends at the end of handleChildProc, Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -391,7 +397,7 @@ public final class Zygote { int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs); boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides); /** * Specialize an unspecialized app process. The current VM must have been started Loading Loading @@ -421,16 +427,19 @@ public final class Zygote { * @param allowlistedDataInfoList Like pkgDataInfoList, but it's for allowlisted apps. * @param bindMountAppDataDirs True if the zygote needs to mount data dirs. * @param bindMountAppStorageDirs True if the zygote needs to mount storage dirs. * @param bindMountSyspropOverrides True if the zygote needs to mount the override system * properties */ private static void specializeAppProcess(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs) { boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides) { nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, startChildZygote, instructionSet, appDataDir, isTopApp, pkgDataInfoList, allowlistedDataInfoList, bindMountAppDataDirs, bindMountAppStorageDirs); bindMountAppDataDirs, bindMountAppStorageDirs, bindMountSyspropOverrides); // Note that this event ends at the end of handleChildProc. Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -455,7 +464,8 @@ public final class Zygote { int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs); boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides); /** * Called to do any initialization before starting an application. Loading Loading @@ -866,7 +876,8 @@ public final class Zygote { args.mSeInfo, args.mNiceName, args.mStartChildZygote, args.mInstructionSet, args.mAppDataDir, args.mIsTopApp, args.mPkgDataInfoList, args.mAllowlistedDataInfoList, args.mBindMountAppDataDirs, args.mBindMountAppStorageDirs); args.mBindMountAppDataDirs, args.mBindMountAppStorageDirs, args.mBindMountSyspropOverrides); // While `specializeAppProcess` sets the thread name on the process's main thread, this // is distinct from the app process name which appears in stack traces, as the latter is Loading core/java/com/android/internal/os/ZygoteArguments.java +7 −0 Original line number Diff line number Diff line Loading @@ -242,6 +242,11 @@ class ZygoteArguments { */ boolean mBindMountAppDataDirs; /** * @see Zygote#BIND_MOUNT_SYSPROP_OVERRIDES */ boolean mBindMountSyspropOverrides; /** * Constructs instance and parses args * Loading Loading @@ -481,6 +486,8 @@ class ZygoteArguments { mBindMountAppStorageDirs = true; } else if (arg.equals(Zygote.BIND_MOUNT_APP_DATA_DIRS)) { mBindMountAppDataDirs = true; } else if (arg.equals(Zygote.BIND_MOUNT_SYSPROP_OVERRIDES)) { mBindMountSyspropOverrides = true; } else { unprocessedArg = arg; break; Loading core/java/com/android/internal/os/ZygoteConnection.java +2 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,8 @@ class ZygoteConnection { parsedArgs.mInstructionSet, parsedArgs.mAppDataDir, parsedArgs.mIsTopApp, parsedArgs.mPkgDataInfoList, parsedArgs.mAllowlistedDataInfoList, parsedArgs.mBindMountAppDataDirs, parsedArgs.mBindMountAppStorageDirs); parsedArgs.mBindMountAppStorageDirs, parsedArgs.mBindMountSyspropOverrides); try { if (pid == 0) { Loading Loading
core/java/android/os/Process.java +5 −2 Original line number Diff line number Diff line Loading @@ -730,13 +730,14 @@ public class Process { whitelistedDataInfoMap, boolean bindMountAppsData, boolean bindMountAppStorageDirs, boolean bindMountSystemOverrides, @Nullable String[] zygoteArgs) { return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, packageName, zygotePolicyFlags, isTopApp, disabledCompatChanges, pkgDataInfoMap, whitelistedDataInfoMap, bindMountAppsData, bindMountAppStorageDirs, zygoteArgs); bindMountAppStorageDirs, bindMountSystemOverrides, zygoteArgs); } /** @hide */ Loading @@ -753,6 +754,7 @@ public class Process { @Nullable String invokeWith, @Nullable String packageName, @Nullable long[] disabledCompatChanges, boolean bindMountSyspropOverrides, @Nullable String[] zygoteArgs) { // Webview zygote can't access app private data files, so doesn't need to know its data // info. Loading @@ -761,7 +763,8 @@ public class Process { abi, instructionSet, appDataDir, invokeWith, packageName, /*zygotePolicyFlags=*/ ZYGOTE_POLICY_FLAG_EMPTY, /*isTopApp=*/ false, disabledCompatChanges, /* pkgDataInfoMap */ null, /* whitelistedDataInfoMap */ null, false, false, zygoteArgs); /* whitelistedDataInfoMap */ null, /* bindMountAppsData */ false, /* bindMountAppStorageDirs */ false, bindMountSyspropOverrides, zygoteArgs); } /** Loading
core/java/android/os/ZygoteProcess.java +9 −2 Original line number Diff line number Diff line Loading @@ -355,6 +355,7 @@ public class ZygoteProcess { allowlistedDataInfoList, boolean bindMountAppsData, boolean bindMountAppStorageDirs, boolean bindOverrideSysprops, @Nullable String[] zygoteArgs) { // TODO (chriswailes): Is there a better place to check this value? if (fetchUsapPoolEnabledPropWithMinInterval()) { Loading @@ -367,7 +368,7 @@ public class ZygoteProcess { abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/ false, packageName, zygotePolicyFlags, isTopApp, disabledCompatChanges, pkgDataInfoMap, allowlistedDataInfoList, bindMountAppsData, bindMountAppStorageDirs, zygoteArgs); bindMountAppStorageDirs, bindOverrideSysprops, zygoteArgs); } catch (ZygoteStartFailedEx ex) { Log.e(LOG_TAG, "Starting VM process through Zygote failed"); Loading Loading @@ -638,6 +639,7 @@ public class ZygoteProcess { allowlistedDataInfoList, boolean bindMountAppsData, boolean bindMountAppStorageDirs, boolean bindMountOverrideSysprops, @Nullable String[] extraArgs) throws ZygoteStartFailedEx { ArrayList<String> argsForZygote = new ArrayList<>(); Loading Loading @@ -753,6 +755,10 @@ public class ZygoteProcess { argsForZygote.add(Zygote.BIND_MOUNT_APP_DATA_DIRS); } if (bindMountOverrideSysprops) { argsForZygote.add(Zygote.BIND_MOUNT_SYSPROP_OVERRIDES); } if (disabledCompatChanges != null && disabledCompatChanges.length > 0) { StringBuilder sb = new StringBuilder(); sb.append("--disabled-compat-changes="); Loading Loading @@ -1306,7 +1312,8 @@ public class ZygoteProcess { ZYGOTE_POLICY_FLAG_SYSTEM_PROCESS /* zygotePolicyFlags */, false /* isTopApp */, null /* disabledCompatChanges */, null /* pkgDataInfoMap */, null /* allowlistedDataInfoList */, true /* bindMountAppsData*/, /* bindMountAppStorageDirs */ false, extraArgs); /* bindMountAppStorageDirs */ false, /*bindMountOverrideSysprops */ false, extraArgs); } catch (ZygoteStartFailedEx ex) { throw new RuntimeException("Starting child-zygote through Zygote failed", ex); Loading
core/java/com/android/internal/os/Zygote.java +18 −7 Original line number Diff line number Diff line Loading @@ -236,6 +236,9 @@ public final class Zygote { /** Bind mount app storage dirs to lower fs not via fuse */ public static final String BIND_MOUNT_APP_DATA_DIRS = "--bind-mount-data-dirs"; /** Bind the system properties to an alternate set, for appcompat reasons */ public static final String BIND_MOUNT_SYSPROP_OVERRIDES = "--bind-mount-sysprop-overrides"; /** * An extraArg passed when a zygote process is forking a child-zygote, specifying a name * in the abstract socket namespace. This socket name is what the new child zygote Loading Loading @@ -353,6 +356,8 @@ public final class Zygote { * @param allowlistedDataInfoList Like pkgDataInfoList, but it's for allowlisted apps. * @param bindMountAppDataDirs True if the zygote needs to mount data dirs. * @param bindMountAppStorageDirs True if the zygote needs to mount storage dirs. * @param bindMountSyspropOverrides True if the zygote needs to mount the override system * properties * * @return 0 if this is the child, pid of the child * if this is the parent, or -1 on error. Loading @@ -361,14 +366,15 @@ public final class Zygote { int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs) { boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides) { ZygoteHooks.preFork(); int pid = nativeForkAndSpecialize( uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose, fdsToIgnore, startChildZygote, instructionSet, appDataDir, isTopApp, pkgDataInfoList, allowlistedDataInfoList, bindMountAppDataDirs, bindMountAppStorageDirs); bindMountAppStorageDirs, bindMountSyspropOverrides); if (pid == 0) { // Note that this event ends at the end of handleChildProc, Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -391,7 +397,7 @@ public final class Zygote { int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs); boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides); /** * Specialize an unspecialized app process. The current VM must have been started Loading Loading @@ -421,16 +427,19 @@ public final class Zygote { * @param allowlistedDataInfoList Like pkgDataInfoList, but it's for allowlisted apps. * @param bindMountAppDataDirs True if the zygote needs to mount data dirs. * @param bindMountAppStorageDirs True if the zygote needs to mount storage dirs. * @param bindMountSyspropOverrides True if the zygote needs to mount the override system * properties */ private static void specializeAppProcess(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs) { boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides) { nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, startChildZygote, instructionSet, appDataDir, isTopApp, pkgDataInfoList, allowlistedDataInfoList, bindMountAppDataDirs, bindMountAppStorageDirs); bindMountAppDataDirs, bindMountAppStorageDirs, bindMountSyspropOverrides); // Note that this event ends at the end of handleChildProc. Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -455,7 +464,8 @@ public final class Zygote { int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp, String[] pkgDataInfoList, String[] allowlistedDataInfoList, boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs); boolean bindMountAppDataDirs, boolean bindMountAppStorageDirs, boolean bindMountSyspropOverrides); /** * Called to do any initialization before starting an application. Loading Loading @@ -866,7 +876,8 @@ public final class Zygote { args.mSeInfo, args.mNiceName, args.mStartChildZygote, args.mInstructionSet, args.mAppDataDir, args.mIsTopApp, args.mPkgDataInfoList, args.mAllowlistedDataInfoList, args.mBindMountAppDataDirs, args.mBindMountAppStorageDirs); args.mBindMountAppDataDirs, args.mBindMountAppStorageDirs, args.mBindMountSyspropOverrides); // While `specializeAppProcess` sets the thread name on the process's main thread, this // is distinct from the app process name which appears in stack traces, as the latter is Loading
core/java/com/android/internal/os/ZygoteArguments.java +7 −0 Original line number Diff line number Diff line Loading @@ -242,6 +242,11 @@ class ZygoteArguments { */ boolean mBindMountAppDataDirs; /** * @see Zygote#BIND_MOUNT_SYSPROP_OVERRIDES */ boolean mBindMountSyspropOverrides; /** * Constructs instance and parses args * Loading Loading @@ -481,6 +486,8 @@ class ZygoteArguments { mBindMountAppStorageDirs = true; } else if (arg.equals(Zygote.BIND_MOUNT_APP_DATA_DIRS)) { mBindMountAppDataDirs = true; } else if (arg.equals(Zygote.BIND_MOUNT_SYSPROP_OVERRIDES)) { mBindMountSyspropOverrides = true; } else { unprocessedArg = arg; break; Loading
core/java/com/android/internal/os/ZygoteConnection.java +2 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,8 @@ class ZygoteConnection { parsedArgs.mInstructionSet, parsedArgs.mAppDataDir, parsedArgs.mIsTopApp, parsedArgs.mPkgDataInfoList, parsedArgs.mAllowlistedDataInfoList, parsedArgs.mBindMountAppDataDirs, parsedArgs.mBindMountAppStorageDirs); parsedArgs.mBindMountAppStorageDirs, parsedArgs.mBindMountSyspropOverrides); try { if (pid == 0) { Loading