summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-05-07 17:21:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-05-07 17:21:27 +0000
commita3446c27d7eb9786f22f5e63540a4600abda0107 (patch)
treecf73881d4f99c9c971970f09524a41717ca378ee
parent37751319ee24278bda70e0031cf55f5b733a5b6f (diff)
parenta32ccec1c4d247e29eef4288706c303b9e71f08b (diff)
downloadplatform_system_apex-a3446c27d7eb9786f22f5e63540a4600abda0107.tar.gz
platform_system_apex-a3446c27d7eb9786f22f5e63540a4600abda0107.tar.bz2
platform_system_apex-a3446c27d7eb9786f22f5e63540a4600abda0107.zip
Merge "Don't mount non-flattened apexes if device doesn't support them" into qt-dev
-rw-r--r--apexd/apexd.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/apexd/apexd.cpp b/apexd/apexd.cpp
index abb623dd..561374c8 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();
}