Loading core/java/android/app/ActivityManagerInternal.java +1 −2 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.content.pm.UserInfo; import android.os.Bundle; import android.os.IBinder; import android.os.TransactionTooLargeException; import android.view.RemoteAnimationAdapter; import java.util.ArrayList; import java.util.List; Loading Loading @@ -300,7 +299,7 @@ public abstract class ActivityManagerInternal { /** Starts a given process. */ public abstract void startProcess(String processName, ApplicationInfo info, boolean knownToBeDead, String hostingType, ComponentName hostingName); boolean knownToBeDead, boolean isTop, String hostingType, ComponentName hostingName); /** Starts up the starting activity process for debugging if needed. * This function needs to be called synchronously from WindowManager context so the caller Loading core/java/android/os/Process.java +4 −2 Original line number Diff line number Diff line Loading @@ -525,6 +525,7 @@ public class Process { * @param appDataDir null-ok the data directory of the app. * @param invokeWith null-ok the command to invoke with. * @param packageName null-ok the name of the package this process belongs to. * @param isTopApp whether the process starts for high priority application. * @param disabledCompatChanges null-ok list of disabled compat changes for the process being * started. * @param zygoteArgs Additional arguments to supply to the zygote process. Loading @@ -545,12 +546,13 @@ public class Process { @Nullable String appDataDir, @Nullable String invokeWith, @Nullable String packageName, boolean isTopApp, @Nullable long[] disabledCompatChanges, @Nullable String[] zygoteArgs) { return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, packageName, /*useUsapPool=*/ true, disabledCompatChanges, zygoteArgs); /*useUsapPool=*/ true, isTopApp, disabledCompatChanges, zygoteArgs); } /** @hide */ Loading @@ -571,7 +573,7 @@ public class Process { return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, packageName, /*useUsapPool=*/ false, disabledCompatChanges, zygoteArgs); /*useUsapPool=*/ false, /*isTopApp=*/ false, disabledCompatChanges, zygoteArgs); } /** Loading core/java/android/os/ZygoteProcess.java +10 −2 Original line number Diff line number Diff line Loading @@ -309,6 +309,7 @@ public class ZygoteProcess { * @param disabledCompatChanges null-ok list of disabled compat changes for the process being * started. * @param zygoteArgs Additional arguments to supply to the zygote process. * @param isTopApp Whether the process starts for high priority application. * * @return An object that describes the result of the attempt to start the process. * @throws RuntimeException on fatal start failure Loading @@ -325,6 +326,7 @@ public class ZygoteProcess { @Nullable String invokeWith, @Nullable String packageName, boolean useUsapPool, boolean isTopApp, @Nullable long[] disabledCompatChanges, @Nullable String[] zygoteArgs) { // TODO (chriswailes): Is there a better place to check this value? Loading @@ -336,7 +338,7 @@ public class ZygoteProcess { return startViaZygote(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/ false, packageName, useUsapPool, disabledCompatChanges, zygoteArgs); packageName, useUsapPool, isTopApp, disabledCompatChanges, zygoteArgs); } catch (ZygoteStartFailedEx ex) { Log.e(LOG_TAG, "Starting VM process through Zygote failed"); Loading Loading @@ -537,6 +539,7 @@ public class ZygoteProcess { * @param startChildZygote Start a sub-zygote. This creates a new zygote process * that has its state cloned from this zygote process. * @param packageName null-ok the name of the package this process belongs to. * @param isTopApp Whether the process starts for high priority application. * @param disabledCompatChanges a list of disabled compat changes for the process being started. * @param extraArgs Additional arguments to supply to the zygote process. * @return An object that describes the result of the attempt to start the process. Loading @@ -556,6 +559,7 @@ public class ZygoteProcess { boolean startChildZygote, @Nullable String packageName, boolean useUsapPool, boolean isTopApp, @Nullable long[] disabledCompatChanges, @Nullable String[] extraArgs) throws ZygoteStartFailedEx { Loading Loading @@ -628,6 +632,10 @@ public class ZygoteProcess { argsForZygote.add("--package-name=" + packageName); } if (isTopApp) { argsForZygote.add(Zygote.START_AS_TOP_APP_ARG); } if (disabledCompatChanges != null && disabledCompatChanges.length > 0) { final StringBuilder sb = new StringBuilder(); sb.append("--disabled-compat-changes="); Loading Loading @@ -1190,7 +1198,7 @@ public class ZygoteProcess { gids, runtimeFlags, 0 /* mountExternal */, 0 /* targetSdkVersion */, seInfo, abi, instructionSet, null /* appDataDir */, null /* invokeWith */, true /* startChildZygote */, null /* packageName */, false /* useUsapPool */, false /* useUsapPool */, false /* isTopApp */, null /* disabledCompatChanges */, extraArgs); } catch (ZygoteStartFailedEx ex) { throw new RuntimeException("Starting child-zygote through Zygote failed", ex); Loading core/java/com/android/internal/os/Zygote.java +13 −7 Original line number Diff line number Diff line Loading @@ -164,6 +164,9 @@ public final class Zygote { /** Number of bytes sent to the Zygote over USAP pipes or the pool event FD */ public static final int USAP_MANAGEMENT_MESSAGE_BYTES = 8; /** Make the new process have top application priority. */ public static final String START_AS_TOP_APP_ARG = "--is-top-app"; /** * 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 @@ -266,18 +269,20 @@ public final class Zygote { * new zygote process. * @param instructionSet null-ok the instruction set to use. * @param appDataDir null-ok the data directory of the app. * @param isTopApp true if the process is for top (high priority) application. * * @return 0 if this is the child, pid of the child * if this is the parent, or -1 on error. */ public static int forkAndSpecialize(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir) { int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp) { ZygoteHooks.preFork(); int pid = nativeForkAndSpecialize( uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose, fdsToIgnore, startChildZygote, instructionSet, appDataDir); fdsToIgnore, startChildZygote, instructionSet, appDataDir, isTopApp); if (pid == 0) { // Note that this event ends at the end of handleChildProc, Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -293,7 +298,7 @@ public final class Zygote { private static native int nativeForkAndSpecialize(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir); String appDataDir, boolean isTopApp); /** * Specialize an unspecialized app process. The current VM must have been started Loading @@ -315,12 +320,13 @@ public final class Zygote { * new zygote process. * @param instructionSet null-ok The instruction set to use. * @param appDataDir null-ok The data directory of the app. * @param isTopApp True if the process is for top (high priority) application. */ public 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 startChildZygote, String instructionSet, String appDataDir, boolean isTopApp) { nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, startChildZygote, instructionSet, appDataDir); niceName, startChildZygote, instructionSet, appDataDir, isTopApp); // Note that this event ends at the end of handleChildProc. Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -339,7 +345,7 @@ public final class Zygote { private static native void nativeSpecializeAppProcess(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, boolean startChildZygote, String instructionSet, String appDataDir); boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp); /** * Called to do any initialization before starting an application. Loading Loading @@ -662,7 +668,7 @@ public final class Zygote { specializeAppProcess(args.mUid, args.mGid, args.mGids, args.mRuntimeFlags, rlimits, args.mMountExternal, args.mSeInfo, args.mNiceName, args.mStartChildZygote, args.mInstructionSet, args.mAppDataDir); args.mInstructionSet, args.mAppDataDir, args.mIsTopApp); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Loading core/java/com/android/internal/os/ZygoteArguments.java +7 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,11 @@ class ZygoteArguments { */ int mHiddenApiAccessStatslogSampleRate = -1; /** * @see Zygote#START_AS_TOP_APP_ARG */ boolean mIsTopApp; /** * A set of disabled app compatibility changes for the running app. From * --disabled-compat-changes. Loading Loading @@ -422,6 +427,8 @@ class ZygoteArguments { mUsapPoolStatusSpecified = true; mUsapPoolEnabled = Boolean.parseBoolean(arg.substring(arg.indexOf('=') + 1)); expectRuntimeArgs = false; } else if (arg.startsWith(Zygote.START_AS_TOP_APP_ARG)) { mIsTopApp = true; } else if (arg.startsWith("--disabled-compat-changes=")) { if (mDisabledCompatChanges != null) { throw new IllegalArgumentException("Duplicate arg specified"); Loading Loading
core/java/android/app/ActivityManagerInternal.java +1 −2 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.content.pm.UserInfo; import android.os.Bundle; import android.os.IBinder; import android.os.TransactionTooLargeException; import android.view.RemoteAnimationAdapter; import java.util.ArrayList; import java.util.List; Loading Loading @@ -300,7 +299,7 @@ public abstract class ActivityManagerInternal { /** Starts a given process. */ public abstract void startProcess(String processName, ApplicationInfo info, boolean knownToBeDead, String hostingType, ComponentName hostingName); boolean knownToBeDead, boolean isTop, String hostingType, ComponentName hostingName); /** Starts up the starting activity process for debugging if needed. * This function needs to be called synchronously from WindowManager context so the caller Loading
core/java/android/os/Process.java +4 −2 Original line number Diff line number Diff line Loading @@ -525,6 +525,7 @@ public class Process { * @param appDataDir null-ok the data directory of the app. * @param invokeWith null-ok the command to invoke with. * @param packageName null-ok the name of the package this process belongs to. * @param isTopApp whether the process starts for high priority application. * @param disabledCompatChanges null-ok list of disabled compat changes for the process being * started. * @param zygoteArgs Additional arguments to supply to the zygote process. Loading @@ -545,12 +546,13 @@ public class Process { @Nullable String appDataDir, @Nullable String invokeWith, @Nullable String packageName, boolean isTopApp, @Nullable long[] disabledCompatChanges, @Nullable String[] zygoteArgs) { return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, packageName, /*useUsapPool=*/ true, disabledCompatChanges, zygoteArgs); /*useUsapPool=*/ true, isTopApp, disabledCompatChanges, zygoteArgs); } /** @hide */ Loading @@ -571,7 +573,7 @@ public class Process { return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, packageName, /*useUsapPool=*/ false, disabledCompatChanges, zygoteArgs); /*useUsapPool=*/ false, /*isTopApp=*/ false, disabledCompatChanges, zygoteArgs); } /** Loading
core/java/android/os/ZygoteProcess.java +10 −2 Original line number Diff line number Diff line Loading @@ -309,6 +309,7 @@ public class ZygoteProcess { * @param disabledCompatChanges null-ok list of disabled compat changes for the process being * started. * @param zygoteArgs Additional arguments to supply to the zygote process. * @param isTopApp Whether the process starts for high priority application. * * @return An object that describes the result of the attempt to start the process. * @throws RuntimeException on fatal start failure Loading @@ -325,6 +326,7 @@ public class ZygoteProcess { @Nullable String invokeWith, @Nullable String packageName, boolean useUsapPool, boolean isTopApp, @Nullable long[] disabledCompatChanges, @Nullable String[] zygoteArgs) { // TODO (chriswailes): Is there a better place to check this value? Loading @@ -336,7 +338,7 @@ public class ZygoteProcess { return startViaZygote(processClass, niceName, uid, gid, gids, runtimeFlags, mountExternal, targetSdkVersion, seInfo, abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/ false, packageName, useUsapPool, disabledCompatChanges, zygoteArgs); packageName, useUsapPool, isTopApp, disabledCompatChanges, zygoteArgs); } catch (ZygoteStartFailedEx ex) { Log.e(LOG_TAG, "Starting VM process through Zygote failed"); Loading Loading @@ -537,6 +539,7 @@ public class ZygoteProcess { * @param startChildZygote Start a sub-zygote. This creates a new zygote process * that has its state cloned from this zygote process. * @param packageName null-ok the name of the package this process belongs to. * @param isTopApp Whether the process starts for high priority application. * @param disabledCompatChanges a list of disabled compat changes for the process being started. * @param extraArgs Additional arguments to supply to the zygote process. * @return An object that describes the result of the attempt to start the process. Loading @@ -556,6 +559,7 @@ public class ZygoteProcess { boolean startChildZygote, @Nullable String packageName, boolean useUsapPool, boolean isTopApp, @Nullable long[] disabledCompatChanges, @Nullable String[] extraArgs) throws ZygoteStartFailedEx { Loading Loading @@ -628,6 +632,10 @@ public class ZygoteProcess { argsForZygote.add("--package-name=" + packageName); } if (isTopApp) { argsForZygote.add(Zygote.START_AS_TOP_APP_ARG); } if (disabledCompatChanges != null && disabledCompatChanges.length > 0) { final StringBuilder sb = new StringBuilder(); sb.append("--disabled-compat-changes="); Loading Loading @@ -1190,7 +1198,7 @@ public class ZygoteProcess { gids, runtimeFlags, 0 /* mountExternal */, 0 /* targetSdkVersion */, seInfo, abi, instructionSet, null /* appDataDir */, null /* invokeWith */, true /* startChildZygote */, null /* packageName */, false /* useUsapPool */, false /* useUsapPool */, false /* isTopApp */, null /* disabledCompatChanges */, extraArgs); } catch (ZygoteStartFailedEx ex) { throw new RuntimeException("Starting child-zygote through Zygote failed", ex); Loading
core/java/com/android/internal/os/Zygote.java +13 −7 Original line number Diff line number Diff line Loading @@ -164,6 +164,9 @@ public final class Zygote { /** Number of bytes sent to the Zygote over USAP pipes or the pool event FD */ public static final int USAP_MANAGEMENT_MESSAGE_BYTES = 8; /** Make the new process have top application priority. */ public static final String START_AS_TOP_APP_ARG = "--is-top-app"; /** * 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 @@ -266,18 +269,20 @@ public final class Zygote { * new zygote process. * @param instructionSet null-ok the instruction set to use. * @param appDataDir null-ok the data directory of the app. * @param isTopApp true if the process is for top (high priority) application. * * @return 0 if this is the child, pid of the child * if this is the parent, or -1 on error. */ public static int forkAndSpecialize(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir) { int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp) { ZygoteHooks.preFork(); int pid = nativeForkAndSpecialize( uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose, fdsToIgnore, startChildZygote, instructionSet, appDataDir); fdsToIgnore, startChildZygote, instructionSet, appDataDir, isTopApp); if (pid == 0) { // Note that this event ends at the end of handleChildProc, Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -293,7 +298,7 @@ public final class Zygote { private static native int nativeForkAndSpecialize(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose, int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir); String appDataDir, boolean isTopApp); /** * Specialize an unspecialized app process. The current VM must have been started Loading @@ -315,12 +320,13 @@ public final class Zygote { * new zygote process. * @param instructionSet null-ok The instruction set to use. * @param appDataDir null-ok The data directory of the app. * @param isTopApp True if the process is for top (high priority) application. */ public 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 startChildZygote, String instructionSet, String appDataDir, boolean isTopApp) { nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, startChildZygote, instructionSet, appDataDir); niceName, startChildZygote, instructionSet, appDataDir, isTopApp); // Note that this event ends at the end of handleChildProc. Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading @@ -339,7 +345,7 @@ public final class Zygote { private static native void nativeSpecializeAppProcess(int uid, int gid, int[] gids, int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName, boolean startChildZygote, String instructionSet, String appDataDir); boolean startChildZygote, String instructionSet, String appDataDir, boolean isTopApp); /** * Called to do any initialization before starting an application. Loading Loading @@ -662,7 +668,7 @@ public final class Zygote { specializeAppProcess(args.mUid, args.mGid, args.mGids, args.mRuntimeFlags, rlimits, args.mMountExternal, args.mSeInfo, args.mNiceName, args.mStartChildZygote, args.mInstructionSet, args.mAppDataDir); args.mInstructionSet, args.mAppDataDir, args.mIsTopApp); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Loading
core/java/com/android/internal/os/ZygoteArguments.java +7 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,11 @@ class ZygoteArguments { */ int mHiddenApiAccessStatslogSampleRate = -1; /** * @see Zygote#START_AS_TOP_APP_ARG */ boolean mIsTopApp; /** * A set of disabled app compatibility changes for the running app. From * --disabled-compat-changes. Loading Loading @@ -422,6 +427,8 @@ class ZygoteArguments { mUsapPoolStatusSpecified = true; mUsapPoolEnabled = Boolean.parseBoolean(arg.substring(arg.indexOf('=') + 1)); expectRuntimeArgs = false; } else if (arg.startsWith(Zygote.START_AS_TOP_APP_ARG)) { mIsTopApp = true; } else if (arg.startsWith("--disabled-compat-changes=")) { if (mDisabledCompatChanges != null) { throw new IllegalArgumentException("Duplicate arg specified"); Loading