Merge "ActivityManager: create process group in behalf of app zygote" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
178939357c
@@ -969,6 +969,16 @@ public class Process {
|
||||
public static final native int getProcessGroup(int pid)
|
||||
throws IllegalArgumentException, SecurityException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Create a new process group in the cgroup uid/pid hierarchy
|
||||
*
|
||||
* @return <0 in case of error
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final native int createProcessGroup(int uid, int pid);
|
||||
|
||||
/**
|
||||
* On some devices, the foreground process may have one or more CPU
|
||||
* cores exclusively reserved for it. This method can be used to
|
||||
|
||||
@@ -377,6 +377,10 @@ jint android_os_Process_getProcessGroup(JNIEnv* env, jobject clazz, jint pid)
|
||||
return (int) sp;
|
||||
}
|
||||
|
||||
jint android_os_Process_createProcessGroup(JNIEnv* env, jobject clazz, jint uid, jint pid) {
|
||||
return createProcessGroup(uid, pid);
|
||||
}
|
||||
|
||||
/** Sample CPUset list format:
|
||||
* 0-3,4,6-8
|
||||
*/
|
||||
@@ -1358,6 +1362,7 @@ static const JNINativeMethod methods[] = {
|
||||
{"setThreadGroupAndCpuset", "(II)V", (void*)android_os_Process_setThreadGroupAndCpuset},
|
||||
{"setProcessGroup", "(II)V", (void*)android_os_Process_setProcessGroup},
|
||||
{"getProcessGroup", "(I)I", (void*)android_os_Process_getProcessGroup},
|
||||
{"createProcessGroup", "(II)I", (void*)android_os_Process_createProcessGroup},
|
||||
{"getExclusiveCores", "()[I", (void*)android_os_Process_getExclusiveCores},
|
||||
{"setSwappiness", "(IZ)Z", (void*)android_os_Process_setSwappiness},
|
||||
{"setArgV0", "(Ljava/lang/String;)V", (void*)android_os_Process_setArgV0},
|
||||
|
||||
@@ -2407,6 +2407,11 @@ public final class ProcessList {
|
||||
app.getDisabledCompatChanges(), pkgDataInfoMap, allowlistedAppDataInfoMap,
|
||||
false, false,
|
||||
new String[]{PROC_START_SEQ_IDENT + app.getStartSeq()});
|
||||
|
||||
if (Process.createProcessGroup(uid, startResult.pid) < 0) {
|
||||
Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
|
||||
+ app.processName + " (" + startResult.pid + ")");
|
||||
}
|
||||
} else {
|
||||
startResult = Process.start(entryPoint,
|
||||
app.processName, uid, uid, gids, runtimeFlags, mountExternal,
|
||||
|
||||
Reference in New Issue
Block a user