Disable zygote preloading

Change-Id: I2b0cfdb8f0a66c1bac92f4c67a4be06fa78b6d74
diff --git a/Android.mk b/Android.mk
index 38eb01e..0503f8c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -170,7 +170,7 @@
 
 .PHONY: zygote-oat-process
 zygote-oat-process: $(TARGET_BOOT_OAT) test-art-target-sync
-	sed s/app_process/oat_process/ < system/core/rootdir/init.rc > $(ANDROID_PRODUCT_OUT)/root/init.rc
+	sed -e 's/app_process/oat_process/' -e 's/--start-system-server/--start-system-server --no-preload/' < system/core/rootdir/init.rc > $(ANDROID_PRODUCT_OUT)/root/init.rc
 	rm -f $(ANDROID_PRODUCT_OUT)/boot.img
 	unset ONE_SHOT_MAKEFILE && $(MAKE) showcommands bootimage
 	adb reboot bootloader
@@ -179,7 +179,7 @@
 
 .PHONY: zygote-app-process
 zygote-app-process:
-	sed s/oat_process/app_process/ < system/core/rootdir/init.rc > $(ANDROID_PRODUCT_OUT)/root/init.rc
+	cp system/core/rootdir/init.rc $(ANDROID_PRODUCT_OUT)/root/init.rc
 	rm -f $(ANDROID_PRODUCT_OUT)/boot.img
 	unset ONE_SHOT_MAKEFILE && $(MAKE) showcommands bootimage
 	adb reboot bootloader
diff --git a/oat_process/app_main.cpp b/oat_process/app_main.cpp
index 4e90dab..62858dc 100644
--- a/oat_process/app_main.cpp
+++ b/oat_process/app_main.cpp
@@ -209,6 +209,7 @@
     // Parse runtime arguments.  Stop at first unrecognized option.
     bool zygote = false;
     bool startSystemServer = false;
+    bool noPreload = false;
     bool application = false;
     const char* parentDir = NULL;
     const char* niceName = NULL;
@@ -222,6 +223,8 @@
             niceName = "zygote";
         } else if (strcmp(arg, "--start-system-server") == 0) {
             startSystemServer = true;
+        } else if (strcmp(arg, "--no-preload") == 0) {
+            noPreload = true;
         } else if (strcmp(arg, "--application") == 0) {
             application = true;
         } else if (strncmp(arg, "--nice-name=", 12) == 0) {
@@ -240,8 +243,14 @@
     runtime.mParentDir = parentDir;
 
     if (zygote) {
-        runtime.start("com.android.internal.os.ZygoteInit",
-                startSystemServer ? "start-system-server" : "");
+        std::string options;
+        if (startSystemServer) {
+            options += "start-system-server ";
+        }
+        if (noPreload) {
+            options += "no-preload ";
+        }
+        runtime.start("com.android.internal.os.ZygoteInit", options.c_str());
     } else if (className) {
         // Remainder of args get passed to startup class main()
         runtime.mClassName = className;