summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2019-07-16 12:00:59 -0700
committer android-build-merger <android-build-merger@google.com> 2019-07-16 12:00:59 -0700
commit0c5bf69471d12c9238d77bb7dc8499132b0e0929 (patch)
treef424ab40d112227c08e434dad4a509fda7ea4c05
parentc5c76d9d4dd6bc26f7d9810201c757884ed0956f (diff)
parentd55a427204e5ef968318e7a558c7da1c07203fea (diff)
Merge "Check that a Runtime APEX has been activated before running otapreopt." am: 59234af3e9
am: d55a427204 Change-Id: Ide06c468c5d872302d3f6c7fe7dc0d69b6ac1b40
-rw-r--r--cmds/installd/otapreopt_chroot.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmds/installd/otapreopt_chroot.cpp b/cmds/installd/otapreopt_chroot.cpp
index 0c4badf489..b4bcd53120 100644
--- a/cmds/installd/otapreopt_chroot.cpp
+++ b/cmds/installd/otapreopt_chroot.cpp
@@ -236,6 +236,18 @@ static int otapreopt_chroot(const int argc, char **arg) {
// the Android Runtime APEX, as it is required by otapreopt to run dex2oat.
std::vector<apex::ApexFile> active_packages = ActivateApexPackages();
+ // Check that an Android Runtime APEX has been activated; clean up and exit
+ // early otherwise.
+ if (std::none_of(active_packages.begin(),
+ active_packages.end(),
+ [](const apex::ApexFile& package){
+ return package.GetManifest().name() == "com.android.runtime";
+ })) {
+ LOG(FATAL_WITHOUT_ABORT) << "No activated com.android.runtime APEX package.";
+ DeactivateApexPackages(active_packages);
+ exit(217);
+ }
+
// Now go on and run otapreopt.
// Incoming: cmd + status-fd + target-slot + cmd... | Incoming | = argc