Merge "Add libvintf_fcm_exclude" am: a35d1c374b
am: 1d782f0e45
am: 2dab8b824b
am: 2bf11d501c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1424937 Change-Id: Ib7f394760a56126c6fc5ecd60fc4b1d35ba4a1ff
This commit is contained in:
commit
59236470dc
3 changed files with 141 additions and 0 deletions
30
compatibility_matrices/exclude/Android.bp
Normal file
30
compatibility_matrices/exclude/Android.bp
Normal file
|
@ -0,0 +1,30 @@
|
|||
// 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.
|
||||
|
||||
cc_library_host_static {
|
||||
name: "libvintf_fcm_exclude",
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
],
|
||||
static_libs: [
|
||||
"libbase",
|
||||
],
|
||||
export_include_dirs: [
|
||||
"include",
|
||||
],
|
||||
srcs: [
|
||||
"fcm_exclude.cpp",
|
||||
],
|
||||
}
|
81
compatibility_matrices/exclude/fcm_exclude.cpp
Normal file
81
compatibility_matrices/exclude/fcm_exclude.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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{
|
||||
// TODO(b/110261831): reduce items in this list
|
||||
"android.hardware.gnss.measurement_corrections@",
|
||||
"android.hardware.graphics.bufferqueue@",
|
||||
|
||||
// Exempted.
|
||||
"android.hardware.camera.device@",
|
||||
"android.hardware.tests.",
|
||||
};
|
||||
|
||||
static std::vector<std::string> excluded_exact{
|
||||
// TODO(b/110261831): reduce items in this list
|
||||
"android.hardware.audio@7.0",
|
||||
"android.hardware.audio.effect@7.0",
|
||||
"android.hardware.biometrics.fingerprint@2.3",
|
||||
"android.hardware.cas.native@1.0",
|
||||
"android.hardware.fastboot@1.0",
|
||||
"android.hardware.gnss.visibility_control@1.0",
|
||||
"android.hardware.media.bufferpool@1.0",
|
||||
"android.hardware.media.bufferpool@2.0",
|
||||
"android.hardware.radio.config@1.2",
|
||||
"android.hardware.tv.cec@2.0",
|
||||
"android.hardware.tv.tuner@1.0",
|
||||
"android.hardware.keymaster",
|
||||
|
||||
// Exempted
|
||||
"android.hardware.common",
|
||||
"android.hardware.graphics.common",
|
||||
};
|
||||
|
||||
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
|
30
compatibility_matrices/exclude/include/vintf/fcm_exclude.h
Normal file
30
compatibility_matrices/exclude/include/vintf/fcm_exclude.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace android::vintf::details {
|
||||
|
||||
// Determine whether VINTF checks |package| is missing from FCMs.
|
||||
// |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);
|
||||
|
||||
} // namespace android::vintf::details
|
Loading…
Reference in a new issue