From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 11 Sep 2019 06:46:38 -0400 Subject: [PATCH] add parameter for avoiding full preload with exec --- api/module-lib-current.txt | 2 ++ .../main/java/dalvik/system/ZygoteHooks.java | 26 +++++++++++++++++-- .../api/legacy_platform/current.txt | 2 ++ .../api/stable_platform/current.txt | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt index 15741a7805..e554dd77cb 100644 --- a/api/module-lib-current.txt +++ b/api/module-lib-current.txt @@ -366,7 +366,9 @@ package dalvik.system { public final class ZygoteHooks { method public static void gcAndFinalize(); method public static boolean isIndefiniteThreadSuspensionSafe(); + method public static void onBeginPreload(boolean); method public static void onBeginPreload(); + method public static void onEndPreload(boolean); method public static void onEndPreload(); method public static void postForkChild(int, boolean, boolean, String); method public static void postForkCommon(); diff --git a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java index a17a2574f7..763511d218 100644 --- a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java +++ b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java @@ -62,7 +62,7 @@ public final class ZygoteHooks { */ @SystemApi(client = MODULE_LIBRARIES) @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) - public static void onBeginPreload() { + public static void onBeginPreload(boolean fullPreload) { com.android.i18n.system.ZygoteHooks.onBeginPreload(); ICU.initializeCacheInZygote(); @@ -81,6 +81,17 @@ public final class ZygoteHooks { } } + /** + * Called when the zygote begins preloading classes and data. + * + * @hide + */ + @SystemApi(client = MODULE_LIBRARIES) + @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) + public static void onBeginPreload() { + onBeginPreload(true); + } + /** * Called when the zygote has completed preloading classes and data. * @@ -88,7 +99,7 @@ public final class ZygoteHooks { */ @SystemApi(client = MODULE_LIBRARIES) @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) - public static void onEndPreload() { + public static void onEndPreload(boolean fullPreload) { com.android.i18n.system.ZygoteHooks.onEndPreload(); // Clone standard descriptors as originals closed / rebound during zygote post fork. @@ -97,6 +108,17 @@ public final class ZygoteHooks { FileDescriptor.err.cloneForFork(); } + /** + * Called when the zygote has completed preloading classes and data. + * + * @hide + */ + @SystemApi(client = MODULE_LIBRARIES) + @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE) + public static void onEndPreload() { + onEndPreload(true); + } + /** * Runs several special GCs to try to clean up a few generations of * softly- and final-reachable objects, along with any other garbage. diff --git a/mmodules/core_platform_api/api/legacy_platform/current.txt b/mmodules/core_platform_api/api/legacy_platform/current.txt index 15741a7805..e554dd77cb 100644 --- a/mmodules/core_platform_api/api/legacy_platform/current.txt +++ b/mmodules/core_platform_api/api/legacy_platform/current.txt @@ -366,7 +366,9 @@ package dalvik.system { public final class ZygoteHooks { method public static void gcAndFinalize(); method public static boolean isIndefiniteThreadSuspensionSafe(); + method public static void onBeginPreload(boolean); method public static void onBeginPreload(); + method public static void onEndPreload(boolean); method public static void onEndPreload(); method public static void postForkChild(int, boolean, boolean, String); method public static void postForkCommon(); diff --git a/mmodules/core_platform_api/api/stable_platform/current.txt b/mmodules/core_platform_api/api/stable_platform/current.txt index 15741a7805..e554dd77cb 100644 --- a/mmodules/core_platform_api/api/stable_platform/current.txt +++ b/mmodules/core_platform_api/api/stable_platform/current.txt @@ -366,7 +366,9 @@ package dalvik.system { public final class ZygoteHooks { method public static void gcAndFinalize(); method public static boolean isIndefiniteThreadSuspensionSafe(); + method public static void onBeginPreload(boolean); method public static void onBeginPreload(); + method public static void onEndPreload(boolean); method public static void onEndPreload(); method public static void postForkChild(int, boolean, boolean, String); method public static void postForkCommon();