Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e7884ab authored by Tao Bao's avatar Tao Bao Committed by android-build-merger
Browse files

Merge "Call libvintf to verify package compatibility."

am: b0945e1a

Change-Id: I1c54dafa606aa4ba0955983f3a5023d7b65ded1b
parents c08c055c b0945e1a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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 \
+10 −5
Original line number Diff line number Diff line
@@ -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,12 +536,17 @@ 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);
  // 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
really_install_package(const char *path, bool* wipe_cache, bool needs_mount,
                       std::vector<std::string>& log_buffer, int retry_count, int* max_temperature)
@@ -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);
+3 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ LOCAL_STATIC_LIBRARIES := \
    libdivsufsort64 \
    libfs_mgr \
    liblog \
    libvintf_recovery \
    libvintf \
    libtinyxml2 \
    libselinux \
    libext4_utils \
    libsparse \