diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-02-16 20:41:51 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-16 20:41:51 +0000 |
| commit | c91fb923a6d33f566be2789afb2a200ef27ba094 (patch) | |
| tree | d8b98a07875e915dd16b1d92af3f48a5eaa931bf /core/java | |
| parent | 2d4714ec65b5dd80f54494ce342d325f0dfa0618 (diff) | |
| parent | 6fca4110dc5307e673c8bf390b8dd72a5c5eb957 (diff) | |
Merge "Cleanup of Zygote files" am: 6fca4110dc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1590611
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I9123313e1f2f9745347f8cc2c38eedf55a2cd81e
Diffstat (limited to 'core/java')
4 files changed, 17 insertions, 25 deletions
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index a41018000d77..65beb9360241 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -590,7 +590,7 @@ public final class Zygote { static Runnable forkUsap(LocalServerSocket usapPoolSocket, int[] sessionSocketRawFDs, boolean isPriorityFork) { - FileDescriptor[] pipeFDs = null; + FileDescriptor[] pipeFDs; try { pipeFDs = Os.pipe2(O_CLOEXEC); diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index 6573e4217a7f..5a576ebbc442 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -505,8 +505,8 @@ class ZygoteConnection { parsedArgs.mDisabledCompatChanges, parsedArgs.mRemainingArgs, null /* classLoader */); } else { - return ZygoteInit.childZygoteInit(parsedArgs.mTargetSdkVersion, - parsedArgs.mRemainingArgs, null /* classLoader */); + return ZygoteInit.childZygoteInit( + parsedArgs.mRemainingArgs /* classLoader */); } } } diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 7fde5474ec92..ef1c50f43681 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -117,7 +117,7 @@ public class ZygoteInit { /** * 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_GID = 9999; @@ -159,7 +159,7 @@ public class ZygoteInit { sPreloadComplete = true; } - public static void lazyPreload() { + static void lazyPreload() { Preconditions.checkState(!sPreloadComplete); Log.i(TAG, "Lazily preloading resources."); @@ -364,7 +364,7 @@ public class ZygoteInit { } if ("true".equals(prop)) { Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ResetJitCounters"); - runtime.resetJitCounters(); + VMRuntime.resetJitCounters(); Trace.traceEnd(Trace.TRACE_TAG_DALVIK); } @@ -418,8 +418,6 @@ public class ZygoteInit { * larger. */ private static void preloadResources() { - final VMRuntime runtime = VMRuntime.getRuntime(); - try { mResources = Resources.getSystem(); mResources.startPreloading(); @@ -463,9 +461,7 @@ public class ZygoteInit { int N = ar.length(); for (int i = 0; i < N; i++) { int id = ar.getResourceId(i, 0); - if (false) { - Log.v(TAG, "Preloading resource #" + Integer.toHexString(id)); - } + if (id != 0) { if (mResources.getColorStateList(id, null) == null) { throw new IllegalArgumentException( @@ -483,9 +479,7 @@ public class ZygoteInit { int N = ar.length(); for (int i = 0; i < N; i++) { int id = ar.getResourceId(i, 0); - if (false) { - Log.v(TAG, "Preloading resource #" + Integer.toHexString(id)); - } + if (id != 0) { if (mResources.getDrawable(id, null) == null) { throw new IllegalArgumentException( @@ -688,13 +682,12 @@ public class ZygoteInit { final String packageName = "*"; final String outputPath = null; final int dexFlags = 0; - final String compilerFilter = systemServerFilter; final String uuid = StorageManager.UUID_PRIVATE_INTERNAL; final String seInfo = null; final int targetSdkVersion = 0; // SystemServer targets the system's SDK version try { installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName, - instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, + instructionSet, dexoptNeeded, outputPath, dexFlags, systemServerFilter, uuid, classLoaderContext, seInfo, false /* downgrade */, targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null, "server-dexopt"); @@ -770,7 +763,7 @@ public class ZygoteInit { capabilities &= ((long) data[0].effective) | (((long) data[1].effective) << 32); /* Hardcoded command line to start the system server */ - String args[] = { + String[] args = { "--setuid=1000", "--setgid=1000", "--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, "com.android.server.SystemServer", }; - ZygoteArguments parsedArgs = null; + ZygoteArguments parsedArgs; int pid; @@ -870,7 +863,7 @@ public class ZygoteInit { * @param argv Command line arguments used to specify the Zygote's configuration. */ @UnsupportedAppUsage - public static void main(String argv[]) { + public static void main(String[] argv) { ZygoteServer zygoteServer = null; // Mark zygote start. This ensures that thread creation will throw @@ -1029,7 +1022,7 @@ public class ZygoteInit { * are enabled) * @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) { if (RuntimeInit.DEBUG) { 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 * threadpool. */ - static final Runnable childZygoteInit( - int targetSdkVersion, String[] argv, ClassLoader classLoader) { + static Runnable childZygoteInit(String[] 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(); } diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java index db7cbbca450e..585ddf6ddf98 100644 --- a/core/java/com/android/internal/os/ZygoteServer.java +++ b/core/java/com/android/internal/os/ZygoteServer.java @@ -411,7 +411,7 @@ class ZygoteServer { } } - void resetUsapRefillState() { + private void resetUsapRefillState() { mUsapPoolRefillAction = UsapPoolRefillAction.NONE; mUsapPoolRefillTriggerTimestamp = INVALID_TIMESTAMP; } |
