summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-04-20 00:19:06 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-04-20 00:19:06 +0200
commit34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d (patch)
tree99862c043d8570f56a2ebbd54d77c3d2b97f401a /install.cpp
parentMerge "Add tests for read_metadata_from_package()." am: e888d45950 am: c08c055ce0 (diff)
parentCall libvintf to verify package compatibility. (diff)
downloadandroid_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.tar
android_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.tar.gz
android_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.tar.bz2
android_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.tar.lz
android_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.tar.xz
android_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.tar.zst
android_bootable_recovery-34ae4d02ce1f909dfc572558f9c183f1a5a0fe3d.zip
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 73ddf5e92..e5a59b832 100644
--- a/install.cpp
+++ b/install.cpp
@@ -44,6 +44,7 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
+#include <vintf/VintfObjectRecovery.h>
#include <ziparchive/zip_archive.h>
#include "common.h"
@@ -535,10 +536,15 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) {
}
CloseArchive(zip_handle);
- // TODO(b/36814503): Enable the actual verification when VintfObject::CheckCompatibility() lands.
- // VintfObject::CheckCompatibility returns zero on success.
- // return (android::vintf::VintfObject::CheckCompatibility(compatibility_info, true) == 0);
- return true;
+ // VintfObjectRecovery::CheckCompatibility returns zero on success.
+ std::string err;
+ int result = android::vintf::VintfObjectRecovery::CheckCompatibility(compatibility_info, &err);
+ if (result == 0) {
+ return true;
+ }
+
+ LOG(ERROR) << "Failed to verify package compatibility (result " << result << "): " << err;
+ return false;
}
static int
@@ -590,7 +596,6 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
// Additionally verify the compatibility of the package.
if (!verify_package_compatibility(zip)) {
- LOG(ERROR) << "Failed to verify package compatibility";
log_buffer.push_back(android::base::StringPrintf("error: %d", kPackageCompatibilityFailure));
sysReleaseMap(&map);
CloseArchive(zip);