diff options
| author | 2019-07-16 12:20:23 -0700 | |
|---|---|---|
| committer | 2019-07-16 12:20:23 -0700 | |
| commit | 3e446c9659583f6093c66bc3bcc0102d33d8e2a9 (patch) | |
| tree | 3228a61aa1885df691f6b916d39613b33f69e853 | |
| parent | 7a7cc0d533c43a2c864142f79002d07495a59057 (diff) | |
| parent | 5c092f7ee44f85a4f39231b4a046702d37ae76df (diff) | |
Merge "Check that a Runtime APEX has been activated before running otapreopt." am: 59234af3e9 am: d55a427204 am: 0c5bf69471
am: 5c092f7ee4
Change-Id: I8b10c5d8c78031d3e17bfd57297cf373042b5ec5
| -rw-r--r-- | cmds/installd/otapreopt_chroot.cpp | 12 |
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 |