Merge "fcm_exclude: split HIDL and AIDL predicate." into main am: 23847d4411 am: a2f7b02a8c am: 01a3afed45 am: 8bcce246a2

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2688566

Change-Id: I07e68b78225757ea81bc479542d276b7ec92597c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yifan Hong 2023-08-05 01:56:10 +00:00 committed by Automerger Merge Worker
commit 7725da1b9b
2 changed files with 57 additions and 21 deletions

View file

@ -24,9 +24,7 @@
namespace android::vintf::details {
// The predicate to VintfObject::checkMissingHalsInMatrices.
bool ShouldCheckMissingHalsInFcm(const std::string& package) {
using std::placeholders::_1;
bool ShouldCheckMissingHidlHalsInFcm(const std::string& packageAndVersion) {
static std::vector<std::string> included_prefixes{
// Other AOSP HALs (e.g. android.frameworks.*) are not added because only framework
// matrix is checked.
@ -51,28 +49,11 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) {
"android.hardware.media.bufferpool@1.0",
"android.hardware.media.bufferpool@2.0",
"android.hardware.radio.config@1.2",
// AIDL
"android.hardware.audio.common",
"android.hardware.audio.core.sounddose",
"android.hardware.biometrics.common",
"android.hardware.camera.metadata",
"android.hardware.camera.device",
"android.hardware.camera.common",
"android.hardware.common",
"android.hardware.common.fmq",
"android.hardware.graphics.common",
"android.hardware.input.common",
"android.hardware.keymaster",
"android.hardware.media.bufferpool2",
"android.hardware.radio",
"android.hardware.uwb.fira_android",
// Fastboot HAL is only used by recovery. Recovery is owned by OEM. Framework
// does not depend on this HAL, hence it is not declared in any manifests or matrices.
"android.hardware.fastboot@1.0",
"android.hardware.fastboot@1.1",
// Fastboot AIDL
"android.hardware.fastboot",
// Deprecated HALs.
// HIDL
@ -105,6 +86,60 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) {
"android.hardware.wifi.offload@1.0",
};
auto package_has_prefix = [&](const std::string& prefix) {
return android::base::StartsWith(packageAndVersion, prefix);
};
// Only check packageAndVersions that are in the include list and not in the exclude list.
if (!std::any_of(included_prefixes.begin(), included_prefixes.end(), package_has_prefix)) {
return false;
}
if (std::find(excluded_exact.begin(), excluded_exact.end(), packageAndVersion) !=
excluded_exact.end()) {
return false;
}
return !std::any_of(excluded_prefixes.begin(), excluded_prefixes.end(), package_has_prefix);
}
// The predicate to VintfObject::checkMissingHalsInMatrices.
bool ShouldCheckMissingAidlHalsInFcm(const std::string& package) {
static std::vector<std::string> included_prefixes{
// Other AOSP HALs (e.g. android.frameworks.*) are not added because only framework
// matrix is checked.
"android.hardware.",
};
static std::vector<std::string> excluded_prefixes{
// Test packages are exempted.
"android.hardware.tests.",
};
static std::vector<std::string> excluded_exact{
// Packages without top level interfaces (including types-only packages) are exempted.
// AIDL
"android.hardware.audio.common",
"android.hardware.audio.core.sounddose",
"android.hardware.biometrics.common",
"android.hardware.camera.metadata",
"android.hardware.camera.device",
"android.hardware.camera.common",
"android.hardware.common",
"android.hardware.common.fmq",
"android.hardware.graphics.common",
"android.hardware.input.common",
"android.hardware.keymaster",
"android.hardware.media.bufferpool2",
"android.hardware.radio",
"android.hardware.uwb.fira_android",
// Fastboot HAL is only used by recovery. Recovery is owned by OEM. Framework
// does not depend on this HAL, hence it is not declared in any manifests or matrices.
"android.hardware.fastboot",
};
auto package_has_prefix = [&](const std::string& prefix) {
return android::base::StartsWith(package, prefix);
};

View file

@ -25,6 +25,7 @@ namespace android::vintf::details {
// |package| can be a HIDL package and version like
// "android.hardware.foo@1.0", or an AIDL package name like
// "android.hardware.foo".
bool ShouldCheckMissingHalsInFcm(const std::string& package);
bool ShouldCheckMissingHidlHalsInFcm(const std::string& packageAndVersion);
bool ShouldCheckMissingAidlHalsInFcm(const std::string& package);
} // namespace android::vintf::details