summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Ioffe <ioffe@google.com>2019-05-08 17:11:53 +0000
committerNikita Ioffe <ioffe@google.com>2019-05-08 21:44:32 +0000
commit3d3769cf257ddc477682393c62a07a27145543d2 (patch)
tree23be635188441953b5c7d2fa245f208b8ca6397d
parentb097207ca25f94d157496d66dd8483a73a850647 (diff)
downloadapex-3d3769cf257ddc477682393c62a07a27145543d2.tar.gz
Revert "Revert "Don't mount non-flattened apexes if device doesn't support them""
This reverts commit b097207ca25f94d157496d66dd8483a73a850647. Reason for revert: automotive now targets flatten apex Bug: 130623080 Test: cpct/boot/device_boot_test for hawk-userdebug on forrest Change-Id: I38ea0b323c4745eafe7118f213a15723ef6123fc
-rw-r--r--apexd/apexd.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/apexd/apexd.cpp b/apexd/apexd.cpp
index 9f7b23d1..ad8aa7ea 100644
--- a/apexd/apexd.cpp
+++ b/apexd/apexd.cpp
@@ -397,6 +397,12 @@ StatusOr<MountedApexData> mountNonFlattened(const ApexFile& apex,
using StatusM = StatusOr<MountedApexData>;
const std::string& full_path = apex.GetPath();
+ if (!kUpdatable) {
+ return StatusM::Fail(StringLog()
+ << "Unable to mount non-flattened apex package "
+ << full_path << " because device doesn't support it");
+ }
+
loop::LoopbackDeviceUniqueFd loopbackDevice;
for (size_t attempts = 1;; ++attempts) {
StatusOr<loop::LoopbackDeviceUniqueFd> ret = loop::createLoopDevice(
@@ -1310,6 +1316,8 @@ Status scanPackagesDirAndActivate(const char* apex_package_dir) {
const auto& packages_with_code = GetActivePackagesMap();
std::vector<std::string> failed_pkgs;
+ size_t activated_cnt = 0;
+ size_t skipped_cnt = 0;
for (const std::string& name : *scan) {
LOG(INFO) << "Found " << name;
@@ -1328,6 +1336,14 @@ Status scanPackagesDirAndActivate(const char* apex_package_dir) {
LOG(INFO) << "Skipping activation of " << name
<< " same package with higher version " << it->second
<< " is already active";
+ skipped_cnt++;
+ continue;
+ }
+
+ if (!kUpdatable && !apex_file->IsFlattened()) {
+ LOG(INFO) << "Skipping activation of non-flattened apex package " << name
+ << " because device doesn't support it";
+ skipped_cnt++;
continue;
}
@@ -1336,6 +1352,8 @@ Status scanPackagesDirAndActivate(const char* apex_package_dir) {
LOG(ERROR) << "Failed to activate " << name << " : "
<< res.ErrorMessage();
failed_pkgs.push_back(name);
+ } else {
+ activated_cnt++;
}
}
@@ -1345,7 +1363,8 @@ Status scanPackagesDirAndActivate(const char* apex_package_dir) {
<< Join(failed_pkgs, ','));
}
- LOG(INFO) << "Activated " << scan->size() << " packages";
+ LOG(INFO) << "Activated " << activated_cnt
+ << " packages. Skipped: " << skipped_cnt;
return Status::Success();
}