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

Commit 23847d44 authored by Yifan Hong's avatar Yifan Hong Committed by Gerrit Code Review
Browse files

Merge "fcm_exclude: split HIDL and AIDL predicate." into main

parents e8d695d9 32f40c34
Loading
Loading
Loading
Loading
+55 −20
Original line number Diff line number Diff line
@@ -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);
    };
+2 −1
Original line number Diff line number Diff line
@@ -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