diff options
author | Tao Bao <tbao@google.com> | 2017-04-20 00:25:53 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-20 00:25:53 +0200 |
commit | 71df092bf2b339798cca0945698df1c6a78d0f94 (patch) | |
tree | 1b392ca02db6e63a82d2b53a578f8a5530501b28 | |
parent | Merge "Add tests for read_metadata_from_package()." am: e888d45950 am: c08c055ce0 am: 7b9b77f445 (diff) | |
parent | Call libvintf to verify package compatibility. (diff) | |
download | android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.tar android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.tar.gz android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.tar.bz2 android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.tar.lz android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.tar.xz android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.tar.zst android_bootable_recovery-71df092bf2b339798cca0945698df1c6a78d0f94.zip |
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | install.cpp | 15 | ||||
-rw-r--r-- | tests/Android.mk | 3 |
3 files changed, 17 insertions, 5 deletions
diff --git a/Android.mk b/Android.mk index 9e374de8f..adf478f00 100644 --- a/Android.mk +++ b/Android.mk @@ -55,6 +55,7 @@ endif LOCAL_MODULE := librecovery LOCAL_STATIC_LIBRARIES := \ libminui \ + libvintf_recovery \ libcrypto_utils \ libcrypto \ libbase @@ -114,6 +115,9 @@ LOCAL_STATIC_LIBRARIES := \ libfs_mgr \ libcrypto_utils \ libcrypto \ + libvintf_recovery \ + libvintf \ + libtinyxml2 \ libbase \ libcutils \ libutils \ 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); diff --git a/tests/Android.mk b/tests/Android.mk index 20cbcc147..e52663031 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -132,6 +132,9 @@ LOCAL_STATIC_LIBRARIES := \ libdivsufsort64 \ libfs_mgr \ liblog \ + libvintf_recovery \ + libvintf \ + libtinyxml2 \ libselinux \ libext4_utils \ libsparse \ |