Do not allow input-vdex with dexlayout.

input-vdex and dexlayout are incompatible with each other.

bug: 36084905
bug: 36076104
bug: 36059948
bug: 35872504

Test: device boots, vdex works on OTA, input-vdex is not passed
      for speed-profile.

Change-Id: I630c90acf0a8f49f50b7909e2dec995dd4a4d13f
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 2684f3d..3fa30fa 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -2100,6 +2100,10 @@
     return DoProfileGuidedOptimizations();
   }
 
+  bool HasInputVdexFile() const {
+    return input_vdex_file_ != nullptr || input_vdex_fd_ != -1 || !input_vdex_.empty();
+  }
+
   bool LoadProfile() {
     DCHECK(UseProfile());
 
@@ -2885,6 +2889,13 @@
     }
   }
 
+  if (dex2oat->DoDexLayoutOptimizations()) {
+    if (dex2oat->HasInputVdexFile()) {
+      LOG(ERROR) << "Dexlayout is incompatible with an input VDEX";
+      return EXIT_FAILURE;
+    }
+  }
+
   art::MemMap::Init();  // For ZipEntry::ExtractToMemMap, and vdex.
 
   // Check early that the result of compilation can be written