diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-05-07 17:21:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-05-07 17:21:27 +0000 |
commit | a3446c27d7eb9786f22f5e63540a4600abda0107 (patch) | |
tree | cf73881d4f99c9c971970f09524a41717ca378ee | |
parent | 37751319ee24278bda70e0031cf55f5b733a5b6f (diff) | |
parent | a32ccec1c4d247e29eef4288706c303b9e71f08b (diff) | |
download | platform_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.cpp | 21 |
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(); } |