Track ZygoteHooks API changes in libcore
Track ZygoteHooks API changes in libcore to make the ZygoteHooks API more consistent. Bug: 111742291 Test: build / boot / treehugger Change-Id: Ie65aac6539cffc90663807791511b95a6cd61ab4
This commit is contained in:
@@ -132,8 +132,6 @@ public final class Zygote {
|
|||||||
* */
|
* */
|
||||||
protected static FileDescriptor sBlastulaPoolEventFD;
|
protected static FileDescriptor sBlastulaPoolEventFD;
|
||||||
|
|
||||||
private static final ZygoteHooks VM_HOOKS = new ZygoteHooks();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extraArg passed when a zygote process is forking a child-zygote, specifying a name
|
* 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
|
* in the abstract socket namespace. This socket name is what the new child zygote
|
||||||
@@ -246,7 +244,7 @@ public final class Zygote {
|
|||||||
int[][] rlimits, int mountExternal, String seInfo, String niceName, int[] fdsToClose,
|
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,
|
||||||
String packageName, String[] packagesForUID, String[] visibleVolIDs) {
|
String packageName, String[] packagesForUID, String[] visibleVolIDs) {
|
||||||
VM_HOOKS.preFork();
|
ZygoteHooks.preFork();
|
||||||
// Resets nice priority for zygote process.
|
// Resets nice priority for zygote process.
|
||||||
resetNicePriority();
|
resetNicePriority();
|
||||||
int pid = nativeForkAndSpecialize(
|
int pid = nativeForkAndSpecialize(
|
||||||
@@ -260,7 +258,7 @@ public final class Zygote {
|
|||||||
// Note that this event ends at the end of handleChildProc,
|
// Note that this event ends at the end of handleChildProc,
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork");
|
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork");
|
||||||
}
|
}
|
||||||
VM_HOOKS.postForkCommon();
|
ZygoteHooks.postForkCommon();
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +309,7 @@ public final class Zygote {
|
|||||||
*
|
*
|
||||||
* TODO (chriswailes): Look into moving this to immediately after the fork.
|
* TODO (chriswailes): Look into moving this to immediately after the fork.
|
||||||
*/
|
*/
|
||||||
VM_HOOKS.postForkCommon();
|
ZygoteHooks.postForkCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native void nativeSpecializeBlastula(int uid, int gid, int[] gids,
|
private static native void nativeSpecializeBlastula(int uid, int gid, int[] gids,
|
||||||
@@ -349,7 +347,7 @@ public final class Zygote {
|
|||||||
*/
|
*/
|
||||||
public static int forkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
|
public static int forkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
|
||||||
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities) {
|
int[][] rlimits, long permittedCapabilities, long effectiveCapabilities) {
|
||||||
VM_HOOKS.preFork();
|
ZygoteHooks.preFork();
|
||||||
// Resets nice priority for zygote process.
|
// Resets nice priority for zygote process.
|
||||||
resetNicePriority();
|
resetNicePriority();
|
||||||
int pid = nativeForkSystemServer(
|
int pid = nativeForkSystemServer(
|
||||||
@@ -359,7 +357,7 @@ public final class Zygote {
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
Trace.setTracingEnabled(true, runtimeFlags);
|
Trace.setTracingEnabled(true, runtimeFlags);
|
||||||
}
|
}
|
||||||
VM_HOOKS.postForkCommon();
|
ZygoteHooks.postForkCommon();
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +432,7 @@ public final class Zygote {
|
|||||||
|
|
||||||
// Disable some VM functionality and reset some system values
|
// Disable some VM functionality and reset some system values
|
||||||
// before forking.
|
// before forking.
|
||||||
VM_HOOKS.preFork();
|
ZygoteHooks.preFork();
|
||||||
resetNicePriority();
|
resetNicePriority();
|
||||||
|
|
||||||
while (blastulaPoolCount++ < sBlastulaPoolMax) {
|
while (blastulaPoolCount++ < sBlastulaPoolMax) {
|
||||||
@@ -447,7 +445,7 @@ public final class Zygote {
|
|||||||
|
|
||||||
// Re-enable runtime services for the Zygote. Blastula services
|
// Re-enable runtime services for the Zygote. Blastula services
|
||||||
// are re-enabled in specializeBlastula.
|
// are re-enabled in specializeBlastula.
|
||||||
VM_HOOKS.postForkCommon();
|
ZygoteHooks.postForkCommon();
|
||||||
|
|
||||||
Log.i("zygote", "Filled the blastula pool. New blastulas: " + numBlastulasToSpawn);
|
Log.i("zygote", "Filled the blastula pool. New blastulas: " + numBlastulasToSpawn);
|
||||||
}
|
}
|
||||||
@@ -864,12 +862,12 @@ public final class Zygote {
|
|||||||
|
|
||||||
private static void callPostForkSystemServerHooks() {
|
private static void callPostForkSystemServerHooks() {
|
||||||
// SystemServer specific post fork hooks run before child post fork hooks.
|
// SystemServer specific post fork hooks run before child post fork hooks.
|
||||||
VM_HOOKS.postForkSystemServer();
|
ZygoteHooks.postForkSystemServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void callPostForkChildHooks(int runtimeFlags, boolean isSystemServer,
|
private static void callPostForkChildHooks(int runtimeFlags, boolean isSystemServer,
|
||||||
boolean isZygote, String instructionSet) {
|
boolean isZygote, String instructionSet) {
|
||||||
VM_HOOKS.postForkChild(runtimeFlags, isSystemServer, isZygote, instructionSet);
|
ZygoteHooks.postForkChild(runtimeFlags, isSystemServer, isZygote, instructionSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user