diff options
| author | 2017-04-25 17:36:51 +0100 | |
|---|---|---|
| committer | 2017-04-25 17:36:51 +0100 | |
| commit | 08e9eed8f609c0917b27e15a6bfb5a05d8cb3e2b (patch) | |
| tree | 12a6a2a85d7aff9db59f6b2fe80936a62a0a20c9 | |
| parent | cf7d5d6b352442a7abf02a5b53a4575d395d0e97 (diff) | |
Allow stripped APK to be compiled with a vdex.
bug: 37558732
Test: oat_file_assistant_test
Test: "adb shell cmd package compile" of a stripped /system apk
Change-Id: I48d4baf13fa356ab84e7dd04f318a595e13fd70b
| -rw-r--r-- | runtime/oat_file_assistant.cc | 26 | ||||
| -rw-r--r-- | runtime/oat_file_assistant_test.cc | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc index a7be73a849..322bd1c620 100644 --- a/runtime/oat_file_assistant.cc +++ b/runtime/oat_file_assistant.cc @@ -848,24 +848,24 @@ OatFileAssistant::DexOptNeeded OatFileAssistant::OatFileInfo::GetDexOptNeeded( return kNoDexOptNeeded; } - if (oat_file_assistant_->HasOriginalDexFiles()) { - if (filter_okay && Status() == kOatRelocationOutOfDate) { - return kDex2OatForRelocation; - } + if (filter_okay && Status() == kOatRelocationOutOfDate) { + return kDex2OatForRelocation; + } - if (IsUseable()) { - return kDex2OatForFilter; - } + if (IsUseable()) { + return kDex2OatForFilter; + } - if (Status() == kOatBootImageOutOfDate) { - return kDex2OatForBootImage; - } + if (Status() == kOatBootImageOutOfDate) { + return kDex2OatForBootImage; + } + if (oat_file_assistant_->HasOriginalDexFiles()) { return kDex2OatFromScratch; + } else { + // Otherwise there is nothing we can do, even if we want to. + return kNoDexOptNeeded; } - - // Otherwise there is nothing we can do, even if we want to. - return kNoDexOptNeeded; } const OatFile* OatFileAssistant::OatFileInfo::GetFile() { diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc index 4a738ab0a3..810f0226df 100644 --- a/runtime/oat_file_assistant_test.cc +++ b/runtime/oat_file_assistant_test.cc @@ -526,7 +526,7 @@ TEST_F(OatFileAssistantTest, StrippedDexOdexOat) { oat_file_assistant.GetDexOptNeeded(CompilerFilter::kVerifyAtRuntime)); EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, oat_file_assistant.GetDexOptNeeded(CompilerFilter::kSpeed)); - EXPECT_EQ(OatFileAssistant::kNoDexOptNeeded, // Can't run dex2oat because dex file is stripped. + EXPECT_EQ(-OatFileAssistant::kDex2OatForFilter, // Compiling from the .vdex file oat_file_assistant.GetDexOptNeeded(CompilerFilter::kEverything)); EXPECT_FALSE(oat_file_assistant.IsInBootClassPath()); |