Load /data oat/odex files non-executable when only_use_system_oat_files is set.

Make it still ok to use the vdex and the class status in the oat file.
This means:
- If dex code is uncompressed in APK we'll use that
- If dex code is compressed in APK, we'll use the dex code in the vdex.

This is a temporary solution in order to almost mimic performance-wise what
full stack integrity wants to achieve (priv-apps running from verified,
uncompressed dex code in APK).

This is to assess the impact of full stack integrity on privileged apps.

This CL doesn't ensure any integrity, and doesn't check whether the vdex has
been "tainted".

bug: 30972906

Change-Id: If0a6ab26dd6211290db53b7f02d88d45aff68c0c
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 6c01c1e..a614030 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -119,9 +119,13 @@
   //
   // load_executable should be true if the caller intends to try and load
   // executable code for this dex location.
+  //
+  // only_load_system_executable should be true if the caller intends to have
+  // only oat files from /system loaded executable.
   OatFileAssistant(const char* dex_location,
                    const InstructionSet isa,
-                   bool load_executable);
+                   bool load_executable,
+                   bool only_load_system_executable = false);
 
   // Similar to this(const char*, const InstructionSet, bool), however, if a valid zip_fd is
   // provided, vdex, oat, and zip files will be read from vdex_fd, oat_fd and zip_fd respectively.
@@ -129,6 +133,7 @@
   OatFileAssistant(const char* dex_location,
                    const InstructionSet isa,
                    bool load_executable,
+                   bool only_load_system_executable,
                    int vdex_fd,
                    int oat_fd,
                    int zip_fd);
@@ -487,6 +492,9 @@
   // Whether we will attempt to load oat files executable.
   bool load_executable_ = false;
 
+  // Whether only oat files on /system are loaded executable.
+  const bool only_load_system_executable_ = false;
+
   // Cached value of the required dex checksums.
   // This should be accessed only by the GetRequiredDexChecksums() method.
   std::vector<uint32_t> cached_required_dex_checksums_;