Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/module-lib-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ package dalvik.system {
method public static void onBeginPreload();
method public static void onEndPreload(boolean);
method public static void onEndPreload();
method public static void postExecSpawn(int);
method public static void postForkChild(int, boolean, boolean, String);
method public static void postForkCommon();
method public static void postForkSystemServer(int);
Expand Down
21 changes: 21 additions & 0 deletions dalvik/src/main/java/dalvik/system/ZygoteHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,24 @@ public static void postForkChild(int runtimeFlags, boolean isSystemServer,
}
}

/**
* Called in an app process started through exec-based spawning.
*
* <p>The process was not forked from a zygote, so this deliberately avoids
* the fork-specific {@link #postForkChild} work. It applies app runtime
* policy that normally comes from zygote runtime flags before the app
* entrypoint is loaded.
*
* @param runtimeFlags The flags listed in com.android.internal.os.Zygote
* passed to the runtime.
*
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public static void postExecSpawn(int runtimeFlags) {
nativePostExecSpawn(runtimeFlags);
}

/**
* Called by the zygote in both the parent and child processes after
* every fork. In the child process, this method is called after
Expand Down Expand Up @@ -319,5 +337,8 @@ private static native void nativePostForkChild(long token, int runtimeFlags,
boolean isSystemServer, boolean isZygote,
String instructionSet);

// Hook for app processes started through exec-based spawning.
private static native void nativePostExecSpawn(int runtimeFlags);

private static native boolean nativeZygoteLongSuspendOk();
}