Ignore heap trim requests if we are the zygote

Done to prevent app launching lag due to sleep in heap trimmer
daemon.

Bug: 17310019

Change-Id: Ia593e7eced1c1583771985ec9e7b60ee0c0e7912
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 3dfa8ad..404aff3 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3002,7 +3002,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).