| /* |
| * Copyright (C) 2020 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #include <string> |
| #include <vector> |
| |
| #include <android-base/strings.h> |
| #include <vintf/fcm_exclude.h> |
| |
| namespace android::vintf::details { |
| |
| // The predicate to VintfObject::checkMissingHalsInMatrices. |
| bool ShouldCheckMissingHalsInFcm(const std::string& package) { |
| using std::placeholders::_1; |
| |
| 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{ |
| // Packages without top level interfaces (including types-only packages) are exempted. |
| "android.hardware.camera.device@", |
| "android.hardware.gnss.measurement_corrections@1.", |
| "android.hardware.graphics.bufferqueue@", |
| |
| // 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. |
| // HIDL |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| // 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.threadnetwork", |
| "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. |
| "[email protected]", |
| "[email protected]", |
| // Fastboot AIDL |
| "android.hardware.fastboot", |
| |
| // Deprecated HALs. |
| // HIDL |
| // TODO(b/171260360) Remove when HAL definition is removed |
| "[email protected]", |
| "[email protected]", |
| // Health 1.0 HAL is deprecated. The top level interface are deleted. |
| "[email protected]", |
| // TODO(b/171260670) Remove when HAL definition is removed |
| "[email protected]", |
| // TODO(b/171260715) Remove when HAL definition is removed |
| "[email protected]", |
| |
| // TODO(b/205175891): File individual bugs for these HALs deprecated in P |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| "[email protected]", |
| |
| // Under hardware/interfaces/staging, still in development |
| // AIDL |
| "android.hardware.media.c2", |
| }; |
| |
| auto package_has_prefix = [&](const std::string& prefix) { |
| return android::base::StartsWith(package, 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(), package) != excluded_exact.end()) { |
| return false; |
| } |
| |
| return !std::any_of(excluded_prefixes.begin(), excluded_prefixes.end(), package_has_prefix); |
| } |
| |
| } // namespace android::vintf::details |