Merge "Ignore heap trim requests if we are the zygote"
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index f95a68e..2048160 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3013,7 +3013,10 @@
 
   Thread* self = Thread::Current();
   Runtime* runtime = Runtime::Current();
-  if (runtime == nullptr || !runtime->IsFinishedStarting() || runtime->IsShuttingDown(self)) {
+  if (runtime == nullptr || !runtime->IsFinishedStarting() || runtime->IsShuttingDown(self) ||
+      runtime->IsZygote()) {
+    // Ignore the request if we are the zygote to prevent app launching lag due to sleep in heap
+    // trimmer daemon. b/17310019
     // Heap trimming isn't supported without a Java runtime or Daemons (such as at dex2oat time)
     // Also: we do not wish to start a heap trim if the runtime is shutting down (a racy check
     // as we don't hold the lock while requesting the trim).