summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2018-01-09 00:02:17 -0800
committer Mathieu Chartier <mathieuc@google.com> 2018-01-09 00:02:17 -0800
commitb41ffcc92bb91a68947bf715bca9ddab617795bf (patch)
tree1e2e32943ee81f3b76f195bebb9058b16f4828ee
parent9c3769fd66d19488ee8952e48d4b8c387de9dc0d (diff)
Disable compact dex for input fd == output fd
In the case where compact dex is enabled by default, we must explicitly disable it for the unsupported case where update input vdex is true. Test: make Bug: 63756964 Change-Id: Ie2bed45d6206f557c20c147cb21e4a0adf72176e
-rw-r--r--cmds/installd/dexopt.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 29d5c32f16..944aeb9fa5 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -61,6 +61,7 @@ static constexpr bool kEnableMinidebugInfo = true;
static constexpr const char* kMinidebugInfoSystemProperty = "dalvik.vm.dex2oat-minidebuginfo";
static constexpr bool kMinidebugInfoSystemPropertyDefault = false;
static constexpr const char* kMinidebugDex2oatFlag = "--generate-mini-debug-info";
+static constexpr const char* kDisableCompactDexFlag = "--compact-dex-level=none";
// Deleter using free() for use with std::unique_ptr<>. See also UniqueCPtr<> below.
struct FreeDelete {
@@ -409,6 +410,10 @@ static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vd
ALOGV("Running %s in=%s out=%s\n", dex2oat_bin, relative_input_file_name, output_file_name);
+ // Disable cdex if update input vdex is true since this combination of options is not
+ // supported.
+ const bool disable_cdex = input_vdex_fd == output_vdex_fd;
+
const char* argv[9 // program name, mandatory arguments and the final NULL
+ (have_dex2oat_isa_variant ? 1 : 0)
+ (have_dex2oat_isa_features ? 1 : 0)
@@ -427,6 +432,7 @@ static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vd
+ (class_loader_context != nullptr ? 1 : 0)
+ (has_base_dir ? 1 : 0)
+ (have_dex2oat_large_app_threshold ? 1 : 0)
+ + (disable_cdex ? 1 : 0)
+ (generate_minidebug_info ? 1 : 0)];
int i = 0;
argv[i++] = dex2oat_bin;
@@ -494,6 +500,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vd
if (generate_minidebug_info) {
argv[i++] = kMinidebugDex2oatFlag;
}
+ if (disable_cdex) {
+ argv[i++] = kDisableCompactDexFlag;
+ }
// Do not add after dex2oat_flags, they should override others for debugging.
argv[i] = NULL;