Use optimizing for apps.

Doing it in dex2oat, to avoid messing up with our current testing.

Change-Id: I76c58f11f0d4756b894e797fc52712453e35adb1
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index bb80a70..a372179 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -494,6 +494,7 @@
     bool watch_dog_enabled = true;
     bool generate_gdb_information = kIsDebugBuild;
     bool abort_on_hard_verifier_error = false;
+    bool requested_specific_compiler = false;
 
     PassManagerOptions pass_manager_options;
 
@@ -603,6 +604,7 @@
           Usage("Error parsing '%s': %s", option.data(), error_msg.c_str());
         }
       } else if (option.starts_with("--compiler-backend=")) {
+        requested_specific_compiler = true;
         StringPiece backend_str = option.substr(strlen("--compiler-backend=")).data();
         if (backend_str == "Quick") {
           compiler_kind_ = Compiler::kQuick;
@@ -612,6 +614,7 @@
           Usage("Unknown compiler backend: %s", backend_str.data());
         }
       } else if (option.starts_with("--compiler-filter=")) {
+        requested_specific_compiler = true;
         compiler_filter_string = option.substr(strlen("--compiler-filter=")).data();
       } else if (option == "--compile-pic") {
         compile_pic = true;
@@ -741,6 +744,13 @@
       }
     }
 
+    image_ = (!image_filename_.empty());
+    if (!requested_specific_compiler && !kUseOptimizingCompiler) {
+      // If no specific compiler is requested, the current behavior is
+      // to compile the boot image with Quick, and the rest with Optimizing.
+      compiler_kind_ = image_ ? Compiler::kQuick : Compiler::kOptimizing;
+    }
+
     if (compiler_kind_ == Compiler::kOptimizing) {
       // Optimizing only supports PIC mode.
       compile_pic = true;
@@ -774,7 +784,6 @@
       android_root_ += android_root_env_var;
     }
 
-    image_ = (!image_filename_.empty());
     if (!image_ && boot_image_filename.empty()) {
       boot_image_filename += android_root_;
       boot_image_filename += "/framework/boot.art";
diff --git a/runtime/oat.h b/runtime/oat.h
index 79cb024..d420c3a 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -32,7 +32,7 @@
 class PACKED(4) OatHeader {
  public:
   static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' };
-  static constexpr uint8_t kOatVersion[] = { '0', '5', '8', '\0' };
+  static constexpr uint8_t kOatVersion[] = { '0', '5', '9', '\0' };
 
   static constexpr const char* kImageLocationKey = "image-location";
   static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";