diff options
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | install.cpp | 15 | ||||
-rw-r--r-- | tests/Android.mk | 3 | ||||
-rw-r--r-- | update_verifier/update_verifier.rc | 4 |
4 files changed, 19 insertions, 7 deletions
diff --git a/Android.mk b/Android.mk index 2a33bbe80..408b146a9 100644 --- a/Android.mk +++ b/Android.mk @@ -53,6 +53,7 @@ endif LOCAL_MODULE := librecovery LOCAL_STATIC_LIBRARIES := \ libminui \ + libvintf_recovery \ libcrypto_utils \ libcrypto \ libbase @@ -112,6 +113,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 4fb809996..ffeba2e18 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" @@ -544,10 +545,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 @@ -599,7 +605,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 22a8efcbb..f59f486d7 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -133,6 +133,9 @@ LOCAL_STATIC_LIBRARIES := \ libdivsufsort64 \ libfs_mgr \ liblog \ + libvintf_recovery \ + libvintf \ + libtinyxml2 \ libselinux \ libext4_utils \ libsparse \ diff --git a/update_verifier/update_verifier.rc b/update_verifier/update_verifier.rc index 808f2c055..862b06257 100644 --- a/update_verifier/update_verifier.rc +++ b/update_verifier/update_verifier.rc @@ -1,11 +1,11 @@ service update_verifier_nonencrypted /system/bin/update_verifier nonencrypted user root - group cache + group cache system priority -20 ioprio rt 0 service update_verifier /system/bin/update_verifier ${vold.decrypt} user root - group cache + group cache system priority -20 ioprio rt 0 |