blob: ccce449387a26b0eb79d5ff6eac3120c82c64567 [file] [log] [blame]
Yifan Hong4c00d8e2020-09-10 18:40:14 -07001/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Ryan Prichardc8fc80c2023-07-21 16:15:08 -070017#include <functional>
Yifan Hong4c00d8e2020-09-10 18:40:14 -070018#include <string>
19#include <vector>
20
21#include <android-base/strings.h>
22#include <vintf/fcm_exclude.h>
23
24namespace android::vintf::details {
25
26// The predicate to VintfObject::checkMissingHalsInMatrices.
27bool ShouldCheckMissingHalsInFcm(const std::string& package) {
28 using std::placeholders::_1;
29
30 static std::vector<std::string> included_prefixes{
31 // Other AOSP HALs (e.g. android.frameworks.*) are not added because only framework
32 // matrix is checked.
33 "android.hardware.",
34 };
35
36 static std::vector<std::string> excluded_prefixes{
Yifan Hong113c60b2020-09-15 16:55:14 -070037 // Packages without top level interfaces (including types-only packages) are exempted.
38 "android.hardware.camera.device@",
39 "android.hardware.gnss.measurement_corrections@1.",
Yifan Hong4c00d8e2020-09-10 18:40:14 -070040 "android.hardware.graphics.bufferqueue@",
41
Yifan Hong113c60b2020-09-15 16:55:14 -070042 // Test packages are exempted.
Yifan Hong4c00d8e2020-09-10 18:40:14 -070043 "android.hardware.tests.",
44 };
45
46 static std::vector<std::string> excluded_exact{
Yifan Hong113c60b2020-09-15 16:55:14 -070047 // Packages without top level interfaces (including types-only packages) are exempted.
48 // HIDL
49 "android.hardware.cas.native@1.0",
50 "android.hardware.gnss.visibility_control@1.0",
Yifan Hongb7d29ee2020-09-15 16:55:53 -070051 "android.hardware.media.bufferpool@1.0",
52 "android.hardware.media.bufferpool@2.0",
Yifan Hong113c60b2020-09-15 16:55:14 -070053 "android.hardware.radio.config@1.2",
54 // AIDL
Mikhail Naganov32a8ef32021-10-26 14:00:00 -070055 "android.hardware.audio.common",
Vlad Popa2afbd1e2022-12-28 17:04:58 +010056 "android.hardware.audio.core.sounddose",
Kevin Chyn7d3fdf52020-09-15 13:01:40 -070057 "android.hardware.biometrics.common",
Jayant Chowdhary33e7fef2021-11-03 12:06:08 -070058 "android.hardware.camera.metadata",
Jayant Chowdharyfd3b3c62021-11-03 12:23:41 -070059 "android.hardware.camera.device",
Jayant Chowdhary0b0d7332021-11-03 12:41:32 -070060 "android.hardware.camera.common",
Jayant Chowdharyfd3b3c62021-11-03 12:23:41 -070061 "android.hardware.common",
Devin Moore23a52ec2020-10-09 13:37:12 -070062 "android.hardware.common.fmq",
Yifan Hong4c00d8e2020-09-10 18:40:14 -070063 "android.hardware.graphics.common",
Siarhei Vishniakou600e9132022-01-07 16:27:22 -080064 "android.hardware.input.common",
Yifan Hong113c60b2020-09-15 16:55:14 -070065 "android.hardware.keymaster",
Sungtak Lee1468ddf2022-09-06 16:05:58 +000066 "android.hardware.media.bufferpool2",
Sarah Chinbd8e4762021-09-20 13:45:18 -070067 "android.hardware.radio",
Roshan Piusf527f8f2021-10-12 09:45:28 -070068 "android.hardware.uwb.fira_android",
Yifan Hongcd3d7cc2020-09-15 17:08:06 -070069
70 // Fastboot HAL is only used by recovery. Recovery is owned by OEM. Framework
71 // does not depend on this HAL, hence it is not declared in any manifests or matrices.
72 "android.hardware.fastboot@1.0",
josephjang72c410d2020-09-24 09:51:08 +080073 "android.hardware.fastboot@1.1",
Sandeep Dhavale7bc10fb2022-10-04 21:44:18 +000074 // Fastboot AIDL
75 "android.hardware.fastboot",
Yifan Hong6777f8a2020-10-20 19:28:34 +000076
77 // Deprecated HALs.
78 // HIDL
79 // TODO(b/171260360) Remove when HAL definition is removed
80 "android.hardware.audio.effect@2.0",
81 "android.hardware.audio@2.0",
Yifan Hong01eb4072021-01-29 17:57:41 -080082 // Health 1.0 HAL is deprecated. The top level interface are deleted.
Yifan Hong6777f8a2020-10-20 19:28:34 +000083 "android.hardware.health@1.0",
84 // TODO(b/171260670) Remove when HAL definition is removed
85 "android.hardware.nfc@1.0",
86 // TODO(b/171260715) Remove when HAL definition is removed
87 "android.hardware.radio.deprecated@1.0",
Yifan Hong909db8a2023-01-27 16:43:26 -080088
89 // TODO(b/205175891): File individual bugs for these HALs deprecated in P
90 "android.hardware.audio.effect@4.0",
91 "android.hardware.audio@4.0",
92 "android.hardware.bluetooth.a2dp@1.0",
93 "android.hardware.cas@1.0",
94 "android.hardware.configstore@1.0",
95 "android.hardware.gnss@1.0",
96 "android.hardware.gnss@1.1",
97 "android.hardware.graphics.mapper@2.0",
98 "android.hardware.nfc@1.1",
99 "android.hardware.radio.config@1.0",
100 "android.hardware.radio@1.0",
101 "android.hardware.radio@1.1",
102 "android.hardware.radio@1.3",
103 "android.hardware.thermal@1.0",
104 "android.hardware.thermal@1.1",
105 "android.hardware.wifi.offload@1.0",
Yifan Hong4c00d8e2020-09-10 18:40:14 -0700106 };
107
108 auto package_has_prefix = [&](const std::string& prefix) {
109 return android::base::StartsWith(package, prefix);
110 };
111
112 // Only check packageAndVersions that are in the include list and not in the exclude list.
113 if (!std::any_of(included_prefixes.begin(), included_prefixes.end(), package_has_prefix)) {
114 return false;
115 }
116
117 if (std::find(excluded_exact.begin(), excluded_exact.end(), package) != excluded_exact.end()) {
118 return false;
119 }
120
121 return !std::any_of(excluded_prefixes.begin(), excluded_prefixes.end(), package_has_prefix);
122}
123
124} // namespace android::vintf::details