diff options
-rw-r--r-- | dalvik/src/main/java/dalvik/system/ZygoteHooks.java | 16 | ||||
-rw-r--r-- | mmodules/core_platform_api/api/platform/current-api.txt | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java index 7e8fe3651e..f05ea2cca6 100644 --- a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java +++ b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java @@ -153,6 +153,20 @@ public final class ZygoteHooks { Daemons.startPostZygoteFork(); } + /** + * Is it safe to keep all ART daemon threads stopped indefinitely in the zygote? + * The answer may change from false to true dynamically, but not in the other + * direction. + */ + @libcore.api.CorePlatformApi + public static boolean indefiniteThreadSuspensionOK() { + // TODO: Make this return true if we're done with JIT compilation. + // + // We only care about JIT compilation that affects other processes. + // The zygote itself doesn't run appreciable amounts of Java code when + // running single-threaded. + return !nativeZygoteJitEnabled(); + } // Hook for SystemServer specific early initialization post-forking. private static native void nativePostForkSystemServer(int runtimeFlags); @@ -165,6 +179,8 @@ public final class ZygoteHooks { boolean isSystemServer, boolean isZygote, String instructionSet); + private static native boolean nativeZygoteJitEnabled(); + /** * We must not fork until we're single-threaded again. Wait until /proc shows we're * down to just one thread. diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt index 15a0a48d8c..104e479171 100644 --- a/mmodules/core_platform_api/api/platform/current-api.txt +++ b/mmodules/core_platform_api/api/platform/current-api.txt @@ -745,6 +745,7 @@ package dalvik.system { public final class ZygoteHooks { method public static void gcAndFinalize(); + method public static boolean indefiniteThreadSuspensionOK(); method public static void onBeginPreload(); method public static void onEndPreload(); method public static void postForkChild(int, boolean, boolean, String); |