aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-04-10 18:55:57 -0500
committerTao Bao2017-04-19 17:17:16 -0500
commit919d2c9a5341d123fa1c97ffad3549c20e1dd021 (patch)
tree6bdf1c0ad8bef71ef111e5c8932f2b2e578ade37 /install.cpp
parent08146728c1a9b5d686f79f20fa6a9e2201c760be (diff)
downloadplatform-bootable-recovery-919d2c9a5341d123fa1c97ffad3549c20e1dd021.tar.gz
platform-bootable-recovery-919d2c9a5341d123fa1c97ffad3549c20e1dd021.tar.xz
platform-bootable-recovery-919d2c9a5341d123fa1c97ffad3549c20e1dd021.zip
Call libvintf to verify package compatibility.
The libvintf API has landed. Hook up to do the actual verification. Bug: 36597505 Test: recovery_component_test Test: m recoveryimage; adb sideload on angler and sailfish, with packages that contain dummy compatibility entries. Test: m recoveryimage; adb sideload on angler and sailfish, with packages that don't contain any compatibility entries. Change-Id: Idbd6f5aaef605ca51b20e667505d686de5ac781f (cherry picked from commit da320ac6ab53395ddff3cc08b88a61f977ed939a)
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 95794ce0..2a647b1a 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"
@@ -539,10 +540,15 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) {
539 } 540 }
540 CloseArchive(zip_handle); 541 CloseArchive(zip_handle);
541 542
542 // TODO(b/36814503): Enable the actual verification when VintfObject::CheckCompatibility() lands. 543 // VintfObjectRecovery::CheckCompatibility returns zero on success.
543 // VintfObject::CheckCompatibility returns zero on success. 544 std::string err;
544 // return (android::vintf::VintfObject::CheckCompatibility(compatibility_info, true) == 0); 545 int result = android::vintf::VintfObjectRecovery::CheckCompatibility(compatibility_info, &err);
545 return true; 546 if (result == 0) {
547 return true;
548 }
549
550 LOG(ERROR) << "Failed to verify package compatibility (result " << result << "): " << err;
551 return false;
546} 552}
547 553
548static int 554static int
@@ -594,7 +600,6 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
594 600
595 // Additionally verify the compatibility of the package. 601 // Additionally verify the compatibility of the package.
596 if (!verify_package_compatibility(zip)) { 602 if (!verify_package_compatibility(zip)) {
597 LOG(ERROR) << "Failed to verify package compatibility";
598 log_buffer.push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure)); 603 log_buffer.push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure));
599 sysReleaseMap(&map); 604 sysReleaseMap(&map);
600 CloseArchive(zip); 605 CloseArchive(zip);