diff options
| author | 2017-03-20 18:42:49 -0700 | |
|---|---|---|
| committer | 2017-04-11 20:02:55 -0700 | |
| commit | 54e1a402610d7f392f7e421dcafcf6b017a99d88 (patch) | |
| tree | 2310054b5426ad681f763b283cd7476425385252 | |
| parent | 1636e003355d9dc6c04d4f9701241f3ab364be32 (diff) | |
Otapreopt: Check dexopt return status before retry
Only retry compilation (triggering a wipe and boot image regeneration)
when dex2oat failed in runtime creation.
(cherry picked from commit 2c925927ee7524086965be324e614c9041126085)
Bug: 36336122
Test: m
Test: Device boots
Test: Can install apps
Test: Can run A/B OTA
Change-Id: I1a2ae3a871a926002980acd8b7fa777fe8f7d739
| -rw-r--r-- | cmds/installd/Android.mk | 1 | ||||
| -rw-r--r-- | cmds/installd/otapreopt.cpp | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/cmds/installd/Android.mk b/cmds/installd/Android.mk index be1a4345ea..1d21b3ce1b 100644 --- a/cmds/installd/Android.mk +++ b/cmds/installd/Android.mk @@ -24,6 +24,7 @@ LOCAL_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LOCAL_LIBART_IMG_HOST_MIN_BASE_AD LOCAL_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA) LOCAL_SRC_FILES := otapreopt.cpp globals.cpp utils.cpp dexopt.cpp +LOCAL_HEADER_LIBRARIES := dex2oat_headers LOCAL_SHARED_LIBRARIES := \ libbase \ libcutils \ diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp index 82b8cc204d..e8e6b56ea4 100644 --- a/cmds/installd/otapreopt.cpp +++ b/cmds/installd/otapreopt.cpp @@ -33,6 +33,7 @@ #include <android-base/strings.h> #include <cutils/fs.h> #include <cutils/properties.h> +#include <dex2oat_return_codes.h> #include <log/log.h> #include <private/android_filesystem_config.h> @@ -576,7 +577,11 @@ private: } // If the dexopt failed, we may have a stale boot image from a previous OTA run. - // Try to delete and retry. + // Then regenerate and retry. + if (WEXITSTATUS(dexopt_result) != + static_cast<int>(art::dex2oat::ReturnCode::kCreateRuntime)) { + return dexopt_result; + } if (!PrepareBootImage(/* force */ true)) { LOG(ERROR) << "Forced boot image creating failed. Original error return was " |