Revert "Only do dexlayout when generating comptact dex."
This reverts commit 14d3c2c0a0ca3733f63430066ce14b1f9ba5d90d.
Bug: 207346972
Reason for revert: Failing LayoutSections test.
Change-Id: I97d89d0e99a1e17582a0bea7fc1a04f7ddf873c9
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 7a27ab6..f5c6bc9 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -2324,11 +2324,7 @@
}
bool DoDexLayoutOptimizations() const {
- // Only run dexlayout when being asked to generate compact dex. We do this
- // to avoid having multiple arguments being passed to dex2oat and the main
- // user of dex2oat (installd) will have the same reasons for
- // disabling/enabling compact dex and dex layout.
- return DoGenerateCompactDex();
+ return DoProfileGuidedOptimizations() || DoGenerateCompactDex();
}
bool DoOatLayoutOptimizations() const {
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index b9e708f..428ec81 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -3311,9 +3311,9 @@
if (extract_dex_files_into_vdex_) {
vdex_dex_files_offset_ = vdex_size_;
- // Perform dexlayout if compact dex is enabled. Also see
- // Dex2Oat::DoDexLayoutOptimizations.
- if (compact_dex_level_ != CompactDexLevel::kCompactDexLevelNone) {
+ // Perform dexlayout if requested.
+ if (profile_compilation_info_ != nullptr ||
+ compact_dex_level_ != CompactDexLevel::kCompactDexLevelNone) {
for (OatDexFile& oat_dex_file : oat_dex_files_) {
// use_existing_vdex should not be used with compact dex and layout.
CHECK(!use_existing_vdex)