aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-04-19 19:10:07 -0500
committerGerrit Code Review2017-04-19 19:10:09 -0500
commitb0945e1a23b26153aa386ca4e6f768f04b28abdf (patch)
tree615d8c35c1982dbb64e2326aab117f208d18193a /install.cpp
parente888d45950ea90d54efcb309269dbe226cf58ac7 (diff)
parent919d2c9a5341d123fa1c97ffad3549c20e1dd021 (diff)
downloadplatform-bootable-recovery-b0945e1a23b26153aa386ca4e6f768f04b28abdf.tar.gz
platform-bootable-recovery-b0945e1a23b26153aa386ca4e6f768f04b28abdf.tar.xz
platform-bootable-recovery-b0945e1a23b26153aa386ca4e6f768f04b28abdf.zip
Merge "Call libvintf to verify package compatibility."
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/install.cpp b/install.cpp
index 73ddf5e9..e5a59b83 100644
--- a/install.cpp
+++ b/install.cpp
@@ -44,6 +44,7 @@
44#include <android-base/properties.h> 44#include <android-base/properties.h>
45#include <android-base/stringprintf.h> 45#include <android-base/stringprintf.h>
46#include <android-base/strings.h> 46#include <android-base/strings.h>
47#include <vintf/VintfObjectRecovery.h>
47#include <ziparchive/zip_archive.h> 48#include <ziparchive/zip_archive.h>
48 49
49#include "common.h" 50#include "common.h"
@@ -535,10 +536,15 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) {
535 } 536 }
536 CloseArchive(zip_handle); 537 CloseArchive(zip_handle);
537 538
538 // TODO(b/36814503): Enable the actual verification when VintfObject::CheckCompatibility() lands. 539 // VintfObjectRecovery::CheckCompatibility returns zero on success.
539 // VintfObject::CheckCompatibility returns zero on success. 540 std::string err;
540 // return (android::vintf::VintfObject::CheckCompatibility(compatibility_info, true) == 0); 541 int result = android::vintf::VintfObjectRecovery::CheckCompatibility(compatibility_info, &err);
541 return true; 542 if (result == 0) {
543 return true;
544 }
545
546 LOG(ERROR) << "Failed to verify package compatibility (result " << result << "): " << err;
547 return false;
542} 548}
543 549
544static int 550static int
@@ -590,7 +596,6 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
590 596
591 // Additionally verify the compatibility of the package. 597 // Additionally verify the compatibility of the package.
592 if (!verify_package_compatibility(zip)) { 598 if (!verify_package_compatibility(zip)) {
593 LOG(ERROR) << "Failed to verify package compatibility";
594 log_buffer.push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure)); 599 log_buffer.push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure));
595 sysReleaseMap(&map); 600 sysReleaseMap(&map);
596 CloseArchive(zip); 601 CloseArchive(zip);