Merge "Cleanup of Zygote files" am: 6fca4110dc am: c91fb923a6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1590611 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I43db62c8e3a3f648f45cc985d132437af6759c3c
This commit is contained in:
@@ -590,7 +590,7 @@ public final class Zygote {
|
|||||||
static Runnable forkUsap(LocalServerSocket usapPoolSocket,
|
static Runnable forkUsap(LocalServerSocket usapPoolSocket,
|
||||||
int[] sessionSocketRawFDs,
|
int[] sessionSocketRawFDs,
|
||||||
boolean isPriorityFork) {
|
boolean isPriorityFork) {
|
||||||
FileDescriptor[] pipeFDs = null;
|
FileDescriptor[] pipeFDs;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
pipeFDs = Os.pipe2(O_CLOEXEC);
|
pipeFDs = Os.pipe2(O_CLOEXEC);
|
||||||
|
|||||||
@@ -505,8 +505,8 @@ class ZygoteConnection {
|
|||||||
parsedArgs.mDisabledCompatChanges,
|
parsedArgs.mDisabledCompatChanges,
|
||||||
parsedArgs.mRemainingArgs, null /* classLoader */);
|
parsedArgs.mRemainingArgs, null /* classLoader */);
|
||||||
} else {
|
} else {
|
||||||
return ZygoteInit.childZygoteInit(parsedArgs.mTargetSdkVersion,
|
return ZygoteInit.childZygoteInit(
|
||||||
parsedArgs.mRemainingArgs, null /* classLoader */);
|
parsedArgs.mRemainingArgs /* classLoader */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class ZygoteInit {
|
|||||||
/**
|
/**
|
||||||
* Controls whether we should preload resources during zygote init.
|
* Controls whether we should preload resources during zygote init.
|
||||||
*/
|
*/
|
||||||
public static final boolean PRELOAD_RESOURCES = true;
|
private static final boolean PRELOAD_RESOURCES = true;
|
||||||
|
|
||||||
private static final int UNPRIVILEGED_UID = 9999;
|
private static final int UNPRIVILEGED_UID = 9999;
|
||||||
private static final int UNPRIVILEGED_GID = 9999;
|
private static final int UNPRIVILEGED_GID = 9999;
|
||||||
@@ -159,7 +159,7 @@ public class ZygoteInit {
|
|||||||
sPreloadComplete = true;
|
sPreloadComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void lazyPreload() {
|
static void lazyPreload() {
|
||||||
Preconditions.checkState(!sPreloadComplete);
|
Preconditions.checkState(!sPreloadComplete);
|
||||||
Log.i(TAG, "Lazily preloading resources.");
|
Log.i(TAG, "Lazily preloading resources.");
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ public class ZygoteInit {
|
|||||||
}
|
}
|
||||||
if ("true".equals(prop)) {
|
if ("true".equals(prop)) {
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ResetJitCounters");
|
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ResetJitCounters");
|
||||||
runtime.resetJitCounters();
|
VMRuntime.resetJitCounters();
|
||||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,8 +418,6 @@ public class ZygoteInit {
|
|||||||
* larger.
|
* larger.
|
||||||
*/
|
*/
|
||||||
private static void preloadResources() {
|
private static void preloadResources() {
|
||||||
final VMRuntime runtime = VMRuntime.getRuntime();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mResources = Resources.getSystem();
|
mResources = Resources.getSystem();
|
||||||
mResources.startPreloading();
|
mResources.startPreloading();
|
||||||
@@ -463,9 +461,7 @@ public class ZygoteInit {
|
|||||||
int N = ar.length();
|
int N = ar.length();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
int id = ar.getResourceId(i, 0);
|
int id = ar.getResourceId(i, 0);
|
||||||
if (false) {
|
|
||||||
Log.v(TAG, "Preloading resource #" + Integer.toHexString(id));
|
|
||||||
}
|
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
if (mResources.getColorStateList(id, null) == null) {
|
if (mResources.getColorStateList(id, null) == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
@@ -483,9 +479,7 @@ public class ZygoteInit {
|
|||||||
int N = ar.length();
|
int N = ar.length();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
int id = ar.getResourceId(i, 0);
|
int id = ar.getResourceId(i, 0);
|
||||||
if (false) {
|
|
||||||
Log.v(TAG, "Preloading resource #" + Integer.toHexString(id));
|
|
||||||
}
|
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
if (mResources.getDrawable(id, null) == null) {
|
if (mResources.getDrawable(id, null) == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
@@ -688,13 +682,12 @@ public class ZygoteInit {
|
|||||||
final String packageName = "*";
|
final String packageName = "*";
|
||||||
final String outputPath = null;
|
final String outputPath = null;
|
||||||
final int dexFlags = 0;
|
final int dexFlags = 0;
|
||||||
final String compilerFilter = systemServerFilter;
|
|
||||||
final String uuid = StorageManager.UUID_PRIVATE_INTERNAL;
|
final String uuid = StorageManager.UUID_PRIVATE_INTERNAL;
|
||||||
final String seInfo = null;
|
final String seInfo = null;
|
||||||
final int targetSdkVersion = 0; // SystemServer targets the system's SDK version
|
final int targetSdkVersion = 0; // SystemServer targets the system's SDK version
|
||||||
try {
|
try {
|
||||||
installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName,
|
installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName,
|
||||||
instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter,
|
instructionSet, dexoptNeeded, outputPath, dexFlags, systemServerFilter,
|
||||||
uuid, classLoaderContext, seInfo, false /* downgrade */,
|
uuid, classLoaderContext, seInfo, false /* downgrade */,
|
||||||
targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null,
|
targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null,
|
||||||
"server-dexopt");
|
"server-dexopt");
|
||||||
@@ -770,7 +763,7 @@ public class ZygoteInit {
|
|||||||
capabilities &= ((long) data[0].effective) | (((long) data[1].effective) << 32);
|
capabilities &= ((long) data[0].effective) | (((long) data[1].effective) << 32);
|
||||||
|
|
||||||
/* Hardcoded command line to start the system server */
|
/* Hardcoded command line to start the system server */
|
||||||
String args[] = {
|
String[] args = {
|
||||||
"--setuid=1000",
|
"--setuid=1000",
|
||||||
"--setgid=1000",
|
"--setgid=1000",
|
||||||
"--setgroups=1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1018,1021,1023,"
|
"--setgroups=1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1018,1021,1023,"
|
||||||
@@ -781,7 +774,7 @@ public class ZygoteInit {
|
|||||||
"--target-sdk-version=" + VMRuntime.SDK_VERSION_CUR_DEVELOPMENT,
|
"--target-sdk-version=" + VMRuntime.SDK_VERSION_CUR_DEVELOPMENT,
|
||||||
"com.android.server.SystemServer",
|
"com.android.server.SystemServer",
|
||||||
};
|
};
|
||||||
ZygoteArguments parsedArgs = null;
|
ZygoteArguments parsedArgs;
|
||||||
|
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
@@ -870,7 +863,7 @@ public class ZygoteInit {
|
|||||||
* @param argv Command line arguments used to specify the Zygote's configuration.
|
* @param argv Command line arguments used to specify the Zygote's configuration.
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static void main(String argv[]) {
|
public static void main(String[] argv) {
|
||||||
ZygoteServer zygoteServer = null;
|
ZygoteServer zygoteServer = null;
|
||||||
|
|
||||||
// Mark zygote start. This ensures that thread creation will throw
|
// Mark zygote start. This ensures that thread creation will throw
|
||||||
@@ -1029,7 +1022,7 @@ public class ZygoteInit {
|
|||||||
* are enabled)
|
* are enabled)
|
||||||
* @param argv arg strings
|
* @param argv arg strings
|
||||||
*/
|
*/
|
||||||
public static final Runnable zygoteInit(int targetSdkVersion, long[] disabledCompatChanges,
|
public static Runnable zygoteInit(int targetSdkVersion, long[] disabledCompatChanges,
|
||||||
String[] argv, ClassLoader classLoader) {
|
String[] argv, ClassLoader classLoader) {
|
||||||
if (RuntimeInit.DEBUG) {
|
if (RuntimeInit.DEBUG) {
|
||||||
Slog.d(RuntimeInit.TAG, "RuntimeInit: Starting application from zygote");
|
Slog.d(RuntimeInit.TAG, "RuntimeInit: Starting application from zygote");
|
||||||
@@ -1049,11 +1042,10 @@ public class ZygoteInit {
|
|||||||
* to zygoteInit(), which skips calling into initialization routines that start the Binder
|
* to zygoteInit(), which skips calling into initialization routines that start the Binder
|
||||||
* threadpool.
|
* threadpool.
|
||||||
*/
|
*/
|
||||||
static final Runnable childZygoteInit(
|
static Runnable childZygoteInit(String[] argv) {
|
||||||
int targetSdkVersion, String[] argv, ClassLoader classLoader) {
|
|
||||||
RuntimeInit.Arguments args = new RuntimeInit.Arguments(argv);
|
RuntimeInit.Arguments args = new RuntimeInit.Arguments(argv);
|
||||||
return RuntimeInit.findStaticMain(args.startClass, args.startArgs, classLoader);
|
return RuntimeInit.findStaticMain(args.startClass, args.startArgs, /* classLoader= */null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final native void nativeZygoteInit();
|
private static native void nativeZygoteInit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ class ZygoteServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetUsapRefillState() {
|
private void resetUsapRefillState() {
|
||||||
mUsapPoolRefillAction = UsapPoolRefillAction.NONE;
|
mUsapPoolRefillAction = UsapPoolRefillAction.NONE;
|
||||||
mUsapPoolRefillTriggerTimestamp = INVALID_TIMESTAMP;
|
mUsapPoolRefillTriggerTimestamp = INVALID_TIMESTAMP;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user