Reland: Support pass BCP art/vdex/oat files by FD
The original implementation in odrefresh generated inconsistent number
of files between jars and other files. The code is reworked.
Original description:
This is currently used by odrefresh.
Main runtime changes are:
1. When reading the image header, also tries to read from the FD if
provided.
2. Initialize the art/vdex/odex FDs in the boot image chunk if provided.
This allows them to be opened (in case if the file is not accessible
by path) in LoadComponents.
3. OpenBootDexFiles: accept BCP JARs passed as FD, in case if the file
is not accessible by path.
4. The new FDs are passed from new runtime args,
-Xbootclasspath{art,vdex,oat}fds.
It is used in odrefresh to pass the previous output of BCP extensions to
be used in the next phase, system server compilation.
Bug: 193720426
Test: odrefresh --use-compilation-os=10 --force-compile # exit 80
odrefresh --verify # exit 0 (was 79 previosly)
Test: Verify the checksum of output files are the same, with
--use-compilation-os or not, i.e. regardless where the compilation
happens
Test: mma in art/
Test: odsign_e2e_tests
Change-Id: Ie3ae48c7d70a2779cfbd80b307199a0f327c895c
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 7706a5c..55fdb72 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -263,6 +263,9 @@
const std::vector<std::string>& boot_class_path,
const std::vector<std::string>& boot_class_path_locations,
const std::vector<int>& boot_class_path_fds,
+ const std::vector<int>& boot_class_path_image_fds,
+ const std::vector<int>& boot_class_path_vdex_fds,
+ const std::vector<int>& boot_class_path_oat_fds,
const std::vector<std::string>& image_file_names,
const InstructionSet image_instruction_set,
CollectorType foreground_collector_type,
@@ -464,6 +467,9 @@
if (space::ImageSpace::LoadBootImage(boot_class_path,
boot_class_path_locations,
boot_class_path_fds,
+ boot_class_path_image_fds,
+ boot_class_path_vdex_fds,
+ boot_class_path_oat_fds,
image_file_names,
image_instruction_set,
runtime->ShouldRelocate(),