Merge "Check for build-tags before installing sideload OTA" into main am: e288aff6fa am: 10c691b0bf

Original change: https://android-review.googlesource.com/c/platform/bootable/recovery/+/3006662

Change-Id: I5d6953d58797973eb764cdf35f82296eab35df19
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2024-04-05 19:35:51 +00:00 committed by Automerger Merge Worker
commit 9ed3eed0e7

View file

@ -189,6 +189,17 @@ static bool CheckAbSpecificMetadata(const std::map<std::string, std::string>& me
return false;
}
}
const auto post_build = get_value(metadata, "post-build");
const auto build_fingerprint = android::base::Tokenize(post_build, "/");
if (!build_fingerprint.empty()) {
const auto& post_build_tag = build_fingerprint.back();
const auto build_tag = android::base::GetProperty("ro.build.tags", "");
if (build_tag != post_build_tag) {
LOG(ERROR) << "Post build-tag " << post_build_tag << " does not match device build tag "
<< build_tag;
return false;
}
}
return true;
}