diff options
900 files changed, 13543 insertions, 1917 deletions
diff --git a/Android.bp b/Android.bp index 00ba1e24c5..815e7662e6 100644 --- a/Android.bp +++ b/Android.bp @@ -1,3 +1,33 @@ +package { + default_applicable_licenses: ["hardware_interfaces_license"], +} + +// Added automatically by a large-scale-change that took the approach of +// 'apply every license found to every target'. While this makes sure we respect +// every license restriction, it may not be entirely correct. +// +// e.g. GPL in an MIT project might only apply to the contrib/ directory. +// +// Please consider splitting the single license below into multiple licenses, +// taking care not to lose any license_kind information, and overriding the +// default license using the 'licenses: [...]' property on targets as needed. +// +// For unused files, consider creating a 'fileGroup' with "//visibility:private" +// to attach the license to, and including a comment whether the files may be +// used in the current project. +// See: http://go/android-license-faq +license { + name: "hardware_interfaces_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + "SPDX-license-identifier-NCSA", + ], + license_text: [ + "NOTICE", + ], +} + hidl_package_root { name: "android.hardware", use_current: true, diff --git a/atrace/1.0/Android.bp b/atrace/1.0/Android.bp index 5290a9a486..69d25f4e21 100644 --- a/atrace/1.0/Android.bp +++ b/atrace/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.atrace@1.0", root: "android.hardware", diff --git a/atrace/1.0/default/Android.bp b/atrace/1.0/default/Android.bp index 4bbbdb3471..766ef361b7 100644 --- a/atrace/1.0/default/Android.bp +++ b/atrace/1.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.atrace@1.0-service", defaults: ["hidl_defaults"], diff --git a/atrace/1.0/vts/functional/Android.bp b/atrace/1.0/vts/functional/Android.bp index 07d3f7fedf..9681aa27ae 100644 --- a/atrace/1.0/vts/functional/Android.bp +++ b/atrace/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalAtraceV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp index 35f6803e30..268935516a 100644 --- a/audio/2.0/Android.bp +++ b/audio/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio@2.0", root: "android.hardware", diff --git a/audio/2.0/config/Android.bp b/audio/2.0/config/Android.bp index 65a32eb11d..3844b2b046 100644 --- a/audio/2.0/config/Android.bp +++ b/audio/2.0/config/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + filegroup { name: "audio_policy_configuration_V2_0", srcs: ["audio_policy_configuration.xsd"], diff --git a/audio/4.0/Android.bp b/audio/4.0/Android.bp index 4957a1470f..1a05d416b8 100644 --- a/audio/4.0/Android.bp +++ b/audio/4.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio@4.0", root: "android.hardware", diff --git a/audio/4.0/config/Android.bp b/audio/4.0/config/Android.bp index 6aac8999f4..5b559b1605 100644 --- a/audio/4.0/config/Android.bp +++ b/audio/4.0/config/Android.bp @@ -1,7 +1,15 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_policy_configuration_V4_0", srcs: ["audio_policy_configuration.xsd"], package_name: "audio.policy.configuration.V4_0", } - diff --git a/audio/5.0/Android.bp b/audio/5.0/Android.bp index 365a654610..525b0b9544 100644 --- a/audio/5.0/Android.bp +++ b/audio/5.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio@5.0", root: "android.hardware", diff --git a/audio/5.0/config/Android.bp b/audio/5.0/config/Android.bp index a3f1c33f4e..95354bd1b2 100644 --- a/audio/5.0/config/Android.bp +++ b/audio/5.0/config/Android.bp @@ -1,7 +1,15 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_policy_configuration_V5_0", srcs: ["audio_policy_configuration.xsd"], package_name: "audio.policy.configuration.V5_0", } - diff --git a/audio/6.0/Android.bp b/audio/6.0/Android.bp index d7880b631d..09705e69c6 100644 --- a/audio/6.0/Android.bp +++ b/audio/6.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio@6.0", root: "android.hardware", diff --git a/audio/6.0/config/Android.bp b/audio/6.0/config/Android.bp index 182dfcc9b5..c8ca19e5dd 100644 --- a/audio/6.0/config/Android.bp +++ b/audio/6.0/config/Android.bp @@ -1,7 +1,15 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_policy_configuration_V6_0", srcs: ["audio_policy_configuration.xsd"], package_name: "audio.policy.configuration.V6_0", } - diff --git a/audio/7.0/Android.bp b/audio/7.0/Android.bp index d07ce1284a..5533df3d7b 100644 --- a/audio/7.0/Android.bp +++ b/audio/7.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio@7.0", root: "android.hardware", diff --git a/audio/7.0/IStreamOutEventCallback.hal b/audio/7.0/IStreamOutEventCallback.hal index 4de767f737..8ef0060eeb 100644 --- a/audio/7.0/IStreamOutEventCallback.hal +++ b/audio/7.0/IStreamOutEventCallback.hal @@ -51,6 +51,25 @@ interface IStreamOutEventCallback { * "has-atmos", int32 * "audio-encoding", int32 * + * S (audio HAL 7.0) in addition adds the following keys: + * "presentation-id", int32 + * "program-id", int32 + * "presentation-content-classifier", int32 + * presentation-content-classifier key values can be referenced from + * frameworks/base/media/java/android/media/AudioPresentation.java + * i.e AudioPresentation.ContentClassifier + * It can contain any of the below values + * CONTENT_UNKNOWN = -1, + * CONTENT_MAIN = 0, + * CONTENT_MUSIC_AND_EFFECTS = 1, + * CONTENT_VISUALLY_IMPAIRED = 2, + * CONTENT_HEARING_IMPAIRED = 3, + * CONTENT_DIALOG = 4, + * CONTENT_COMMENTARY = 5, + * CONTENT_EMERGENCY = 6, + * CONTENT_VOICEOVER = 7 + * "presentation-language", string // represents ISO 639-2 (three letter code) + * * Parceling Format: * All values are native endian order. [1] * diff --git a/audio/7.0/config/Android.bp b/audio/7.0/config/Android.bp index f67cc7cb49..096ab6aec7 100644 --- a/audio/7.0/config/Android.bp +++ b/audio/7.0/config/Android.bp @@ -1,6 +1,31 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_policy_configuration_V7_0", srcs: ["audio_policy_configuration.xsd"], package_name: "android.audio.policy.configuration.V7_0", nullability: true, } + +xsd_config { + name: "audio_policy_configuration_V7_0_enums", + srcs: ["audio_policy_configuration.xsd"], + package_name: "android.audio.policy.configuration.V7_0", + nullability: true, + enums_only: true, +} + +xsd_config { + name: "audio_policy_configuration_V7_0_parser", + srcs: ["audio_policy_configuration.xsd"], + package_name: "android.audio.policy.configuration.V7_0", + nullability: true, + parser_only: true, +} diff --git a/audio/7.0/config/audio_policy_configuration.xsd b/audio/7.0/config/audio_policy_configuration.xsd index 31ec64bcf1..ee51aa88c5 100644 --- a/audio/7.0/config/audio_policy_configuration.xsd +++ b/audio/7.0/config/audio_policy_configuration.xsd @@ -311,13 +311,17 @@ </xs:restriction> </xs:simpleType> <xs:simpleType name="vendorExtension"> - <!-- Vendor extension names must be prefixed by "VX_" to distinguish them from AOSP values. - Vendor are encouraged to namespace their module names to avoid conflicts. - Example for an hypothetical Google virtual reality device: - <devicePort tagName="VR" type="VX_GOOGLE_VR" role="sink"> + <!-- Vendor extension names must be prefixed by "VX_" to distinguish them from + AOSP values. Vendors must namespace their names to avoid conflicts. The + namespace part must only use capital latin characters and decimal digits and + consist of at least 3 characters. The part of the extension name after the + namespace may in addition include underscores. Example for a hypothetical + Google virtual reality device: + + <devicePort tagName="VR" type="VX_GOOGLE_VR" role="sink" /> --> <xs:restriction base="xs:string"> - <xs:pattern value="VX_[_a-zA-Z0-9]+"/> + <xs:pattern value="VX_[A-Z0-9]{3,}_[_A-Z0-9]+"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="extendableAudioDevice"> diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp index 56b43ffce0..f27eb9381d 100644 --- a/audio/common/2.0/Android.bp +++ b/audio/common/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.common@2.0", root: "android.hardware", diff --git a/audio/common/4.0/Android.bp b/audio/common/4.0/Android.bp index dc4bca4a92..ea88b06f3d 100644 --- a/audio/common/4.0/Android.bp +++ b/audio/common/4.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.common@4.0", root: "android.hardware", diff --git a/audio/common/5.0/Android.bp b/audio/common/5.0/Android.bp index bf265a5511..c4f3d4c8c6 100644 --- a/audio/common/5.0/Android.bp +++ b/audio/common/5.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.common@5.0", root: "android.hardware", diff --git a/audio/common/6.0/Android.bp b/audio/common/6.0/Android.bp index caeee6f75b..fc54caff83 100644 --- a/audio/common/6.0/Android.bp +++ b/audio/common/6.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.common@6.0", root: "android.hardware", diff --git a/audio/common/7.0/Android.bp b/audio/common/7.0/Android.bp index 1c016b401b..2f7665e502 100644 --- a/audio/common/7.0/Android.bp +++ b/audio/common/7.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.common@7.0", root: "android.hardware", @@ -16,15 +25,14 @@ hidl_interface { cc_library { name: "android.hardware.audio.common@7.0-enums", vendor_available: true, - generated_headers: ["audio_policy_configuration_V7_0"], - generated_sources: ["audio_policy_configuration_V7_0"], + generated_headers: ["audio_policy_configuration_V7_0_enums"], + generated_sources: ["audio_policy_configuration_V7_0_enums"], header_libs: ["libxsdc-utils"], - export_generated_headers: ["audio_policy_configuration_V7_0"], + export_generated_headers: ["audio_policy_configuration_V7_0_enums"], export_header_lib_headers: ["libxsdc-utils"], export_include_dirs: ["enums/include"], shared_libs: [ "libbase", "liblog", - "libxml2", ], } diff --git a/audio/common/7.0/enums/include/android_audio_policy_configuration_V7_0-enums.h b/audio/common/7.0/enums/include/android_audio_policy_configuration_V7_0-enums.h index b427f3a0d4..fe8eee1d53 100644 --- a/audio/common/7.0/enums/include/android_audio_policy_configuration_V7_0-enums.h +++ b/audio/common/7.0/enums/include/android_audio_policy_configuration_V7_0-enums.h @@ -14,14 +14,14 @@ * limitations under the License. */ -#ifndef ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0_ENUMS_H -#define ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0_ENUMS_H +#ifndef ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0__ENUMS_H +#define ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0__ENUMS_H #include <sys/types.h> -#include <algorithm> -#include <cctype> +#include <regex> +#include <string> -#include <android_audio_policy_configuration_V7_0.h> +#include <android_audio_policy_configuration_V7_0_enums.h> namespace android::audio::policy::configuration::V7_0 { @@ -219,11 +219,9 @@ static inline bool maybeVendorExtension(const std::string& s) { } static inline bool isVendorExtension(const std::string& s) { - // Must match the "vendorExtension" rule from the XSD file. - static const std::string vendorPrefix = "VX_"; - return maybeVendorExtension(s) && - std::all_of(s.begin() + vendorPrefix.size(), s.end(), - [](unsigned char c) { return c == '_' || std::isalnum(c); }); + // Must be the same as the "vendorExtension" rule from the XSD file. + static const std::regex vendorExtension("VX_[A-Z0-9]{3,}_[_A-Z0-9]+"); + return std::regex_match(s.begin(), s.end(), vendorExtension); } static inline bool isUnknownAudioChannelMask(const std::string& mask) { @@ -264,4 +262,4 @@ static inline bool isUnknownAudioUsage(const std::string& usage) { } // namespace android::audio::policy::configuration::V7_0 -#endif // ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0_ENUMS_H +#endif // ANDROID_AUDIO_POLICY_CONFIGURATION_V7_0__ENUMS_H diff --git a/audio/common/7.0/example/Android.bp b/audio/common/7.0/example/Android.bp index 03c1cd89cd..a85e4faae8 100644 --- a/audio/common/7.0/example/Android.bp +++ b/audio/common/7.0/example/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.audio@7.0-service.example", vendor: true, @@ -35,7 +44,6 @@ cc_binary { "libcutils", "libhidlbase", "liblog", - "libxml2", "libutils", "android.hardware.audio@7.0", "android.hardware.audio.common@7.0", diff --git a/audio/common/7.0/example/Effect.cpp b/audio/common/7.0/example/Effect.cpp index 578881148a..0621669258 100644 --- a/audio/common/7.0/example/Effect.cpp +++ b/audio/common/7.0/example/Effect.cpp @@ -17,7 +17,7 @@ #define LOG_TAG "EffectsFactory7.0" #include <log/log.h> -#include <android_audio_policy_configuration_V7_0.h> +#include <android_audio_policy_configuration_V7_0-enums.h> #include "Effect.h" diff --git a/audio/common/all-versions/default/Android.bp b/audio/common/all-versions/default/Android.bp index 29a3d6f46e..8f557449f1 100644 --- a/audio/common/all-versions/default/Android.bp +++ b/audio/common/all-versions/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.audio.common-util", defaults: ["hidl_defaults"], @@ -140,7 +149,6 @@ cc_library { "android.hardware.audio.common@7.0", "android.hardware.audio.common@7.0-enums", "libbase", - "libxml2", ], cflags: [ "-DMAJOR_VERSION=7", diff --git a/audio/common/all-versions/default/service/Android.bp b/audio/common/all-versions/default/service/Android.bp index 0d304c3a00..b7b2297cf1 100644 --- a/audio/common/all-versions/default/service/Android.bp +++ b/audio/common/all-versions/default/service/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.audio.service", diff --git a/audio/common/all-versions/default/tests/hidlutils_tests.cpp b/audio/common/all-versions/default/tests/hidlutils_tests.cpp index ec6bdf38ef..e154453e2b 100644 --- a/audio/common/all-versions/default/tests/hidlutils_tests.cpp +++ b/audio/common/all-versions/default/tests/hidlutils_tests.cpp @@ -432,10 +432,16 @@ TEST(HidlUtils, ConvertDeviceType) { // The enums module is too small to have unit tests on its own. TEST(HidlUtils, VendorExtension) { EXPECT_TRUE(xsd::isVendorExtension("VX_GOOGLE_VR_42")); + EXPECT_TRUE(xsd::isVendorExtension("VX_QCM_SPK")); EXPECT_FALSE(xsd::isVendorExtension("")); EXPECT_FALSE(xsd::isVendorExtension("random string")); EXPECT_FALSE(xsd::isVendorExtension("VX_")); + EXPECT_FALSE(xsd::isVendorExtension("VX_X")); + EXPECT_FALSE(xsd::isVendorExtension("VX_X_")); + EXPECT_FALSE(xsd::isVendorExtension("VX_X_X")); + EXPECT_FALSE(xsd::isVendorExtension("VX_XX_X")); EXPECT_FALSE(xsd::isVendorExtension("VX_GOOGLE_$$")); + EXPECT_FALSE(xsd::isVendorExtension("VX_$CM_SPK")); } TEST(HidlUtils, ConvertInvalidDeviceAddress) { diff --git a/audio/common/all-versions/test/utility/Android.bp b/audio/common/all-versions/test/utility/Android.bp index b796acc73e..1602d25b2f 100644 --- a/audio/common/all-versions/test/utility/Android.bp +++ b/audio/common/all-versions/test/utility/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.audio.common.test.utility", defaults : ["hidl_defaults"], @@ -29,4 +38,3 @@ cc_library_static { static_libs: ["libgtest"], export_static_lib_headers: ["libgtest"], } - diff --git a/audio/common/all-versions/util/Android.bp b/audio/common/all-versions/util/Android.bp index 3c7e62e4e4..91de6ecbff 100644 --- a/audio/common/all-versions/util/Android.bp +++ b/audio/common/all-versions/util/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.audio.common.util@all-versions", defaults: ["hidl_defaults"], diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp index e0f089425f..27857396d2 100644 --- a/audio/core/all-versions/default/Android.bp +++ b/audio/core/all-versions/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + filegroup { name: "android.hardware.audio-impl_srcs", srcs: [ @@ -138,7 +147,6 @@ cc_library_shared { "android.hardware.audio.common@7.0-enums", "android.hardware.audio.common@7.0-util", "libbase", - "libxml2", ], cflags: [ "-DMAJOR_VERSION=7", diff --git a/audio/core/all-versions/default/TEST_MAPPING b/audio/core/all-versions/default/TEST_MAPPING index d53c97afaa..1e2944060b 100644 --- a/audio/core/all-versions/default/TEST_MAPPING +++ b/audio/core/all-versions/default/TEST_MAPPING @@ -2,6 +2,12 @@ "presubmit": [ { "name": "android.hardware.audio@7.0-util_tests" + }, + { + "name": "HalAudioV6_0GeneratorTest" + }, + { + "name": "HalAudioV7_0GeneratorTest" } ] } diff --git a/audio/core/all-versions/default/util/Android.bp b/audio/core/all-versions/default/util/Android.bp index 447184bbe7..7caf18ddfd 100644 --- a/audio/core/all-versions/default/util/Android.bp +++ b/audio/core/all-versions/default/util/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.audio-util_default", defaults: ["hidl_defaults"], @@ -95,7 +104,6 @@ cc_library { "android.hardware.audio.common@7.0-util", "android.hardware.audio@7.0", "libbase", - "libxml2", ], cflags: [ "-DMAJOR_VERSION=7", diff --git a/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp index 0ebe4c24ff..8af4c7855a 100644 --- a/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp @@ -17,105 +17,6 @@ // pull in all the <= 5.0 tests #include "5.0/AudioPrimaryHidlHalTest.cpp" -#if MAJOR_VERSION <= 6 -static std::vector<DeviceConfigParameter> generateOutputDeviceConfigParameters( - bool oneProfilePerDevice) { - std::vector<DeviceConfigParameter> result; - for (const auto& device : getDeviceParameters()) { - auto module = - getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); - for (const auto& ioProfile : module->getOutputProfiles()) { - for (const auto& profile : ioProfile->getAudioProfiles()) { - const auto& channels = profile->getChannels(); - const auto& sampleRates = profile->getSampleRates(); - auto configs = ConfigHelper::combineAudioConfig( - std::vector<audio_channel_mask_t>(channels.begin(), channels.end()), - std::vector<uint32_t>(sampleRates.begin(), sampleRates.end()), - profile->getFormat()); - auto flags = ioProfile->getFlags(); - for (auto& config : configs) { - // Some combinations of flags declared in the config file require special - // treatment. - if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { - config.offloadInfo.sampleRateHz = config.sampleRateHz; - config.offloadInfo.channelMask = config.channelMask; - config.offloadInfo.format = config.format; - config.offloadInfo.streamType = AudioStreamType::MUSIC; - config.offloadInfo.bitRatePerSecond = 320; - config.offloadInfo.durationMicroseconds = -1; - config.offloadInfo.bitWidth = 16; - config.offloadInfo.bufferSize = 256; // arbitrary value - config.offloadInfo.usage = AudioUsage::MEDIA; - result.emplace_back(device, config, - AudioOutputFlag(AudioOutputFlag::COMPRESS_OFFLOAD | - AudioOutputFlag::DIRECT)); - } else { - if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) { // ignore the flag - flags &= ~AUDIO_OUTPUT_FLAG_PRIMARY; - } - result.emplace_back(device, config, AudioOutputFlag(flags)); - } - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - } - return result; -} - -const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateOutputDeviceConfigParameters(false); - return parameters; -} - -const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateOutputDeviceConfigParameters(true); - return parameters; -} - -static std::vector<DeviceConfigParameter> generateInputDeviceConfigParameters( - bool oneProfilePerDevice) { - std::vector<DeviceConfigParameter> result; - for (const auto& device : getDeviceParameters()) { - auto module = - getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); - for (const auto& ioProfile : module->getInputProfiles()) { - for (const auto& profile : ioProfile->getAudioProfiles()) { - const auto& channels = profile->getChannels(); - const auto& sampleRates = profile->getSampleRates(); - auto configs = ConfigHelper::combineAudioConfig( - std::vector<audio_channel_mask_t>(channels.begin(), channels.end()), - std::vector<uint32_t>(sampleRates.begin(), sampleRates.end()), - profile->getFormat()); - for (const auto& config : configs) { - result.emplace_back(device, config, AudioInputFlag(ioProfile->getFlags())); - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - } - return result; -} - -const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateInputDeviceConfigParameters(false); - return parameters; -} - -const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateInputDeviceConfigParameters(true); - return parameters; -} -#endif // MAJOR_VERSION <= 6 - class SingleConfigOutputStreamTest : public OutputStreamTest {}; TEST_P(SingleConfigOutputStreamTest, CloseDeviceWithOpenedOutputStreams) { doc::test("Verify that a device can't be closed if there are output streams opened"); diff --git a/audio/core/all-versions/vts/functional/6.0/Generators.cpp b/audio/core/all-versions/vts/functional/6.0/Generators.cpp new file mode 100644 index 0000000000..6b4dbc17af --- /dev/null +++ b/audio/core/all-versions/vts/functional/6.0/Generators.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2021 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 <android-base/macros.h> + +#include "6.0/Generators.h" +#include "ConfigHelper.h" +#include "PolicyConfig.h" + +// clang-format off +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format on + +// Forward declaration for functions that are substituted +// in generator unit tests. +const PolicyConfig& getCachedPolicyConfig(); +const std::vector<DeviceParameter>& getDeviceParameters(); + +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::CPP_VERSION; + +std::vector<DeviceConfigParameter> generateOutputDeviceConfigParameters(bool oneProfilePerDevice) { + std::vector<DeviceConfigParameter> result; + for (const auto& device : getDeviceParameters()) { + auto module = + getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); + for (const auto& ioProfile : module->getOutputProfiles()) { + for (const auto& profile : ioProfile->getAudioProfiles()) { + const auto& channels = profile->getChannels(); + const auto& sampleRates = profile->getSampleRates(); + auto configs = ConfigHelper::combineAudioConfig( + std::vector<audio_channel_mask_t>(channels.begin(), channels.end()), + std::vector<uint32_t>(sampleRates.begin(), sampleRates.end()), + profile->getFormat()); + auto flags = ioProfile->getFlags(); + for (auto& config : configs) { + // Some combinations of flags declared in the config file require special + // treatment. + if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { + config.offloadInfo.sampleRateHz = config.sampleRateHz; + config.offloadInfo.channelMask = config.channelMask; + config.offloadInfo.format = config.format; + config.offloadInfo.streamType = AudioStreamType::MUSIC; + config.offloadInfo.bitRatePerSecond = 320; + config.offloadInfo.durationMicroseconds = -1; + config.offloadInfo.bitWidth = 16; + config.offloadInfo.bufferSize = 256; // arbitrary value + config.offloadInfo.usage = AudioUsage::MEDIA; + result.emplace_back(device, config, + AudioOutputFlag(AudioOutputFlag::COMPRESS_OFFLOAD | + AudioOutputFlag::DIRECT)); + } else { + if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) { // ignore the flag + flags &= ~AUDIO_OUTPUT_FLAG_PRIMARY; + } + result.emplace_back(device, config, AudioOutputFlag(flags)); + } + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + } + return result; +} + +const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateOutputDeviceConfigParameters(false); + return parameters; +} + +const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateOutputDeviceConfigParameters(true); + return parameters; +} + +std::vector<DeviceConfigParameter> generateInputDeviceConfigParameters(bool oneProfilePerDevice) { + std::vector<DeviceConfigParameter> result; + for (const auto& device : getDeviceParameters()) { + auto module = + getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); + for (const auto& ioProfile : module->getInputProfiles()) { + for (const auto& profile : ioProfile->getAudioProfiles()) { + const auto& channels = profile->getChannels(); + const auto& sampleRates = profile->getSampleRates(); + auto configs = ConfigHelper::combineAudioConfig( + std::vector<audio_channel_mask_t>(channels.begin(), channels.end()), + std::vector<uint32_t>(sampleRates.begin(), sampleRates.end()), + profile->getFormat()); + for (const auto& config : configs) { + result.emplace_back(device, config, AudioInputFlag(ioProfile->getFlags())); + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + } + return result; +} + +const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateInputDeviceConfigParameters(false); + return parameters; +} + +const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateInputDeviceConfigParameters(true); + return parameters; +} diff --git a/audio/core/all-versions/vts/functional/6.0/Generators.h b/audio/core/all-versions/vts/functional/6.0/Generators.h new file mode 100644 index 0000000000..1e87163477 --- /dev/null +++ b/audio/core/all-versions/vts/functional/6.0/Generators.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2021 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 <vector> + +#include "AudioTestDefinitions.h" + +const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters(); +const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters(); +const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters(); +const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters(); + +// For unit tests +std::vector<DeviceConfigParameter> generateOutputDeviceConfigParameters(bool oneProfilePerDevice); +std::vector<DeviceConfigParameter> generateInputDeviceConfigParameters(bool oneProfilePerDevice); diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index be1ffbbcfe..c1923f1230 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -14,277 +14,11 @@ * limitations under the License. */ +#include "Generators.h" + // pull in all the <= 6.0 tests #include "6.0/AudioPrimaryHidlHalTest.cpp" -static std::vector<AudioConfig> combineAudioConfig(std::vector<xsd::AudioChannelMask> channelMasks, - std::vector<int64_t> sampleRates, - const std::string& format) { - std::vector<AudioConfig> configs; - configs.reserve(channelMasks.size() * sampleRates.size()); - for (auto channelMask : channelMasks) { - for (auto sampleRate : sampleRates) { - AudioConfig config{}; - config.base.channelMask = toString(channelMask); - config.base.sampleRateHz = sampleRate; - config.base.format = format; - configs.push_back(config); - } - } - return configs; -} - -static std::tuple<std::vector<AudioInOutFlag>, bool> generateOutFlags( - const xsd::MixPorts::MixPort& mixPort) { - static const std::vector<AudioInOutFlag> offloadFlags = { - toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD), - toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_DIRECT)}; - std::vector<AudioInOutFlag> flags; - bool isOffload = false; - if (mixPort.hasFlags()) { - auto xsdFlags = mixPort.getFlags(); - isOffload = std::find(xsdFlags.begin(), xsdFlags.end(), - xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != - xsdFlags.end(); - if (!isOffload) { - for (auto flag : xsdFlags) { - if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) { - flags.push_back(toString(flag)); - } - } - } else { - flags = offloadFlags; - } - } - return {flags, isOffload}; -} - -static AudioOffloadInfo generateOffloadInfo(const AudioConfigBase& base) { - return AudioOffloadInfo{ - .base = base, - .streamType = toString(xsd::AudioStreamType::AUDIO_STREAM_MUSIC), - .usage = toString(xsd::AudioUsage::AUDIO_USAGE_MEDIA), - .bitRatePerSecond = 320, - .durationMicroseconds = -1, - .bitWidth = 16, - .bufferSize = 256 // arbitrary value - }; -} - -static std::vector<DeviceConfigParameter> generateOutputDeviceConfigParameters( - bool oneProfilePerDevice) { - std::vector<DeviceConfigParameter> result; - for (const auto& device : getDeviceParameters()) { - auto module = - getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); - if (!module || !module->getFirstMixPorts()) break; - for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { - if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile - auto [flags, isOffload] = generateOutFlags(mixPort); - for (const auto& profile : mixPort.getProfile()) { - auto configs = combineAudioConfig(profile.getChannelMasks(), - profile.getSamplingRates(), profile.getFormat()); - for (auto& config : configs) { - // Some combinations of flags declared in the config file require special - // treatment. - if (isOffload) { - config.offloadInfo.info(generateOffloadInfo(config.base)); - } - result.emplace_back(device, config, flags); - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - } - return result; -} - -const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateOutputDeviceConfigParameters(false); - return parameters; -} - -const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateOutputDeviceConfigParameters(true); - return parameters; -} - -const std::vector<DeviceConfigParameter>& getOutputDeviceInvalidConfigParameters( - bool generateInvalidFlags = true) { - static std::vector<DeviceConfigParameter> parameters = [&] { - std::vector<DeviceConfigParameter> result; - for (const auto& device : getDeviceParameters()) { - auto module = - getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); - if (!module || !module->getFirstMixPorts()) break; - bool hasRegularConfig = false, hasOffloadConfig = false; - for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { - if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile - auto [validFlags, isOffload] = generateOutFlags(mixPort); - if ((!isOffload && hasRegularConfig) || (isOffload && hasOffloadConfig)) continue; - for (const auto& profile : mixPort.getProfile()) { - if (!profile.hasFormat() || !profile.hasSamplingRates() || - !profile.hasChannelMasks()) - continue; - AudioConfigBase validBase = { - profile.getFormat(), - static_cast<uint32_t>(profile.getSamplingRates()[0]), - toString(profile.getChannelMasks()[0])}; - { - AudioConfig config{.base = validBase}; - config.base.channelMask = "random_string"; - if (isOffload) { - config.offloadInfo.info(generateOffloadInfo(validBase)); - } - result.emplace_back(device, config, validFlags); - } - { - AudioConfig config{.base = validBase}; - config.base.format = "random_string"; - if (isOffload) { - config.offloadInfo.info(generateOffloadInfo(validBase)); - } - result.emplace_back(device, config, validFlags); - } - if (generateInvalidFlags) { - AudioConfig config{.base = validBase}; - if (isOffload) { - config.offloadInfo.info(generateOffloadInfo(validBase)); - } - std::vector<AudioInOutFlag> flags = {"random_string", ""}; - result.emplace_back(device, config, flags); - } - if (isOffload) { - { - AudioConfig config{.base = validBase}; - config.offloadInfo.info(generateOffloadInfo(validBase)); - config.offloadInfo.info().base.channelMask = "random_string"; - } - { - AudioConfig config{.base = validBase}; - config.offloadInfo.info(generateOffloadInfo(validBase)); - config.offloadInfo.info().base.format = "random_string"; - } - { - AudioConfig config{.base = validBase}; - config.offloadInfo.info(generateOffloadInfo(validBase)); - config.offloadInfo.info().streamType = "random_string"; - } - { - AudioConfig config{.base = validBase}; - config.offloadInfo.info(generateOffloadInfo(validBase)); - config.offloadInfo.info().usage = "random_string"; - } - hasOffloadConfig = true; - } else { - hasRegularConfig = true; - } - break; - } - if (hasOffloadConfig && hasRegularConfig) break; - } - } - return result; - }(); - return parameters; -} - -static std::vector<DeviceConfigParameter> generateInputDeviceConfigParameters( - bool oneProfilePerDevice) { - std::vector<DeviceConfigParameter> result; - for (const auto& device : getDeviceParameters()) { - auto module = - getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); - if (!module || !module->getFirstMixPorts()) break; - for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { - if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile - std::vector<AudioInOutFlag> flags; - if (mixPort.hasFlags()) { - std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), - std::back_inserter(flags), [](auto flag) { return toString(flag); }); - } - for (const auto& profile : mixPort.getProfile()) { - auto configs = combineAudioConfig(profile.getChannelMasks(), - profile.getSamplingRates(), profile.getFormat()); - for (const auto& config : configs) { - result.emplace_back(device, config, flags); - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - if (oneProfilePerDevice) break; - } - } - return result; -} - -const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateInputDeviceConfigParameters(false); - return parameters; -} - -const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters() { - static std::vector<DeviceConfigParameter> parameters = - generateInputDeviceConfigParameters(true); - return parameters; -} - -const std::vector<DeviceConfigParameter>& getInputDeviceInvalidConfigParameters( - bool generateInvalidFlags = true) { - static std::vector<DeviceConfigParameter> parameters = [&] { - std::vector<DeviceConfigParameter> result; - for (const auto& device : getDeviceParameters()) { - auto module = - getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); - if (!module || !module->getFirstMixPorts()) break; - bool hasConfig = false; - for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { - if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile - std::vector<AudioInOutFlag> validFlags; - if (mixPort.hasFlags()) { - std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), - std::back_inserter(validFlags), - [](auto flag) { return toString(flag); }); - } - for (const auto& profile : mixPort.getProfile()) { - if (!profile.hasFormat() || !profile.hasSamplingRates() || - !profile.hasChannelMasks()) - continue; - AudioConfigBase validBase = { - profile.getFormat(), - static_cast<uint32_t>(profile.getSamplingRates()[0]), - toString(profile.getChannelMasks()[0])}; - { - AudioConfig config{.base = validBase}; - config.base.channelMask = "random_string"; - result.emplace_back(device, config, validFlags); - } - { - AudioConfig config{.base = validBase}; - config.base.format = "random_string"; - result.emplace_back(device, config, validFlags); - } - if (generateInvalidFlags) { - AudioConfig config{.base = validBase}; - std::vector<AudioInOutFlag> flags = {"random_string", ""}; - result.emplace_back(device, config, flags); - } - hasConfig = true; - break; - } - if (hasConfig) break; - } - } - return result; - }(); - return parameters; -} - class InvalidInputConfigNoFlagsTest : public AudioHidlTestWithDeviceConfigParameter {}; TEST_P(InvalidInputConfigNoFlagsTest, InputBufferSizeTest) { doc::test("Verify that invalid config is rejected by IDevice::getInputBufferSize method."); diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.cpp b/audio/core/all-versions/vts/functional/7.0/Generators.cpp new file mode 100644 index 0000000000..eafc813cf9 --- /dev/null +++ b/audio/core/all-versions/vts/functional/7.0/Generators.cpp @@ -0,0 +1,309 @@ +/* + * Copyright (C) 2021 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 <android-base/macros.h> + +#include "7.0/Generators.h" +#include "7.0/PolicyConfig.h" + +// clang-format off +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format on + +#include <android_audio_policy_configuration_V7_0-enums.h> +#include <android_audio_policy_configuration_V7_0.h> + +// Forward declaration for functions that are substituted +// in generator unit tests. +const PolicyConfig& getCachedPolicyConfig(); +const std::vector<DeviceParameter>& getDeviceParameters(); + +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::CPP_VERSION; +namespace xsd { +using namespace ::android::audio::policy::configuration::CPP_VERSION; +} + +static std::vector<AudioConfig> combineAudioConfig(std::vector<xsd::AudioChannelMask> channelMasks, + std::vector<int64_t> sampleRates, + const std::string& format) { + std::vector<AudioConfig> configs; + configs.reserve(channelMasks.size() * sampleRates.size()); + for (auto channelMask : channelMasks) { + for (auto sampleRate : sampleRates) { + AudioConfig config{}; + config.base.channelMask = toString(channelMask); + config.base.sampleRateHz = sampleRate; + config.base.format = format; + configs.push_back(config); + } + } + return configs; +} + +static std::tuple<std::vector<AudioInOutFlag>, bool> generateOutFlags( + const xsd::MixPorts::MixPort& mixPort) { + static const std::vector<AudioInOutFlag> offloadFlags = { + toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD), + toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_DIRECT)}; + std::vector<AudioInOutFlag> flags; + bool isOffload = false; + if (mixPort.hasFlags()) { + auto xsdFlags = mixPort.getFlags(); + isOffload = std::find(xsdFlags.begin(), xsdFlags.end(), + xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != + xsdFlags.end(); + if (!isOffload) { + for (auto flag : xsdFlags) { + if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) { + flags.push_back(toString(flag)); + } + } + } else { + flags = offloadFlags; + } + } + return {flags, isOffload}; +} + +static AudioOffloadInfo generateOffloadInfo(const AudioConfigBase& base) { + return AudioOffloadInfo{ + .base = base, + .streamType = toString(xsd::AudioStreamType::AUDIO_STREAM_MUSIC), + .usage = toString(xsd::AudioUsage::AUDIO_USAGE_MEDIA), + .bitRatePerSecond = 320, + .durationMicroseconds = -1, + .bitWidth = 16, + .bufferSize = 256 // arbitrary value + }; +} + +std::vector<DeviceConfigParameter> generateOutputDeviceConfigParameters(bool oneProfilePerDevice) { + std::vector<DeviceConfigParameter> result; + for (const auto& device : getDeviceParameters()) { + auto module = + getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); + if (!module || !module->getFirstMixPorts()) break; + for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { + if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile + auto [flags, isOffload] = generateOutFlags(mixPort); + for (const auto& profile : mixPort.getProfile()) { + auto configs = combineAudioConfig(profile.getChannelMasks(), + profile.getSamplingRates(), profile.getFormat()); + for (auto& config : configs) { + // Some combinations of flags declared in the config file require special + // treatment. + if (isOffload) { + config.offloadInfo.info(generateOffloadInfo(config.base)); + } + result.emplace_back(device, config, flags); + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + } + return result; +} + +const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateOutputDeviceConfigParameters(false); + return parameters; +} + +const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateOutputDeviceConfigParameters(true); + return parameters; +} + +const std::vector<DeviceConfigParameter>& getOutputDeviceInvalidConfigParameters( + bool generateInvalidFlags) { + static std::vector<DeviceConfigParameter> parameters = [&] { + std::vector<DeviceConfigParameter> result; + for (const auto& device : getDeviceParameters()) { + auto module = + getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); + if (!module || !module->getFirstMixPorts()) break; + bool hasRegularConfig = false, hasOffloadConfig = false; + for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { + if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile + auto [validFlags, isOffload] = generateOutFlags(mixPort); + if ((!isOffload && hasRegularConfig) || (isOffload && hasOffloadConfig)) continue; + for (const auto& profile : mixPort.getProfile()) { + if (!profile.hasFormat() || !profile.hasSamplingRates() || + !profile.hasChannelMasks()) + continue; + AudioConfigBase validBase = { + profile.getFormat(), + static_cast<uint32_t>(profile.getSamplingRates()[0]), + toString(profile.getChannelMasks()[0])}; + { + AudioConfig config{.base = validBase}; + config.base.channelMask = "random_string"; + if (isOffload) { + config.offloadInfo.info(generateOffloadInfo(validBase)); + } + result.emplace_back(device, config, validFlags); + } + { + AudioConfig config{.base = validBase}; + config.base.format = "random_string"; + if (isOffload) { + config.offloadInfo.info(generateOffloadInfo(validBase)); + } + result.emplace_back(device, config, validFlags); + } + if (generateInvalidFlags) { + AudioConfig config{.base = validBase}; + if (isOffload) { + config.offloadInfo.info(generateOffloadInfo(validBase)); + } + std::vector<AudioInOutFlag> flags = {"random_string", ""}; + result.emplace_back(device, config, flags); + } + if (isOffload) { + { + AudioConfig config{.base = validBase}; + config.offloadInfo.info(generateOffloadInfo(validBase)); + config.offloadInfo.info().base.channelMask = "random_string"; + result.emplace_back(device, config, validFlags); + } + { + AudioConfig config{.base = validBase}; + config.offloadInfo.info(generateOffloadInfo(validBase)); + config.offloadInfo.info().base.format = "random_string"; + result.emplace_back(device, config, validFlags); + } + { + AudioConfig config{.base = validBase}; + config.offloadInfo.info(generateOffloadInfo(validBase)); + config.offloadInfo.info().streamType = "random_string"; + result.emplace_back(device, config, validFlags); + } + { + AudioConfig config{.base = validBase}; + config.offloadInfo.info(generateOffloadInfo(validBase)); + config.offloadInfo.info().usage = "random_string"; + result.emplace_back(device, config, validFlags); + } + hasOffloadConfig = true; + } else { + hasRegularConfig = true; + } + break; + } + if (hasOffloadConfig && hasRegularConfig) break; + } + } + return result; + }(); + return parameters; +} + +std::vector<DeviceConfigParameter> generateInputDeviceConfigParameters(bool oneProfilePerDevice) { + std::vector<DeviceConfigParameter> result; + for (const auto& device : getDeviceParameters()) { + auto module = + getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); + if (!module || !module->getFirstMixPorts()) break; + for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { + if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile + std::vector<AudioInOutFlag> flags; + if (mixPort.hasFlags()) { + std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), + std::back_inserter(flags), [](auto flag) { return toString(flag); }); + } + for (const auto& profile : mixPort.getProfile()) { + auto configs = combineAudioConfig(profile.getChannelMasks(), + profile.getSamplingRates(), profile.getFormat()); + for (const auto& config : configs) { + result.emplace_back(device, config, flags); + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + if (oneProfilePerDevice) break; + } + } + return result; +} + +const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateInputDeviceConfigParameters(false); + return parameters; +} + +const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters() { + static std::vector<DeviceConfigParameter> parameters = + generateInputDeviceConfigParameters(true); + return parameters; +} + +const std::vector<DeviceConfigParameter>& getInputDeviceInvalidConfigParameters( + bool generateInvalidFlags) { + static std::vector<DeviceConfigParameter> parameters = [&] { + std::vector<DeviceConfigParameter> result; + for (const auto& device : getDeviceParameters()) { + auto module = + getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device)); + if (!module || !module->getFirstMixPorts()) break; + bool hasConfig = false; + for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { + if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile + std::vector<AudioInOutFlag> validFlags; + if (mixPort.hasFlags()) { + std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), + std::back_inserter(validFlags), + [](auto flag) { return toString(flag); }); + } + for (const auto& profile : mixPort.getProfile()) { + if (!profile.hasFormat() || !profile.hasSamplingRates() || + !profile.hasChannelMasks()) + continue; + AudioConfigBase validBase = { + profile.getFormat(), + static_cast<uint32_t>(profile.getSamplingRates()[0]), + toString(profile.getChannelMasks()[0])}; + { + AudioConfig config{.base = validBase}; + config.base.channelMask = "random_string"; + result.emplace_back(device, config, validFlags); + } + { + AudioConfig config{.base = validBase}; + config.base.format = "random_string"; + result.emplace_back(device, config, validFlags); + } + if (generateInvalidFlags) { + AudioConfig config{.base = validBase}; + std::vector<AudioInOutFlag> flags = {"random_string", ""}; + result.emplace_back(device, config, flags); + } + hasConfig = true; + break; + } + if (hasConfig) break; + } + } + return result; + }(); + return parameters; +} diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.h b/audio/core/all-versions/vts/functional/7.0/Generators.h new file mode 100644 index 0000000000..e36cfad31b --- /dev/null +++ b/audio/core/all-versions/vts/functional/7.0/Generators.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2021 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 <vector> + +#include "AudioTestDefinitions.h" + +const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters(); +const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters(); +const std::vector<DeviceConfigParameter>& getOutputDeviceInvalidConfigParameters( + bool generateInvalidFlags = true); +const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters(); +const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters(); +const std::vector<DeviceConfigParameter>& getInputDeviceInvalidConfigParameters( + bool generateInvalidFlags = true); + +// For unit tests +std::vector<DeviceConfigParameter> generateOutputDeviceConfigParameters(bool oneProfilePerDevice); +std::vector<DeviceConfigParameter> generateInputDeviceConfigParameters(bool oneProfilePerDevice); diff --git a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h index 7d8864284c..feb4d4b3aa 100644 --- a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h +++ b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h @@ -16,11 +16,35 @@ #pragma once -// Note: it is assumed that this file is included from AudioPrimaryHidlTest.h -// and thus it doesn't have all '#include' and 'using' directives required -// for a standalone compilation. +#include <fcntl.h> +#include <unistd.h> +#include <optional> +#include <set> +#include <string> + +#include <gtest/gtest.h> +#include <system/audio_config.h> +#include <utils/Errors.h> + +// clang-format off +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format on + +#include <android_audio_policy_configuration_V7_0-enums.h> +#include <android_audio_policy_configuration_V7_0.h> + +#include "DeviceManager.h" + +using ::android::NO_INIT; +using ::android::OK; +using ::android::status_t; + +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::CPP_VERSION; namespace xsd { +using namespace ::android::audio::policy::configuration::CPP_VERSION; using Module = Modules::Module; } @@ -30,20 +54,13 @@ class PolicyConfig { : mConfigFileName{configFileName}, mFilePath{findExistingConfigurationFile(mConfigFileName)}, mConfig{xsd::read(mFilePath.c_str())} { - if (mConfig) { - mStatus = OK; - mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); - if (mConfig->getFirstModules()) { - for (const auto& module : mConfig->getFirstModules()->get_module()) { - if (module.getFirstAttachedDevices()) { - auto attachedDevices = module.getFirstAttachedDevices()->getItem(); - if (!attachedDevices.empty()) { - mModulesWithDevicesNames.insert(module.getName()); - } - } - } - } - } + init(); + } + PolicyConfig(const std::string& configPath, const std::string& configFileName) + : mConfigFileName{configFileName}, + mFilePath{configPath + "/" + mConfigFileName}, + mConfig{xsd::read(mFilePath.c_str())} { + init(); } status_t getStatus() const { return mStatus; } std::string getError() const { @@ -87,6 +104,22 @@ class PolicyConfig { } return std::string{}; } + void init() { + if (mConfig) { + mStatus = OK; + mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); + if (mConfig->getFirstModules()) { + for (const auto& module : mConfig->getFirstModules()->get_module()) { + if (module.getFirstAttachedDevices()) { + auto attachedDevices = module.getFirstAttachedDevices()->getItem(); + if (!attachedDevices.empty()) { + mModulesWithDevicesNames.insert(module.getName()); + } + } + } + } + } + } const std::string mConfigFileName; const std::string mFilePath; diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index e8b704ca22..926a791ba8 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "VtsHalAudioTargetTest_defaults", defaults: ["VtsHalTargetTestDefaults"], @@ -119,6 +128,7 @@ cc_test { defaults: ["VtsHalAudioTargetTest_defaults"], srcs: [ "6.0/AudioPrimaryHidlHalTest.cpp", + "6.0/Generators.cpp", ], static_libs: [ "libaudiofoundation", @@ -145,7 +155,10 @@ cc_test { defaults: ["VtsHalAudioTargetTest_defaults"], srcs: [ "7.0/AudioPrimaryHidlHalTest.cpp", + "7.0/Generators.cpp", ], + generated_headers: ["audio_policy_configuration_V7_0_parser"], + generated_sources: ["audio_policy_configuration_V7_0_parser"], static_libs: [ "android.hardware.audio@7.0", "android.hardware.audio.common@7.0", @@ -163,3 +176,57 @@ cc_test { // TODO(b/146104851): Add auto-gen rules and remove it. test_config: "VtsHalAudioV7_0TargetTest.xml", } + +// Note: the following aren't VTS tests, but rather unit tests +// to verify correctness of test parameter generator utilities. +cc_test { + name: "HalAudioV6_0GeneratorTest", + defaults: ["VtsHalAudioTargetTest_defaults"], + srcs: [ + "6.0/Generators.cpp", + "tests/generators_tests.cpp", + ], + static_libs: [ + "android.hardware.audio@6.0", + "android.hardware.audio.common@6.0", + "libaudiofoundation", + "libaudiopolicycomponents", + "libmedia_helper", + ], + cflags: [ + "-DMAJOR_VERSION=6", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ], + data: [ + "tests/apm_config_no_vx.xml", + "tests/apm_config_with_vx.xml", + ], + test_config: "tests/HalAudioV6_0GeneratorTest.xml", +} + +cc_test { + name: "HalAudioV7_0GeneratorTest", + defaults: ["VtsHalAudioTargetTest_defaults"], + srcs: [ + "7.0/Generators.cpp", + "tests/generators_tests.cpp", + ], + generated_headers: ["audio_policy_configuration_V7_0_parser"], + generated_sources: ["audio_policy_configuration_V7_0_parser"], + static_libs: [ + "android.hardware.audio@7.0", + "android.hardware.audio.common@7.0", + "android.hardware.audio.common@7.0-enums", + ], + cflags: [ + "-DMAJOR_VERSION=7", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ], + data: [ + "tests/apm_config_no_vx_7_0.xml", + "tests/apm_config_with_vx_7_0.xml", + ], + test_config: "tests/HalAudioV7_0GeneratorTest.xml", +} diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 61e99e8699..56939fe6e6 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -59,6 +59,7 @@ #include "utility/ReturnIn.h" #include "utility/ValidateXml.h" +#include "AudioTestDefinitions.h" /** Provide version specific functions that are used in the generic tests */ #if MAJOR_VERSION == 2 #include "2.0/AudioPrimaryHidlHalUtils.h" @@ -107,7 +108,11 @@ static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUP #include "DeviceManager.h" #if MAJOR_VERSION <= 6 #include "PolicyConfig.h" +#if MAJOR_VERSION == 6 +#include "6.0/Generators.h" +#endif #elif MAJOR_VERSION >= 7 +#include "7.0/Generators.h" #include "7.0/PolicyConfig.h" #endif @@ -175,9 +180,6 @@ TEST(CheckConfig, audioPolicyConfigurationValidation) { //////////////////// Test parameter types and definitions //////////////////// ////////////////////////////////////////////////////////////////////////////// -enum { PARAM_FACTORY_NAME, PARAM_DEVICE_NAME }; -using DeviceParameter = std::tuple<std::string, std::string>; - static inline std::string DeviceParameterToString( const ::testing::TestParamInfo<DeviceParameter>& info) { const auto& deviceName = std::get<PARAM_DEVICE_NAME>(info.param); @@ -509,24 +511,6 @@ INSTANTIATE_TEST_CASE_P(AudioPatchHidl, AudioPatchHidlTest, // list is empty, this isn't a problem. GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioPatchHidlTest); -// Nesting a tuple in another tuple allows to use GTest Combine function to generate -// all combinations of devices and configs. -enum { PARAM_DEVICE, PARAM_CONFIG, PARAM_FLAGS }; -#if MAJOR_VERSION <= 6 -enum { INDEX_INPUT, INDEX_OUTPUT }; -using DeviceConfigParameter = - std::tuple<DeviceParameter, AudioConfig, std::variant<AudioInputFlag, AudioOutputFlag>>; -#elif MAJOR_VERSION >= 7 -using DeviceConfigParameter = std::tuple<DeviceParameter, AudioConfig, std::vector<AudioInOutFlag>>; -#endif - -#if MAJOR_VERSION >= 6 -const std::vector<DeviceConfigParameter>& getInputDeviceConfigParameters(); -const std::vector<DeviceConfigParameter>& getInputDeviceSingleConfigParameters(); -const std::vector<DeviceConfigParameter>& getOutputDeviceConfigParameters(); -const std::vector<DeviceConfigParameter>& getOutputDeviceSingleConfigParameters(); -#endif - #if MAJOR_VERSION >= 4 static std::string SanitizeStringForGTestName(const std::string& s) { std::string result = s; diff --git a/audio/core/all-versions/vts/functional/AudioTestDefinitions.h b/audio/core/all-versions/vts/functional/AudioTestDefinitions.h new file mode 100644 index 0000000000..5b14a216c9 --- /dev/null +++ b/audio/core/all-versions/vts/functional/AudioTestDefinitions.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 <tuple> +#include <variant> +#include <vector> + +// clang-format off +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format on + +enum { PARAM_FACTORY_NAME, PARAM_DEVICE_NAME }; +using DeviceParameter = std::tuple<std::string, std::string>; + +// Nesting a tuple in another tuple allows to use GTest Combine function to generate +// all combinations of devices and configs. +enum { PARAM_DEVICE, PARAM_CONFIG, PARAM_FLAGS }; +#if MAJOR_VERSION <= 6 +enum { INDEX_INPUT, INDEX_OUTPUT }; +using DeviceConfigParameter = + std::tuple<DeviceParameter, android::hardware::audio::common::CPP_VERSION::AudioConfig, + std::variant<android::hardware::audio::common::CPP_VERSION::AudioInputFlag, + android::hardware::audio::common::CPP_VERSION::AudioOutputFlag>>; +#elif MAJOR_VERSION >= 7 +using DeviceConfigParameter = + std::tuple<DeviceParameter, android::hardware::audio::common::CPP_VERSION::AudioConfig, + std::vector<android::hardware::audio::CPP_VERSION::AudioInOutFlag>>; +#endif diff --git a/audio/core/all-versions/vts/functional/ConfigHelper.h b/audio/core/all-versions/vts/functional/ConfigHelper.h index 1a1dbea939..a2bb1eecf0 100644 --- a/audio/core/all-versions/vts/functional/ConfigHelper.h +++ b/audio/core/all-versions/vts/functional/ConfigHelper.h @@ -16,10 +16,21 @@ #pragma once -// Code in this file uses 'getCachedPolicyConfig' -#ifndef AUDIO_PRIMARY_HIDL_HAL_TEST -#error Must be included from AudioPrimaryHidlTest.h -#endif +#include <common/all-versions/VersionUtils.h> + +#include "PolicyConfig.h" + +// clang-format off +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format on + +using ::android::hardware::audio::common::utils::EnumBitfield; +using ::android::hardware::audio::common::utils::mkEnumBitfield; + +// Forward declaration for functions that are substituted +// in generator unit tests. +const PolicyConfig& getCachedPolicyConfig(); ////////////////////////////////////////////////////////////////////////////// //////////////// Required and recommended audio format support /////////////// @@ -35,7 +46,7 @@ struct ConfigHelper { // FIXME: in the next audio HAL version, test all available devices static bool primaryHasMic() { auto& policyConfig = getCachedPolicyConfig(); - if (policyConfig.getStatus() != OK || policyConfig.getPrimaryModule() == nullptr) { + if (policyConfig.getStatus() != android::OK || policyConfig.getPrimaryModule() == nullptr) { return true; // Could not get the information, run all tests } auto getMic = [](auto& devs) { diff --git a/audio/core/all-versions/vts/functional/DeviceManager.h b/audio/core/all-versions/vts/functional/DeviceManager.h index 6efed7991e..6db78a77d6 100644 --- a/audio/core/all-versions/vts/functional/DeviceManager.h +++ b/audio/core/all-versions/vts/functional/DeviceManager.h @@ -16,9 +16,27 @@ #pragma once -// Note: it is assumed that this file is included from AudioPrimaryHidlTest.h -// and thus it doesn't have all '#include' and 'using' directives required -// for a standalone compilation. +#include <unistd.h> + +#include <map> + +#include <android-base/logging.h> +#include <hwbinder/IPCThreadState.h> + +// clang-format off +#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h) +#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h) +#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h) +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format on + +#include "utility/ReturnIn.h" + +using ::android::sp; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::test::utility; +using namespace ::android::hardware::audio::CPP_VERSION; template <class Derived, class Key, class Interface> class InterfaceManager { @@ -56,7 +74,7 @@ class InterfaceManager { // the remote device has the time to be destroyed. // flushCommand makes sure all local command are sent, thus should reduce // the latency between local and remote destruction. - IPCThreadState::self()->flushCommands(); + ::android::hardware::IPCThreadState::self()->flushCommands(); usleep(100 * 1000); } diff --git a/audio/core/all-versions/vts/functional/PolicyConfig.h b/audio/core/all-versions/vts/functional/PolicyConfig.h index c9e0c0dd5a..a94041c427 100644 --- a/audio/core/all-versions/vts/functional/PolicyConfig.h +++ b/audio/core/all-versions/vts/functional/PolicyConfig.h @@ -16,11 +16,19 @@ #pragma once -// Note: it is assumed that this file is included from AudioPrimaryHidlTest.h -// and thus it doesn't have all '#include' and 'using' directives required -// for a standalone compilation. +#include <set> +#include <string> +#include <DeviceDescriptor.h> +#include <HwModule.h> #include <Serializer.h> +#include <gtest/gtest.h> +#include <system/audio_config.h> + +#include "DeviceManager.h" + +using ::android::sp; +using ::android::status_t; struct PolicyConfigData { android::HwModuleCollection hwModules; @@ -42,28 +50,14 @@ class PolicyConfig : private PolicyConfigData, public android::AudioPolicyConfig break; } } - mStatus = android::deserializeAudioPolicyFile(mFilePath.c_str(), this); - if (mStatus == OK) { - mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); - // Available devices are not 'attached' to modules at this moment. - // Need to go over available devices and find their module. - for (const auto& device : availableOutputDevices) { - for (const auto& module : hwModules) { - if (module->getDeclaredDevices().indexOf(device) >= 0) { - mModulesWithDevicesNames.insert(module->getName()); - break; - } - } - } - for (const auto& device : availableInputDevices) { - for (const auto& module : hwModules) { - if (module->getDeclaredDevices().indexOf(device) >= 0) { - mModulesWithDevicesNames.insert(module->getName()); - break; - } - } - } - } + init(); + } + PolicyConfig(const std::string& configPath, const std::string& configFileName) + : android::AudioPolicyConfig(hwModules, availableOutputDevices, availableInputDevices, + defaultOutputDevice), + mConfigFileName{configFileName}, + mFilePath{configPath + "/" + mConfigFileName} { + init(); } status_t getStatus() const { return mStatus; } std::string getError() const { @@ -88,8 +82,33 @@ class PolicyConfig : private PolicyConfigData, public android::AudioPolicyConfig } private: + void init() { + mStatus = android::deserializeAudioPolicyFileForVts(mFilePath.c_str(), this); + if (mStatus == android::OK) { + mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); + // Available devices are not 'attached' to modules at this moment. + // Need to go over available devices and find their module. + for (const auto& device : availableOutputDevices) { + for (const auto& module : hwModules) { + if (module->getDeclaredDevices().indexOf(device) >= 0) { + mModulesWithDevicesNames.insert(module->getName()); + break; + } + } + } + for (const auto& device : availableInputDevices) { + for (const auto& module : hwModules) { + if (module->getDeclaredDevices().indexOf(device) >= 0) { + mModulesWithDevicesNames.insert(module->getName()); + break; + } + } + } + } + } + const std::string mConfigFileName; - status_t mStatus = NO_INIT; + status_t mStatus = android::NO_INIT; std::string mFilePath; sp<const android::HwModule> mPrimaryModule = nullptr; std::set<std::string> mModulesWithDevicesNames; diff --git a/audio/core/all-versions/vts/functional/tests/HalAudioV6_0GeneratorTest.xml b/audio/core/all-versions/vts/functional/tests/HalAudioV6_0GeneratorTest.xml new file mode 100644 index 0000000000..0c85a05838 --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/HalAudioV6_0GeneratorTest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 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. +--> +<configuration description="Runs HalAudioV6_0GeneratorTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="apm_config_no_vx.xml->/data/local/tmp/apm_config_no_vx.xml" /> + <option name="push" value="apm_config_with_vx.xml->/data/local/tmp/apm_config_with_vx.xml" /> + <option name="push" value="HalAudioV6_0GeneratorTest->/data/local/tmp/HalAudioV6_0GeneratorTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="HalAudioV6_0GeneratorTest" /> + </test> +</configuration> diff --git a/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml b/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml new file mode 100644 index 0000000000..2e794554c8 --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 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. +--> +<configuration description="Runs HalAudioV7_0GeneratorTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="apm_config_no_vx_7_0.xml->/data/local/tmp/apm_config_no_vx.xml" /> + <option name="push" value="apm_config_with_vx_7_0.xml->/data/local/tmp/apm_config_with_vx.xml" /> + <option name="push" value="HalAudioV7_0GeneratorTest->/data/local/tmp/HalAudioV7_0GeneratorTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="HalAudioV7_0GeneratorTest" /> + </test> +</configuration> diff --git a/audio/core/all-versions/vts/functional/tests/apm_config_no_vx.xml b/audio/core/all-versions/vts/functional/tests/apm_config_no_vx.xml new file mode 100644 index 0000000000..61972b26d5 --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/apm_config_no_vx.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- Copyright (C) 2021 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. +--> + +<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude"> + <globalConfiguration speaker_drc_enabled="true"/> + <modules> + <module name="primary" halVersion="3.0"> + <attachedDevices> + <item>Speaker</item> + <item>Built-In Mic</item> + </attachedDevices> + <defaultOutputDevice>Speaker</defaultOutputDevice> + <mixPorts> + <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + </mixPort> + <mixPort name="primary input" role="sink"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + </mixPort> + </mixPorts> + <devicePorts> + <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address=""> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + <gains> + <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT" + minValueMB="-8400" + maxValueMB="4000" + defaultValueMB="0" + stepValueMB="100"/> + </gains> + </devicePort> + <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + </devicePort> + </devicePorts> + <routes> + <route type="mix" sink="Speaker" sources="primary output"/> + <route type="mix" sink="primary input" sources="Built-In Mic"/> + </routes> + </module> + </modules> + <volumes/> + <surroundSound> + <formats> + <format name="AUDIO_FORMAT_AC3" /> + <format name="AUDIO_FORMAT_AAC_LC" subformats="AUDIO_FORMAT_AAC_HE_V1 AUDIO_FORMAT_AAC_HE_V2 AUDIO_FORMAT_AAC_ELD AUDIO_FORMAT_AAC_XHE" /> + </formats> + </surroundSound> +</audioPolicyConfiguration> diff --git a/audio/core/all-versions/vts/functional/tests/apm_config_no_vx_7_0.xml b/audio/core/all-versions/vts/functional/tests/apm_config_no_vx_7_0.xml new file mode 100644 index 0000000000..abcdb1274c --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/apm_config_no_vx_7_0.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- Copyright (C) 2021 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. +--> + +<audioPolicyConfiguration version="7.0" xmlns:xi="http://www.w3.org/2001/XInclude"> + <globalConfiguration speaker_drc_enabled="true"/> + <modules> + <module name="primary" halVersion="3.0"> + <attachedDevices> + <item>Speaker</item> + <item>Built-In Mic</item> + </attachedDevices> + <defaultOutputDevice>Speaker</defaultOutputDevice> + <mixPorts> + <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + </mixPort> + <mixPort name="primary input" role="sink"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + </mixPort> + </mixPorts> + <devicePorts> + <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address=""> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + <gains> + <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT" + minValueMB="-8400" + maxValueMB="4000" + defaultValueMB="0" + stepValueMB="100"/> + </gains> + </devicePort> + <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + </devicePort> + </devicePorts> + <routes> + <route type="mix" sink="Speaker" sources="primary output"/> + <route type="mix" sink="primary input" sources="Built-In Mic"/> + </routes> + </module> + </modules> + <volumes/> + <surroundSound> + <formats> + <format name="AUDIO_FORMAT_AC3" /> + <format name="AUDIO_FORMAT_AAC_LC" subformats="AUDIO_FORMAT_AAC_HE_V1 AUDIO_FORMAT_AAC_HE_V2 AUDIO_FORMAT_AAC_ELD AUDIO_FORMAT_AAC_XHE" /> + </formats> + </surroundSound> +</audioPolicyConfiguration> diff --git a/audio/core/all-versions/vts/functional/tests/apm_config_with_vx.xml b/audio/core/all-versions/vts/functional/tests/apm_config_with_vx.xml new file mode 100644 index 0000000000..aabb52e68c --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/apm_config_with_vx.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- Copyright (C) 2021 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. +--> + +<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude"> + <globalConfiguration speaker_drc_enabled="true"/> + <modules> + <module name="primary" halVersion="3.0"> + <attachedDevices> + <item>Speaker</item> + <item>Built-In Mic</item> + </attachedDevices> + <defaultOutputDevice>Speaker</defaultOutputDevice> + <mixPorts> + <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + </mixPort> + <mixPort name="primary input" role="sink"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + <profile name="" format="VX_GOOGLE_B_FORMAT" + samplingRates="192000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + </mixPort> + </mixPorts> + <devicePorts> + <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address=""> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + <gains> + <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT" + minValueMB="-8400" + maxValueMB="4000" + defaultValueMB="0" + stepValueMB="100"/> + </gains> + </devicePort> + <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + <profile name="" format="VX_GOOGLE_B_FORMAT" + samplingRates="192000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + </devicePort> + <devicePort tagName="Ambient Mic" type="VX_GOOGLE_AUDIO_DEVICE_AMBIENT_MIC" role="source"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/> + </devicePort> + </devicePorts> + <routes> + <route type="mix" sink="Speaker" sources="primary output"/> + <route type="mix" sink="primary input" sources="Built-In Mic,Ambient Mic"/> + </routes> + </module> + </modules> + <volumes/> + <surroundSound> + <formats> + <format name="AUDIO_FORMAT_AC3" /> + <format name="AUDIO_FORMAT_AAC_LC" subformats="AUDIO_FORMAT_AAC_HE_V1 AUDIO_FORMAT_AAC_HE_V2 AUDIO_FORMAT_AAC_ELD AUDIO_FORMAT_AAC_XHE" /> + <format name="VX_GOOGLE_B_FORMAT" /> + <format name="AUDIO_FORMAT_AC4" subformats="VX_GOOGLE_B_FORMAT" /> + </formats> + </surroundSound> +</audioPolicyConfiguration> diff --git a/audio/core/all-versions/vts/functional/tests/apm_config_with_vx_7_0.xml b/audio/core/all-versions/vts/functional/tests/apm_config_with_vx_7_0.xml new file mode 100644 index 0000000000..8dd5f45db6 --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/apm_config_with_vx_7_0.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- Copyright (C) 2021 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. +--> + +<audioPolicyConfiguration version="7.0" xmlns:xi="http://www.w3.org/2001/XInclude"> + <globalConfiguration speaker_drc_enabled="true"/> + <modules> + <module name="primary" halVersion="3.0"> + <attachedDevices> + <item>Speaker</item> + <item>Built-In Mic</item> + </attachedDevices> + <defaultOutputDevice>Speaker</defaultOutputDevice> + <mixPorts> + <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + </mixPort> + <mixPort name="primary input" role="sink"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + <profile name="" format="VX_GOOGLE_B_FORMAT" + samplingRates="192000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + </mixPort> + </mixPorts> + <devicePorts> + <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address=""> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> + <gains> + <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT" + minValueMB="-8400" + maxValueMB="4000" + defaultValueMB="0" + stepValueMB="100"/> + </gains> + </devicePort> + <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + <profile name="" format="VX_GOOGLE_B_FORMAT" + samplingRates="192000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + </devicePort> + <devicePort tagName="Ambient Mic" type="VX_GOOGLE_AUDIO_DEVICE_AMBIENT_MIC" role="source"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000" + channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/> + </devicePort> + </devicePorts> + <routes> + <route type="mix" sink="Speaker" sources="primary output"/> + <route type="mix" sink="primary input" sources="Built-In Mic,Ambient Mic"/> + </routes> + </module> + </modules> + <volumes/> + <surroundSound> + <formats> + <format name="AUDIO_FORMAT_AC3" /> + <format name="AUDIO_FORMAT_AAC_LC" subformats="AUDIO_FORMAT_AAC_HE_V1 AUDIO_FORMAT_AAC_HE_V2 AUDIO_FORMAT_AAC_ELD AUDIO_FORMAT_AAC_XHE" /> + <format name="VX_GOOGLE_B_FORMAT" /> + <format name="AUDIO_FORMAT_AC4" subformats="VX_GOOGLE_B_FORMAT" /> + </formats> + </surroundSound> +</audioPolicyConfiguration> diff --git a/audio/core/all-versions/vts/functional/tests/generators_tests.cpp b/audio/core/all-versions/vts/functional/tests/generators_tests.cpp new file mode 100644 index 0000000000..583ff01fc2 --- /dev/null +++ b/audio/core/all-versions/vts/functional/tests/generators_tests.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2021 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 <memory> +#include <string> +#include <vector> + +#include <android-base/macros.h> +#include <gtest/gtest.h> +#define LOG_TAG "Generators_Test" +#include <log/log.h> + +#if MAJOR_VERSION == 6 +#include <system/audio.h> +#include "6.0/Generators.h" +#include "PolicyConfig.h" +#elif MAJOR_VERSION == 7 +#include "7.0/Generators.h" +#include "7.0/PolicyConfig.h" +#endif + +using namespace android; +using namespace ::android::hardware::audio::common::CPP_VERSION; +#if MAJOR_VERSION == 7 +namespace xsd { +using namespace ::android::audio::policy::configuration::CPP_VERSION; +} +#endif + +// Stringify the argument. +#define QUOTE(x) #x +#define STRINGIFY(x) QUOTE(x) + +struct PolicyConfigManager { + static PolicyConfigManager& getInstance() { + static PolicyConfigManager instance; + return instance; + } + bool init(const std::string& filePath, const std::string& fileName) { + mConfig = std::make_unique<PolicyConfig>(filePath, fileName); + mDeviceParameters.clear(); + if (mConfig->getStatus() == OK) { + const auto devices = mConfig->getModulesWithDevicesNames(); + mDeviceParameters.reserve(devices.size()); + for (const auto& deviceName : devices) { + mDeviceParameters.emplace_back( + "android.hardware.audio.IDevicesFactory@" STRINGIFY(FILE_VERSION), + deviceName); + } + return true; + } else { + ALOGE("%s", mConfig->getError().c_str()); + return false; + } + } + const PolicyConfig& getConfig() { return *mConfig; } + const std::vector<DeviceParameter>& getDeviceParameters() { return mDeviceParameters; } + + private: + std::unique_ptr<PolicyConfig> mConfig; + std::vector<DeviceParameter> mDeviceParameters; +}; + +// Test implementations +const PolicyConfig& getCachedPolicyConfig() { + return PolicyConfigManager::getInstance().getConfig(); +} + +const std::vector<DeviceParameter>& getDeviceParameters() { + return PolicyConfigManager::getInstance().getDeviceParameters(); +} + +static const std::string kDataDir = "/data/local/tmp"; + +class GeneratorsTest : public ::testing::TestWithParam<std::string> { + public: + static void validateConfig(const AudioConfig& config) { +#if MAJOR_VERSION == 6 + ASSERT_TRUE(audio_is_valid_format(static_cast<audio_format_t>(config.format))) + << "Audio format is invalid " << ::testing::PrintToString(config.format); + ASSERT_TRUE( + audio_channel_mask_is_valid(static_cast<audio_channel_mask_t>(config.channelMask))) + << "Audio channel mask is invalid " << ::testing::PrintToString(config.channelMask); +#elif MAJOR_VERSION == 7 + ASSERT_FALSE(xsd::isUnknownAudioFormat(config.base.format)) + << "Audio format is invalid " << ::testing::PrintToString(config.base.format); + ASSERT_FALSE(xsd::isUnknownAudioChannelMask(config.base.channelMask)) + << "Audio channel mask is invalid " + << ::testing::PrintToString(config.base.channelMask); +#endif + } + static void validateDeviceConfigs(const std::vector<DeviceConfigParameter>& params) { + for (const auto& param : params) { + ASSERT_NO_FATAL_FAILURE(validateConfig(std::get<PARAM_CONFIG>(param))); + } + } +}; + +TEST_P(GeneratorsTest, ValidateConfigs) { + ASSERT_TRUE(PolicyConfigManager::getInstance().init(kDataDir, GetParam())); + EXPECT_NE(nullptr, getCachedPolicyConfig().getPrimaryModule()); + EXPECT_FALSE(getCachedPolicyConfig().getModulesWithDevicesNames().empty()); + const auto allOutConfigs = generateOutputDeviceConfigParameters(false /*oneProfilePerDevice*/); + EXPECT_FALSE(allOutConfigs.empty()); + EXPECT_NO_FATAL_FAILURE(validateDeviceConfigs(allOutConfigs)); + const auto singleOutConfig = generateOutputDeviceConfigParameters(true /*oneProfilePerDevice*/); + EXPECT_FALSE(singleOutConfig.empty()); + EXPECT_NO_FATAL_FAILURE(validateDeviceConfigs(singleOutConfig)); + const auto allInConfigs = generateInputDeviceConfigParameters(false /*oneProfilePerDevice*/); + EXPECT_FALSE(allInConfigs.empty()); + EXPECT_NO_FATAL_FAILURE(validateDeviceConfigs(allInConfigs)); + const auto singleInConfig = generateInputDeviceConfigParameters(true /*oneProfilePerDevice*/); + EXPECT_FALSE(singleInConfig.empty()); + EXPECT_NO_FATAL_FAILURE(validateDeviceConfigs(singleInConfig)); +} + +// Target file names are the same for all versions, see 'HalAudioVx_0GeneratorTest.xml' test configs +INSTANTIATE_TEST_SUITE_P(Generators, GeneratorsTest, + ::testing::Values("apm_config_no_vx.xml", "apm_config_with_vx.xml")); diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp index a5a8b3405f..f2f512433b 100644 --- a/audio/effect/2.0/Android.bp +++ b/audio/effect/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.effect@2.0", root: "android.hardware", diff --git a/audio/effect/2.0/xml/Android.bp b/audio/effect/2.0/xml/Android.bp index 050425a1c4..d015639e5d 100644 --- a/audio/effect/2.0/xml/Android.bp +++ b/audio/effect/2.0/xml/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + genrule { name: "audio_effects_conf_V2_0", srcs: ["audio_effects_conf.xsd"], diff --git a/audio/effect/4.0/Android.bp b/audio/effect/4.0/Android.bp index 31f94ae8b8..1eb754a922 100644 --- a/audio/effect/4.0/Android.bp +++ b/audio/effect/4.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.effect@4.0", root: "android.hardware", diff --git a/audio/effect/4.0/xml/Android.bp b/audio/effect/4.0/xml/Android.bp index 27ffd0200c..8c03a35fbb 100644 --- a/audio/effect/4.0/xml/Android.bp +++ b/audio/effect/4.0/xml/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + genrule { name: "audio_effects_conf_V4_0", srcs: ["audio_effects_conf.xsd"], diff --git a/audio/effect/5.0/Android.bp b/audio/effect/5.0/Android.bp index a3081c688c..126964c9b5 100644 --- a/audio/effect/5.0/Android.bp +++ b/audio/effect/5.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.effect@5.0", root: "android.hardware", diff --git a/audio/effect/5.0/xml/Android.bp b/audio/effect/5.0/xml/Android.bp index 67b2f97947..7982e2a1a9 100644 --- a/audio/effect/5.0/xml/Android.bp +++ b/audio/effect/5.0/xml/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_effects_conf_V5_0", srcs: ["audio_effects_conf.xsd"], diff --git a/audio/effect/6.0/Android.bp b/audio/effect/6.0/Android.bp index de4bde74b1..8d15d0942f 100644 --- a/audio/effect/6.0/Android.bp +++ b/audio/effect/6.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.effect@6.0", root: "android.hardware", diff --git a/audio/effect/6.0/xml/Android.bp b/audio/effect/6.0/xml/Android.bp index 8d68672df1..f139341e94 100644 --- a/audio/effect/6.0/xml/Android.bp +++ b/audio/effect/6.0/xml/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_effects_conf_V6_0", srcs: ["audio_effects_conf.xsd"], diff --git a/audio/effect/7.0/Android.bp b/audio/effect/7.0/Android.bp index c1137827cf..7399cdbddd 100644 --- a/audio/effect/7.0/Android.bp +++ b/audio/effect/7.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.audio.effect@7.0", root: "android.hardware", diff --git a/audio/effect/7.0/xml/Android.bp b/audio/effect/7.0/xml/Android.bp index dc12e6368d..978e4341e2 100644 --- a/audio/effect/7.0/xml/Android.bp +++ b/audio/effect/7.0/xml/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_effects_conf_V7_0", srcs: ["audio_effects_conf.xsd"], diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp index 99b1120218..6df9dbf9c4 100644 --- a/audio/effect/all-versions/default/Android.bp +++ b/audio/effect/all-versions/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.audio.effect-impl_default", defaults: ["hidl_defaults"], diff --git a/audio/effect/all-versions/default/util/Android.bp b/audio/effect/all-versions/default/util/Android.bp index 5ba19d3a2d..143094d604 100644 --- a/audio/effect/all-versions/default/util/Android.bp +++ b/audio/effect/all-versions/default/util/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.audio.effect-util_default", defaults: ["hidl_defaults"], diff --git a/audio/effect/all-versions/vts/functional/Android.bp b/audio/effect/all-versions/vts/functional/Android.bp index f4a72834d5..48d6474b41 100644 --- a/audio/effect/all-versions/vts/functional/Android.bp +++ b/audio/effect/all-versions/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "VtsHalAudioEffectTargetTest_default", defaults: ["VtsHalTargetTestDefaults"], diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index 15a2fd928c..23e77867a5 100644 --- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -31,7 +31,6 @@ #include <android/hidl/memory/1.0/IMemory.h> #if MAJOR_VERSION >= 7 #include <android_audio_policy_configuration_V7_0-enums.h> -#include <android_audio_policy_configuration_V7_0.h> #endif #include <common/all-versions/VersionUtils.h> diff --git a/audio/policy/1.0/vts/functional/Android.bp b/audio/policy/1.0/vts/functional/Android.bp index 7b7cf0d44a..cccb2fc6f0 100644 --- a/audio/policy/1.0/vts/functional/Android.bp +++ b/audio/policy/1.0/vts/functional/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalAudioPolicyV1_0TargetTest", srcs: [ diff --git a/audio/policy/1.0/xml/Android.bp b/audio/policy/1.0/xml/Android.bp index 6da7b5a3e5..403278cbba 100644 --- a/audio/policy/1.0/xml/Android.bp +++ b/audio/policy/1.0/xml/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_policy_engine_conf_V1_0", srcs: ["audio_policy_engine_configuration.xsd"], diff --git a/audio/policy/1.0/xml/pfw_schemas/Android.bp b/audio/policy/1.0/xml/pfw_schemas/Android.bp index 8054dc57ef..5d669c2a83 100644 --- a/audio/policy/1.0/xml/pfw_schemas/Android.bp +++ b/audio/policy/1.0/xml/pfw_schemas/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + xsd_config { name: "audio_policy_engine_configurable_configuration_V1_0", srcs: ["AllSchemas.xsd"], diff --git a/authsecret/1.0/Android.bp b/authsecret/1.0/Android.bp index 5c556d2926..b14284b4d2 100644 --- a/authsecret/1.0/Android.bp +++ b/authsecret/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.authsecret@1.0", root: "android.hardware", diff --git a/authsecret/1.0/default/Android.bp b/authsecret/1.0/default/Android.bp index b6ea3c4ca7..5bf389b60b 100644 --- a/authsecret/1.0/default/Android.bp +++ b/authsecret/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.authsecret@1.0-service", init_rc: ["android.hardware.authsecret@1.0-service.rc"], diff --git a/authsecret/1.0/vts/functional/Android.bp b/authsecret/1.0/vts/functional/Android.bp index c49d37492d..853b4ddeb1 100644 --- a/authsecret/1.0/vts/functional/Android.bp +++ b/authsecret/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalAuthSecretV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/authsecret/aidl/Android.bp b/authsecret/aidl/Android.bp index 0a05034762..8fe9f27d7e 100644 --- a/authsecret/aidl/Android.bp +++ b/authsecret/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.authsecret", vendor_available: true, diff --git a/authsecret/aidl/default/Android.bp b/authsecret/aidl/default/Android.bp index 44e0711096..a6c0bc4001 100644 --- a/authsecret/aidl/default/Android.bp +++ b/authsecret/aidl/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.authsecret-service.example", relative_install_path: "hw", diff --git a/authsecret/aidl/vts/Android.bp b/authsecret/aidl/vts/Android.bp index 29b3bcc21d..dca70465ab 100644 --- a/authsecret/aidl/vts/Android.bp +++ b/authsecret/aidl/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalAuthSecretTargetTest", defaults: [ diff --git a/automotive/audiocontrol/1.0/Android.bp b/automotive/audiocontrol/1.0/Android.bp index 8835f51a29..628793bfbd 100644 --- a/automotive/audiocontrol/1.0/Android.bp +++ b/automotive/audiocontrol/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.audiocontrol@1.0", root: "android.hardware", diff --git a/automotive/audiocontrol/1.0/default/Android.bp b/automotive/audiocontrol/1.0/default/Android.bp index ae4b8057ae..7180a70774 100644 --- a/automotive/audiocontrol/1.0/default/Android.bp +++ b/automotive/audiocontrol/1.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.audiocontrol@1.0-service", defaults: ["hidl_defaults"], @@ -19,7 +28,7 @@ cc_binary { relative_install_path: "hw", srcs: [ "AudioControl.cpp", - "service.cpp" + "service.cpp", ], init_rc: ["android.hardware.automotive.audiocontrol@1.0-service.rc"], @@ -31,3 +40,16 @@ cc_binary { ], vintf_fragments: ["audiocontrol_manifest.xml"], } + +filegroup { + name: "audiocontrolV1.0_source", + srcs: [ + "AudioControl.cpp", + ], +} + +cc_library_headers { + name: "audiocontrolV1.0_header", + host_supported: true, + export_include_dirs: ["."], +} diff --git a/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp b/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp new file mode 100644 index 0000000000..78f5b523ed --- /dev/null +++ b/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp @@ -0,0 +1,52 @@ +/****************************************************************************** + * + * Copyright (C) 2021 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. + * + ***************************************************************************** + * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore + */ + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_fuzz { + name: "audiocontrolV1.0_fuzzer", + host_supported: true, + srcs: [ + "audiocontrolV1.0_fuzzer.cpp", + ":audiocontrolV1.0_source", + ], + header_libs: [ + "audiocontrolV1.0_header", + ], + shared_libs: [ + "android.hardware.automotive.audiocontrol@1.0", + "libhidlbase", + "liblog", + "libutils", + ], + fuzz_config: { + cc: [ + "android-media-fuzzing-reports@google.com", + ], + componentid: 533764, + }, +} diff --git a/automotive/audiocontrol/1.0/default/test/fuzzer/audiocontrolV1.0_fuzzer.cpp b/automotive/audiocontrol/1.0/default/test/fuzzer/audiocontrolV1.0_fuzzer.cpp new file mode 100644 index 0000000000..268df08f94 --- /dev/null +++ b/automotive/audiocontrol/1.0/default/test/fuzzer/audiocontrolV1.0_fuzzer.cpp @@ -0,0 +1,41 @@ +/****************************************************************************** + * + * Copyright (C) 2021 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. + * + ***************************************************************************** + * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore + */ +#include <AudioControl.h> +#include <fuzzer/FuzzedDataProvider.h> + +using ::android::sp; +using ::android::hardware::automotive::audiocontrol::V1_0::ContextNumber; +using ::android::hardware::automotive::audiocontrol::V1_0::implementation::AudioControl; + +namespace android::hardware::automotive::audiocontrol::V1_0::implementation::fuzzer { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + if (size < 1) { + return 0; + } + if (sp<AudioControl> audioControl = new AudioControl(); audioControl != nullptr) { + FuzzedDataProvider fdp = FuzzedDataProvider(data, size); + ContextNumber contextNumber = static_cast<ContextNumber>(fdp.ConsumeIntegral<uint32_t>()); + audioControl->getBusForContext(contextNumber); + audioControl->setBalanceTowardRight(fdp.ConsumeFloatingPoint<float>()); + audioControl->setFadeTowardFront(fdp.ConsumeFloatingPoint<float>()); + } + return 0; +} +} // namespace android::hardware::automotive::audiocontrol::V1_0::implementation::fuzzer diff --git a/automotive/audiocontrol/1.0/vts/functional/Android.bp b/automotive/audiocontrol/1.0/vts/functional/Android.bp index 1bb8e88fbc..15c480aec5 100644 --- a/automotive/audiocontrol/1.0/vts/functional/Android.bp +++ b/automotive/audiocontrol/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalAudioControlV1_0TargetTest", srcs: [ diff --git a/automotive/audiocontrol/2.0/Android.bp b/automotive/audiocontrol/2.0/Android.bp index e9ce638bae..4d1fdbca26 100644 --- a/automotive/audiocontrol/2.0/Android.bp +++ b/automotive/audiocontrol/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.audiocontrol@2.0", root: "android.hardware", diff --git a/automotive/audiocontrol/2.0/default/Android.bp b/automotive/audiocontrol/2.0/default/Android.bp index 44ad0281fe..1b8cef723d 100644 --- a/automotive/audiocontrol/2.0/default/Android.bp +++ b/automotive/audiocontrol/2.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.audiocontrol@2.0-service", defaults: ["hidl_defaults"], diff --git a/automotive/audiocontrol/2.0/vts/functional/Android.bp b/automotive/audiocontrol/2.0/vts/functional/Android.bp index ac20509dd5..cb7a54d79b 100644 --- a/automotive/audiocontrol/2.0/vts/functional/Android.bp +++ b/automotive/audiocontrol/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalAudioControlV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index f8240b1cc7..7a947d3ab5 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -1,5 +1,14 @@ // This is the expected build file, but it may not be right in all cases +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.automotive.audiocontrol", vendor_available: true, diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp index 05fec79666..878bee19cb 100644 --- a/automotive/audiocontrol/aidl/default/Android.bp +++ b/automotive/audiocontrol/aidl/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.audiocontrol-service.example", relative_install_path: "hw", diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index 89f5f9266c..6856b91d2b 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsAidlHalAudioControlTest", defaults: [ diff --git a/automotive/can/1.0/Android.bp b/automotive/can/1.0/Android.bp index 2ddfaf93b8..47db9f8d34 100644 --- a/automotive/can/1.0/Android.bp +++ b/automotive/can/1.0/Android.bp @@ -1,5 +1,15 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + // SPDX-license-identifier-NCSA + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.can@1.0", root: "android.hardware", diff --git a/automotive/can/1.0/default/Android.bp b/automotive/can/1.0/default/Android.bp index 0ba066e35a..c0c17e27f5 100644 --- a/automotive/can/1.0/default/Android.bp +++ b/automotive/can/1.0/default/Android.bp @@ -14,6 +14,16 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + // SPDX-license-identifier-NCSA + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.automotive.can@defaults", cpp_std: "experimental", diff --git a/automotive/can/1.0/default/libc++fs/Android.bp b/automotive/can/1.0/default/libc++fs/Android.bp index 7ab1c28b3b..06419919ac 100644 --- a/automotive/can/1.0/default/libc++fs/Android.bp +++ b/automotive/can/1.0/default/libc++fs/Android.bp @@ -17,6 +17,15 @@ // TODO(152067309): Stop building this yourself once it's ABI stable and has // been made vendor available. Just use libc++fs instead of this. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-NCSA + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.automotive@libc++fsdefaults", local_include_dirs: ["include"], diff --git a/automotive/can/1.0/default/libnetdevice/Android.bp b/automotive/can/1.0/default/libnetdevice/Android.bp index 2605f88104..653e773240 100644 --- a/automotive/can/1.0/default/libnetdevice/Android.bp +++ b/automotive/can/1.0/default/libnetdevice/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.automotive.can@libnetdevice", defaults: ["android.hardware.automotive.can@defaults"], diff --git a/automotive/can/1.0/default/libnl++/Android.bp b/automotive/can/1.0/default/libnl++/Android.bp index a69e302658..790adcd073 100644 --- a/automotive/can/1.0/default/libnl++/Android.bp +++ b/automotive/can/1.0/default/libnl++/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libnl++", defaults: ["android.hardware.automotive.can@defaults"], diff --git a/automotive/can/1.0/hidl-utils/Android.bp b/automotive/can/1.0/hidl-utils/Android.bp index 63b07c9391..7453e10308 100644 --- a/automotive/can/1.0/hidl-utils/Android.bp +++ b/automotive/can/1.0/hidl-utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.automotive.can@hidl-utils-lib", export_include_dirs: ["include"], diff --git a/automotive/can/1.0/tools/Android.bp b/automotive/can/1.0/tools/Android.bp index a6c40d933a..a0807aa190 100644 --- a/automotive/can/1.0/tools/Android.bp +++ b/automotive/can/1.0/tools/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "canhalctrl", defaults: ["android.hardware.automotive.can@defaults"], diff --git a/automotive/can/1.0/tools/configurator/Android.bp b/automotive/can/1.0/tools/configurator/Android.bp index 2c4bc1d6fc..cc826bc85f 100644 --- a/automotive/can/1.0/tools/configurator/Android.bp +++ b/automotive/can/1.0/tools/configurator/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "canhalconfigurator", init_rc: ["canhalconfigurator.rc"], diff --git a/automotive/can/1.0/tools/configurator/proto/Android.bp b/automotive/can/1.0/tools/configurator/proto/Android.bp index 05e120524a..7b10791c83 100644 --- a/automotive/can/1.0/tools/configurator/proto/Android.bp +++ b/automotive/can/1.0/tools/configurator/proto/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.automotive.can@1.x-config-format", defaults: ["android.hardware.automotive.can@defaults"], diff --git a/automotive/can/1.0/tools/libcanhaltools/Android.bp b/automotive/can/1.0/tools/libcanhaltools/Android.bp index cee9eef20d..a25748bea9 100644 --- a/automotive/can/1.0/tools/libcanhaltools/Android.bp +++ b/automotive/can/1.0/tools/libcanhaltools/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.automotive.can@libcanhaltools", defaults: ["android.hardware.automotive.can@defaults"], diff --git a/automotive/can/1.0/vts/functional/Android.bp b/automotive/can/1.0/vts/functional/Android.bp index d020750f3a..1d51492fd8 100644 --- a/automotive/can/1.0/vts/functional/Android.bp +++ b/automotive/can/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.automotive.can@vts-defaults", defaults: [ diff --git a/automotive/can/1.0/vts/utils/Android.bp b/automotive/can/1.0/vts/utils/Android.bp index d03ead30eb..81d7ed180c 100644 --- a/automotive/can/1.0/vts/utils/Android.bp +++ b/automotive/can/1.0/vts/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.automotive.can@vts-utils-lib", defaults: ["android.hardware.automotive.can@defaults"], diff --git a/automotive/evs/1.0/Android.bp b/automotive/evs/1.0/Android.bp index 279c09aca0..04b9c7865d 100644 --- a/automotive/evs/1.0/Android.bp +++ b/automotive/evs/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.evs@1.0", root: "android.hardware", diff --git a/automotive/evs/1.0/default/Android.bp b/automotive/evs/1.0/default/Android.bp index 6e28ab1a54..c4c624f8aa 100644 --- a/automotive/evs/1.0/default/Android.bp +++ b/automotive/evs/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.evs@1.0-service", defaults: ["hidl_defaults"], diff --git a/automotive/evs/1.0/vts/functional/Android.bp b/automotive/evs/1.0/vts/functional/Android.bp index 74d512293b..f1b57d715d 100644 --- a/automotive/evs/1.0/vts/functional/Android.bp +++ b/automotive/evs/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalEvsV1_0TargetTest", srcs: [ diff --git a/automotive/evs/1.1/Android.bp b/automotive/evs/1.1/Android.bp index 443422e5aa..a72f971e04 100644 --- a/automotive/evs/1.1/Android.bp +++ b/automotive/evs/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.evs@1.1", root: "android.hardware", diff --git a/automotive/evs/1.1/default/Android.bp b/automotive/evs/1.1/default/Android.bp index 6e5695d7c4..ea1851f607 100644 --- a/automotive/evs/1.1/default/Android.bp +++ b/automotive/evs/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.evs@1.1-service", defaults: ["hidl_defaults"], diff --git a/automotive/evs/1.1/vts/functional/Android.bp b/automotive/evs/1.1/vts/functional/Android.bp index d61f0a8f9c..cbc2150811 100644 --- a/automotive/evs/1.1/vts/functional/Android.bp +++ b/automotive/evs/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalEvsV1_1TargetTest", srcs: [ diff --git a/automotive/evs/1.1/vts/fuzzing/Android.bp b/automotive/evs/1.1/vts/fuzzing/Android.bp index 48427ee532..1764821ad6 100644 --- a/automotive/evs/1.1/vts/fuzzing/Android.bp +++ b/automotive/evs/1.1/vts/fuzzing/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.automotive.evs@fuzz-defaults", defaults: ["VtsHalTargetTestDefaults"], diff --git a/automotive/evs/common/utils/default/Android.bp b/automotive/evs/common/utils/default/Android.bp index 776ef81875..18b6ee68f6 100644 --- a/automotive/evs/common/utils/default/Android.bp +++ b/automotive/evs/common/utils/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { host_supported: true, name: "android.hardware.automotive.evs@common-default-lib", diff --git a/automotive/evs/common/utils/default/test/fuzz/Android.bp b/automotive/evs/common/utils/default/test/fuzz/Android.bp index 105ec68b04..a2cf27383f 100644 --- a/automotive/evs/common/utils/default/test/fuzz/Android.bp +++ b/automotive/evs/common/utils/default/test/fuzz/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_fuzz { host_supported: true, name : "FormatConvertFuzzer_copyNV21toRGB32", diff --git a/automotive/occupant_awareness/aidl/Android.bp b/automotive/occupant_awareness/aidl/Android.bp index 4127f333b3..26c53fa4bb 100644 --- a/automotive/occupant_awareness/aidl/Android.bp +++ b/automotive/occupant_awareness/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.automotive.occupant_awareness", vendor_available: true, diff --git a/automotive/occupant_awareness/aidl/default/Android.bp b/automotive/occupant_awareness/aidl/default/Android.bp index 1e50930716..4db43bbd85 100644 --- a/automotive/occupant_awareness/aidl/default/Android.bp +++ b/automotive/occupant_awareness/aidl/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.occupant_awareness@1.0-service", init_rc: ["android.hardware.automotive.occupant_awareness@1.0-service.rc"], diff --git a/automotive/occupant_awareness/aidl/mock/Android.bp b/automotive/occupant_awareness/aidl/mock/Android.bp index 64ca73377b..275eb22f31 100644 --- a/automotive/occupant_awareness/aidl/mock/Android.bp +++ b/automotive/occupant_awareness/aidl/mock/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.occupant_awareness@1.0-service_mock", relative_install_path: "hw", diff --git a/automotive/occupant_awareness/aidl/vts/functional/Android.bp b/automotive/occupant_awareness/aidl/vts/functional/Android.bp index dbd0538de1..f248aa9f4e 100644 --- a/automotive/occupant_awareness/aidl/vts/functional/Android.bp +++ b/automotive/occupant_awareness/aidl/vts/functional/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalOccupantAwarenessV1_0TargetTest", defaults: [ diff --git a/automotive/sv/1.0/Android.bp b/automotive/sv/1.0/Android.bp index 3a39148aa0..a6b1ba77b3 100644 --- a/automotive/sv/1.0/Android.bp +++ b/automotive/sv/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.sv@1.0", root: "android.hardware", diff --git a/automotive/sv/1.0/default/Android.bp b/automotive/sv/1.0/default/Android.bp index 8417949eba..da974a0509 100644 --- a/automotive/sv/1.0/default/Android.bp +++ b/automotive/sv/1.0/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.automotive.sv@1.0-service", vendor: true, diff --git a/automotive/sv/1.0/vts/functional/Android.bp b/automotive/sv/1.0/vts/functional/Android.bp index d5d72a6c5b..1ff34506ee 100644 --- a/automotive/sv/1.0/vts/functional/Android.bp +++ b/automotive/sv/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSurroundViewV1_0TargetTest", srcs: [ diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp index 4fa8773270..e2164b1d9d 100644 --- a/automotive/vehicle/2.0/Android.bp +++ b/automotive/vehicle/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.automotive.vehicle@2.0", root: "android.hardware", diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp index c66c9cca11..b2f8bf630a 100644 --- a/automotive/vehicle/2.0/default/Android.bp +++ b/automotive/vehicle/2.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "vhal_v2_0_defaults", shared_libs: [ @@ -212,3 +221,29 @@ cc_binary { "android.hardware.automotive.vehicle@2.0-libproto-native", ], } + +cc_fuzz { + name: "vehicleManager_fuzzer", + vendor: true, + defaults: ["vhal_v2_0_target_defaults"], + whole_static_libs: ["android.hardware.automotive.vehicle@2.0-manager-lib"], + srcs: [ + "tests/fuzzer/VehicleManager_fuzzer.cpp", + ], + shared_libs: [ + "libbase", + "libcutils", + "libbinder_ndk", + ], + header_libs: ["libbase_headers"], + local_include_dirs: [ + "common/include", + "tests", + ], + fuzz_config: { + cc: [ + "android-media-fuzzing-reports@google.com", + ], + componentid: 533764, + }, +} diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index 73513f4e4c..5915a53c03 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -996,6 +996,15 @@ const ConfigDeclaration kVehicleProperties[]{ }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + {.config = + { + .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {toInt(EvsServiceType::REARVIEW), + toInt(EvsServiceState::OFF)}}}, + {.config = {.prop = VEHICLE_MAP_SERVICE, .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE}}, diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp index 890eb33643..b62918f61e 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp @@ -96,11 +96,12 @@ bool JsonFakeValueGenerator::hasNext() { std::vector<VehiclePropValue> JsonFakeValueGenerator::parseFakeValueJson(std::istream& is) { std::vector<VehiclePropValue> fakeVhalEvents; - Json::Reader reader; + Json::CharReaderBuilder builder; Json::Value rawEvents; - if (!reader.parse(is, rawEvents)) { + std::string errorMessage; + if (!Json::parseFromStream(builder, is, &rawEvents, &errorMessage)) { ALOGE("%s: Failed to parse fake data JSON file. Error: %s", __func__, - reader.getFormattedErrorMessages().c_str()); + errorMessage.c_str()); return fakeVhalEvents; } diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp index c5b9ed6b0a..6e85ae96ee 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp @@ -13,6 +13,15 @@ // limitations under the License. // Vehicle HAL Protobuf library +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.automotive.vehicle@2.0-libproto-native", vendor: true, diff --git a/automotive/vehicle/2.0/default/tests/fuzzer/README.md b/automotive/vehicle/2.0/default/tests/fuzzer/README.md new file mode 100644 index 0000000000..3fa0d3f845 --- /dev/null +++ b/automotive/vehicle/2.0/default/tests/fuzzer/README.md @@ -0,0 +1,66 @@ +# Fuzzer for android.hardware.automotive.vehicle@2.0-manager-lib + +## Plugin Design Considerations +The fuzzer plugin for android.hardware.automotive.vehicle@2.0-manager-lib is +designed based on the understanding of the library and tries to achieve the following: + +##### Maximize code coverage +The configuration parameters are not hardcoded, but instead selected based on +incoming data. This ensures more code paths are reached by the fuzzer. + +Vehicle Manager supports the following parameters: +1. Vehicle Property (parameter name: `vehicleProp`) +2. Diagnostic Integer Sensor Index (parameter name: `diagnosticIntIndex`) +3. Diagnostic Float Sensor Index (parameter name: `diagnosticFloatIndex`) +4. Availability Message Type (parameter name: `availabilityMsgType`) +5. Subscription Message Type (parameter name: `subscriptionMsgType`) + +| Parameter| Valid Values| Configured Value| +|------------- |-------------| ----- | +| `vehicleProp` | 0.`VehicleProperty::INVALID` 1.`VehicleProperty::HVAC_FAN_SPEED` 2.`VehicleProperty::INFO_MAKE` 3.`VehicleProperty::DISPLAY_BRIGHTNESS` 4.`VehicleProperty::INFO_FUEL_CAPACITY` 5.`VehicleProperty::HVAC_SEAT_TEMPERATURE`| Value obtained from FuzzedDataProvider | +| `diagnosticIntIndex` | 0.`DiagnosticIntegerSensorIndex::FUEL_SYSTEM_STATUS` 1.`DiagnosticIntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON` 2.`DiagnosticIntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT` 3.`DiagnosticIntegerSensorIndex::FUEL_TYPE` | Value obtained from FuzzedDataProvider | +| `diagnosticFloatIndex` | 0.`DiagnosticFloatSensorIndex::CALCULATED_ENGINE_LOAD` 1.`DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1` 2.`DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1` 3.`DiagnosticFloatSensorIndex::THROTTLE_POSITION` | Value obtained from FuzzedDataProvider | +| `availabilityMsgType` | 0.`VmsMessageType::AVAILABILITY_CHANGE` 1.`VmsMessageType::AVAILABILITY_RESPONSE` | Value obtained from FuzzedDataProvider | +| `subscriptionMsgType` | 0.`VmsMessageType::SUBSCRIPTIONS_CHANGE` 1.`VmsMessageType::SUBSCRIPTIONS_RESPONSE` | Value obtained from FuzzedDataProvider | + +This also ensures that the plugin is always deterministic for any given input. + +## Build + +This describes steps to build vehicleManager_fuzzer binary. + +### Android + +#### Steps to build +Build the fuzzer +``` + $ mm -j$(nproc) vehicleManager_fuzzer +``` + +#### Steps to run +Create a directory CORPUS_DIR +``` + $ adb shell mkdir /data/local/tmp/CORPUS_DIR +``` + +##### Some Additional steps needed to run the vehicleManager_fuzzer successfully on device + +1. Push the following libraries from /vendor/lib/ and /vendor/lib64/ folders of your workspace to the device's /vendor/lib/ and /vendor/lib64/ : +``` +1.1 android.hardware.automotive.vehicle@2.0.so +1.2 carwatchdog_aidl_interface-V2-ndk_platform.so +``` +2. Now, reboot the device using command +``` + $ adb reboot +``` + +##### To run the fuzzer on device +``` + $ adb sync data + $ adb shell LD_LIBRARY_PATH=/vendor/lib64 /data/fuzz/${TARGET_ARCH}/vehicleManager_fuzzer/vendor/vehicleManager_fuzzer /data/local/tmp/CORPUS_DIR +``` + +## References: + * http://llvm.org/docs/LibFuzzer.html + * https://github.com/google/oss-fuzz diff --git a/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp b/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp new file mode 100644 index 0000000000..796c08f2f2 --- /dev/null +++ b/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.cpp @@ -0,0 +1,433 @@ +/****************************************************************************** + * + * Copyright (C) 2021 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. + * + ***************************************************************************** + * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore + */ + +#include "VehicleManager_fuzzer.h" +#include <utils/SystemClock.h> +#include <vhal_v2_0/Obd2SensorStore.h> +#include <vhal_v2_0/WatchdogClient.h> + +namespace android::hardware::automotive::vehicle::V2_0::fuzzer { + +using ::aidl::android::automotive::watchdog::TimeoutLength; +using ::android::elapsedRealtimeNano; +using ::android::Looper; +using ::android::sp; +using ::android::hardware::hidl_handle; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::automotive::vehicle::V2_0::DiagnosticFloatSensorIndex; +using ::android::hardware::automotive::vehicle::V2_0::DiagnosticIntegerSensorIndex; +using ::android::hardware::automotive::vehicle::V2_0::kCustomComplexProperty; +using ::android::hardware::automotive::vehicle::V2_0::kVehicleProperties; +using ::android::hardware::automotive::vehicle::V2_0::MockedVehicleCallback; +using ::android::hardware::automotive::vehicle::V2_0::Obd2SensorStore; +using ::android::hardware::automotive::vehicle::V2_0::recyclable_ptr; +using ::android::hardware::automotive::vehicle::V2_0::StatusCode; +using ::android::hardware::automotive::vehicle::V2_0::SubscribeFlags; +using ::android::hardware::automotive::vehicle::V2_0::SubscribeOptions; +using ::android::hardware::automotive::vehicle::V2_0::VehicleAreaConfig; +using ::android::hardware::automotive::vehicle::V2_0::VehicleHal; +using ::android::hardware::automotive::vehicle::V2_0::VehicleHalManager; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropConfig; +using ::android::hardware::automotive::vehicle::V2_0::VehicleProperty; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyAccess; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyChangeMode; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyStore; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyType; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropValuePool; +using ::android::hardware::automotive::vehicle::V2_0::VmsMessageType; +using ::android::hardware::automotive::vehicle::V2_0::WatchdogClient; +using ::android::hardware::automotive::vehicle::V2_0::vms::createAvailabilityRequest; +using ::android::hardware::automotive::vehicle::V2_0::vms::createBaseVmsMessage; +using ::android::hardware::automotive::vehicle::V2_0::vms::createPublisherIdRequest; +using ::android::hardware::automotive::vehicle::V2_0::vms::createStartSessionMessage; +using ::android::hardware::automotive::vehicle::V2_0::vms::createSubscriptionsRequest; +using ::android::hardware::automotive::vehicle::V2_0::vms::getAvailableLayers; +using ::android::hardware::automotive::vehicle::V2_0::vms::getSequenceNumberForAvailabilityState; +using ::android::hardware::automotive::vehicle::V2_0::vms::getSequenceNumberForSubscriptionsState; +using ::android::hardware::automotive::vehicle::V2_0::vms::hasServiceNewlyStarted; +using ::android::hardware::automotive::vehicle::V2_0::vms::isAvailabilitySequenceNumberNewer; +using ::android::hardware::automotive::vehicle::V2_0::vms::isSequenceNumberNewer; +using ::android::hardware::automotive::vehicle::V2_0::vms::isValidVmsMessage; +using ::android::hardware::automotive::vehicle::V2_0::vms::parseData; +using ::android::hardware::automotive::vehicle::V2_0::vms::parseMessageType; +using ::android::hardware::automotive::vehicle::V2_0::vms::parsePublisherIdResponse; +using ::android::hardware::automotive::vehicle::V2_0::vms::parseStartSessionMessage; +using ::android::hardware::automotive::vehicle::V2_0::vms::VmsLayer; +using ::android::hardware::automotive::vehicle::V2_0::vms::VmsLayerAndPublisher; +using ::android::hardware::automotive::vehicle::V2_0::vms::VmsLayerOffering; +using ::android::hardware::automotive::vehicle::V2_0::vms::VmsOffers; + +constexpr const char kCarMake[] = "Default Car"; +constexpr VehicleProperty kVehicleProp[] = {VehicleProperty::INVALID, + VehicleProperty::HVAC_FAN_SPEED, + VehicleProperty::INFO_MAKE, + VehicleProperty::DISPLAY_BRIGHTNESS, + VehicleProperty::INFO_FUEL_CAPACITY, + VehicleProperty::HVAC_SEAT_TEMPERATURE}; +constexpr DiagnosticIntegerSensorIndex kDiagnosticIntIndex[] = { + DiagnosticIntegerSensorIndex::FUEL_SYSTEM_STATUS, + DiagnosticIntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON, + DiagnosticIntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT, + DiagnosticIntegerSensorIndex::FUEL_TYPE}; +constexpr DiagnosticFloatSensorIndex kDiagnosticFloatIndex[] = { + DiagnosticFloatSensorIndex::CALCULATED_ENGINE_LOAD, + DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1, + DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1, + DiagnosticFloatSensorIndex::THROTTLE_POSITION}; +constexpr size_t kVehiclePropArrayLength = std::size(kVehicleProp); +constexpr size_t kIntSensorArrayLength = std::size(kDiagnosticIntIndex); +constexpr size_t kFloatSensorArrayLength = std::size(kDiagnosticFloatIndex); +constexpr VmsMessageType kAvailabilityMessageType[] = {VmsMessageType::AVAILABILITY_CHANGE, + VmsMessageType::AVAILABILITY_RESPONSE}; +constexpr VmsMessageType kSubscriptionMessageType[] = {VmsMessageType::SUBSCRIPTIONS_CHANGE, + VmsMessageType::SUBSCRIPTIONS_RESPONSE}; + +MockedVehicleHal::VehiclePropValuePtr MockedVehicleHal::get( + const VehiclePropValue& requestedPropValue, StatusCode* outStatus) { + VehiclePropValuePtr pValue = nullptr; + if (outStatus == nullptr) { + return pValue; + } + auto property = static_cast<VehicleProperty>(requestedPropValue.prop); + int32_t areaId = requestedPropValue.areaId; + *outStatus = StatusCode::OK; + + switch (property) { + case VehicleProperty::INFO_MAKE: + pValue = getValuePool()->obtainString(kCarMake); + break; + case VehicleProperty::INFO_FUEL_CAPACITY: + if (mFuelCapacityAttemptsLeft-- > 0) { + *outStatus = StatusCode::TRY_AGAIN; + } else { + pValue = getValuePool()->obtainFloat(42.42); + } + break; + default: + if (requestedPropValue.prop == kCustomComplexProperty) { + pValue = getValuePool()->obtainComplex(); + pValue->value.int32Values = hidl_vec<int32_t>{10, 20}; + pValue->value.int64Values = hidl_vec<int64_t>{30, 40}; + pValue->value.floatValues = hidl_vec<float_t>{1.1, 2.2}; + pValue->value.bytes = hidl_vec<uint8_t>{1, 2, 3}; + pValue->value.stringValue = kCarMake; + break; + } + auto key = makeKey(toInt(property), areaId); + pValue = getValuePool()->obtain(mValues[key]); + } + + if (*outStatus == StatusCode::OK && pValue.get() != nullptr) { + pValue->prop = toInt(property); + pValue->areaId = areaId; + pValue->timestamp = elapsedRealtimeNano(); + } + + return pValue; +} + +void VehicleHalManagerFuzzer::process(const uint8_t* data, size_t size) { + mFuzzedDataProvider = new FuzzedDataProvider(data, size); + invokeDebug(); + invokePropConfigs(); + invokeSubscribe(); + invokeSetAndGetValues(); + invokeObd2SensorStore(); + invokeVmsUtils(); + invokeVehiclePropStore(); + invokeWatchDogClient(); +} + +void VehicleHalManagerFuzzer::invokeDebug() { + hidl_string debugOption = mFuzzedDataProvider->PickValueInArray( + {"--help", "--list", "--get", "--set", "", "invalid"}); + hidl_handle fd = {}; + fd.setTo(native_handle_create(/*numFds=*/1, /*numInts=*/0), /*shouldOwn=*/true); + + mManager->debug(fd, {}); + mManager->debug(fd, {debugOption}); +} + +void VehicleHalManagerFuzzer::invokePropConfigs() { + int32_t vehicleProp1 = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + int32_t vehicleProp2 = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + + hidl_vec<int32_t> properties = {vehicleProp1, vehicleProp2}; + + mManager->getPropConfigs(properties, + []([[maybe_unused]] StatusCode status, + [[maybe_unused]] const hidl_vec<VehiclePropConfig>& c) {}); + + mManager->getPropConfigs({toInt(kVehicleProp[abs(vehicleProp1) % kVehiclePropArrayLength])}, + []([[maybe_unused]] StatusCode status, + [[maybe_unused]] const hidl_vec<VehiclePropConfig>& c) {}); + + mManager->getAllPropConfigs( + []([[maybe_unused]] const hidl_vec<VehiclePropConfig>& propConfigs) {}); +} + +void VehicleHalManagerFuzzer::invokeSubscribe() { + int32_t vehicleProp1 = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + int32_t vehicleProp2 = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + int32_t vehicleProp3 = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + + const auto prop1 = toInt(kVehicleProp[abs(vehicleProp1) % kVehiclePropArrayLength]); + sp<MockedVehicleCallback> cb = new MockedVehicleCallback(); + + hidl_vec<SubscribeOptions> options = { + SubscribeOptions{.propId = prop1, .flags = SubscribeFlags::EVENTS_FROM_CAR}}; + + mManager->subscribe(cb, options); + + auto unsubscribedValue = mObjectPool->obtain(VehiclePropertyType::INT32); + unsubscribedValue->prop = toInt(kVehicleProp[abs(vehicleProp2) % kVehiclePropArrayLength]); + + mHal->sendPropEvent(std::move(unsubscribedValue)); + cb->getReceivedEvents(); + cb->waitForExpectedEvents(0); + + auto subscribedValue = mObjectPool->obtain(VehiclePropertyType::INT32); + subscribedValue->prop = toInt(kVehicleProp[abs(vehicleProp2) % kVehiclePropArrayLength]); + subscribedValue->value.int32Values[0] = INT32_MAX; + + cb->reset(); + VehiclePropValue actualValue(*subscribedValue.get()); + mHal->sendPropEvent(std::move(subscribedValue)); + cb->waitForExpectedEvents(1); + mManager->unsubscribe(cb, prop1); + + sp<MockedVehicleCallback> cb2 = new MockedVehicleCallback(); + + hidl_vec<SubscribeOptions> options2 = { + SubscribeOptions{ + .propId = toInt(kVehicleProp[abs(vehicleProp3) % kVehiclePropArrayLength]), + .flags = SubscribeFlags::EVENTS_FROM_CAR}, + }; + + mManager->subscribe(cb2, options2); + + mHal->sendHalError(StatusCode::TRY_AGAIN, + toInt(kVehicleProp[abs(vehicleProp3) % kVehiclePropArrayLength]), + /*areaId=*/0); +} + +void VehicleHalManagerFuzzer::invokeSetAndGetValues() { + uint32_t vehicleProp1 = + mFuzzedDataProvider->ConsumeIntegralInRange<uint32_t>(0, kVehiclePropArrayLength - 1); + uint32_t vehicleProp2 = + mFuzzedDataProvider->ConsumeIntegralInRange<uint32_t>(0, kVehiclePropArrayLength - 1); + uint32_t vehicleProp3 = + mFuzzedDataProvider->ConsumeIntegralInRange<uint32_t>(0, kVehiclePropArrayLength - 1); + + invokeGet(kCustomComplexProperty, 0); + invokeGet(toInt(kVehicleProp[vehicleProp2]), 0); + invokeGet(toInt(kVehicleProp[vehicleProp1]), 0); + + auto expectedValue = mObjectPool->obtainInt32(mFuzzedDataProvider->ConsumeIntegral<int32_t>()); + mObjectPool->obtainInt64(mFuzzedDataProvider->ConsumeIntegral<int64_t>()); + mObjectPool->obtainFloat(mFuzzedDataProvider->ConsumeFloatingPoint<float>()); + mObjectPool->obtainBoolean(mFuzzedDataProvider->ConsumeBool()); + expectedValue->prop = toInt(kVehicleProp[vehicleProp2]); + expectedValue->areaId = 0; + + mManager->set(*expectedValue.get()); + invokeGet(toInt(kVehicleProp[vehicleProp2]), 0); + expectedValue->prop = toInt(kVehicleProp[vehicleProp3]); + mManager->set(*expectedValue.get()); + expectedValue->prop = toInt(VehicleProperty::INVALID); + mManager->set(*expectedValue.get()); +} + +void VehicleHalManagerFuzzer::invokeObd2SensorStore() { + uint32_t diagnosticIntIndex = + mFuzzedDataProvider->ConsumeIntegralInRange<uint32_t>(0, kIntSensorArrayLength - 1); + int32_t diagnosticIntValue = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + uint32_t diagnosticFloatIndex = + mFuzzedDataProvider->ConsumeIntegralInRange<uint32_t>(0, kFloatSensorArrayLength - 1); + float diagnosticFloatValue = mFuzzedDataProvider->ConsumeFloatingPoint<float>(); + + std::unique_ptr<Obd2SensorStore> sensorStore( + new Obd2SensorStore(kIntSensorArrayLength, kFloatSensorArrayLength)); + if (sensorStore) { + sensorStore->setIntegerSensor(kDiagnosticIntIndex[diagnosticIntIndex], diagnosticIntValue); + sensorStore->setFloatSensor(kDiagnosticFloatIndex[diagnosticFloatIndex], + diagnosticFloatValue); + sensorStore->getIntegerSensors(); + sensorStore->getFloatSensors(); + sensorStore->getSensorsBitmask(); + static std::vector<std::string> sampleDtcs = {"P0070", + "P0102" + "P0123"}; + for (auto&& dtc : sampleDtcs) { + auto freezeFrame = createVehiclePropValue(VehiclePropertyType::MIXED, 0); + sensorStore->fillPropValue(dtc, freezeFrame.get()); + freezeFrame->prop = static_cast<int>(VehicleProperty::OBD2_FREEZE_FRAME); + } + } +} + +void VehicleHalManagerFuzzer::invokeVmsUtils() { + bool availabilityMsgType = mFuzzedDataProvider->ConsumeBool(); + bool subscriptionMsgType = mFuzzedDataProvider->ConsumeBool(); + int32_t intValue = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + + VmsLayer layer(1, 0, 2); + auto message = createSubscribeMessage(layer); + isValidVmsMessage(*message); + message = createUnsubscribeMessage(layer); + + VmsOffers offers = {intValue, {VmsLayerOffering(VmsLayer(1, 0, 2))}}; + message = createOfferingMessage(offers); + std::vector<VmsLayer> dependencies = {VmsLayer(2, 0, 2), VmsLayer(3, 0, 3)}; + std::vector<VmsLayerOffering> offering = {VmsLayerOffering(layer, dependencies)}; + offers = {intValue, offering}; + message = createOfferingMessage(offers); + + message = createAvailabilityRequest(); + message = createSubscriptionsRequest(); + + std::string bytes = "placeholder"; + const VmsLayerAndPublisher layer_and_publisher(VmsLayer(2, 0, 1), intValue); + message = createDataMessageWithLayerPublisherInfo(layer_and_publisher, bytes); + parseData(*message); + createSubscribeToPublisherMessage(layer_and_publisher); + createUnsubscribeToPublisherMessage(layer_and_publisher); + + std::string pub_bytes = "pub_id"; + message = createPublisherIdRequest(pub_bytes); + message = createBaseVmsMessage(2); + message->value.int32Values = + hidl_vec<int32_t>{toInt(VmsMessageType::PUBLISHER_ID_RESPONSE), intValue}; + parsePublisherIdResponse(*message); + + message->value.int32Values = + hidl_vec<int32_t>{toInt(kSubscriptionMessageType[subscriptionMsgType]), intValue}; + getSequenceNumberForSubscriptionsState(*message); + + message->value.int32Values = hidl_vec<int32_t>{toInt(kSubscriptionMessageType[0]), intValue}; + isSequenceNumberNewer(*message, intValue + 1); + invokeGetSubscribedLayers(kSubscriptionMessageType[subscriptionMsgType]); + + message->value.int32Values = + hidl_vec<int32_t>{toInt(kAvailabilityMessageType[availabilityMsgType]), 0}; + hasServiceNewlyStarted(*message); + message = createStartSessionMessage(intValue, intValue + 1); + parseMessageType(*message); + + message->value.int32Values = + hidl_vec<int32_t>{toInt(kAvailabilityMessageType[availabilityMsgType]), intValue}; + isAvailabilitySequenceNumberNewer(*message, intValue + 1); + + message->value.int32Values = + hidl_vec<int32_t>{toInt(kAvailabilityMessageType[availabilityMsgType]), intValue}; + getSequenceNumberForAvailabilityState(*message); + message = createBaseVmsMessage(3); + int new_service_id; + message->value.int32Values = hidl_vec<int32_t>{toInt(VmsMessageType::START_SESSION), 0, -1}; + parseStartSessionMessage(*message, -1, 0, &new_service_id); +} + +void VehicleHalManagerFuzzer::invokeGet(int32_t property, int32_t areaId) { + VehiclePropValue requestedValue{}; + requestedValue.prop = property; + requestedValue.areaId = areaId; + mActualValue = VehiclePropValue{}; // reset previous values + + StatusCode refStatus; + VehiclePropValue refValue; + mManager->get(requestedValue, + [&refStatus, &refValue](StatusCode status, const VehiclePropValue& value) { + refStatus = status; + refValue = value; + }); + + mActualValue = refValue; + mActualStatusCode = refStatus; +} + +void VehicleHalManagerFuzzer::invokeGetSubscribedLayers(VmsMessageType type) { + VmsOffers offers = {123, + {VmsLayerOffering(VmsLayer(1, 0, 1), {VmsLayer(4, 1, 1)}), + VmsLayerOffering(VmsLayer(2, 0, 1))}}; + auto message = createBaseVmsMessage(16); + message->value.int32Values = hidl_vec<int32_t>{toInt(type), + 1234, // sequence number + 2, // number of layers + 1, // number of associated layers + 1, // layer 1 + 0, 1, + 4, // layer 2 + 1, 1, + 2, // associated layer + 0, 1, + 2, // number of publisher IDs + 111, // publisher IDs + 123}; + isValidVmsMessage(*message); + getSubscribedLayers(*message, offers); + getAvailableLayers(*message); +} + +void VehicleHalManagerFuzzer::invokeVehiclePropStore() { + bool shouldWriteStatus = mFuzzedDataProvider->ConsumeBool(); + int32_t vehicleProp = mFuzzedDataProvider->ConsumeIntegral<int32_t>(); + auto store = std::make_unique<VehiclePropertyStore>(); + VehiclePropConfig config{ + .prop = vehicleProp, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, + }; + store->registerProperty(config); + VehiclePropValue propValue{}; + propValue.prop = vehicleProp; + propValue.areaId = 0; + store->writeValue(propValue, shouldWriteStatus); + store->readAllValues(); + store->getAllConfigs(); + store->getConfigOrNull(vehicleProp); + store->readValuesForProperty(vehicleProp); + store->readValueOrNull(propValue); + store->readValueOrNull(propValue.prop, propValue.areaId, 0); + store->removeValuesForProperty(vehicleProp); + store->removeValue(propValue); + store->getConfigOrDie(vehicleProp); +} + +void VehicleHalManagerFuzzer::invokeWatchDogClient() { + auto service = new VehicleHalManager(mHal.get()); + sp<Looper> looper(Looper::prepare(/*opts=*/mFuzzedDataProvider->ConsumeBool())); + if (auto watchdogClient = ndk::SharedRefBase::make<WatchdogClient>(looper, service); + watchdogClient->initialize()) { + watchdogClient->checkIfAlive(-1, TimeoutLength::TIMEOUT_NORMAL); + watchdogClient->prepareProcessTermination(); + } + delete service; +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + VehicleHalManagerFuzzer vmFuzzer; + vmFuzzer.process(data, size); + return 0; +} + +} // namespace android::hardware::automotive::vehicle::V2_0::fuzzer diff --git a/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.h b/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.h new file mode 100644 index 0000000000..e9335d3334 --- /dev/null +++ b/automotive/vehicle/2.0/default/tests/fuzzer/VehicleManager_fuzzer.h @@ -0,0 +1,124 @@ +/****************************************************************************** + * + * Copyright (C) 2021 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. + * + ***************************************************************************** + * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore + */ + +#ifndef __VEHICLE_MANAGER_FUZZER_H__ +#define __VEHICLE_MANAGER_FUZZER_H__ + +#include <vhal_v2_0/VehicleHalManager.h> +#include <vhal_v2_0/VehiclePropertyStore.h> +#include <vhal_v2_0/VmsUtils.h> + +#include <VehicleHalTestUtils.h> +#include <fuzzer/FuzzedDataProvider.h> + +namespace android::hardware::automotive::vehicle::V2_0::fuzzer { + +constexpr int kRetriableAttempts = 3; + +class MockedVehicleHal : public VehicleHal { + public: + MockedVehicleHal() + : mFuelCapacityAttemptsLeft(kRetriableAttempts), + mMirrorFoldAttemptsLeft(kRetriableAttempts) { + mConfigs.assign(std::begin(kVehicleProperties), std::end(kVehicleProperties)); + } + + std::vector<VehiclePropConfig> listProperties() override { return mConfigs; } + + VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue, + StatusCode* outStatus) override; + + StatusCode set(const VehiclePropValue& propValue) override { + if (toInt(VehicleProperty::MIRROR_FOLD) == propValue.prop && + mMirrorFoldAttemptsLeft-- > 0) { + return StatusCode::TRY_AGAIN; + } + + mValues[makeKey(propValue)] = propValue; + return StatusCode::OK; + } + + StatusCode subscribe(int32_t /* property */, float /* sampleRate */) override { + return StatusCode::OK; + } + + StatusCode unsubscribe(int32_t /* property */) override { return StatusCode::OK; } + + void sendPropEvent(recyclable_ptr<VehiclePropValue> value) { doHalEvent(std::move(value)); } + + void sendHalError(StatusCode error, int32_t property, int32_t areaId) { + doHalPropertySetError(error, property, areaId); + } + + private: + int64_t makeKey(const VehiclePropValue& v) const { return makeKey(v.prop, v.areaId); } + + int64_t makeKey(int32_t prop, int32_t area) const { + return (static_cast<int64_t>(prop) << 32) | area; + } + + private: + std::vector<VehiclePropConfig> mConfigs; + std::unordered_map<int64_t, VehiclePropValue> mValues; + int mFuelCapacityAttemptsLeft; + int mMirrorFoldAttemptsLeft; +}; + +class VehicleHalManagerFuzzer { + public: + VehicleHalManagerFuzzer() { + mHal.reset(new MockedVehicleHal); + mManager.reset(new VehicleHalManager(mHal.get())); + mObjectPool = mHal->getValuePool(); + } + ~VehicleHalManagerFuzzer() { + mManager.reset(nullptr); + mHal.reset(nullptr); + mObjectPool = nullptr; + if (mFuzzedDataProvider) { + delete mFuzzedDataProvider; + } + } + void process(const uint8_t* data, size_t size); + + private: + FuzzedDataProvider* mFuzzedDataProvider = nullptr; + VehiclePropValue mActualValue = VehiclePropValue{}; + StatusCode mActualStatusCode = StatusCode::OK; + + VehiclePropValuePool* mObjectPool = nullptr; + std::unique_ptr<MockedVehicleHal> mHal; + std::unique_ptr<VehicleHalManager> mManager; + + void invokeDebug(); + void invokePropConfigs(); + void invokeSubscribe(); + void invokeSetAndGetValues(); + void invokeObd2SensorStore(); + void invokeVmsUtils(); + void invokeVehiclePropStore(); + void invokeWatchDogClient(); + void invokeGetSubscribedLayers(VmsMessageType type); + void invokeGet(int32_t property, int32_t areaId); +}; + +} // namespace android::hardware::automotive::vehicle::V2_0::fuzzer + +#endif // __VEHICLE_MANAGER_FUZZER_H__ diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal index ed75e1dfb7..94645a4b4b 100644 --- a/automotive/vehicle/2.0/types.hal +++ b/automotive/vehicle/2.0/types.hal @@ -354,6 +354,12 @@ enum VehicleProperty : int32_t { /** * Speed of the vehicle * + * The value must be positive when the vehicle is moving forward and negative when + * the vehicle is moving backward. This value is independent of gear value + * (CURRENT_GEAR or GEAR_SELECTION), for example, if GEAR_SELECTION is GEAR_NEUTRAL, + * PERF_VEHICLE_SPEED is positive when the vehicle is moving forward, negative when moving + * backward, and zero when not moving. + * * @change_mode VehiclePropertyChangeMode:CONTINUOUS * @access VehiclePropertyAccess:READ * @unit VehicleUnit:METER_PER_SEC @@ -2921,6 +2927,29 @@ enum VehicleProperty : int32_t { | VehicleArea:GLOBAL), /** + * Enable/request an EVS service. + * + * The property provides a generalized way to trigger EVS services. VHAL + * should use this property to request Android to start or stop EVS service. + * + * int32Values[0] = a type of the EVS service. The value must be one of enums in + * EvsServiceType. + * int32Values[1] = the state of the EVS service. The value must be one of enums in + * EvsServiceState. + * + * For example, to enable rear view EVS service, android side can set the property value as + * [EvsServiceType::REAR_VIEW, EvsServiceState::ON]. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + EVS_SERVICE_REQUEST = ( + 0x0F10 + | VehiclePropertyGroup:SYSTEM + | VehiclePropertyType:INT32_VEC + | VehicleArea:GLOBAL), + + /** * Defines a request to apply power policy. * * VHAL sets this property to change car power policy. Car power policy service subscribes to @@ -3031,7 +3060,7 @@ enum VehicleProperty : int32_t { /** * Starts the ClusterUI in cluster display. * - * int32[0]: the type of ClusterUI to show + * int32: the type of ClusterUI to show * 0 indicates ClusterHome, that is a home screen of cluster display, and provides * the default UI and a kind of launcher functionality for cluster display. * the other values are followed by OEM's definition. @@ -3051,12 +3080,12 @@ enum VehicleProperty : int32_t { * int32[0]: on/off: 0 - off, 1 - on, -1 - don't care * int32[1]: width: positive number - actual width in pixels -1 - don't care (should set "don't care" both width and height) - * int32[2]: height: ditto with width + * int32[2]: height: same format with 'width' * int32[3]: Inset - left: positive number - actual left inset value in pixels -1 - don't care (should set "don't care" all Inset fields) - * int32[4]: Inset - top - * int32[5]: Inset - right - * int32[6]: Inset - bottom + * int32[4]: Inset - top: same format with 'left' + * int32[5]: Inset - right: same format with 'left' + * int32[6]: Inset - bottom: same format with 'left' * * @change_mode VehiclePropertyChangeMode:ON_CHANGE * @access VehiclePropertyAccess:READ @@ -3091,9 +3120,9 @@ enum VehicleProperty : int32_t { * -1 indicates the area isn't used any more. * bytes: the array to represent the availability of ClusterUI. * 0 indicates non-available and 1 indicates available. - * For example, let's assume a car supports 3 UI like HOME, MAPS, CALL and it only supports - * CALL UI only when the cellular network is available. Then, if the nework is avaibale, - * it'll send [1 1 1], and if it's out of network, it'll send [1 1 0]. + * For example, let's assume a car supports 3 OEM defined ClusterUI like HOME, MAPS, CALL, + * and it only supports CALL UI only when the cellular network is available. Then, if the + * nework is avaibale, it'll send [1 1 1], and if it's out of network, it'll send [1 1 0]. * * @change_mode VehiclePropertyChangeMode:ON_CHANGE * @access VehiclePropertyAccess:WRITE @@ -3111,7 +3140,7 @@ enum VehicleProperty : int32_t { * request to turn the display on to show some specific ClusterUI. * ClusterOS should response this with CLUSTER_DISPLAY_STATE. * - * int32[0]: the type of ClusterUI to show + * int32: the type of ClusterUI to show * * @change_mode VehiclePropertyChangeMode:ON_CHANGE * @access VehiclePropertyAccess:WRITE @@ -3207,6 +3236,33 @@ enum VehicleSeatOccupancyState : int32_t { }; /** + * Used by EVS_SERVICE_REQUEST to enumerate the service's type. + */ +enum EvsServiceType : int32_t { + + REARVIEW = 0, + SURROUNDVIEW = 1, +}; + +/** + * Used by EVS_SERVICE_REQUEST to enumerate the service's state. + */ +enum EvsServiceState : int32_t { + + OFF = 0, + ON = 1, +}; + +/** + * Index in int32VAlues for VehicleProperty#EVS_SERVICE_REQUEST property. + */ +enum EvsServiceRequestIndex : int32_t { + + TYPE = 0, + STATE = 1, +}; + +/** * Used by lights state properties to enumerate the current state of the lights. * * Most XXX_LIGHTS_STATE properties will only report ON and OFF states. Only diff --git a/automotive/vehicle/2.0/utils/Android.bp b/automotive/vehicle/2.0/utils/Android.bp index e354634165..a75ce49803 100644 --- a/automotive/vehicle/2.0/utils/Android.bp +++ b/automotive/vehicle/2.0/utils/Android.bp @@ -13,6 +13,15 @@ // limitations under the License. // User HAL helper library. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib", defaults: ["vhal_v2_0_defaults"], diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index f7462e6f51..829f8c2625 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.biometrics.common", vendor_available: true, @@ -13,4 +22,4 @@ aidl_interface { enabled: false, }, } -}
\ No newline at end of file +} diff --git a/biometrics/common/aidl/OWNERS b/biometrics/common/aidl/OWNERS new file mode 100644 index 0000000000..36d726136f --- /dev/null +++ b/biometrics/common/aidl/OWNERS @@ -0,0 +1,2 @@ +ilyamaty@google.com +kchyn@google.com diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl index 8dbc149fa8..4b4e7df146 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl @@ -1,14 +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. + */ /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped @@ -19,7 +35,8 @@ package android.hardware.biometrics.common; @VintfStability parcelable CommonProps { int sensorId; - android.hardware.biometrics.common.SensorStrength sensorStrength; + android.hardware.biometrics.common.SensorStrength sensorStrength = android.hardware.biometrics.common.SensorStrength.CONVENIENCE; int maxEnrollmentsPerUser; android.hardware.biometrics.common.HardwareInfo[] hardwareInfo; + String softwareInfo; } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl index b94b6b0174..c5288fdae5 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/HardwareInfo.aidl @@ -1,14 +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. + */ /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped @@ -20,6 +36,5 @@ package android.hardware.biometrics.common; parcelable HardwareInfo { String deviceName; String hardwareVersion; - String firmwareVersion; String serialNumber; } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl index 1a875bfbd8..2bc6a6df05 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl @@ -1,14 +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. + */ /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl index eaff85d2f9..6675d091e5 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl @@ -1,14 +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. + */ /////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl index 9c3fd58090..7c3d511360 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl @@ -33,7 +33,7 @@ parcelable CommonProps { * A statically configured strength for this sensor. See the SensorStrength interface for more * information. */ - SensorStrength sensorStrength; + SensorStrength sensorStrength = SensorStrength.CONVENIENCE; /** * The maximum number of enrollments that a single user can have. Statically configured. @@ -44,4 +44,13 @@ parcelable CommonProps { * A list of hardware information for subsystems that pertain to this biometric sensor. */ HardwareInfo[] hardwareInfo; -}
\ No newline at end of file + + /** + * Software information for subsystems that pertain to this biometric sensor. + * This may include information for the matching algorithm, the PAD (Presentation Attack + * Detection) algorithm, and any other algorithm(s) used by this biometric sensor. + * For example, <algorithm_1_info>;<algorithm_2_info>;<algorithm_3_info>. + * The format of each algorithm's info can be <vendor>/<algorithm>/<version>. + */ + String softwareInfo; +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl index 23f0202542..ce9e354dd3 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/HardwareInfo.aidl @@ -29,12 +29,7 @@ parcelable HardwareInfo { String hardwareVersion; /** - * The firmware version. - */ - String firmwareVersion; - - /** * The sensor's serial number. */ String serialNumber; -}
\ No newline at end of file +} diff --git a/biometrics/face/1.0/Android.bp b/biometrics/face/1.0/Android.bp index dd406f99c3..d3c262a0e7 100644 --- a/biometrics/face/1.0/Android.bp +++ b/biometrics/face/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.biometrics.face@1.0", root: "android.hardware", diff --git a/biometrics/face/1.0/default/Android.bp b/biometrics/face/1.0/default/Android.bp index d6ff087ee6..30cefed88c 100644 --- a/biometrics/face/1.0/default/Android.bp +++ b/biometrics/face/1.0/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.biometrics.face@1.0-service.example", defaults: ["hidl_defaults"], diff --git a/biometrics/face/1.0/vts/functional/Android.bp b/biometrics/face/1.0/vts/functional/Android.bp index ff4a6de889..259c4eca49 100644 --- a/biometrics/face/1.0/vts/functional/Android.bp +++ b/biometrics/face/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBiometricsFaceV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -21,4 +30,3 @@ cc_test { static_libs: ["android.hardware.biometrics.face@1.0"], test_suites: ["general-tests", "vts"], } - diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp index a4fcbfe54b..63f5ae41af 100644 --- a/biometrics/face/aidl/Android.bp +++ b/biometrics/face/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.biometrics.face", vendor_available: true, diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl index 8fd6c5f9a8..c19534c016 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -58,7 +59,5 @@ enum AcquiredInfo { VENDOR = 22, FIRST_FRAME_RECEIVED = 23, DARK_GLASSES_DETECTED = 24, - FACE_COVERING_DETECTED = 25, - EYES_NOT_VISIBLE = 26, - MOUTH_NOT_VISIBLE = 27, + MOUTH_COVERING_DETECTED = 25, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl index a9e4de3bc3..20bc76779b 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/AuthenticationFrame.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl index a93510160b..aa51343281 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/BaseFrame.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -33,7 +34,7 @@ package android.hardware.biometrics.face; @VintfStability parcelable BaseFrame { - android.hardware.biometrics.face.AcquiredInfo acquiredInfo; + android.hardware.biometrics.face.AcquiredInfo acquiredInfo = android.hardware.biometrics.face.AcquiredInfo.INSUFFICIENT; int vendorCode; float pan; float tilt; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl index cc2bf53c1d..6be8c8e975 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Cell.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl index cc78e6b077..982e759180 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -34,6 +35,6 @@ package android.hardware.biometrics.face; @VintfStability parcelable EnrollmentFrame { @nullable android.hardware.biometrics.face.Cell cell; - android.hardware.biometrics.face.EnrollmentStage stage; + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.FIRST_FRAME_RECEIVED; android.hardware.biometrics.face.BaseFrame data; } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl index fefac68ad6..6be6e0bbdd 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStage.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl index d13eccd0fe..232bd52813 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -33,6 +34,6 @@ package android.hardware.biometrics.face; @VintfStability parcelable EnrollmentStageConfig { - android.hardware.biometrics.face.EnrollmentStage stage; + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.FIRST_FRAME_RECEIVED; List<android.hardware.biometrics.face.Cell> cells; } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl index 3603c4e08c..8e99ad6529 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/EnrollmentType.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl index 6bbe7871ac..0437f0708c 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Error.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -40,4 +41,5 @@ enum Error { CANCELED = 5, UNABLE_TO_REMOVE = 6, VENDOR = 8, + REENROLL_REQUIRED = 16, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl index 481b678157..a215b99f72 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/FaceSensorType.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -33,6 +34,7 @@ package android.hardware.biometrics.face; @Backing(type="byte") @VintfStability enum FaceSensorType { - RGB = 0, - IR = 1, + UNKNOWN = 0, + RGB = 1, + IR = 2, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl index d9e561d518..a8faf06a26 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/Feature.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl index bfaf90d0e1..0d1ef45d8e 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/IFace.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl index c9165e1ab6..205429bd7a 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -33,7 +34,7 @@ package android.hardware.biometrics.face; @VintfStability interface ISession { - void generateChallenge(in int cookie, in int timeoutSec); + void generateChallenge(in int cookie); void revokeChallenge(in int cookie, in long challenge); android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in android.hardware.common.NativeHandle previewSurface); android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long operationId); diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl index 6127c7b956..d6ebbb6208 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISessionCallback.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl index 23a8d4dddc..c55a600eed 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SensorProps.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -34,7 +35,7 @@ package android.hardware.biometrics.face; @VintfStability parcelable SensorProps { android.hardware.biometrics.common.CommonProps commonProps; - android.hardware.biometrics.face.FaceSensorType sensorType; + android.hardware.biometrics.face.FaceSensorType sensorType = android.hardware.biometrics.face.FaceSensorType.RGB; boolean halControlsPreview; int enrollPreviewWidth; int enrollPreviewHeight; diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl index 3792eae17f..4db47c9c67 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/SessionState.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl index 217a9bbfb1..a3b229e83a 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -187,7 +187,7 @@ enum AcquiredInfo { */ ROLL_TOO_EXTREME = 18, - /** + /** * The user’s face has been obscured by some object. * * The user should be informed to remove any objects from the line of sight from @@ -230,18 +230,5 @@ enum AcquiredInfo { * A face mask or face covering detected. This can be useful for providing relevant feedback to * the user and enabling an alternative authentication logic if the implementation supports it. */ - FACE_COVERING_DETECTED = 25, - - /** - * Either one or both eyes are not visible in the frame. Prefer to use DARK_GLASSES_DETECTED if - * the eyes are not visible due to dark glasses. - */ - EYES_NOT_VISIBLE = 26, - - /** - * The mouth is not visible in the frame. Prefer to use MASK_DETECTED if the mouth is not - * visible due to a mask. - */ - MOUTH_NOT_VISIBLE = 27, + MOUTH_COVERING_DETECTED = 25, } - diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl index 9e6b98adfa..85535f920d 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/BaseFrame.aidl @@ -29,7 +29,7 @@ parcelable BaseFrame { * Information about the frame that can be used by the framework to provide feedback to the * user, for example ask the user to move their face in a certain way. */ - AcquiredInfo acquiredInfo; + AcquiredInfo acquiredInfo = AcquiredInfo.INSUFFICIENT; /** * If acquiredInfo is set to AcquiredInfo::VENDOR. This is the index into the configuration diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl index d4f9771d03..ea0a502166 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -16,9 +16,9 @@ package android.hardware.biometrics.face; +import android.hardware.biometrics.face.BaseFrame; import android.hardware.biometrics.face.Cell; import android.hardware.biometrics.face.EnrollmentStage; -import android.hardware.biometrics.face.BaseFrame; /** * Describes an individual frame captured during enrollment. @@ -33,7 +33,7 @@ parcelable EnrollmentFrame { /** * The enrollment stage for which this frame was captured. */ - EnrollmentStage stage; + EnrollmentStage stage = EnrollmentStage.FIRST_FRAME_RECEIVED; /** * The frame metadata. Can be used by the framework to provide user feedback. diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl index 0b64e2bfbd..3c31fcc977 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -24,7 +24,7 @@ parcelable EnrollmentStageConfig { /** * The stage that's being configured. */ - EnrollmentStage stage; + EnrollmentStage stage = EnrollmentStage.FIRST_FRAME_RECEIVED; /** * Optional list of cells that must be completed to finish this stage. diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl index 7230128989..6f3264b4b6 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/Error.aidl @@ -87,5 +87,9 @@ enum Error { * * LOCKOUT_PERMANENT = 9 */ -} + /** + * Authentication cannot be performed because re-enrollment is required. + */ + REENROLL_REQUIRED = 16, +} diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl index 2a5dd20be1..57f39d4f51 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/FaceSensorType.aidl @@ -16,9 +16,4 @@ package android.hardware.biometrics.face; -@VintfStability -@Backing(type="byte") -enum FaceSensorType { - RGB, - IR -} +@VintfStability @Backing(type="byte") enum FaceSensorType { UNKNOWN, RGB, IR } diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl index 6f2014a61f..66c7c38710 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl @@ -45,7 +45,7 @@ interface ISession { * to allow addition of biometric enrollments. * To secure this path, the following path is taken: * 1) Upon user requesting face enroll, the framework requests - * IFace#generateChallenge + * ISession#generateChallenge * 2) Framework sends the challenge to the credential subsystem, and upon credential * confirmation, a HAT is created, containing the challenge in the "challenge" field. * 3) Framework sends the HAT to the HAL, e.g. ISession#enroll. @@ -53,11 +53,10 @@ interface ISession { * 5) Implementation now has confidence that the user entered their credential to allow * biometric enrollment. * - * Note that the interface allows multiple in-flight challenges. For example, invoking - * generateChallenge(0, 0, timeoutSec) twice does not invalidate the first challenge. The - * challenge is invalidated only when: - * 1) The provided timeout expires, or - * 2) IFace#revokeChallenge is invoked + * Note that this interface allows multiple in-flight challenges. Invoking generateChallenge + * twice does not invalidate the first challenge. The challenge is invalidated only when: + * 1) Its lifespan exceeds the HAL's internal challenge timeout + * 2) IFingerprint#revokeChallenge is invoked * * For example, the following is a possible table of valid challenges: * ---------------------------------------------- @@ -70,9 +69,8 @@ interface ISession { * ---------------------------------------------- * * @param cookie A unique number identifying this operation - * @param timeoutSec Duration for which the challenge is valid for */ - void generateChallenge(in int cookie, in int timeoutSec); + void generateChallenge(in int cookie); /** * revokeChallenge: @@ -113,7 +111,7 @@ interface ISession { * * Before capturing face data, the implementation must first verify the authenticity and * integrity of the provided HardwareAuthToken. In addition, it must check that the challenge - * within the provided HardwareAuthToken is valid. See IFace#generateChallenge. If any of + * within the provided HardwareAuthToken is valid. See ISession#generateChallenge. If any of * the above checks fail, the framework must be notified via ISessionCallback#onError and the * HAL must notify the framework when it returns to the idle state. See * Error::UNABLE_TO_PROCESS. diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl index 091e3225a3..b11b436098 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/SensorProps.aidl @@ -29,7 +29,7 @@ parcelable SensorProps { /** * A statically configured sensor type representing this face sensor. */ - FaceSensorType sensorType; + FaceSensorType sensorType = FaceSensorType.RGB; /** * Whether or not the HAL is responsible for showing the face enrollment preview to the user. @@ -76,4 +76,3 @@ parcelable SensorProps { */ boolean supportsDetectInteraction; } - diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp index a13b8cb09d..d72411e6e2 100644 --- a/biometrics/face/aidl/default/Android.bp +++ b/biometrics/face/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.biometrics.face-service.example", relative_install_path: "hw", diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp index 2b4085054b..73e50f3151 100644 --- a/biometrics/face/aidl/default/Face.cpp +++ b/biometrics/face/aidl/default/Face.cpp @@ -26,14 +26,13 @@ const FaceSensorType kSensorType = FaceSensorType::RGB; const bool kHalControlsPreview = true; const std::string kHwDeviceName = "faceSensor"; const std::string kHardwareVersion = "vendor/model/revision"; -const std::string kFirmwareVersion = "1.01"; const std::string kSerialNumber = "00000001"; +const std::string kSoftwareVersion = "vendor1/algorithm1/version;vendor2/algorithm2/version"; ndk::ScopedAStatus Face::getSensorProps(std::vector<SensorProps>* return_val) { common::HardwareInfo hardware_info; hardware_info.deviceName = kHwDeviceName; hardware_info.hardwareVersion = kHardwareVersion; - hardware_info.firmwareVersion = kFirmwareVersion; hardware_info.serialNumber = kSerialNumber; common::CommonProps commonProps; @@ -41,6 +40,7 @@ ndk::ScopedAStatus Face::getSensorProps(std::vector<SensorProps>* return_val) { commonProps.sensorStrength = kSensorStrength; commonProps.maxEnrollmentsPerUser = kMaxEnrollmentsPerUser; commonProps.hardwareInfo = {std::move(hardware_info)}; + commonProps.softwareInfo = kSoftwareVersion; SensorProps props; props.commonProps = std::move(commonProps); diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp index a7130e62d0..ce6c5572e6 100644 --- a/biometrics/face/aidl/default/Session.cpp +++ b/biometrics/face/aidl/default/Session.cpp @@ -37,7 +37,7 @@ class CancellationSignal : public common::BnCancellationSignal { Session::Session(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {} -ndk::ScopedAStatus Session::generateChallenge(int32_t /*cookie*/, int32_t /*timeoutSec*/) { +ndk::ScopedAStatus Session::generateChallenge(int32_t /*cookie*/) { LOG(INFO) << "generateChallenge"; if (cb_) { cb_->onStateChanged(0, SessionState::GENERATING_CHALLENGE); diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h index 0651726d0a..eb9ae83342 100644 --- a/biometrics/face/aidl/default/Session.h +++ b/biometrics/face/aidl/default/Session.h @@ -30,7 +30,7 @@ class Session : public BnSession { public: explicit Session(std::shared_ptr<ISessionCallback> cb); - ndk::ScopedAStatus generateChallenge(int32_t cookie, int32_t timeoutSec) override; + ndk::ScopedAStatus generateChallenge(int32_t cookie) override; ndk::ScopedAStatus revokeChallenge(int32_t cookie, int64_t challenge) override; diff --git a/biometrics/face/aidl/vts/Android.bp b/biometrics/face/aidl/vts/Android.bp index a4c76f573a..c5660b1e01 100644 --- a/biometrics/face/aidl/vts/Android.bp +++ b/biometrics/face/aidl/vts/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBiometricsFaceTargetTest", defaults: [ diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp index 25bd48db70..3378930fe2 100644 --- a/biometrics/fingerprint/2.1/Android.bp +++ b/biometrics/fingerprint/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.biometrics.fingerprint@2.1", root: "android.hardware", diff --git a/biometrics/fingerprint/2.1/default/Android.bp b/biometrics/fingerprint/2.1/default/Android.bp index ec4838bd9d..4d5cc8d3ee 100644 --- a/biometrics/fingerprint/2.1/default/Android.bp +++ b/biometrics/fingerprint/2.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.biometrics.fingerprint@2.1-service", defaults: ["hidl_defaults"], diff --git a/biometrics/fingerprint/2.1/vts/functional/Android.bp b/biometrics/fingerprint/2.1/vts/functional/Android.bp index 7e3f3406bb..0935bf61c2 100644 --- a/biometrics/fingerprint/2.1/vts/functional/Android.bp +++ b/biometrics/fingerprint/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBiometricsFingerprintV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -21,4 +30,3 @@ cc_test { static_libs: ["android.hardware.biometrics.fingerprint@2.1"], test_suites: ["general-tests", "vts"], } - diff --git a/biometrics/fingerprint/2.2/Android.bp b/biometrics/fingerprint/2.2/Android.bp index a8f202c2c0..bea8d44351 100644 --- a/biometrics/fingerprint/2.2/Android.bp +++ b/biometrics/fingerprint/2.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.biometrics.fingerprint@2.2", root: "android.hardware", diff --git a/biometrics/fingerprint/2.2/default/Android.bp b/biometrics/fingerprint/2.2/default/Android.bp index 8931308936..f4fb57f20c 100644 --- a/biometrics/fingerprint/2.2/default/Android.bp +++ b/biometrics/fingerprint/2.2/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.biometrics.fingerprint@2.2-service.example", defaults: ["hidl_defaults"], diff --git a/biometrics/fingerprint/2.2/vts/functional/Android.bp b/biometrics/fingerprint/2.2/vts/functional/Android.bp index 5e8e7c80be..02f833ac0c 100644 --- a/biometrics/fingerprint/2.2/vts/functional/Android.bp +++ b/biometrics/fingerprint/2.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBiometricsFingerprintV2_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/biometrics/fingerprint/2.3/Android.bp b/biometrics/fingerprint/2.3/Android.bp index cf635029f1..4608df7ebf 100644 --- a/biometrics/fingerprint/2.3/Android.bp +++ b/biometrics/fingerprint/2.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.biometrics.fingerprint@2.3", root: "android.hardware", diff --git a/biometrics/fingerprint/2.3/vts/functional/Android.bp b/biometrics/fingerprint/2.3/vts/functional/Android.bp index 521c0f41fd..100aa29cd0 100644 --- a/biometrics/fingerprint/2.3/vts/functional/Android.bp +++ b/biometrics/fingerprint/2.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBiometricsFingerprintV2_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index 6bf20386e1..7ee957dd88 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.biometrics.fingerprint", vendor_available: true, diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 189095a7d7..a8e73fc82c 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -43,4 +44,5 @@ enum AcquiredInfo { START = 7, TOO_DARK = 8, TOO_BRIGHT = 9, + IMMOBILE = 10, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl index cdbc2d2f67..f79c576fb1 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl index c81cad2971..9c208c4e7c 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl index 2d44528f2e..07777c991b 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl index b583006d46..87eaf96a41 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -33,7 +34,7 @@ package android.hardware.biometrics.fingerprint; @VintfStability interface ISession { - void generateChallenge(in int cookie, in int timeoutSec); + void generateChallenge(in int cookie); void revokeChallenge(in int cookie, in long challenge); android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat); android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long operationId); diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl index f20f15324e..13c2b05081 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl index a6e8b4d245..515ddaa358 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl index 53ac6dd917..c7a4002c11 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -34,7 +35,7 @@ package android.hardware.biometrics.fingerprint; @VintfStability parcelable SensorProps { android.hardware.biometrics.common.CommonProps commonProps; - android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType; + android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType = android.hardware.biometrics.fingerprint.FingerprintSensorType.UNKNOWN; android.hardware.biometrics.fingerprint.SensorLocation[] sensorLocations; boolean supportsNavigationGestures; boolean supportsDetectInteraction; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl index 05dd85bbfd..9b0b6f6a77 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SessionState.aidl @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 3709a64b78..bf11daa817 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -75,5 +75,12 @@ enum AcquiredInfo { * the image was too bright to be used for matching. */ TOO_BRIGHT, + + /** + * This message may be sent during enrollment if the same area of the finger has already + * been captured during this enrollment session. In general, enrolling multiple areas of the + * same finger can help against false rejections. + */ + IMMOBILE, } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index ab7930d81b..ef2e6fc499 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -61,7 +61,7 @@ interface ISession { * to allow addition of biometric enrollments. * To secure this path, the following path is taken: * 1) Upon user requesting fingerprint enroll, the framework requests - * IFingerprint#generateChallenge + * ISession#generateChallenge * 2) Framework sends the challenge to the credential subsystem, and upon credential * confirmation, a HAT is created, containing the challenge in the "challenge" field. * 3) Framework sends the HAT to the HAL, e.g. ISession#enroll. @@ -69,10 +69,9 @@ interface ISession { * 5) Implementation now has confidence that the user entered their credential to allow * biometric enrollment. * - * Note that the interface allows multiple in-flight challenges. For example, invoking - * generateChallenge(0, 0, timeoutSec, cb) twice does not invalidate the first challenge. The - * challenge is invalidated only when: - * 1) The provided timeout expires, or + * Note that this interface allows multiple in-flight challenges. Invoking generateChallenge + * twice does not invalidate the first challenge. The challenge is invalidated only when: + * 1) Its lifespan exceeds the HAL's internal challenge timeout * 2) IFingerprint#revokeChallenge is invoked * * For example, the following is a possible table of valid challenges: @@ -86,9 +85,8 @@ interface ISession { * ---------------------------------------------- * * @param cookie A unique number identifying this operation - * @param timeoutSec Duration for which the challenge is valid for */ - void generateChallenge(in int cookie, in int timeoutSec); + void generateChallenge(in int cookie); /** * revokeChallenge: @@ -117,7 +115,7 @@ interface ISession { * * Before capturing fingerprint data, the implementation must first verify the authenticity and * integrity of the provided HardwareAuthToken. In addition, it must check that the challenge - * within the provided HardwareAuthToken is valid. See IFingerprint#generateChallenge. If any of + * within the provided HardwareAuthToken is valid. See ISession#generateChallenge. If any of * the above checks fail, the framework must be notified via ISessionCallback#onError and the * HAL must notify the framework when it returns to the idle state. See * Error::UNABLE_TO_PROCESS. diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl index 5222f3ea3a..fd2cf47d9e 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -30,7 +30,7 @@ parcelable SensorProps { /** * A statically configured sensor type representing this fingerprint sensor. */ - FingerprintSensorType sensorType; + FingerprintSensorType sensorType = FingerprintSensorType.UNKNOWN; /** * A list of display-specific locations from where the sensor is usable from. See SensorLocation @@ -49,4 +49,3 @@ parcelable SensorProps { */ boolean supportsDetectInteraction; } - diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 24087cf036..80e6e02cf1 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.biometrics.fingerprint-service.example", vendor: true, @@ -6,9 +15,11 @@ cc_binary { vintf_fragments: ["fingerprint-default.xml"], local_include_dirs: ["include"], srcs: [ - "main.cpp", + "CancellationSignal.cpp", "Fingerprint.cpp", "Session.cpp", + "WorkerThread.cpp", + "main.cpp", ], shared_libs: [ "libbase", diff --git a/biometrics/fingerprint/aidl/default/CancellationSignal.cpp b/biometrics/fingerprint/aidl/default/CancellationSignal.cpp new file mode 100644 index 0000000000..659831616d --- /dev/null +++ b/biometrics/fingerprint/aidl/default/CancellationSignal.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 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 "CancellationSignal.h" + +#include <android-base/logging.h> +#include <chrono> + +namespace aidl::android::hardware::biometrics::fingerprint { + +CancellationSignal::CancellationSignal(std::promise<void>&& cancellationPromise) + : mCancellationPromise(std::move(cancellationPromise)) {} + +ndk::ScopedAStatus CancellationSignal::cancel() { + mCancellationPromise.set_value(); + return ndk::ScopedAStatus::ok(); +} + +bool shouldCancel(const std::future<void>& f) { + CHECK(f.valid()); + return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready; +} + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index 6f893468a8..206f5187e9 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -15,11 +15,12 @@ */ #include "Fingerprint.h" + #include "Session.h" namespace aidl::android::hardware::biometrics::fingerprint { namespace { - +constexpr size_t MAX_WORKER_QUEUE_SIZE = 5; constexpr int SENSOR_ID = 1; constexpr common::SensorStrength SENSOR_STRENGTH = common::SensorStrength::STRONG; constexpr int MAX_ENROLLMENTS_PER_USER = 5; @@ -27,19 +28,19 @@ constexpr FingerprintSensorType SENSOR_TYPE = FingerprintSensorType::REAR; constexpr bool SUPPORTS_NAVIGATION_GESTURES = true; constexpr char HW_DEVICE_NAME[] = "fingerprintSensor"; constexpr char HW_VERSION[] = "vendor/model/revision"; -constexpr char FW_VERSION[] = "1.01"; constexpr char SERIAL_NUMBER[] = "00000001"; +constexpr char SW_VERSION[] = "vendor1/algorithm1/version;vendor2/algorithm2/version"; } // namespace -Fingerprint::Fingerprint() {} +Fingerprint::Fingerprint() + : mEngine(std::make_unique<FakeFingerprintEngine>()), mWorker(MAX_WORKER_QUEUE_SIZE) {} ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) { - std::vector<common::HardwareInfo> hardwareInfos = { - {HW_DEVICE_NAME, HW_VERSION, FW_VERSION, SERIAL_NUMBER}}; + std::vector<common::HardwareInfo> hardwareInfos = {{HW_DEVICE_NAME, HW_VERSION, SERIAL_NUMBER}}; common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER, - hardwareInfos}; + hardwareInfos, SW_VERSION}; SensorLocation sensorLocation = {0 /* displayId */, 0 /* sensorLocationX */, 0 /* sensorLocationY */, 0 /* sensorRadius */}; @@ -52,14 +53,19 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) { return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t /*userId*/, +ndk::ScopedAStatus Fingerprint::createSession(int32_t sensorId, int32_t userId, const std::shared_ptr<ISessionCallback>& cb, std::shared_ptr<ISession>* out) { - *out = SharedRefBase::make<Session>(cb); + CHECK(mSession == nullptr || mSession->isClosed()) << "Open session already exists!"; + + mSession = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker); + *out = mSession; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Fingerprint::reset() { + // Crash. The system will start a fresh instance of the HAL. + CHECK(false) << "Unable to reset. Crashing."; return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index c928df4dd5..9e6ac77a2f 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -14,93 +14,216 @@ * limitations under the License. */ -#include <aidl/android/hardware/biometrics/common/BnCancellationSignal.h> +#include "Session.h" + #include <android-base/logging.h> -#include "Session.h" +#include "CancellationSignal.h" namespace aidl::android::hardware::biometrics::fingerprint { -class CancellationSignal : public common::BnCancellationSignal { - public: - ndk::ScopedAStatus cancel() override { return ndk::ScopedAStatus::ok(); } -}; +Session::Session(int sensorId, int userId, std::shared_ptr<ISessionCallback> cb, + FakeFingerprintEngine* engine, WorkerThread* worker) + : mSensorId(sensorId), + mUserId(userId), + mCb(std::move(cb)), + mEngine(engine), + mWorker(worker), + mScheduledState(SessionState::IDLING), + mCurrentState(SessionState::IDLING) { + CHECK_GE(mSensorId, 0); + CHECK_GE(mUserId, 0); + CHECK(mEngine); + CHECK(mWorker); + CHECK(mCb); +} -Session::Session(std::shared_ptr<ISessionCallback> cb) : mCb(std::move(cb)) {} +void Session::scheduleStateOrCrash(SessionState state) { + CHECK(mScheduledState == SessionState::IDLING); + CHECK(mCurrentState == SessionState::IDLING); + mScheduledState = state; +} + +void Session::enterStateOrCrash(int cookie, SessionState state) { + CHECK(mScheduledState == state); + mCurrentState = mScheduledState; + mScheduledState = SessionState::IDLING; + mCb->onStateChanged(cookie, mCurrentState); +} -ndk::ScopedAStatus Session::generateChallenge(int32_t /*cookie*/, int32_t /*timeoutSec*/) { +void Session::enterIdling(int cookie) { + mCurrentState = SessionState::IDLING; + mCb->onStateChanged(cookie, mCurrentState); +} + +bool Session::isClosed() { + return mCurrentState == SessionState::CLOSED; +} + +ndk::ScopedAStatus Session::generateChallenge(int32_t cookie) { LOG(INFO) << "generateChallenge"; + scheduleStateOrCrash(SessionState::GENERATING_CHALLENGE); + + mWorker->schedule(Callable::from([this, cookie] { + enterStateOrCrash(cookie, SessionState::GENERATING_CHALLENGE); + mEngine->generateChallengeImpl(mCb.get()); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::revokeChallenge(int32_t /*cookie*/, int64_t /*challenge*/) { +ndk::ScopedAStatus Session::revokeChallenge(int32_t cookie, int64_t challenge) { LOG(INFO) << "revokeChallenge"; + scheduleStateOrCrash(SessionState::REVOKING_CHALLENGE); + + mWorker->schedule(Callable::from([this, cookie, challenge] { + enterStateOrCrash(cookie, SessionState::REVOKING_CHALLENGE); + mEngine->revokeChallengeImpl(mCb.get(), challenge); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::enroll(int32_t /*cookie*/, const keymaster::HardwareAuthToken& /*hat*/, - std::shared_ptr<common::ICancellationSignal>* /*out*/) { +ndk::ScopedAStatus Session::enroll(int32_t cookie, const keymaster::HardwareAuthToken& hat, + std::shared_ptr<common::ICancellationSignal>* out) { LOG(INFO) << "enroll"; + scheduleStateOrCrash(SessionState::ENROLLING); + + std::promise<void> cancellationPromise; + auto cancFuture = cancellationPromise.get_future(); + + mWorker->schedule(Callable::from([this, cookie, hat, cancFuture = std::move(cancFuture)] { + enterStateOrCrash(cookie, SessionState::ENROLLING); + if (shouldCancel(cancFuture)) { + mCb->onError(Error::CANCELED, 0 /* vendorCode */); + } else { + mEngine->enrollImpl(mCb.get(), hat); + } + enterIdling(cookie); + })); + + *out = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise)); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::authenticate(int32_t /*cookie*/, int64_t /*keystoreOperationId*/, +ndk::ScopedAStatus Session::authenticate(int32_t cookie, int64_t operationId, std::shared_ptr<common::ICancellationSignal>* out) { LOG(INFO) << "authenticate"; - if (mCb) { - mCb->onStateChanged(0, SessionState::AUTHENTICATING); - } - *out = SharedRefBase::make<CancellationSignal>(); + scheduleStateOrCrash(SessionState::AUTHENTICATING); + + std::promise<void> cancPromise; + auto cancFuture = cancPromise.get_future(); + + mWorker->schedule( + Callable::from([this, cookie, operationId, cancFuture = std::move(cancFuture)] { + enterStateOrCrash(cookie, SessionState::AUTHENTICATING); + if (shouldCancel(cancFuture)) { + mCb->onError(Error::CANCELED, 0 /* vendorCode */); + } else { + mEngine->authenticateImpl(mCb.get(), operationId); + } + enterIdling(cookie); + })); + + *out = SharedRefBase::make<CancellationSignal>(std::move(cancPromise)); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::detectInteraction( - int32_t /*cookie*/, std::shared_ptr<common::ICancellationSignal>* /*out*/) { +ndk::ScopedAStatus Session::detectInteraction(int32_t cookie, + std::shared_ptr<common::ICancellationSignal>* out) { LOG(INFO) << "detectInteraction"; + scheduleStateOrCrash(SessionState::DETECTING_INTERACTION); + + std::promise<void> cancellationPromise; + auto cancFuture = cancellationPromise.get_future(); + + mWorker->schedule(Callable::from([this, cookie, cancFuture = std::move(cancFuture)] { + enterStateOrCrash(cookie, SessionState::DETECTING_INTERACTION); + if (shouldCancel(cancFuture)) { + mCb->onError(Error::CANCELED, 0 /* vendorCode */); + } else { + mEngine->detectInteractionImpl(mCb.get()); + } + enterIdling(cookie); + })); + + *out = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise)); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::enumerateEnrollments(int32_t /*cookie*/) { +ndk::ScopedAStatus Session::enumerateEnrollments(int32_t cookie) { LOG(INFO) << "enumerateEnrollments"; - if (mCb) { - mCb->onStateChanged(0, SessionState::ENUMERATING_ENROLLMENTS); - mCb->onEnrollmentsEnumerated(std::vector<int32_t>()); - } + scheduleStateOrCrash(SessionState::ENUMERATING_ENROLLMENTS); + + mWorker->schedule(Callable::from([this, cookie] { + enterStateOrCrash(cookie, SessionState::ENUMERATING_ENROLLMENTS); + mEngine->enumerateEnrollmentsImpl(mCb.get()); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::removeEnrollments(int32_t /*cookie*/, - const std::vector<int32_t>& /*enrollmentIds*/) { +ndk::ScopedAStatus Session::removeEnrollments(int32_t cookie, + const std::vector<int32_t>& enrollmentIds) { LOG(INFO) << "removeEnrollments"; - if (mCb) { - mCb->onStateChanged(0, SessionState::REMOVING_ENROLLMENTS); - mCb->onEnrollmentsRemoved(std::vector<int32_t>()); - } + scheduleStateOrCrash(SessionState::REMOVING_ENROLLMENTS); + + mWorker->schedule(Callable::from([this, cookie, enrollmentIds] { + enterStateOrCrash(cookie, SessionState::REMOVING_ENROLLMENTS); + mEngine->removeEnrollmentsImpl(mCb.get(), enrollmentIds); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::getAuthenticatorId(int32_t /*cookie*/) { +ndk::ScopedAStatus Session::getAuthenticatorId(int32_t cookie) { LOG(INFO) << "getAuthenticatorId"; - if (mCb) { - mCb->onStateChanged(0, SessionState::GETTING_AUTHENTICATOR_ID); - mCb->onAuthenticatorIdRetrieved(0 /* authenticatorId */); - } + scheduleStateOrCrash(SessionState::GETTING_AUTHENTICATOR_ID); + + mWorker->schedule(Callable::from([this, cookie] { + enterStateOrCrash(cookie, SessionState::GETTING_AUTHENTICATOR_ID); + mEngine->getAuthenticatorIdImpl(mCb.get()); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::invalidateAuthenticatorId(int32_t /*cookie*/) { +ndk::ScopedAStatus Session::invalidateAuthenticatorId(int32_t cookie) { LOG(INFO) << "invalidateAuthenticatorId"; + scheduleStateOrCrash(SessionState::INVALIDATING_AUTHENTICATOR_ID); + + mWorker->schedule(Callable::from([this, cookie] { + enterStateOrCrash(cookie, SessionState::INVALIDATING_AUTHENTICATOR_ID); + mEngine->invalidateAuthenticatorIdImpl(mCb.get()); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::resetLockout(int32_t /*cookie*/, - const keymaster::HardwareAuthToken& /*hat*/) { +ndk::ScopedAStatus Session::resetLockout(int32_t cookie, const keymaster::HardwareAuthToken& hat) { LOG(INFO) << "resetLockout"; + scheduleStateOrCrash(SessionState::RESETTING_LOCKOUT); + + mWorker->schedule(Callable::from([this, cookie, hat] { + enterStateOrCrash(cookie, SessionState::RESETTING_LOCKOUT); + mEngine->resetLockoutImpl(mCb.get(), hat); + enterIdling(cookie); + })); + return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::close(int32_t /*cookie*/) { +ndk::ScopedAStatus Session::close(int32_t cookie) { LOG(INFO) << "close"; + CHECK(mCurrentState == SessionState::IDLING) << "Can't close a non-idling session. Crashing."; + mCurrentState = SessionState::CLOSED; + mCb->onStateChanged(cookie, mCurrentState); return ndk::ScopedAStatus::ok(); } @@ -119,4 +242,5 @@ ndk::ScopedAStatus Session::onUiReady() { LOG(INFO) << "onUiReady"; return ndk::ScopedAStatus::ok(); } + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/WorkerThread.cpp b/biometrics/fingerprint/aidl/default/WorkerThread.cpp index 512efb8d5d..d1a63d07ee 100644 --- a/biometrics/fingerprint/aidl/default/WorkerThread.cpp +++ b/biometrics/fingerprint/aidl/default/WorkerThread.cpp @@ -36,7 +36,7 @@ WorkerThread::~WorkerThread() { mThread.join(); } -bool WorkerThread::schedule(Task&& task) { +bool WorkerThread::schedule(std::unique_ptr<Callable> task) { if (mIsDestructing) { return false; } @@ -58,10 +58,10 @@ void WorkerThread::threadFunc() { if (mIsDestructing) { return; } - Task task = std::move(mQueue.front()); + std::unique_ptr<Callable> task = std::move(mQueue.front()); mQueue.pop_front(); lock.unlock(); - task(); + (*task)(); } } diff --git a/biometrics/fingerprint/aidl/default/include/Callable.h b/biometrics/fingerprint/aidl/default/include/Callable.h new file mode 100644 index 0000000000..c6295117e5 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/Callable.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 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 + +namespace aidl::android::hardware::biometrics::fingerprint { + +// Interface for representing parameterless functions. Unlike std::function<void()>, this can also +// represent move-only lambdas. +class Callable { + public: + virtual void operator()() = 0; + virtual ~Callable() = default; + + // Creates a heap-allocated Callable instance from any function object. + template <typename T> + static std::unique_ptr<Callable> from(T func); + + private: + template <typename T> + class AnyFuncWrapper; +}; + +// Private helper class for wrapping any function object into a Callable. +template <typename T> +class Callable::AnyFuncWrapper : public Callable { + public: + explicit AnyFuncWrapper(T func) : mFunc(std::move(func)) {} + + void operator()() override { mFunc(); } + + private: + T mFunc; +}; + +template <typename T> +std::unique_ptr<Callable> Callable::from(T func) { + return std::make_unique<AnyFuncWrapper<T>>(std::move(func)); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint
\ No newline at end of file diff --git a/biometrics/fingerprint/aidl/default/include/CancellationSignal.h b/biometrics/fingerprint/aidl/default/include/CancellationSignal.h new file mode 100644 index 0000000000..99f2fbae97 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/CancellationSignal.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 <aidl/android/hardware/biometrics/common/BnCancellationSignal.h> +#include <aidl/android/hardware/biometrics/fingerprint/ISessionCallback.h> +#include <functional> +#include <future> + +#include "WorkerThread.h" + +namespace aidl::android::hardware::biometrics::fingerprint { + +class CancellationSignal : public common::BnCancellationSignal { + public: + explicit CancellationSignal(std::promise<void>&& cancellationPromise); + + ndk::ScopedAStatus cancel() override; + + private: + std::promise<void> mCancellationPromise; +}; + +// Returns whether the given cancellation future is ready, i.e. whether the operation corresponding +// to this future should be cancelled. +bool shouldCancel(const std::future<void>& cancellationFuture); + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h new file mode 100644 index 0000000000..42e1aa5357 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2021 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 <android-base/logging.h> + +namespace aidl::android::hardware::biometrics::fingerprint { + +class FakeFingerprintEngine { + public: + void generateChallengeImpl(ISessionCallback* cb) { + LOG(INFO) << "generateChallengeImpl"; + cb->onChallengeGenerated(0 /* challenge */); + } + + void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) { + LOG(INFO) << "revokeChallengeImpl"; + cb->onChallengeRevoked(challenge); + } + + void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) { + LOG(INFO) << "enrollImpl"; + cb->onEnrollmentProgress(0 /* enrollmentId */, 0 /* remaining */); + } + + void authenticateImpl(ISessionCallback* cb, int64_t /*operationId*/) { + LOG(INFO) << "authenticateImpl"; + cb->onAuthenticationSucceeded(0 /* enrollmentId */, {} /* hat */); + } + + void detectInteractionImpl(ISessionCallback* cb) { + LOG(INFO) << "detectInteractionImpl"; + cb->onInteractionDetected(); + } + + void enumerateEnrollmentsImpl(ISessionCallback* cb) { + LOG(INFO) << "enumerateEnrollmentsImpl"; + cb->onEnrollmentsEnumerated({} /* enrollmentIds */); + } + + void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds) { + LOG(INFO) << "removeEnrollmentsImpl"; + cb->onEnrollmentsRemoved(enrollmentIds); + } + + void getAuthenticatorIdImpl(ISessionCallback* cb) { + LOG(INFO) << "getAuthenticatorIdImpl"; + cb->onAuthenticatorIdRetrieved(0 /* authenticatorId */); + } + + void invalidateAuthenticatorIdImpl(ISessionCallback* cb) { + LOG(INFO) << "invalidateAuthenticatorIdImpl"; + cb->onAuthenticatorIdInvalidated(0 /* newAuthenticatorId */); + } + + void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) { + LOG(INFO) << "resetLockoutImpl"; + cb->onLockoutCleared(); + } +}; + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h index ce1366cf4c..9b43419718 100644 --- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h +++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h @@ -18,9 +18,13 @@ #include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h> +#include "FakeFingerprintEngine.h" +#include "Session.h" +#include "WorkerThread.h" + namespace aidl::android::hardware::biometrics::fingerprint { -class Fingerprint final : public BnFingerprint { +class Fingerprint : public BnFingerprint { public: Fingerprint(); @@ -31,6 +35,11 @@ class Fingerprint final : public BnFingerprint { std::shared_ptr<ISession>* out) override; ndk::ScopedAStatus reset() override; + + private: + std::unique_ptr<FakeFingerprintEngine> mEngine; + WorkerThread mWorker; + std::shared_ptr<Session> mSession; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index 99d806b5e5..d2f0c19777 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -19,6 +19,9 @@ #include <aidl/android/hardware/biometrics/fingerprint/BnSession.h> #include <aidl/android/hardware/biometrics/fingerprint/ISessionCallback.h> +#include "FakeFingerprintEngine.h" +#include "WorkerThread.h" + namespace aidl::android::hardware::biometrics::fingerprint { namespace common = aidl::android::hardware::biometrics::common; @@ -26,16 +29,17 @@ namespace keymaster = aidl::android::hardware::keymaster; class Session : public BnSession { public: - explicit Session(std::shared_ptr<ISessionCallback> cb); + Session(int sensorId, int userId, std::shared_ptr<ISessionCallback> cb, + FakeFingerprintEngine* engine, WorkerThread* worker); - ndk::ScopedAStatus generateChallenge(int32_t cookie, int32_t timeoutSec) override; + ndk::ScopedAStatus generateChallenge(int32_t cookie) override; ndk::ScopedAStatus revokeChallenge(int32_t cookie, int64_t challenge) override; ndk::ScopedAStatus enroll(int32_t cookie, const keymaster::HardwareAuthToken& hat, std::shared_ptr<common::ICancellationSignal>* out) override; - ndk::ScopedAStatus authenticate(int32_t cookie, int64_t keystoreOperationId, + ndk::ScopedAStatus authenticate(int32_t cookie, int64_t operationId, std::shared_ptr<common::ICancellationSignal>* out) override; ndk::ScopedAStatus detectInteraction( @@ -62,8 +66,29 @@ class Session : public BnSession { ndk::ScopedAStatus onUiReady() override; + bool isClosed(); + private: + // Crashes the HAL if it's not currently idling because that would be an invalid state machine + // transition. Otherwise, sets the scheduled state to the given state. + void scheduleStateOrCrash(SessionState state); + + // Crashes the HAL if the provided state doesn't match the previously scheduled state. + // Otherwise, transitions into the provided state, clears the scheduled state, and notifies + // the client about the transition by calling ISessionCallback#onStateChanged. + void enterStateOrCrash(int cookie, SessionState state); + + // Sets the current state to SessionState::IDLING and notifies the client about the transition + // by calling ISessionCallback#onStateChanged. + void enterIdling(int cookie); + + int32_t mSensorId; + int32_t mUserId; std::shared_ptr<ISessionCallback> mCb; + FakeFingerprintEngine* mEngine; + WorkerThread* mWorker; + SessionState mScheduledState; + SessionState mCurrentState; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/WorkerThread.h b/biometrics/fingerprint/aidl/default/include/WorkerThread.h index 49104c85e2..6fff4f2cb7 100644 --- a/biometrics/fingerprint/aidl/default/include/WorkerThread.h +++ b/biometrics/fingerprint/aidl/default/include/WorkerThread.h @@ -21,9 +21,9 @@ #include <queue> #include <thread> -namespace aidl::android::hardware::biometrics::fingerprint { +#include "Callable.h" -using Task = std::function<void()>; +namespace aidl::android::hardware::biometrics::fingerprint { // A class that encapsulates a worker thread and a task queue, and provides a convenient interface // for a Session to schedule its tasks for asynchronous execution. @@ -47,7 +47,12 @@ class WorkerThread final { // If the internal queue is not full, pushes a task at the end of the queue and returns true. // Otherwise, returns false. If the queue is busy, blocks until it becomes available. - bool schedule(Task&& task); + // This method expects heap-allocated tasks because it's the simplest way to represent function + // objects of any type. Stack-allocated std::function could be used instead, but it cannot + // represent functions with move-only captures because std::function is inherently copyable. + // Not being able to pass move-only lambdas is a major limitation for the HAL implementation, + // so heap-allocated tasks that share a common interface (Callable) were chosen instead. + bool schedule(std::unique_ptr<Callable> task); private: // The function that runs on the internal thread. Sequentially runs the available tasks from @@ -63,7 +68,7 @@ class WorkerThread final { std::atomic<bool> mIsDestructing; // Queue that's guarded by mQueueMutex and mQueueCond. - std::deque<Task> mQueue; + std::deque<std::unique_ptr<Callable>> mQueue; std::mutex mQueueMutex; std::condition_variable mQueueCond; diff --git a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp b/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp index ba901ad5ca..0d5014bb84 100644 --- a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp @@ -25,13 +25,14 @@ namespace { +using aidl::android::hardware::biometrics::fingerprint::Callable; using aidl::android::hardware::biometrics::fingerprint::WorkerThread; using namespace std::chrono_literals; TEST(WorkerThreadTest, ScheduleReturnsTrueWhenQueueHasSpace) { WorkerThread worker(1 /*maxQueueSize*/); for (int i = 0; i < 100; ++i) { - EXPECT_TRUE(worker.schedule([] {})); + EXPECT_TRUE(worker.schedule(Callable::from([] {}))); // Allow enough time for the previous task to be processed. std::this_thread::sleep_for(2ms); } @@ -40,16 +41,16 @@ TEST(WorkerThreadTest, ScheduleReturnsTrueWhenQueueHasSpace) { TEST(WorkerThreadTest, ScheduleReturnsFalseWhenQueueIsFull) { WorkerThread worker(2 /*maxQueueSize*/); // Add a long-running task. - worker.schedule([] { std::this_thread::sleep_for(1s); }); + worker.schedule(Callable::from([] { std::this_thread::sleep_for(1s); })); // Allow enough time for the worker to start working on the previous task. std::this_thread::sleep_for(2ms); // Fill the worker's queue to the maximum. - worker.schedule([] {}); - worker.schedule([] {}); + worker.schedule(Callable::from([] {})); + worker.schedule(Callable::from([] {})); - EXPECT_FALSE(worker.schedule([] {})); + EXPECT_FALSE(worker.schedule(Callable::from([] {}))); } TEST(WorkerThreadTest, TasksExecuteInOrder) { @@ -58,19 +59,19 @@ TEST(WorkerThreadTest, TasksExecuteInOrder) { std::vector<int> results; for (int i = 0; i < NUM_TASKS; ++i) { - worker.schedule([&results, i] { + worker.schedule(Callable::from([&results, i] { // Delay tasks differently to provoke races. std::this_thread::sleep_for(std::chrono::nanoseconds(100 - i % 100)); // Unguarded write to results to provoke races. results.push_back(i); - }); + })); } std::promise<void> promise; auto future = promise.get_future(); // Schedule a special task to signal when all of the tasks are finished. - worker.schedule([&promise] { promise.set_value(); }); + worker.schedule(Callable::from([&promise] { promise.set_value(); })); auto status = future.wait_for(1s); ASSERT_EQ(status, std::future_status::ready); @@ -86,11 +87,11 @@ TEST(WorkerThreadTest, ExecutionStopsAfterWorkerIsDestroyed) { { WorkerThread worker(2 /*maxQueueSize*/); - worker.schedule([&promise1] { + worker.schedule(Callable::from([&promise1] { promise1.set_value(); std::this_thread::sleep_for(200ms); - }); - worker.schedule([&promise2] { promise2.set_value(); }); + })); + worker.schedule(Callable::from([&promise2] { promise2.set_value(); })); // Make sure the first task is executing. auto status1 = future1.wait_for(1s); diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp index 07bccb5965..0d83e744f2 100644 --- a/biometrics/fingerprint/aidl/vts/Android.bp +++ b/biometrics/fingerprint/aidl/vts/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBiometricsFingerprintTargetTest", defaults: [ diff --git a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp index ddbc0fee5a..894fdfe362 100644 --- a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp +++ b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include <aidl/Gtest.h> #include <aidl/Vintf.h> #include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h> @@ -30,25 +31,35 @@ constexpr int kSensorId = 0; constexpr int kUserId = 0; constexpr auto kCallbackTimeout = std::chrono::seconds(1); -enum class SessionCallbackMethodName { +enum class MethodName { kOnStateChanged, }; -struct SessionCallbackInvocation { - SessionCallbackMethodName method_name; +struct Invocation { + MethodName methodName; + int32_t cookie; SessionState state; }; class SessionCallback : public BnSessionCallback { public: - explicit SessionCallback(std::promise<SessionCallbackInvocation> invocation_promise) - : invocation_promise_(std::move(invocation_promise)) {} + explicit SessionCallback() : mIsPromiseValid(false) {} + + void setPromise(std::promise<std::vector<Invocation>>&& promise) { + mPromise = std::move(promise); + mIsPromiseValid = true; + } - ndk::ScopedAStatus onStateChanged(int32_t /*cookie*/, SessionState state) override { - SessionCallbackInvocation invocation = {}; - invocation.method_name = SessionCallbackMethodName::kOnStateChanged; + ndk::ScopedAStatus onStateChanged(int32_t cookie, SessionState state) override { + Invocation invocation = {}; + invocation.methodName = MethodName::kOnStateChanged; + invocation.cookie = cookie; invocation.state = state; - invocation_promise_.set_value(invocation); + mInvocations.push_back(invocation); + if (state == SessionState::IDLING) { + assert(mIsPromiseValid); + mPromise.set_value(mInvocations); + } return ndk::ScopedAStatus::ok(); } @@ -73,26 +84,20 @@ class SessionCallback : public BnSessionCallback { return ndk::ScopedAStatus::ok(); } - ndk::ScopedAStatus onAuthenticationSucceeded(int32_t /*enrollmentId*/, - const keymaster::HardwareAuthToken& /*hat*/) override { + ndk::ScopedAStatus onAuthenticationSucceeded( + int32_t /*enrollmentId*/, const keymaster::HardwareAuthToken& /*hat*/) override { return ndk::ScopedAStatus::ok(); } - ndk::ScopedAStatus onAuthenticationFailed() override { - return ndk::ScopedAStatus::ok(); - } + ndk::ScopedAStatus onAuthenticationFailed() override { return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus onLockoutTimed(int64_t /*durationMillis*/) override { return ndk::ScopedAStatus::ok(); } - ndk::ScopedAStatus onLockoutPermanent() override { - return ndk::ScopedAStatus::ok(); - } + ndk::ScopedAStatus onLockoutPermanent() override { return ndk::ScopedAStatus::ok(); } - ndk::ScopedAStatus onLockoutCleared() override { - return ndk::ScopedAStatus::ok(); - } + ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus onInteractionDetected() override { return ndk::ScopedAStatus::ok(); } @@ -115,7 +120,9 @@ class SessionCallback : public BnSessionCallback { } private: - std::promise<SessionCallbackInvocation> invocation_promise_; + bool mIsPromiseValid; + std::vector<Invocation> mInvocations; + std::promise<std::vector<Invocation>> mPromise; }; class Fingerprint : public testing::TestWithParam<std::string> { @@ -123,28 +130,40 @@ class Fingerprint : public testing::TestWithParam<std::string> { void SetUp() override { AIBinder* binder = AServiceManager_waitForService(GetParam().c_str()); ASSERT_NE(binder, nullptr); - hal_ = IFingerprint::fromBinder(ndk::SpAIBinder(binder)); + mHal = IFingerprint::fromBinder(ndk::SpAIBinder(binder)); } - std::shared_ptr<IFingerprint> hal_; + std::shared_ptr<IFingerprint> mHal; }; TEST_P(Fingerprint, AuthenticateTest) { - std::promise<SessionCallbackInvocation> invocation_promise; - std::future<SessionCallbackInvocation> invocation_future = invocation_promise.get_future(); - std::shared_ptr<SessionCallback> session_cb = - ndk::SharedRefBase::make<SessionCallback>(std::move(invocation_promise)); + // Prepare the callback + std::promise<std::vector<Invocation>> promise; + auto future = promise.get_future(); + std::shared_ptr<SessionCallback> cb = ndk::SharedRefBase::make<SessionCallback>(); + cb->setPromise(std::move(promise)); + // Create a session std::shared_ptr<ISession> session; - ASSERT_TRUE(hal_->createSession(kSensorId, kUserId, session_cb, &session).isOk()); + ASSERT_TRUE(mHal->createSession(kSensorId, kUserId, cb, &session).isOk()); + + // Call authenticate + int32_t cookie = 123; + std::shared_ptr<common::ICancellationSignal> cancellationSignal; + ASSERT_TRUE(session->authenticate(cookie, 0, &cancellationSignal).isOk()); + + // Get the results + ASSERT_TRUE(future.wait_for(kCallbackTimeout) == std::future_status::ready); + std::vector<Invocation> invocations = future.get(); - std::shared_ptr<common::ICancellationSignal> cancel_cb; - ASSERT_TRUE(session->authenticate(0, 0, &cancel_cb).isOk()); - ASSERT_EQ(invocation_future.wait_for(kCallbackTimeout), std::future_status::ready); + // Close the session + ASSERT_TRUE(session->close(0).isOk()); - SessionCallbackInvocation invocation = invocation_future.get(); - EXPECT_EQ(invocation.method_name, SessionCallbackMethodName::kOnStateChanged); - EXPECT_EQ(invocation.state, SessionState::AUTHENTICATING); + ASSERT_FALSE(invocations.empty()); + EXPECT_EQ(invocations.front().methodName, MethodName::kOnStateChanged); + EXPECT_EQ(invocations.front().state, SessionState::AUTHENTICATING); + EXPECT_EQ(invocations.back().methodName, MethodName::kOnStateChanged); + EXPECT_EQ(invocations.back().state, SessionState::IDLING); } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Fingerprint); @@ -154,6 +173,7 @@ INSTANTIATE_TEST_SUITE_P( ::android::PrintInstanceNameToString); } // namespace +} // namespace aidl::android::hardware::biometrics::fingerprint int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); @@ -161,5 +181,3 @@ int main(int argc, char** argv) { ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); } - -} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp index 1cac820427..8d023c01d7 100644 --- a/bluetooth/1.0/Android.bp +++ b/bluetooth/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.bluetooth@1.0", root: "android.hardware", diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp index 6e39d541fb..70a42b7f9b 100644 --- a/bluetooth/1.0/default/Android.bp +++ b/bluetooth/1.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.bluetooth@1.0-impl", defaults: ["hidl_defaults"], diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp index e9f867f5f0..4806fef5ee 100644 --- a/bluetooth/1.0/vts/functional/Android.bp +++ b/bluetooth/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBluetoothV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/bluetooth/1.1/Android.bp b/bluetooth/1.1/Android.bp index c3967f028f..4feb28bd96 100644 --- a/bluetooth/1.1/Android.bp +++ b/bluetooth/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.bluetooth@1.1", root: "android.hardware", diff --git a/bluetooth/1.1/default/Android.bp b/bluetooth/1.1/default/Android.bp index 4f7fecbeb6..ce85db0515 100644 --- a/bluetooth/1.1/default/Android.bp +++ b/bluetooth/1.1/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.bluetooth@1.1-service", defaults: ["hidl_defaults"], diff --git a/bluetooth/1.1/vts/functional/Android.bp b/bluetooth/1.1/vts/functional/Android.bp index eb4a720f95..e64d5a9105 100644 --- a/bluetooth/1.1/vts/functional/Android.bp +++ b/bluetooth/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBluetoothV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/bluetooth/a2dp/1.0/Android.bp b/bluetooth/a2dp/1.0/Android.bp index d9ec982da8..7f39d4f55c 100644 --- a/bluetooth/a2dp/1.0/Android.bp +++ b/bluetooth/a2dp/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.bluetooth.a2dp@1.0", root: "android.hardware", diff --git a/bluetooth/a2dp/1.0/default/Android.bp b/bluetooth/a2dp/1.0/default/Android.bp index 5264899bb9..f368dd4ab2 100644 --- a/bluetooth/a2dp/1.0/default/Android.bp +++ b/bluetooth/a2dp/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.bluetooth.a2dp@1.0-impl.mock", relative_install_path: "hw", diff --git a/bluetooth/a2dp/1.0/vts/functional/Android.bp b/bluetooth/a2dp/1.0/vts/functional/Android.bp index df18fcc7c5..0d393bc29c 100644 --- a/bluetooth/a2dp/1.0/vts/functional/Android.bp +++ b/bluetooth/a2dp/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBluetoothA2dpV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/bluetooth/audio/2.0/Android.bp b/bluetooth/audio/2.0/Android.bp index 3fbd51f631..dd39f9f9d3 100644 --- a/bluetooth/audio/2.0/Android.bp +++ b/bluetooth/audio/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.bluetooth.audio@2.0", root: "android.hardware", diff --git a/bluetooth/audio/2.0/default/Android.bp b/bluetooth/audio/2.0/default/Android.bp index 8ed631e08f..9bca0ca9f2 100644 --- a/bluetooth/audio/2.0/default/Android.bp +++ b/bluetooth/audio/2.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.bluetooth.audio@2.0-impl", defaults: ["hidl_defaults"], diff --git a/bluetooth/audio/2.0/default/BluetoothAudioProvidersFactory.cpp b/bluetooth/audio/2.0/default/BluetoothAudioProvidersFactory.cpp index df89cc8bae..0e5b7e4e86 100644 --- a/bluetooth/audio/2.0/default/BluetoothAudioProvidersFactory.cpp +++ b/bluetooth/audio/2.0/default/BluetoothAudioProvidersFactory.cpp @@ -75,7 +75,7 @@ Return<void> BluetoothAudioProvidersFactory::getProviderCapabilities( android::bluetooth::audio::GetOffloadCodecCapabilities(sessionType); if (db_codec_capabilities.size()) { audio_capabilities.resize(db_codec_capabilities.size()); - for (int i = 0; i < db_codec_capabilities.size(); ++i) { + for (std::size_t i = 0; i < db_codec_capabilities.size(); ++i) { audio_capabilities[i].codecCapabilities(db_codec_capabilities[i]); } } diff --git a/bluetooth/audio/2.0/vts/functional/Android.bp b/bluetooth/audio/2.0/vts/functional/Android.bp index 0ed5da43f2..f5cb956e37 100644 --- a/bluetooth/audio/2.0/vts/functional/Android.bp +++ b/bluetooth/audio/2.0/vts/functional/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBluetoothAudioV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/bluetooth/audio/2.1/Android.bp b/bluetooth/audio/2.1/Android.bp index 9af8add19b..822f5b3ebf 100644 --- a/bluetooth/audio/2.1/Android.bp +++ b/bluetooth/audio/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.bluetooth.audio@2.1", root: "android.hardware", diff --git a/bluetooth/audio/2.1/default/Android.bp b/bluetooth/audio/2.1/default/Android.bp index c05aa3f04a..5c30f79001 100644 --- a/bluetooth/audio/2.1/default/Android.bp +++ b/bluetooth/audio/2.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.bluetooth.audio@2.1-impl", defaults: ["hidl_defaults"], diff --git a/bluetooth/audio/2.1/vts/functional/Android.bp b/bluetooth/audio/2.1/vts/functional/Android.bp index 6ec5537775..3314a8ada8 100644 --- a/bluetooth/audio/2.1/vts/functional/Android.bp +++ b/bluetooth/audio/2.1/vts/functional/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBluetoothAudioV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/bluetooth/audio/utils/Android.bp b/bluetooth/audio/utils/Android.bp index 35476d285f..551bc50618 100644 --- a/bluetooth/audio/utils/Android.bp +++ b/bluetooth/audio/utils/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "libbluetooth_audio_session", defaults: ["hidl_defaults"], diff --git a/bluetooth/audio/utils/OWNERS b/bluetooth/audio/utils/OWNERS new file mode 100644 index 0000000000..a35dde22fd --- /dev/null +++ b/bluetooth/audio/utils/OWNERS @@ -0,0 +1,3 @@ +include platform/system/bt:/OWNERS + +cheneyni@google.com
\ No newline at end of file diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/session/BluetoothAudioSession.cpp index 50119bf399..2f3ddaf213 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/session/BluetoothAudioSession.cpp @@ -43,7 +43,10 @@ AudioConfiguration BluetoothAudioSession::invalidSoftwareAudioConfiguration = AudioConfiguration BluetoothAudioSession::invalidOffloadAudioConfiguration = {}; static constexpr int kFmqSendTimeoutMs = 1000; // 1000 ms timeout for sending +static constexpr int kFmqReceiveTimeoutMs = + 1000; // 1000 ms timeout for receiving static constexpr int kWritePollMs = 1; // polled non-blocking interval +static constexpr int kReadPollMs = 1; // polled non-blocking interval static inline timespec timespec_convert_from_hal(const TimeSpec& TS) { return {.tv_sec = static_cast<long>(TS.tvSec), @@ -402,6 +405,39 @@ size_t BluetoothAudioSession::OutWritePcmData(const void* buffer, return totalWritten; } +// The control function reads stream from FMQ +size_t BluetoothAudioSession::InReadPcmData(void* buffer, size_t bytes) { + if (buffer == nullptr || !bytes) return 0; + size_t totalRead = 0; + int ms_timeout = kFmqReceiveTimeoutMs; + do { + std::unique_lock<std::recursive_mutex> lock(mutex_); + if (!IsSessionReady()) break; + size_t availableToRead = mDataMQ->availableToRead(); + if (availableToRead) { + if (availableToRead > (bytes - totalRead)) { + availableToRead = bytes - totalRead; + } + if (!mDataMQ->read(static_cast<uint8_t*>(buffer) + totalRead, + availableToRead)) { + ALOGE("FMQ datapath reading %zu/%zu failed", totalRead, bytes); + return totalRead; + } + totalRead += availableToRead; + } else if (ms_timeout >= kReadPollMs) { + lock.unlock(); + usleep(kReadPollMs * 1000); + ms_timeout -= kReadPollMs; + continue; + } else { + ALOGD("in data %zu/%zu overflow %d ms", totalRead, bytes, + (kFmqReceiveTimeoutMs - ms_timeout)); + return totalRead; + } + } while (totalRead < bytes); + return totalRead; +} + std::unique_ptr<BluetoothAudioSessionInstance> BluetoothAudioSessionInstance::instance_ptr = std::unique_ptr<BluetoothAudioSessionInstance>( diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession.h b/bluetooth/audio/utils/session/BluetoothAudioSession.h index 838d1ccad0..83e20ad588 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSession.h +++ b/bluetooth/audio/utils/session/BluetoothAudioSession.h @@ -79,6 +79,8 @@ struct PortStatusCallbacks { }; class BluetoothAudioSession { + friend class BluetoothAudioSession_2_1; + private: // using recursive_mutex to allow hwbinder to re-enter agian. std::recursive_mutex mutex_; @@ -153,6 +155,8 @@ class BluetoothAudioSession { // The control function writes stream to FMQ size_t OutWritePcmData(const void* buffer, size_t bytes); + // The control function read stream from FMQ + size_t InReadPcmData(void* buffer, size_t bytes); static constexpr PcmParameters kInvalidPcmParameters = { .sampleRate = SampleRate::RATE_UNKNOWN, diff --git a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h index 86af4680a5..4d7be21d7a 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h +++ b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_1.h @@ -25,6 +25,8 @@ namespace audio { class BluetoothAudioSessionControl_2_1 { using SessionType_2_1 = ::android::hardware::bluetooth::audio::V2_1::SessionType; + using AudioConfiguration_2_1 = + ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration; public: // The control API helps to check if session is ready or not @@ -65,18 +67,17 @@ class BluetoothAudioSessionControl_2_1 { // The control API for the bluetooth_audio module to get current // AudioConfiguration - static const AudioConfiguration& GetAudioConfig( + static const AudioConfiguration_2_1 GetAudioConfig( const SessionType_2_1& session_type) { std::shared_ptr<BluetoothAudioSession_2_1> session_ptr = BluetoothAudioSessionInstance_2_1::GetSessionInstance(session_type); if (session_ptr != nullptr) { - // TODO: map 2.1 to 2.0 audio config inside GetAudioConfig? - return session_ptr->GetAudioSession()->GetAudioConfig(); + return session_ptr->GetAudioConfig(); } else if (session_type == SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH) { - return BluetoothAudioSession::kInvalidOffloadAudioConfiguration; + return BluetoothAudioSession_2_1::kInvalidOffloadAudioConfiguration; } else { - return BluetoothAudioSession::kInvalidSoftwareAudioConfiguration; + return BluetoothAudioSession_2_1::kInvalidSoftwareAudioConfiguration; } } @@ -141,6 +142,17 @@ class BluetoothAudioSessionControl_2_1 { } return 0; } + + // The control API reads stream from FMQ + static size_t InReadPcmData(const SessionType_2_1& session_type, void* buffer, + size_t bytes) { + std::shared_ptr<BluetoothAudioSession_2_1> session_ptr = + BluetoothAudioSessionInstance_2_1::GetSessionInstance(session_type); + if (session_ptr != nullptr) { + return session_ptr->GetAudioSession()->InReadPcmData(buffer, bytes); + } + return 0; + } }; } // namespace audio diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp index 9e1baf4f6e..9d91196d4d 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp +++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.cpp @@ -29,6 +29,11 @@ using SessionType_2_1 = using SessionType_2_0 = ::android::hardware::bluetooth::audio::V2_0::SessionType; +::android::hardware::bluetooth::audio::V2_1::AudioConfiguration + BluetoothAudioSession_2_1::invalidSoftwareAudioConfiguration = {}; +::android::hardware::bluetooth::audio::V2_1::AudioConfiguration + BluetoothAudioSession_2_1::invalidOffloadAudioConfiguration = {}; + namespace { bool is_2_0_session_type( const ::android::hardware::bluetooth::audio::V2_1::SessionType& @@ -60,6 +65,71 @@ BluetoothAudioSession_2_1::GetAudioSession() { return audio_session; } +// The control function is for the bluetooth_audio module to get the current +// AudioConfiguration +const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration +BluetoothAudioSession_2_1::GetAudioConfig() { + std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_); + if (audio_session->IsSessionReady()) { + // If session is unknown it means it should be 2.0 type + if (session_type_2_1_ != SessionType_2_1::UNKNOWN) + return audio_config_2_1_; + + ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration toConf; + const AudioConfiguration fromConf = GetAudioSession()->GetAudioConfig(); + // pcmConfig only differs between 2.0 and 2.1 in AudioConfiguration + if (fromConf.getDiscriminator() == + AudioConfiguration::hidl_discriminator::codecConfig) { + toConf.codecConfig() = fromConf.codecConfig(); + } else { + toConf.pcmConfig() = { + .sampleRate = static_cast< + ::android::hardware::bluetooth::audio::V2_1::SampleRate>( + fromConf.pcmConfig().sampleRate), + .channelMode = fromConf.pcmConfig().channelMode, + .bitsPerSample = fromConf.pcmConfig().bitsPerSample, + .dataIntervalUs = 0}; + } + return toConf; + } else if (session_type_2_1_ == + SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH) { + return kInvalidOffloadAudioConfiguration; + } else { + return kInvalidSoftwareAudioConfiguration; + } +} + +bool BluetoothAudioSession_2_1::UpdateAudioConfig( + const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration& + audio_config) { + bool is_software_session = + (session_type_2_1_ == SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH || + session_type_2_1_ == + SessionType_2_1::HEARING_AID_SOFTWARE_ENCODING_DATAPATH || + session_type_2_1_ == + SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH || + session_type_2_1_ == + SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH); + bool is_offload_session = + (session_type_2_1_ == SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH); + auto audio_config_discriminator = audio_config.getDiscriminator(); + bool is_software_audio_config = + (is_software_session && + audio_config_discriminator == + ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration:: + hidl_discriminator::pcmConfig); + bool is_offload_audio_config = + (is_offload_session && + audio_config_discriminator == + ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration:: + hidl_discriminator::codecConfig); + if (!is_software_audio_config && !is_offload_audio_config) { + return false; + } + audio_config_2_1_ = audio_config; + return true; +} + // The report function is used to report that the Bluetooth stack has started // this session without any failure, and will invoke session_changed_cb_ to // notify those registered bluetooth_audio outputs @@ -86,7 +156,27 @@ void BluetoothAudioSession_2_1::OnSessionStarted( audio_session->OnSessionStarted(stack_iface, dataMQ, config); } else { - LOG(FATAL) << " Not implemented yet!!"; + std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_); + if (stack_iface == nullptr) { + LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_2_1_) + << ", IBluetoothAudioPort Invalid"; + } else if (!UpdateAudioConfig(audio_config)) { + LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_2_1_) + << ", AudioConfiguration=" << toString(audio_config) + << " Invalid"; + } else if (!audio_session->UpdateDataPath(dataMQ)) { + LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_2_1_) + << " DataMQ Invalid"; + audio_config_2_1_ = + (session_type_2_1_ == SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH + ? kInvalidOffloadAudioConfiguration + : kInvalidSoftwareAudioConfiguration); + } else { + audio_session->stack_iface_ = stack_iface; + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_2_1_) + << ", AudioConfiguration=" << toString(audio_config); + audio_session->ReportSessionStatus(); + }; } } diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h index 0e9c12b849..5a351531a3 100644 --- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h +++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_1.h @@ -40,6 +40,11 @@ class BluetoothAudioSession_2_1 { const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration& audio_config); + static ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration + invalidSoftwareAudioConfiguration; + static ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration + invalidOffloadAudioConfiguration; + public: BluetoothAudioSession_2_1( const ::android::hardware::bluetooth::audio::V2_1::SessionType& @@ -58,8 +63,15 @@ class BluetoothAudioSession_2_1 { // The control function is for the bluetooth_audio module to get the current // AudioConfiguration - const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration& + const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration GetAudioConfig(); + + static constexpr ::android::hardware::bluetooth::audio::V2_1:: + AudioConfiguration& kInvalidSoftwareAudioConfiguration = + invalidSoftwareAudioConfiguration; + static constexpr ::android::hardware::bluetooth::audio::V2_1:: + AudioConfiguration& kInvalidOffloadAudioConfiguration = + invalidOffloadAudioConfiguration; }; class BluetoothAudioSessionInstance_2_1 { diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp index 844cf9b26b..81170666c3 100644 --- a/boot/1.0/Android.bp +++ b/boot/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.boot@1.0", root: "android.hardware", diff --git a/boot/1.0/default/Android.bp b/boot/1.0/default/Android.bp index e6d46be646..10634e8535 100644 --- a/boot/1.0/default/Android.bp +++ b/boot/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.boot@1.0-impl", defaults: ["hidl_defaults"], diff --git a/boot/1.0/vts/functional/Android.bp b/boot/1.0/vts/functional/Android.bp index 92c818c56c..90ee9cb417 100644 --- a/boot/1.0/vts/functional/Android.bp +++ b/boot/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBootV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/boot/1.1/Android.bp b/boot/1.1/Android.bp index 3f505e659e..a2a8447ec7 100644 --- a/boot/1.1/Android.bp +++ b/boot/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.boot@1.1", root: "android.hardware", diff --git a/boot/1.1/default/Android.bp b/boot/1.1/default/Android.bp index abf1bf9530..0b0a5b711e 100644 --- a/boot/1.1/default/Android.bp +++ b/boot/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.boot@1.1-impl", stem: "android.hardware.boot@1.0-impl-1.1", diff --git a/boot/1.1/default/boot_control/Android.bp b/boot/1.1/default/boot_control/Android.bp index b2e68dfd41..ad71700fa1 100644 --- a/boot/1.1/default/boot_control/Android.bp +++ b/boot/1.1/default/boot_control/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "libboot_control_defaults", vendor: true, diff --git a/boot/1.1/vts/functional/Android.bp b/boot/1.1/vts/functional/Android.bp index 9f0c74a482..3a36046bdc 100644 --- a/boot/1.1/vts/functional/Android.bp +++ b/boot/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBootV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/boot/1.2/Android.bp b/boot/1.2/Android.bp index e51c5cdc4d..17ba3e9ee2 100644 --- a/boot/1.2/Android.bp +++ b/boot/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.boot@1.2", root: "android.hardware", diff --git a/boot/1.2/default/Android.bp b/boot/1.2/default/Android.bp index c097667d1d..4e1c35e599 100644 --- a/boot/1.2/default/Android.bp +++ b/boot/1.2/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.boot@1.2-impl", stem: "android.hardware.boot@1.0-impl-1.2", diff --git a/boot/1.2/vts/functional/Android.bp b/boot/1.2/vts/functional/Android.bp index a7f5ccb440..7d546ed48f 100644 --- a/boot/1.2/vts/functional/Android.bp +++ b/boot/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBootV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp index 5fc120d3b9..fca4ac8e91 100644 --- a/broadcastradio/1.0/Android.bp +++ b/broadcastradio/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.broadcastradio@1.0", root: "android.hardware", diff --git a/broadcastradio/1.0/default/Android.bp b/broadcastradio/1.0/default/Android.bp index 2c96e2a45a..efb7f6c123 100644 --- a/broadcastradio/1.0/default/Android.bp +++ b/broadcastradio/1.0/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.broadcastradio@1.0-impl", vendor: true, diff --git a/broadcastradio/1.0/vts/functional/Android.bp b/broadcastradio/1.0/vts/functional/Android.bp index 2a4f9420ec..623ff78f5d 100644 --- a/broadcastradio/1.0/vts/functional/Android.bp +++ b/broadcastradio/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBroadcastradioV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/broadcastradio/1.1/Android.bp b/broadcastradio/1.1/Android.bp index 5efa3d4599..2874a7d0f0 100644 --- a/broadcastradio/1.1/Android.bp +++ b/broadcastradio/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.broadcastradio@1.1", root: "android.hardware", diff --git a/broadcastradio/1.1/default/Android.bp b/broadcastradio/1.1/default/Android.bp index 3659cb9fe1..5a17f5aace 100644 --- a/broadcastradio/1.1/default/Android.bp +++ b/broadcastradio/1.1/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.broadcastradio@1.1-service", init_rc: ["android.hardware.broadcastradio@1.1-service.rc"], diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp index 661439aa67..f0dfe961b9 100644 --- a/broadcastradio/1.1/vts/functional/Android.bp +++ b/broadcastradio/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBroadcastradioV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/broadcastradio/2.0/Android.bp b/broadcastradio/2.0/Android.bp index 0ef635eb5e..447b2c7976 100644 --- a/broadcastradio/2.0/Android.bp +++ b/broadcastradio/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.broadcastradio@2.0", root: "android.hardware", diff --git a/broadcastradio/2.0/default/Android.bp b/broadcastradio/2.0/default/Android.bp index 83eedb189a..870c944d75 100644 --- a/broadcastradio/2.0/default/Android.bp +++ b/broadcastradio/2.0/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.broadcastradio@2.0-service", init_rc: ["android.hardware.broadcastradio@2.0-service.rc"], diff --git a/broadcastradio/2.0/vts/functional/Android.bp b/broadcastradio/2.0/vts/functional/Android.bp index be17da32df..e26486dcc7 100644 --- a/broadcastradio/2.0/vts/functional/Android.bp +++ b/broadcastradio/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalBroadcastradioV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp index ce50f25f7c..5ba7a76b33 100644 --- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp +++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp @@ -486,6 +486,50 @@ TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) { } /** + * Test tuning with DAB selector. + * + * Verifies that: + * - if DAB selector is not supported, the method returns NOT_SUPPORTED; + * - if it is supported, the method succeeds; + * - after a successful tune call, onCurrentProgramInfoChanged callback is + * invoked carrying a proper selector; + * - program changes exactly to what was requested. + */ +TEST_F(BroadcastRadioHalTest, DabTune) { + ASSERT_TRUE(openSession()); + + ProgramSelector sel = {}; + uint64_t freq = 178352; + sel.primaryId = make_identifier(IdentifierType::DAB_FREQUENCY,freq); + + std::this_thread::sleep_for(gTuneWorkaround); + + // try tuning + ProgramInfo infoCb = {}; + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, + InfoHasId(utils::make_identifier(IdentifierType::DAB_FREQUENCY, freq))) + .Times(AnyNumber()) + .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void())))); + auto result = mSession->tune(sel); + + // expect a failure if it's not supported + if (!utils::isSupported(mProperties, sel)) { + EXPECT_EQ(Result::NOT_SUPPORTED, result); + return; + } + + // expect a callback if it succeeds + EXPECT_EQ(Result::OK, result); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune); + + LOG(DEBUG) << "current program info: " << toString(infoCb); + + // it should tune exactly to what was requested + auto freqs = utils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY); + EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq)); +} + +/** * Test tuning with empty program selector. * * Verifies that: @@ -516,6 +560,12 @@ TEST_P(BroadcastRadioHalTest, Seek) { EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber()); auto result = mSession->scan(true /* up */, true /* skip subchannel */); + + if (result == Result::NOT_SUPPORTED) { + printSkipped("seek not supported"); + return; + } + EXPECT_EQ(Result::OK, result); EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune); @@ -565,6 +615,12 @@ TEST_P(BroadcastRadioHalTest, Cancel) { for (int i = 0; i < 10; i++) { auto result = mSession->scan(true /* up */, true /* skip subchannel */); + + if (result == Result::NOT_SUPPORTED) { + printSkipped("cancel is skipped because of seek not supported"); + return; + } + ASSERT_EQ(Result::OK, result); auto cancelResult = mSession->cancel(); diff --git a/broadcastradio/common/tests/Android.bp b/broadcastradio/common/tests/Android.bp index 0ace941ac1..0a6a3a27d0 100644 --- a/broadcastradio/common/tests/Android.bp +++ b/broadcastradio/common/tests/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "android.hardware.broadcastradio@common-utils-xx-tests", vendor: true, diff --git a/broadcastradio/common/utils/Android.bp b/broadcastradio/common/utils/Android.bp index 32e06d7bdf..3131ab3ac6 100644 --- a/broadcastradio/common/utils/Android.bp +++ b/broadcastradio/common/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.broadcastradio@common-utils-lib", vendor_available: true, diff --git a/broadcastradio/common/utils1x/Android.bp b/broadcastradio/common/utils1x/Android.bp index 443dca158d..681f7de8a6 100644 --- a/broadcastradio/common/utils1x/Android.bp +++ b/broadcastradio/common/utils1x/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.broadcastradio@common-utils-1x-lib", vendor_available: true, diff --git a/broadcastradio/common/utils2x/Android.bp b/broadcastradio/common/utils2x/Android.bp index df2cefe36c..124a7e517f 100644 --- a/broadcastradio/common/utils2x/Android.bp +++ b/broadcastradio/common/utils2x/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.broadcastradio@common-utils-2x-lib", vendor_available: true, diff --git a/broadcastradio/common/vts/utils/Android.bp b/broadcastradio/common/vts/utils/Android.bp index 24fea0bb2d..e08813ba9d 100644 --- a/broadcastradio/common/vts/utils/Android.bp +++ b/broadcastradio/common/vts/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.broadcastradio@vts-utils-lib", srcs: [ diff --git a/camera/common/1.0/Android.bp b/camera/common/1.0/Android.bp index bd00dbbd37..3eb12b92ff 100644 --- a/camera/common/1.0/Android.bp +++ b/camera/common/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.common@1.0", root: "android.hardware", diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp index 3b616fe5b3..0927807b21 100644 --- a/camera/common/1.0/default/Android.bp +++ b/camera/common/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.camera.common@1.0-helper", vendor_available: true, diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp index 5fe39804e8..188b4bed27 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/1.0/default/CameraModule.cpp @@ -563,7 +563,6 @@ void CameraModule::removeCamera(int cameraId) { } } } - free_camera_metadata(metadata); } mCameraInfoMap.removeItem(cameraId); diff --git a/camera/device/1.0/Android.bp b/camera/device/1.0/Android.bp index f2125af005..6947779e6b 100644 --- a/camera/device/1.0/Android.bp +++ b/camera/device/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.device@1.0", root: "android.hardware", diff --git a/camera/device/1.0/default/Android.bp b/camera/device/1.0/default/Android.bp index fbb0372474..f875d77f68 100644 --- a/camera/device/1.0/default/Android.bp +++ b/camera/device/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "camera.device@1.0-impl", defaults: ["hidl_defaults"], diff --git a/camera/device/3.2/Android.bp b/camera/device/3.2/Android.bp index 93d1e75a36..c80538c531 100644 --- a/camera/device/3.2/Android.bp +++ b/camera/device/3.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.device@3.2", root: "android.hardware", diff --git a/camera/device/3.2/default/Android.bp b/camera/device/3.2/default/Android.bp index a8da217486..d7ad6ad740 100644 --- a/camera/device/3.2/default/Android.bp +++ b/camera/device/3.2/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "camera.device@3.2-impl", defaults: ["hidl_defaults"], diff --git a/camera/device/3.3/Android.bp b/camera/device/3.3/Android.bp index 0f8502b80c..f5e51d6b21 100644 --- a/camera/device/3.3/Android.bp +++ b/camera/device/3.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.device@3.3", root: "android.hardware", diff --git a/camera/device/3.3/default/Android.bp b/camera/device/3.3/default/Android.bp index 0aa0dd7ca4..cc0dd39db5 100644 --- a/camera/device/3.3/default/Android.bp +++ b/camera/device/3.3/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "camera.device@3.3-impl", defaults: ["hidl_defaults"], diff --git a/camera/device/3.4/Android.bp b/camera/device/3.4/Android.bp index 5575366155..2a6faabc3f 100644 --- a/camera/device/3.4/Android.bp +++ b/camera/device/3.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.device@3.4", root: "android.hardware", diff --git a/camera/device/3.4/default/Android.bp b/camera/device/3.4/default/Android.bp index 2e58f9e8d4..17bcdbb6d4 100644 --- a/camera/device/3.4/default/Android.bp +++ b/camera/device/3.4/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "camera.device@3.4-impl_headers", vendor: true, diff --git a/camera/device/3.5/Android.bp b/camera/device/3.5/Android.bp index 94962169d9..f29f9364fb 100644 --- a/camera/device/3.5/Android.bp +++ b/camera/device/3.5/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.device@3.5", root: "android.hardware", diff --git a/camera/device/3.5/default/Android.bp b/camera/device/3.5/default/Android.bp index 47a0830cfa..4ed65ba72d 100644 --- a/camera/device/3.5/default/Android.bp +++ b/camera/device/3.5/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "camera.device@3.5-impl_headers", vendor: true, diff --git a/camera/device/3.6/Android.bp b/camera/device/3.6/Android.bp index e6f458ca5f..ff37ca3695 100644 --- a/camera/device/3.6/Android.bp +++ b/camera/device/3.6/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.device@3.6", root: "android.hardware", diff --git a/camera/device/3.6/default/Android.bp b/camera/device/3.6/default/Android.bp index 8f375dee17..0e5440a865 100644 --- a/camera/device/3.6/default/Android.bp +++ b/camera/device/3.6/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "camera.device@3.6-external-impl_headers", vendor: true, diff --git a/camera/device/3.7/Android.bp b/camera/device/3.7/Android.bp new file mode 100644 index 0000000000..42782f29a9 --- /dev/null +++ b/camera/device/3.7/Android.bp @@ -0,0 +1,22 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.camera.device@3.7", + root: "android.hardware", + srcs: [ + "types.hal", + "ICameraDevice.hal", + "ICameraDeviceSession.hal", + ], + interfaces: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.device@3.6", + "android.hardware.graphics.common@1.0", + "android.hidl.base@1.0", + ], + gen_java: false, +} diff --git a/camera/device/3.7/ICameraDevice.hal b/camera/device/3.7/ICameraDevice.hal new file mode 100644 index 0000000000..9bc208373b --- /dev/null +++ b/camera/device/3.7/ICameraDevice.hal @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.camera.device@3.7; + +import android.hardware.camera.common@1.0::Status; +import @3.6::ICameraDevice; + +/** + * Camera device interface + * + * Supports the android.hardware.Camera API, and the android.hardware.camera2 + * API at LIMITED or better hardware level. + * + * ICameraDevice.open() must return @3.2::ICameraDeviceSession, + * @3.5::ICameraDeviceSession, @3.6::ICameraDeviceSession, or + * @3.7::ICameraDeviceSession. + */ +interface ICameraDevice extends @3.6::ICameraDevice { + /** + * isStreamCombinationSupported_3_7: + * + * Identical to @3.5::ICameraDevice.isStreamCombinationSupported, except + * that it takes a @3.7::StreamConfiguration parameter, which could contain + * information about multi-resolution input and output streams. + * + */ + isStreamCombinationSupported_3_7(StreamConfiguration streams) + generates (Status status, bool queryStatus); +}; diff --git a/camera/device/3.7/ICameraDeviceSession.hal b/camera/device/3.7/ICameraDeviceSession.hal new file mode 100644 index 0000000000..fb5c7fa89e --- /dev/null +++ b/camera/device/3.7/ICameraDeviceSession.hal @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.camera.device@3.7; + +import android.hardware.camera.common@1.0::Status; +import @3.2::BufferCache; +import @3.5::StreamConfiguration; +import @3.6::ICameraDeviceSession; +import @3.6::HalStreamConfiguration; + +/** + * Camera device active session interface. + * + * Obtained via ICameraDevice::open(), this interface contains the methods to + * configure and request captures from an active camera device. + */ +interface ICameraDeviceSession extends @3.6::ICameraDeviceSession { + /** + * configureStreams_3_7: + * + * Identical to @3.6::ICameraDeviceSession.configureStreams_3_6, except that: + * + * - The requestedConfiguration allows the camera framework to configure + * stream groups. + * - For requested configurations of streams within the same group, the + * corresponding halConfiguration must have the same usage flags and + * maxBuffers. + * - Within a CaptureRequest, the application is guaranteed not to request + * more than one streams within the same stream group. When one of the + * stream within a stream group is requested, the camera HAL can either + * produce output on that stream, or any other stream within the same + * stream group. + * - The requestedConfiguration allows the camera framework to indicate that + * input images of different sizes may be submitted within capture + * requests. + * + * @return status Status code for the operation, one of: + * OK: + * On successful stream configuration. + * INTERNAL_ERROR: + * If there has been a fatal error and the device is no longer + * operational. Only close() can be called successfully by the + * framework after this error is returned. + * ILLEGAL_ARGUMENT: + * If the requested stream configuration is invalid. Some examples + * of invalid stream configurations include: + * - Including more than 1 INPUT stream + * - Not including any OUTPUT streams + * - Including streams with unsupported formats, or an unsupported + * size for that format. + * - Including too many output streams of a certain format. + * - Unsupported rotation configuration + * - Stream sizes/formats don't satisfy the + * StreamConfigurationMode requirements + * for non-NORMAL mode, or the requested operation_mode is not + * supported by the HAL. + * - Unsupported usage flag + * - Unsupported stream groupIds, or unsupported multi-resolution + * input stream. + * The camera service cannot filter out all possible illegal stream + * configurations, since some devices may support more simultaneous + * streams or larger stream resolutions than the minimum required + * for a given camera device hardware level. The HAL must return an + * ILLEGAL_ARGUMENT for any unsupported stream set, and then be + * ready to accept a future valid stream configuration in a later + * configureStreams call. + * @return halConfiguration The stream parameters desired by the HAL for + * each stream, including maximum buffers, the usage flags, and the + * override format. + */ + configureStreams_3_7(StreamConfiguration requestedConfiguration) + generates (Status status, @3.6::HalStreamConfiguration halConfiguration); + + /** + * processCaptureRequest_3_7: + * + * Identical to @3.4::ICameraDeviceSession.processCaptureRequest, except that: + * + * - The capture request can include width and height of the input buffer for + * a reprocessing request. + * + * @return status Status code for the operation, one of: + * OK: + * On a successful start to processing the capture request + * ILLEGAL_ARGUMENT: + * If the input is malformed (the settings are empty when not + * allowed, the physical camera settings are invalid, there are 0 + * output buffers, etc) and capture processing + * cannot start. Failures during request processing must be + * handled by calling ICameraDeviceCallback::notify(). In case of + * this error, the framework retains responsibility for the + * stream buffers' fences and the buffer handles; the HAL must not + * close the fences or return these buffers with + * ICameraDeviceCallback::processCaptureResult(). + * In case of multi-resolution input image, this error must be returned + * if the caller passes in a CaptureRequest with an invalid + * [inputWith, inputHeight]. + * INTERNAL_ERROR: + * If the camera device has encountered a serious error. After this + * error is returned, only the close() method can be successfully + * called by the framework. + * @return numRequestProcessed Number of requests successfully processed by + * camera HAL. When status is OK, this must be equal to the size of + * requests. When the call fails, this number is the number of requests + * that HAL processed successfully before HAL runs into an error. + * + */ + processCaptureRequest_3_7(vec<CaptureRequest> requests, vec<BufferCache> cachesToRemove) + generates (Status status, uint32_t numRequestProcessed); +}; diff --git a/camera/device/3.7/types.hal b/camera/device/3.7/types.hal new file mode 100644 index 0000000000..9450c2f5a7 --- /dev/null +++ b/camera/device/3.7/types.hal @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.camera.device@3.7; + +import @3.2::CameraMetadata; +import @3.2::StreamConfigurationMode; +import @3.4::CaptureRequest; +import @3.4::Stream; + +/** + * Stream: + * + * A descriptor for a single camera input or output stream. A stream is defined + * by the framework by its buffer resolution and format, and additionally by the + * HAL with the gralloc usage flags and the maximum in-flight buffer count. + * + * This version extends the @3.4 Stream with the multi-resolution output surface + * group Id field. + */ +struct Stream { + /** + * The definition of Stream from the prior version. + */ + @3.4::Stream v3_4; + + /** + * The surface group id used for multi-resolution output streams. + * + * This works simliar to the surfaceGroupId of OutputConfiguration in the + * public API, with the exception that this is for multi-resolution image + * reader and is used by the camera HAL to choose a target stream within + * the same group to which images are written. All streams in the same group + * will have the same image format, data space, and usage flag. + * + * The framework must only call processCaptureRequest on at most one of the + * streams within a surface group. Depending on current active physical + * camera backing the logical multi-camera, or the pixel mode the camera is + * running in, the HAL can choose to request and return a buffer from any + * stream within the same group. -1 means that this stream is an input + * stream, or is an output stream which doesn't belong to any group. + * + * Streams with the same non-negative group id must have the same format and + * usage flag. + */ + int32_t groupId; +}; + +/** + * StreamConfiguration: + * + * Identical to @3.5::StreamConfiguration, except that the streams + * vector contains @3.7::Stream. + */ +struct StreamConfiguration { + /** + * An array of camera stream pointers, defining the input/output + * configuration for the camera HAL device. + */ + vec<Stream> streams; + + /** + * The definition of operation mode from prior version. + * + */ + @3.2::StreamConfigurationMode operationMode; + + /** + * The definition of session parameters from prior version. + */ + @3.2::CameraMetadata sessionParams; + + /** + * The definition of stream configuration counter from prior version. + */ + uint32_t streamConfigCounter; + + /** + * If an input stream is configured, whether the input stream is expected to + * receive variable resolution images. + * + * This flag can only be set to true if the camera device supports + * multi-resolution input streams by advertising input stream configurations in + * physicalCameraMultiResolutionStreamConfigurations in its physical cameras' + * characteristics. + * + * When this flag is set to true, the input stream's width and height can be + * any one of the supported multi-resolution input stream sizes. + */ + bool multiResolutionInputImage; +}; + +/** + * CaptureRequest: + * + * This version extends 3.4::CaptureRequest with the input buffer's width and + * height. + */ +struct CaptureRequest { + /** + * The definition of CaptureRequest from the prior version. + */ + @3.4::CaptureRequest v3_4; + + /** + * The width and height of the input buffer for this capture request. + * + * These fields will be [0, 0] if no input buffer exists in the capture + * request. + * + * If the stream configuration contains an input stream and has the + * multiResolutionInputImage flag set to true, the camera client may submit a + * reprocessing request with input buffer size different than the + * configured input stream size. In that case, the inputWith and inputHeight + * fields will be the actual size of the input image. + * + * If the stream configuration contains an input stream and the + * multiResolutionInputImage flag is false, the inputWidth and inputHeight must + * match the input stream size. + */ + uint32_t inputWidth; + uint32_t inputHeight; +}; diff --git a/camera/metadata/3.2/Android.bp b/camera/metadata/3.2/Android.bp index 6e55139241..ec8107e9f7 100644 --- a/camera/metadata/3.2/Android.bp +++ b/camera/metadata/3.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.metadata@3.2", root: "android.hardware", diff --git a/camera/metadata/3.3/Android.bp b/camera/metadata/3.3/Android.bp index f11fe2bd2f..4bed25b2f4 100644 --- a/camera/metadata/3.3/Android.bp +++ b/camera/metadata/3.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.metadata@3.3", root: "android.hardware", diff --git a/camera/metadata/3.4/Android.bp b/camera/metadata/3.4/Android.bp index 31218be61e..fdddfdf07a 100644 --- a/camera/metadata/3.4/Android.bp +++ b/camera/metadata/3.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.metadata@3.4", root: "android.hardware", diff --git a/camera/metadata/3.5/Android.bp b/camera/metadata/3.5/Android.bp index a28ba430a5..9349d546c5 100644 --- a/camera/metadata/3.5/Android.bp +++ b/camera/metadata/3.5/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.metadata@3.5", root: "android.hardware", diff --git a/camera/metadata/3.6/Android.bp b/camera/metadata/3.6/Android.bp index d9f3fb82e8..9e2b8a35e6 100644 --- a/camera/metadata/3.6/Android.bp +++ b/camera/metadata/3.6/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.metadata@3.6", root: "android.hardware", diff --git a/camera/metadata/3.6/types.hal b/camera/metadata/3.6/types.hal index fb957367f8..3472ae9668 100644 --- a/camera/metadata/3.6/types.hal +++ b/camera/metadata/3.6/types.hal @@ -42,6 +42,14 @@ enum CameraMetadataTag : @3.5::CameraMetadataTag { */ ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE = android.hardware.camera.metadata@3.5::CameraMetadataTag:ANDROID_SCALER_END_3_5, + /** android.scaler.physicalCameraMultiResolutionStreamConfigurations [static, enum[], ndk_public] + * + * <p>The available multi-resolution stream configurations that this + * physical camera device supports + * (i.e. format, width, height, output/input stream).</p> + */ + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS, + ANDROID_SCALER_END_3_6, }; @@ -49,3 +57,11 @@ enum CameraMetadataTag : @3.5::CameraMetadataTag { /* * Enumeration definitions for the various entries that need them */ + +/** android.scaler.physicalCameraMultiResolutionStreamConfigurations enumeration values + * @see ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS + */ +enum CameraMetadataEnumAndroidScalerPhysicalCameraMultiResolutionStreamConfigurations : uint32_t { + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT, +}; diff --git a/camera/provider/2.4/Android.bp b/camera/provider/2.4/Android.bp index 8b67f3fc13..a4c0dd2297 100644 --- a/camera/provider/2.4/Android.bp +++ b/camera/provider/2.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.provider@2.4", root: "android.hardware", diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp index 3672a3296c..76220e2917 100644 --- a/camera/provider/2.4/default/Android.bp +++ b/camera/provider/2.4/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.camera.provider@2.4-legacy", defaults: ["hidl_defaults"], diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp index cd66f74571..8886ee1e8c 100644 --- a/camera/provider/2.4/vts/functional/Android.bp +++ b/camera/provider/2.4/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalCameraProviderV2_4TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -39,10 +48,12 @@ cc_test { "android.hardware.camera.device@3.4", "android.hardware.camera.device@3.5", "android.hardware.camera.device@3.6", + "android.hardware.camera.device@3.7", "android.hardware.camera.metadata@3.4", "android.hardware.camera.provider@2.4", "android.hardware.camera.provider@2.5", "android.hardware.camera.provider@2.6", + "android.hardware.camera.provider@2.7", "android.hardware.graphics.common@1.0", "android.hidl.allocator@1.0", "libgrallocusage", diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index d6213448ea..b2fd402ed8 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -40,11 +40,14 @@ #include <android/hardware/camera/device/3.5/ICameraDeviceSession.h> #include <android/hardware/camera/device/3.6/ICameraDevice.h> #include <android/hardware/camera/device/3.6/ICameraDeviceSession.h> +#include <android/hardware/camera/device/3.7/ICameraDevice.h> +#include <android/hardware/camera/device/3.7/ICameraDeviceSession.h> #include <android/hardware/camera/metadata/3.4/types.h> #include <android/hardware/camera/provider/2.4/ICameraProvider.h> #include <android/hardware/camera/provider/2.5/ICameraProvider.h> #include <android/hardware/camera/provider/2.6/ICameraProvider.h> #include <android/hardware/camera/provider/2.6/ICameraProviderCallback.h> +#include <android/hardware/camera/provider/2.7/ICameraProvider.h> #include <android/hidl/manager/1.0/IServiceManager.h> #include <binder/MemoryHeapBase.h> #include <cutils/properties.h> @@ -189,12 +192,14 @@ enum SystemCameraKind { namespace { // "device@<version>/legacy/<id>" const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/%s/(.+)"; + const int CAMERA_DEVICE_API_VERSION_3_7 = 0x307; const int CAMERA_DEVICE_API_VERSION_3_6 = 0x306; const int CAMERA_DEVICE_API_VERSION_3_5 = 0x305; const int CAMERA_DEVICE_API_VERSION_3_4 = 0x304; const int CAMERA_DEVICE_API_VERSION_3_3 = 0x303; const int CAMERA_DEVICE_API_VERSION_3_2 = 0x302; const int CAMERA_DEVICE_API_VERSION_1_0 = 0x100; + const char *kHAL3_7 = "3.7"; const char *kHAL3_6 = "3.6"; const char *kHAL3_5 = "3.5"; const char *kHAL3_4 = "3.4"; @@ -231,7 +236,9 @@ namespace { return -1; } - if (version.compare(kHAL3_6) == 0) { + if (version.compare(kHAL3_7) == 0) { + return CAMERA_DEVICE_API_VERSION_3_7; + } else if (version.compare(kHAL3_6) == 0) { return CAMERA_DEVICE_API_VERSION_3_6; } else if (version.compare(kHAL3_5) == 0) { return CAMERA_DEVICE_API_VERSION_3_5; @@ -756,7 +763,8 @@ public: sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/, sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/, sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/, - sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/); + sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/, + sp<device::V3_7::ICameraDeviceSession> *session3_7 /*out*/); void castDevice(const sp<device::V3_2::ICameraDevice> &device, int32_t deviceVersion, sp<device::V3_5::ICameraDevice> *device3_5/*out*/); void createStreamConfiguration(const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2, @@ -1883,6 +1891,7 @@ TEST_P(CameraHidlTest, getCameraDeviceInterface) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -1926,6 +1935,7 @@ TEST_P(CameraHidlTest, getResourceCost) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -2666,6 +2676,7 @@ TEST_P(CameraHidlTest, systemCameraTest) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -2752,6 +2763,7 @@ TEST_P(CameraHidlTest, getCameraCharacteristics) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -2832,6 +2844,7 @@ TEST_P(CameraHidlTest, setTorchMode) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -2959,6 +2972,7 @@ TEST_P(CameraHidlTest, dumpState) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -3025,6 +3039,7 @@ TEST_P(CameraHidlTest, openClose) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -3056,9 +3071,13 @@ TEST_P(CameraHidlTest, openClose) { sp<device::V3_4::ICameraDeviceSession> sessionV3_4; sp<device::V3_5::ICameraDeviceSession> sessionV3_5; sp<device::V3_6::ICameraDeviceSession> sessionV3_6; + sp<device::V3_7::ICameraDeviceSession> sessionV3_7; castSession(session, deviceVersion, &sessionV3_3, - &sessionV3_4, &sessionV3_5, &sessionV3_6); - if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_6) { + &sessionV3_4, &sessionV3_5, &sessionV3_6, + &sessionV3_7); + if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_7) { + ASSERT_TRUE(sessionV3_7.get() != nullptr); + } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_6) { ASSERT_TRUE(sessionV3_6.get() != nullptr); } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) { ASSERT_TRUE(sessionV3_5.get() != nullptr); @@ -3122,6 +3141,7 @@ TEST_P(CameraHidlTest, constructDefaultRequestSettings) { for (const auto& name : cameraDeviceNames) { int deviceVersion = getCameraDeviceVersion(name, mProviderType); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: case CAMERA_DEVICE_API_VERSION_3_6: case CAMERA_DEVICE_API_VERSION_3_5: case CAMERA_DEVICE_API_VERSION_3_4: @@ -3221,11 +3241,13 @@ TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5); outputStreams.clear(); @@ -3307,6 +3329,7 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5; @@ -3344,7 +3367,7 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) { openEmptyDeviceSession(name, mProvider2_6, &cti.session /*out*/, &cti.staticMeta /*out*/, &cti.cameraDevice /*out*/); castSession(cti.session, deviceVersion, &cti.session3_3, &cti.session3_4, - &cti.session3_5, &cti.session3_6); + &cti.session3_5, &cti.session3_6, &cti.session3_7); castDevice(cti.cameraDevice, deviceVersion, &cti.cameraDevice3_5); outputStreams.clear(); @@ -3462,11 +3485,13 @@ TEST_P(CameraHidlTest, configureStreamsInvalidOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5); outputStreams.clear(); @@ -3660,11 +3685,13 @@ TEST_P(CameraHidlTest, configureStreamsZSLInputOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5); Status rc = isZSLModeAvailable(staticMeta); @@ -3828,8 +3855,10 @@ TEST_P(CameraHidlTest, configureStreamsWithSessionParameters) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) { ASSERT_NE(session3_4, nullptr); } else { @@ -3951,11 +3980,13 @@ TEST_P(CameraHidlTest, configureStreamsPreviewStillOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5); // Check if camera support depth only @@ -4069,11 +4100,13 @@ TEST_P(CameraHidlTest, configureStreamsConstrainedOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5); Status rc = isConstrainedModeAvailable(staticMeta); @@ -4281,11 +4314,13 @@ TEST_P(CameraHidlTest, configureStreamsVideoStillOutputs) { sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; + sp<device::V3_7::ICameraDeviceSession> session3_7; sp<device::V3_2::ICameraDevice> cameraDevice; sp<device::V3_5::ICameraDevice> cameraDevice3_5; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5); // Check if camera support depth only @@ -6103,7 +6138,9 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t sp<device::V3_3::ICameraDeviceSession> session3_3; sp<device::V3_6::ICameraDeviceSession> session3_6; - castSession(session, deviceVersion, &session3_3, session3_4, session3_5, &session3_6); + sp<device::V3_7::ICameraDeviceSession> session3_7; + castSession(session, deviceVersion, &session3_3, session3_4, session3_5, + &session3_6, &session3_7); ASSERT_NE(nullptr, (*session3_4).get()); *useHalBufManager = false; @@ -6144,7 +6181,7 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t }); ASSERT_TRUE(ret.isOk()); - ASSERT_TRUE(!allowUnsupport || deviceVersion == CAMERA_DEVICE_API_VERSION_3_5); + ASSERT_TRUE(!allowUnsupport || deviceVersion >= CAMERA_DEVICE_API_VERSION_3_5); if (allowUnsupport) { sp<device::V3_5::ICameraDevice> cameraDevice3_5; castDevice(device3_x, deviceVersion, &cameraDevice3_5); @@ -6446,7 +6483,9 @@ void CameraHidlTest::configureSingleStream( sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; - castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + sp<device::V3_7::ICameraDeviceSession> session3_7; + castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); *useHalBufManager = false; status = find_camera_metadata_ro_entry(staticMeta, @@ -6583,13 +6622,21 @@ void CameraHidlTest::castSession(const sp<ICameraDeviceSession> &session, int32_ sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/, sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/, sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/, - sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/) { + sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/, + sp<device::V3_7::ICameraDeviceSession> *session3_7 /*out*/) { ASSERT_NE(nullptr, session3_3); ASSERT_NE(nullptr, session3_4); ASSERT_NE(nullptr, session3_5); ASSERT_NE(nullptr, session3_6); + ASSERT_NE(nullptr, session3_7); switch (deviceVersion) { + case CAMERA_DEVICE_API_VERSION_3_7: { + auto castResult = device::V3_7::ICameraDeviceSession::castFrom(session); + ASSERT_TRUE(castResult.isOk()); + *session3_7 = castResult; + } + [[fallthrough]]; case CAMERA_DEVICE_API_VERSION_3_6: { auto castResult = device::V3_6::ICameraDeviceSession::castFrom(session); ASSERT_TRUE(castResult.isOk()); @@ -7233,7 +7280,9 @@ void CameraHidlTest::verifyBuffersReturned( sp<device::V3_4::ICameraDeviceSession> session3_4; sp<device::V3_5::ICameraDeviceSession> session3_5; sp<device::V3_6::ICameraDeviceSession> session3_6; - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6); + sp<device::V3_7::ICameraDeviceSession> session3_7; + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, + &session3_6, &session3_7); ASSERT_NE(nullptr, session3_5.get()); hidl_vec<int32_t> streamIds(1); diff --git a/camera/provider/2.5/Android.bp b/camera/provider/2.5/Android.bp index be71806206..e14c0a846d 100644 --- a/camera/provider/2.5/Android.bp +++ b/camera/provider/2.5/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.provider@2.5", root: "android.hardware", diff --git a/camera/provider/2.5/default/Android.bp b/camera/provider/2.5/default/Android.bp index 66a2d5b15b..188b70157a 100644 --- a/camera/provider/2.5/default/Android.bp +++ b/camera/provider/2.5/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.camera.provider@2.5-legacy", proprietary: true, diff --git a/camera/provider/2.6/Android.bp b/camera/provider/2.6/Android.bp index 6934c175e0..f402a560c9 100644 --- a/camera/provider/2.6/Android.bp +++ b/camera/provider/2.6/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.camera.provider@2.6", root: "android.hardware", diff --git a/camera/provider/2.7/Android.bp b/camera/provider/2.7/Android.bp new file mode 100644 index 0000000000..094dd9d4cd --- /dev/null +++ b/camera/provider/2.7/Android.bp @@ -0,0 +1,26 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.camera.provider@2.7", + root: "android.hardware", + srcs: [ + "types.hal", + "ICameraProvider.hal", + ], + interfaces: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.device@3.6", + "android.hardware.camera.device@3.7", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.5", + "android.hardware.camera.provider@2.6", + "android.hardware.graphics.common@1.0", + "android.hidl.base@1.0", + ], + gen_java: false, +} diff --git a/camera/provider/2.7/ICameraProvider.hal b/camera/provider/2.7/ICameraProvider.hal new file mode 100644 index 0000000000..c9d52ee21c --- /dev/null +++ b/camera/provider/2.7/ICameraProvider.hal @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.camera.provider@2.7; + +import @2.6::ICameraProvider; +import android.hardware.camera.common@1.0::Status; + +/** + * Camera provider HAL + * + * Adds support for the isConcurrentStreamCombinationSupported() with + * ICameraDevice@3.7::StreamConfiguration. + */ +interface ICameraProvider extends @2.6::ICameraProvider { + /** + * isConcurrentStreamCombinationSupported_2_7: + * + * Identical to @2.6::isConcurrentStreamCombinationSupported except that + * this function takes a vector of @3.7::StreamConfiguration. + * + * @param configs a vector of camera ids and their corresponding stream + * configurations that need to be queried for support. + * + * @return status Status code for the operation, one of: + * OK: + * On successful stream combination query. + * METHOD_NOT_SUPPORTED: + * The camera provider does not support stream combination query. + * INTERNAL_ERROR: + * The stream combination query cannot complete due to internal + * error. + * @return true in case the stream combination is supported, false otherwise. + * + */ + isConcurrentStreamCombinationSupported_2_7(vec<CameraIdAndStreamCombination> configs) + generates (Status status, bool queryStatus); +}; diff --git a/security/keymint/aidl/android/hardware/security/keymint/ByteArray.aidl b/camera/provider/2.7/types.hal index c3b402ea65..363e894ed3 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/ByteArray.aidl +++ b/camera/provider/2.7/types.hal @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * Copyright (C) 2021 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. @@ -14,13 +14,17 @@ * limitations under the License. */ -package android.hardware.security.keymint; +package android.hardware.camera.provider@2.7; + +import android.hardware.camera.device@3.7::StreamConfiguration; /** - * This is used to contain a byte[], to make out parameters of byte arrays - * more convenient for callers. + * CameraIdAndStreamCombination: + * + * This is identical to @2.6::CameraIdAndStreamCombination except that + * streamConfiguration is of version @3.7. */ -@VintfStability -parcelable ByteArray { - byte[] data; -} +struct CameraIdAndStreamCombination { + string cameraId; + @3.7::StreamConfiguration streamConfiguration; +}; diff --git a/cas/1.0/Android.bp b/cas/1.0/Android.bp index 9f289a1dcc..368156ad76 100644 --- a/cas/1.0/Android.bp +++ b/cas/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.cas@1.0", root: "android.hardware", diff --git a/cas/1.0/default/Android.bp b/cas/1.0/default/Android.bp index f968ee1b1f..a85c5fc230 100644 --- a/cas/1.0/default/Android.bp +++ b/cas/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "cas_service_defaults", defaults: ["hidl_defaults"], diff --git a/cas/1.0/vts/functional/Android.bp b/cas/1.0/vts/functional/Android.bp index a065b85906..6d06cabfc3 100644 --- a/cas/1.0/vts/functional/Android.bp +++ b/cas/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalCasV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -33,4 +42,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/cas/1.1/Android.bp b/cas/1.1/Android.bp index e20298b374..f5b1cc9564 100644 --- a/cas/1.1/Android.bp +++ b/cas/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.cas@1.1", root: "android.hardware", diff --git a/cas/1.1/default/Android.bp b/cas/1.1/default/Android.bp index 8e1f20772d..2cfc0b90fb 100644 --- a/cas/1.1/default/Android.bp +++ b/cas/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "cas_service_defaults@1.1", defaults: ["hidl_defaults"], diff --git a/cas/1.1/vts/functional/Android.bp b/cas/1.1/vts/functional/Android.bp index 0647d12a1c..a598554123 100644 --- a/cas/1.1/vts/functional/Android.bp +++ b/cas/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalCasV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -33,4 +42,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/cas/1.2/Android.bp b/cas/1.2/Android.bp index f03b6b7db1..6c94020464 100644 --- a/cas/1.2/Android.bp +++ b/cas/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.cas@1.2", root: "android.hardware", diff --git a/cas/1.2/default/Android.bp b/cas/1.2/default/Android.bp index d855e85a67..38561fd3e7 100644 --- a/cas/1.2/default/Android.bp +++ b/cas/1.2/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "cas_service_defaults@1.2", defaults: ["hidl_defaults"], diff --git a/cas/1.2/vts/functional/Android.bp b/cas/1.2/vts/functional/Android.bp index 74ea85fbf2..21f791be1c 100644 --- a/cas/1.2/vts/functional/Android.bp +++ b/cas/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalCasV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/cas/native/1.0/Android.bp b/cas/native/1.0/Android.bp index 6aa420414b..3bb74c107e 100644 --- a/cas/native/1.0/Android.bp +++ b/cas/native/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.cas.native@1.0", root: "android.hardware", diff --git a/common/aidl/Android.bp b/common/aidl/Android.bp index 8029efa023..912bfdc1f8 100644 --- a/common/aidl/Android.bp +++ b/common/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.common", host_supported: true, @@ -22,6 +31,7 @@ aidl_interface { apex_available: [ "//apex_available:platform", "com.android.media.swcodec", + "com.android.neuralnetworks", ], min_sdk_version: "29", }, diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp index 9389712733..1ab724f097 100644 --- a/common/fmq/aidl/Android.bp +++ b/common/fmq/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.common.fmq", host_supported: true, diff --git a/common/support/Android.bp b/common/support/Android.bp index ce3aa3fbd6..8aea306dae 100644 --- a/common/support/Android.bp +++ b/common/support/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libaidlcommonsupport", vendor_available: true, diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp index de73201f8b..314a809228 100644 --- a/compatibility_matrices/Android.bp +++ b/compatibility_matrices/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + vintf_compatibility_matrix { name: "framework_compatibility_matrix.3.xml", stem: "compatibility_matrix.3.xml", diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index 3951666fbf..85c8ca01a7 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -24,6 +24,9 @@ my_empty_manifest := $(LOCAL_PATH)/manifest.empty.xml include $(CLEAR_VARS) include $(LOCAL_PATH)/clear_vars.mk LOCAL_MODULE := framework_compatibility_matrix.device.xml +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE LOCAL_MODULE_STEM := compatibility_matrix.device.xml # define LOCAL_MODULE_CLASS for local-generated-sources-dir. LOCAL_MODULE_CLASS := ETC @@ -66,6 +69,9 @@ include $(BUILD_FRAMEWORK_COMPATIBILITY_MATRIX) include $(CLEAR_VARS) include $(LOCAL_PATH)/clear_vars.mk LOCAL_MODULE := product_compatibility_matrix.xml +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE ifndef DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE my_framework_matrix_deps := @@ -104,12 +110,18 @@ my_framework_matrix_deps += \ # Phony target that installs all system compatibility matrix files include $(CLEAR_VARS) LOCAL_MODULE := system_compatibility_matrix.xml +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE LOCAL_REQUIRED_MODULES := $(my_system_matrix_deps) include $(BUILD_PHONY_PACKAGE) # Phony target that installs all framework compatibility matrix files (system + product) include $(CLEAR_VARS) LOCAL_MODULE := framework_compatibility_matrix.xml +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE LOCAL_REQUIRED_MODULES := $(my_framework_matrix_deps) include $(BUILD_PHONY_PACKAGE) diff --git a/compatibility_matrices/build/Android.bp b/compatibility_matrices/build/Android.bp index 42dc886b12..79ef36dffc 100644 --- a/compatibility_matrices/build/Android.bp +++ b/compatibility_matrices/build/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + bootstrap_go_package { name: "vintf-compatibility-matrix-soong-rules", pkgPath: "android/soong/vintf-compatibility-matrix", diff --git a/compatibility_matrices/build/vintf_compatibility_matrix.go b/compatibility_matrices/build/vintf_compatibility_matrix.go index 2772ba36e7..f1bd0ae797 100644 --- a/compatibility_matrices/build/vintf_compatibility_matrix.go +++ b/compatibility_matrices/build/vintf_compatibility_matrix.go @@ -41,7 +41,7 @@ var ( }, "inputs") xmllintXsd = pctx.AndroidStaticRule("xmllint-xsd", blueprint.RuleParams{ - Command: `$XmlLintCmd --schema $xsd $in > /dev/null && touch -a $out`, + Command: `$XmlLintCmd --quiet --schema $xsd $in > /dev/null && touch -a $out`, CommandDeps: []string{"$XmlLintCmd"}, Restat: true, }, "xsd") diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml index ade00ffd0a..7fab9d3763 100644 --- a/compatibility_matrices/compatibility_matrix.5.xml +++ b/compatibility_matrices/compatibility_matrix.5.xml @@ -256,6 +256,13 @@ </hal> <hal format="aidl" optional="true"> <name>android.hardware.identity</name> + <!-- + b/178458001: identity V2 is introduced in R, but Android R VINTF does not support AIDL + versions. Hence, we only specify identity V2 in compatibility_matrix.5.xml in Android S+ + branches. In Android R branches, the matrix implicitly specifies V1. + SingleManifestTest.ManifestAidlHalsServed has an exemption for this. + --> + <version>1-2</version> <interface> <name>IIdentityCredentialStore</name> <instance>default</instance> diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 540e0178ec..2a1b5df48a 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -165,7 +165,7 @@ </hal> <hal format="hidl" optional="true"> <name>android.hardware.camera.provider</name> - <version>2.4-6</version> + <version>2.4-7</version> <interface> <name>ICameraProvider</name> <regex-instance>[^/]+/[0-9]+</regex-instance> @@ -387,14 +387,6 @@ </interface> </hal> <hal format="hidl" optional="true"> - <name>android.hardware.memtrack</name> - <version>1.0</version> - <interface> - <name>IMemtrack</name> - <instance>default</instance> - </interface> - </hal> - <hal format="hidl" optional="true"> <name>android.hardware.neuralnetworks</name> <version>1.0-3</version> <interface> diff --git a/compatibility_matrices/exclude/Android.bp b/compatibility_matrices/exclude/Android.bp index d7bf63559d..9b686ae8a0 100644 --- a/compatibility_matrices/exclude/Android.bp +++ b/compatibility_matrices/exclude/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_host_static { name: "libvintf_fcm_exclude", cflags: [ diff --git a/configstore/1.0/Android.bp b/configstore/1.0/Android.bp index d92f2524ad..51fc44c2ca 100644 --- a/configstore/1.0/Android.bp +++ b/configstore/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.configstore@1.0", root: "android.hardware", diff --git a/configstore/1.0/vts/functional/Android.bp b/configstore/1.0/vts/functional/Android.bp index 4e1e045dd1..27c66fd42c 100644 --- a/configstore/1.0/vts/functional/Android.bp +++ b/configstore/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalConfigstoreV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -21,4 +30,3 @@ cc_test { static_libs: ["android.hardware.configstore@1.0"], test_suites: ["general-tests", "vts"], } - diff --git a/configstore/1.1/Android.bp b/configstore/1.1/Android.bp index 7c5f3f7059..ec745dd2ba 100644 --- a/configstore/1.1/Android.bp +++ b/configstore/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.configstore@1.1", root: "android.hardware", diff --git a/configstore/1.1/default/Android.mk b/configstore/1.1/default/Android.mk index 6b7bb004e3..9a6f0fc24f 100644 --- a/configstore/1.1/default/Android.mk +++ b/configstore/1.1/default/Android.mk @@ -3,6 +3,9 @@ LOCAL_PATH := $(call my-dir) ################################################################################ include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.configstore@1.1-service +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE # seccomp is not required for coverage build. ifneq ($(NATIVE_COVERAGE),true) LOCAL_REQUIRED_MODULES_arm64 := configstore@1.1.policy @@ -30,6 +33,9 @@ include $(BUILD_EXECUTABLE) ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), arm64)) include $(CLEAR_VARS) LOCAL_MODULE := configstore@1.1.policy +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/seccomp_policy LOCAL_SRC_FILES := seccomp_policy/configstore@1.1-$(TARGET_ARCH).policy @@ -39,6 +45,9 @@ endif # disable configstore include $(CLEAR_VARS) LOCAL_MODULE := disable_configstore +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_SRC_FILES:= disable_configstore.cpp LOCAL_OVERRIDES_MODULES := android.hardware.configstore@1.1-service diff --git a/configstore/utils/Android.bp b/configstore/utils/Android.bp index 178f245fd6..7ed3f68db2 100644 --- a/configstore/utils/Android.bp +++ b/configstore/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.configstore-utils", vendor_available: true, diff --git a/confirmationui/1.0/Android.bp b/confirmationui/1.0/Android.bp index 15c4f18c99..950a55aa86 100644 --- a/confirmationui/1.0/Android.bp +++ b/confirmationui/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.confirmationui@1.0", root: "android.hardware", diff --git a/confirmationui/1.0/default/Android.bp b/confirmationui/1.0/default/Android.bp index 33a1e078a9..99f6f76422 100644 --- a/confirmationui/1.0/default/Android.bp +++ b/confirmationui/1.0/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.confirmationui@1.0-service", init_rc: ["android.hardware.confirmationui@1.0-service.rc"], diff --git a/confirmationui/1.0/vts/functional/Android.bp b/confirmationui/1.0/vts/functional/Android.bp index c73ee2826c..6c6488bebe 100644 --- a/confirmationui/1.0/vts/functional/Android.bp +++ b/confirmationui/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalConfirmationUIV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/confirmationui/support/Android.bp b/confirmationui/support/Android.bp index e215baa142..6ab83f2bbe 100644 --- a/confirmationui/support/Android.bp +++ b/confirmationui/support/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.confirmationui-support-lib", vendor_available: true, diff --git a/contexthub/1.0/Android.bp b/contexthub/1.0/Android.bp index be30d61a11..00dc666f76 100644 --- a/contexthub/1.0/Android.bp +++ b/contexthub/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.contexthub@1.0", root: "android.hardware", diff --git a/contexthub/1.0/default/Android.bp b/contexthub/1.0/default/Android.bp index 83840375f1..5bd31b62b0 100644 --- a/contexthub/1.0/default/Android.bp +++ b/contexthub/1.0/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.contexthub@1.0-impl", defaults: ["hidl_defaults"], diff --git a/contexthub/1.0/vts/functional/Android.bp b/contexthub/1.0/vts/functional/Android.bp index 091f2dc201..5949f8d482 100644 --- a/contexthub/1.0/vts/functional/Android.bp +++ b/contexthub/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalContexthubV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/contexthub/1.1/Android.bp b/contexthub/1.1/Android.bp index 9ee8e765e5..6aba5f7de0 100644 --- a/contexthub/1.1/Android.bp +++ b/contexthub/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.contexthub@1.1", root: "android.hardware", diff --git a/contexthub/1.1/default/Android.bp b/contexthub/1.1/default/Android.bp index 5c9ec4e2c7..55f5026a9a 100644 --- a/contexthub/1.1/default/Android.bp +++ b/contexthub/1.1/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.contexthub@1.1-service.mock", defaults: ["hidl_defaults"], diff --git a/contexthub/1.1/vts/functional/Android.bp b/contexthub/1.1/vts/functional/Android.bp index 034c11fb0c..b2961c4756 100644 --- a/contexthub/1.1/vts/functional/Android.bp +++ b/contexthub/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalContexthubV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/contexthub/1.2/Android.bp b/contexthub/1.2/Android.bp index 9722a97ee6..d7d4c49cfb 100644 --- a/contexthub/1.2/Android.bp +++ b/contexthub/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.contexthub@1.2", root: "android.hardware", diff --git a/contexthub/1.2/default/Android.bp b/contexthub/1.2/default/Android.bp index 0a31325811..a52577a620 100644 --- a/contexthub/1.2/default/Android.bp +++ b/contexthub/1.2/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.contexthub@1.2-service.mock", defaults: ["hidl_defaults"], diff --git a/contexthub/1.2/vts/functional/Android.bp b/contexthub/1.2/vts/functional/Android.bp index 6e425be258..c923f42a20 100644 --- a/contexthub/1.2/vts/functional/Android.bp +++ b/contexthub/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalContexthubV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/contexthub/common/default/1.X/Android.bp b/contexthub/common/default/1.X/Android.bp index 691a1b7c9d..eef137ec83 100644 --- a/contexthub/common/default/1.X/Android.bp +++ b/contexthub/common/default/1.X/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.contexthub@1.X-common-impl", vendor_available: true, diff --git a/contexthub/common/default/1.X/utils/Android.bp b/contexthub/common/default/1.X/utils/Android.bp index c74b647413..dabe754cca 100644 --- a/contexthub/common/default/1.X/utils/Android.bp +++ b/contexthub/common/default/1.X/utils/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.contexthub@1.X-common-utils", vendor_available: true, diff --git a/contexthub/common/vts/Android.bp b/contexthub/common/vts/Android.bp index 3d5196a70e..ae56a6c52d 100644 --- a/contexthub/common/vts/Android.bp +++ b/contexthub/common/vts/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test_library { name: "VtsHalContexthubUtils", srcs: [ diff --git a/current.txt b/current.txt index 5e9a34c5f6..6c576cab7a 100644 --- a/current.txt +++ b/current.txt @@ -780,14 +780,20 @@ bda492ec4021d13869de72bd6f8c15c5837b78d6136b8d538efec5320573a5ec android.hardwar dabe23dde7c9e3ad65c61def7392f186d7efe7f4216f9b6f9cf0863745b1a9f4 android.hardware.keymaster@4.1::IKeymasterDevice cd84ab19c590e0e73dd2307b591a3093ee18147ef95e6d5418644463a6620076 android.hardware.neuralnetworks@1.2::IDevice f729ee6a5f136b25d79ea6895d24700fce413df555baaecf2c39e4440d15d043 android.hardware.neuralnetworks@1.0::types -c6ae443608502339aec4256feef48e7b2d36f7477ca5361cc95cd27a8ed9c612 android.hardware.neuralnetworks@1.2::types -9fe5a4093043c2b5da4e9491aed1646c388a5d3059b8fd77d5b6a9807e6d3a3e android.hardware.neuralnetworks@1.3::types +a84f8dac7a9b75de1cc2936a9b429b9b62b32a31ea88ca52c29f98f5ddc0fa95 android.hardware.neuralnetworks@1.2::types +cd331b92312d16ab89f475c39296abbf539efc4114a8c5c2b136ad99b904ef33 android.hardware.neuralnetworks@1.3::types e8c86c69c438da8d1549856c1bb3e2d1b8da52722f8235ff49a30f2cce91742c android.hardware.soundtrigger@2.1::ISoundTriggerHwCallback b9fbb6e2e061ed0960939d48b785e9700210add1f13ed32ecd688d0f1ca20ef7 android.hardware.renderscript@1.0::types 0f53d70e1eadf8d987766db4bf6ae2048004682168f4cab118da576787def3fa android.hardware.radio@1.0::types 38d65fb20c60a5b823298560fc0825457ecdc49603a4b4e94bf81511790737da android.hardware.radio@1.4::types 954c334efd80e8869b66d1ce5fe2755712d96ba4b3c38d415739c330af5fb4cb android.hardware.radio@1.5::types +cfaab0e45c5d7b3595032d649da29ed712e920f956c13671efd35602fa81c923 android.hardware.radio@1.0::IRadio +89d78fa49b09e2f31812bb63e1bfac2bf318a9561473c6b0ed6904ce18377d54 android.hardware.radio@1.0::IRadioIndication +bc3c8c233085fca3879dc74b490b9e5bc1063258470d3b4c12f7a74bf215cbbd android.hardware.radio@1.0::IRadioResponse +86fb079a600b2301a752249dfbfc53983a795d752f11aabcb68315a189f6c9a2 android.hardware.radio@1.1::IRadio +00366b2f88f9ec2458014972938270c8413d4ab303218e37bf3add2b8e6b829a android.hardware.radio@1.1::IRadioResponse +2b5afef68e3e2ff1dab63e4f2ee57337ef2635ec812f49080cadfce966d33b52 android.hardware.radio@1.2::IRadio # HALs released in Android S # NOTE: waiting to freeze HALs until later in the release -# NOTE: new HALs are recommended to be in AIDL
\ No newline at end of file +# NOTE: new HALs are recommended to be in AIDL diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp index 44fb83777f..3aa2a4d4d8 100644 --- a/drm/1.0/Android.bp +++ b/drm/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.drm@1.0", root: "android.hardware", diff --git a/drm/1.0/default/Android.bp b/drm/1.0/default/Android.bp index d5063fb2f9..af1c076e0d 100644 --- a/drm/1.0/default/Android.bp +++ b/drm/1.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.drm@1.0-helper", vendor_available: true, diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp index 0545c70606..5ea6ad3c66 100644 --- a/drm/1.0/vts/functional/Android.bp +++ b/drm/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libdrmvtshelper", defaults: ["VtsHalTargetTestDefaults"], diff --git a/drm/1.1/Android.bp b/drm/1.1/Android.bp index 0af4cf4cdf..3290203e64 100644 --- a/drm/1.1/Android.bp +++ b/drm/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.drm@1.1", root: "android.hardware", diff --git a/drm/1.1/vts/functional/Android.bp b/drm/1.1/vts/functional/Android.bp index 053a564023..656ec50894 100644 --- a/drm/1.1/vts/functional/Android.bp +++ b/drm/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.drm@1.1-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/drm/1.2/Android.bp b/drm/1.2/Android.bp index f1c60de482..453ae0da49 100644 --- a/drm/1.2/Android.bp +++ b/drm/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.drm@1.2", root: "android.hardware", diff --git a/drm/1.2/vts/functional/Android.bp b/drm/1.2/vts/functional/Android.bp index 271cc043d0..ca90ee9e30 100644 --- a/drm/1.2/vts/functional/Android.bp +++ b/drm/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.drm@1.2-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/drm/1.3/Android.bp b/drm/1.3/Android.bp index 9a2b9e12aa..08f7aa8367 100644 --- a/drm/1.3/Android.bp +++ b/drm/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.drm@1.3", root: "android.hardware", diff --git a/drm/1.3/vts/functional/Android.bp b/drm/1.3/vts/functional/Android.bp index 3e40adfd4a..cd1cc0f85c 100644 --- a/drm/1.3/vts/functional/Android.bp +++ b/drm/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.drm@1.3-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/drm/1.4/Android.bp b/drm/1.4/Android.bp index f40ff87b13..d1bb4bc858 100644 --- a/drm/1.4/Android.bp +++ b/drm/1.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.drm@1.4", root: "android.hardware", diff --git a/drm/1.4/types.hal b/drm/1.4/types.hal index 17eba8a08f..a4490a543e 100644 --- a/drm/1.4/types.hal +++ b/drm/1.4/types.hal @@ -119,6 +119,10 @@ enum Status : @1.2::Status { */ PROVISIONING_PARSE_ERROR, /** + * The provisioning server detected an error in the provisioning request. + */ + PROVISIONING_REQUEST_REJECTED, + /** * Provisioning failed in a way that is likely to succeed on a subsequent * attempt. */ diff --git a/drm/1.4/vts/functional/Android.bp b/drm/1.4/vts/functional/Android.bp index 80b1dd1825..e18d0883a2 100644 --- a/drm/1.4/vts/functional/Android.bp +++ b/drm/1.4/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.drm@1.4-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/dumpstate/1.0/Android.bp b/dumpstate/1.0/Android.bp index 5d9eefcdf3..4e37ce9a0d 100644 --- a/dumpstate/1.0/Android.bp +++ b/dumpstate/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.dumpstate@1.0", root: "android.hardware", diff --git a/dumpstate/1.0/default/Android.bp b/dumpstate/1.0/default/Android.bp index 6b02715feb..18777a7eb8 100644 --- a/dumpstate/1.0/default/Android.bp +++ b/dumpstate/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.dumpstate@1.0-service.example", init_rc: ["android.hardware.dumpstate@1.0-service.rc"], diff --git a/dumpstate/1.0/vts/functional/Android.bp b/dumpstate/1.0/vts/functional/Android.bp index 451b0536fd..cc0a9cd6ca 100644 --- a/dumpstate/1.0/vts/functional/Android.bp +++ b/dumpstate/1.0/vts/functional/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalDumpstateV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/dumpstate/1.1/Android.bp b/dumpstate/1.1/Android.bp index 75805dfb51..b87ca91d83 100644 --- a/dumpstate/1.1/Android.bp +++ b/dumpstate/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.dumpstate@1.1", root: "android.hardware", diff --git a/dumpstate/1.1/default/Android.bp b/dumpstate/1.1/default/Android.bp index bd920752ba..29c245e8ae 100644 --- a/dumpstate/1.1/default/Android.bp +++ b/dumpstate/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.dumpstate@1.1-service.example", vendor: true, diff --git a/dumpstate/1.1/vts/functional/Android.bp b/dumpstate/1.1/vts/functional/Android.bp index 43a3c21b7c..17b412e3c0 100644 --- a/dumpstate/1.1/vts/functional/Android.bp +++ b/dumpstate/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalDumpstateV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/fastboot/1.0/Android.bp b/fastboot/1.0/Android.bp index 60dfb2d9f5..e097d4b869 100644 --- a/fastboot/1.0/Android.bp +++ b/fastboot/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.fastboot@1.0", root: "android.hardware", diff --git a/fastboot/1.0/default/Android.bp b/fastboot/1.0/default/Android.bp index f7b3635da4..bb32c0d66d 100644 --- a/fastboot/1.0/default/Android.bp +++ b/fastboot/1.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.fastboot@1.0-impl-mock", recovery: true, diff --git a/fastboot/1.1/Android.bp b/fastboot/1.1/Android.bp index 46306cfe81..f08e10ba71 100644 --- a/fastboot/1.1/Android.bp +++ b/fastboot/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.fastboot@1.1", root: "android.hardware", diff --git a/fastboot/1.1/default/Android.bp b/fastboot/1.1/default/Android.bp index 980586ba4b..f779753241 100644 --- a/fastboot/1.1/default/Android.bp +++ b/fastboot/1.1/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.fastboot@1.1-impl-mock", recovery: true, diff --git a/gatekeeper/1.0/Android.bp b/gatekeeper/1.0/Android.bp index f5cb8e457d..631881658a 100644 --- a/gatekeeper/1.0/Android.bp +++ b/gatekeeper/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gatekeeper@1.0", root: "android.hardware", diff --git a/gatekeeper/1.0/default/Android.bp b/gatekeeper/1.0/default/Android.bp index 2be4f4df13..a7723f697e 100644 --- a/gatekeeper/1.0/default/Android.bp +++ b/gatekeeper/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.gatekeeper@1.0-impl", defaults: ["hidl_defaults"], diff --git a/gatekeeper/1.0/software/Android.bp b/gatekeeper/1.0/software/Android.bp index 24c81f6055..098c067a67 100644 --- a/gatekeeper/1.0/software/Android.bp +++ b/gatekeeper/1.0/software/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.gatekeeper@1.0-service.software", defaults: ["hidl_defaults"], diff --git a/gatekeeper/1.0/software/tests/Android.bp b/gatekeeper/1.0/software/tests/Android.bp index 3f0300dc18..1162719526 100644 --- a/gatekeeper/1.0/software/tests/Android.bp +++ b/gatekeeper/1.0/software/tests/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "gatekeeper-software-device-unit-tests", diff --git a/gatekeeper/1.0/vts/functional/Android.bp b/gatekeeper/1.0/vts/functional/Android.bp index 1ca966d20f..64b3505c4d 100644 --- a/gatekeeper/1.0/vts/functional/Android.bp +++ b/gatekeeper/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGatekeeperV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp index 22f47e8aba..873ac05e13 100644 --- a/gnss/1.0/Android.bp +++ b/gnss/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss@1.0", root: "android.hardware", diff --git a/gnss/1.0/default/Android.bp b/gnss/1.0/default/Android.bp index 57d8903c47..b0cf2c6888 100644 --- a/gnss/1.0/default/Android.bp +++ b/gnss/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.gnss@1.0-impl", defaults: ["hidl_defaults"], diff --git a/gnss/1.0/vts/functional/Android.bp b/gnss/1.0/vts/functional/Android.bp index 45755e6671..f27732afdd 100644 --- a/gnss/1.0/vts/functional/Android.bp +++ b/gnss/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGnssV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/gnss/1.1/Android.bp b/gnss/1.1/Android.bp index 1c38e97c44..0664f483c3 100644 --- a/gnss/1.1/Android.bp +++ b/gnss/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss@1.1", root: "android.hardware", diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp index 6853ad948d..ab87990ed1 100644 --- a/gnss/1.1/default/Android.bp +++ b/gnss/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.gnss@1.1-service", init_rc: ["android.hardware.gnss@1.1-service.rc"], diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp index 94bfb894d4..c59d5e7a64 100644 --- a/gnss/1.1/vts/functional/Android.bp +++ b/gnss/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGnssV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp index b7a98b7af2..e88696341e 100644 --- a/gnss/2.0/Android.bp +++ b/gnss/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss@2.0", root: "android.hardware", diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp index be0455365d..8ae9f956c4 100644 --- a/gnss/2.0/default/Android.bp +++ b/gnss/2.0/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.gnss@2.0-service", init_rc: ["android.hardware.gnss@2.0-service.rc"], diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp index d67677afe4..3bbd572841 100644 --- a/gnss/2.0/vts/functional/Android.bp +++ b/gnss/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGnssV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/gnss/2.1/Android.bp b/gnss/2.1/Android.bp index affbeae66d..6273ecbaa0 100644 --- a/gnss/2.1/Android.bp +++ b/gnss/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss@2.1", root: "android.hardware", diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp index 7c4b9c6fc5..9a44eb5607 100644 --- a/gnss/2.1/default/Android.bp +++ b/gnss/2.1/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.gnss@2.1-service", init_rc: ["android.hardware.gnss@2.1-service.rc"], diff --git a/gnss/2.1/vts/functional/Android.bp b/gnss/2.1/vts/functional/Android.bp index aae35710cd..aaddd96f8c 100644 --- a/gnss/2.1/vts/functional/Android.bp +++ b/gnss/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGnssV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/gnss/aidl/Android.bp b/gnss/aidl/Android.bp index c503190802..7725b9549b 100644 --- a/gnss/aidl/Android.bp +++ b/gnss/aidl/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.gnss", vendor_available: true, diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl index 11cdcfcc9a..1a2feb776a 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl @@ -33,6 +33,6 @@ package android.hardware.gnss; @VintfStability parcelable BlocklistedSource { - android.hardware.gnss.GnssConstellationType constellation; + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; int svid; } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl index 2d21748564..9c9a2414a6 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl @@ -33,7 +33,7 @@ package android.hardware.gnss; @VintfStability parcelable CorrelationVector { - int frequencyOffsetMps; + double frequencyOffsetMps; double samplingWidthM; double samplingStartM; int[] magnitude; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl index 728ff68a28..bc73bb19eb 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl @@ -50,7 +50,7 @@ parcelable GnssMeasurement { long carrierCycles; double carrierPhase; double carrierPhaseUncertainty; - android.hardware.gnss.GnssMultipathIndicator multipathIndicator; + android.hardware.gnss.GnssMultipathIndicator multipathIndicator = android.hardware.gnss.GnssMultipathIndicator.UNKNOWN; double snrDb; double agcLevelDb; double fullInterSignalBiasNs; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl index f729d4c2ec..ba02f72961 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl @@ -33,7 +33,7 @@ package android.hardware.gnss; @VintfStability parcelable GnssSignalType { - android.hardware.gnss.GnssConstellationType constellation; + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; double carrierFrequencyHz; @utf8InCpp String codeType; const @utf8InCpp String CODE_TYPE_A = "A"; diff --git a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl index 2fde5b20fd..8b730921ff 100644 --- a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl +++ b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl @@ -26,7 +26,7 @@ parcelable BlocklistedSource { /** * Defines the constellation of the given satellite(s). */ - GnssConstellationType constellation; + GnssConstellationType constellation = GnssConstellationType.UNKNOWN; /** * Satellite (space vehicle) ID number, as defined in GnssSvInfo::svid, or 0 to blocklist all diff --git a/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl b/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl index 22a80cec57..6fbabbc140 100644 --- a/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl +++ b/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl @@ -22,11 +22,10 @@ package android.hardware.gnss; */ @VintfStability parcelable CorrelationVector { - /** * Frequency offset from reported pseudorange rate for this Correlation Vector. */ - int frequencyOffsetMps; + double frequencyOffsetMps; /** * Space between correlation samples in meters. @@ -48,4 +47,4 @@ parcelable CorrelationVector { * The length of the array is defined by the GNSS chipset. */ int[] magnitude; -}
\ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl index 4468b63e26..f20cd25cd7 100644 --- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl @@ -536,7 +536,7 @@ parcelable GnssMeasurement { * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those * signals that are tracked and do not contain multipath. */ - GnssMultipathIndicator multipathIndicator; + GnssMultipathIndicator multipathIndicator = GnssMultipathIndicator.UNKNOWN; /** * Signal-to-noise ratio at correlator output in dB. diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl index 9c68db1f54..a16b170da4 100644 --- a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl @@ -26,7 +26,7 @@ parcelable GnssSignalType { /** * Constellation type of the SV that transmits the signal. */ - GnssConstellationType constellation; + GnssConstellationType constellation = GnssConstellationType.UNKNOWN; /** * Carrier frequency of the signal tracked, for example it can be the diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp index b56a701935..d363a9f832 100644 --- a/gnss/aidl/default/Android.bp +++ b/gnss/aidl/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.gnss-service.example", relative_install_path: "hw", diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp index 7cdc339633..838849d535 100644 --- a/gnss/aidl/vts/Android.bp +++ b/gnss/aidl/vts/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGnssTargetTest", defaults: [ diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp index c44968d674..a330c5a3b0 100644 --- a/gnss/common/utils/default/Android.bp +++ b/gnss/common/utils/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.gnss@common-default-lib", vendor_available: true, diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp index e36b656171..47eff2ec9c 100644 --- a/gnss/common/utils/vts/Android.bp +++ b/gnss/common/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.gnss@common-vts-lib", vendor_available: true, diff --git a/gnss/measurement_corrections/1.0/Android.bp b/gnss/measurement_corrections/1.0/Android.bp index a140674338..d75a9a7e54 100644 --- a/gnss/measurement_corrections/1.0/Android.bp +++ b/gnss/measurement_corrections/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss.measurement_corrections@1.0", root: "android.hardware", diff --git a/gnss/measurement_corrections/1.1/Android.bp b/gnss/measurement_corrections/1.1/Android.bp index 93638489b0..1ae4ef3600 100644 --- a/gnss/measurement_corrections/1.1/Android.bp +++ b/gnss/measurement_corrections/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss.measurement_corrections@1.1", root: "android.hardware", diff --git a/gnss/visibility_control/1.0/Android.bp b/gnss/visibility_control/1.0/Android.bp index 975da785e9..163595a588 100644 --- a/gnss/visibility_control/1.0/Android.bp +++ b/gnss/visibility_control/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.gnss.visibility_control@1.0", root: "android.hardware", diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp index 37d9dfcf89..6ec4e645c1 100644 --- a/graphics/allocator/2.0/Android.bp +++ b/graphics/allocator/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.allocator@2.0", root: "android.hardware", diff --git a/graphics/allocator/2.0/default/Android.bp b/graphics/allocator/2.0/default/Android.bp index 3a2808e93e..47c34849c1 100644 --- a/graphics/allocator/2.0/default/Android.bp +++ b/graphics/allocator/2.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.graphics.allocator@2.0-impl", defaults: ["hidl_defaults"], diff --git a/graphics/allocator/2.0/utils/gralloc1-adapter/Android.bp b/graphics/allocator/2.0/utils/gralloc1-adapter/Android.bp index 9cb53e363b..bc42099c92 100644 --- a/graphics/allocator/2.0/utils/gralloc1-adapter/Android.bp +++ b/graphics/allocator/2.0/utils/gralloc1-adapter/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libgralloc1-adapter", defaults: ["hidl_defaults"], diff --git a/graphics/allocator/2.0/utils/hal/Android.bp b/graphics/allocator/2.0/utils/hal/Android.bp index ac642ce99f..6bb9a0f657 100644 --- a/graphics/allocator/2.0/utils/hal/Android.bp +++ b/graphics/allocator/2.0/utils/hal/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.allocator@2.0-hal", defaults: ["hidl_defaults"], diff --git a/graphics/allocator/2.0/utils/passthrough/Android.bp b/graphics/allocator/2.0/utils/passthrough/Android.bp index 95b92cfb55..f5ac5a61e6 100644 --- a/graphics/allocator/2.0/utils/passthrough/Android.bp +++ b/graphics/allocator/2.0/utils/passthrough/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.allocator@2.0-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/allocator/3.0/Android.bp b/graphics/allocator/3.0/Android.bp index 2cfa1d0ab7..768baba987 100644 --- a/graphics/allocator/3.0/Android.bp +++ b/graphics/allocator/3.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.allocator@3.0", root: "android.hardware", diff --git a/graphics/allocator/4.0/Android.bp b/graphics/allocator/4.0/Android.bp index f5f94585a7..0df9b390f5 100644 --- a/graphics/allocator/4.0/Android.bp +++ b/graphics/allocator/4.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.allocator@4.0", root: "android.hardware", diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp index 7fca3548e3..eda80d7a0d 100644 --- a/graphics/bufferqueue/1.0/Android.bp +++ b/graphics/bufferqueue/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.bufferqueue@1.0", root: "android.hardware", diff --git a/graphics/bufferqueue/2.0/Android.bp b/graphics/bufferqueue/2.0/Android.bp index fd080794b8..13feeb1548 100644 --- a/graphics/bufferqueue/2.0/Android.bp +++ b/graphics/bufferqueue/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.bufferqueue@2.0", root: "android.hardware", diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp index 089fe145a2..74a0d9b9ea 100644 --- a/graphics/common/1.0/Android.bp +++ b/graphics/common/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.common@1.0", root: "android.hardware", diff --git a/graphics/common/1.1/Android.bp b/graphics/common/1.1/Android.bp index 899fe039ce..a120278a86 100644 --- a/graphics/common/1.1/Android.bp +++ b/graphics/common/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.common@1.1", root: "android.hardware", diff --git a/graphics/common/1.2/Android.bp b/graphics/common/1.2/Android.bp index 2c4d93b734..fe149e4225 100644 --- a/graphics/common/1.2/Android.bp +++ b/graphics/common/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.common@1.2", root: "android.hardware", diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index 22e609d758..2a46f9dc7f 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.graphics.common", host_supported: true, diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp index 2358a8fbf3..2e41208663 100644 --- a/graphics/composer/2.1/Android.bp +++ b/graphics/composer/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.composer@2.1", root: "android.hardware", diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp index 0110965b74..3744469e21 100644 --- a/graphics/composer/2.1/default/Android.bp +++ b/graphics/composer/2.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.graphics.composer@2.1-service", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.1/utils/command-buffer/Android.bp b/graphics/composer/2.1/utils/command-buffer/Android.bp index 140d9bb698..07dea31736 100644 --- a/graphics/composer/2.1/utils/command-buffer/Android.bp +++ b/graphics/composer/2.1/utils/command-buffer/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.1-command-buffer", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.1/utils/hal/Android.bp b/graphics/composer/2.1/utils/hal/Android.bp index ea3666dd28..874be84f4d 100644 --- a/graphics/composer/2.1/utils/hal/Android.bp +++ b/graphics/composer/2.1/utils/hal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.1-hal", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp b/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp index ec7a0b927a..0171dd68c9 100644 --- a/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp +++ b/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "libhwc2on1adapter", vendor: true, diff --git a/graphics/composer/2.1/utils/hwc2onfbadapter/Android.bp b/graphics/composer/2.1/utils/hwc2onfbadapter/Android.bp index 73a41f7ff4..3965d1217e 100644 --- a/graphics/composer/2.1/utils/hwc2onfbadapter/Android.bp +++ b/graphics/composer/2.1/utils/hwc2onfbadapter/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "libhwc2onfbadapter", vendor: true, diff --git a/graphics/composer/2.1/utils/passthrough/Android.bp b/graphics/composer/2.1/utils/passthrough/Android.bp index 4d3c976acd..67f516399c 100644 --- a/graphics/composer/2.1/utils/passthrough/Android.bp +++ b/graphics/composer/2.1/utils/passthrough/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.1-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.1/utils/resources/Android.bp b/graphics/composer/2.1/utils/resources/Android.bp index d77bff07bc..9eb23fa82e 100644 --- a/graphics/composer/2.1/utils/resources/Android.bp +++ b/graphics/composer/2.1/utils/resources/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.graphics.composer@2.1-resources", system_ext_specific: true, diff --git a/graphics/composer/2.1/utils/vts/Android.bp b/graphics/composer/2.1/utils/vts/Android.bp index 3b0911f923..8732d53a44 100644 --- a/graphics/composer/2.1/utils/vts/Android.bp +++ b/graphics/composer/2.1/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.composer@2.1-vts", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp index 9e703d8f0b..eb67d34b50 100644 --- a/graphics/composer/2.1/vts/functional/Android.bp +++ b/graphics/composer/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsComposerV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/composer/2.2/Android.bp b/graphics/composer/2.2/Android.bp index 234b9ac6bf..e44a236ba9 100644 --- a/graphics/composer/2.2/Android.bp +++ b/graphics/composer/2.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.composer@2.2", root: "android.hardware", diff --git a/graphics/composer/2.2/default/Android.mk b/graphics/composer/2.2/default/Android.mk index 156ecb6bad..6f7ef85904 100644 --- a/graphics/composer/2.2/default/Android.mk +++ b/graphics/composer/2.2/default/Android.mk @@ -2,6 +2,9 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.graphics.composer@2.2-service +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../NOTICE LOCAL_VENDOR_MODULE := true LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_CFLAGS := -Wall -Werror -DLOG_TAG=\"ComposerHal\" diff --git a/graphics/composer/2.2/utils/command-buffer/Android.bp b/graphics/composer/2.2/utils/command-buffer/Android.bp index c4ceaabe9f..d55145e48c 100644 --- a/graphics/composer/2.2/utils/command-buffer/Android.bp +++ b/graphics/composer/2.2/utils/command-buffer/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.2-command-buffer", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.2/utils/hal/Android.bp b/graphics/composer/2.2/utils/hal/Android.bp index f334a11c7c..4e028e034e 100644 --- a/graphics/composer/2.2/utils/hal/Android.bp +++ b/graphics/composer/2.2/utils/hal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.2-hal", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.2/utils/passthrough/Android.bp b/graphics/composer/2.2/utils/passthrough/Android.bp index 318ce914ed..b7003446e7 100644 --- a/graphics/composer/2.2/utils/passthrough/Android.bp +++ b/graphics/composer/2.2/utils/passthrough/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.2-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.2/utils/resources/Android.bp b/graphics/composer/2.2/utils/resources/Android.bp index 752eb8170d..9e45ef2bc4 100644 --- a/graphics/composer/2.2/utils/resources/Android.bp +++ b/graphics/composer/2.2/utils/resources/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.graphics.composer@2.2-resources", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index a8bb1a22cb..5c085cb768 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.composer@2.2-vts", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index 6aa836c7b9..36f3c00fae 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsComposerV2_2TargetTest", defaults: [ diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp index f522731ec9..1463c3be6c 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp @@ -103,7 +103,8 @@ class GraphicsCompositionTestBase : public ::testing::Test { mTestRenderEngine->initGraphicBuffer( static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight), 1, - static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN)); + static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN | + BufferUsage::GPU_RENDER_TARGET)); mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); } diff --git a/graphics/composer/2.3/Android.bp b/graphics/composer/2.3/Android.bp index 96f301c807..3c52b6f0d5 100644 --- a/graphics/composer/2.3/Android.bp +++ b/graphics/composer/2.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.composer@2.3", root: "android.hardware", diff --git a/graphics/composer/2.3/default/Android.bp b/graphics/composer/2.3/default/Android.bp index a5696ddb95..f801fbadfa 100644 --- a/graphics/composer/2.3/default/Android.bp +++ b/graphics/composer/2.3/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.graphics.composer@2.3-service", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.3/utils/command-buffer/Android.bp b/graphics/composer/2.3/utils/command-buffer/Android.bp index 36ac297588..ca7d136edc 100644 --- a/graphics/composer/2.3/utils/command-buffer/Android.bp +++ b/graphics/composer/2.3/utils/command-buffer/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.3-command-buffer", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.3/utils/hal/Android.bp b/graphics/composer/2.3/utils/hal/Android.bp index 3ee930050c..b475757658 100644 --- a/graphics/composer/2.3/utils/hal/Android.bp +++ b/graphics/composer/2.3/utils/hal/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.3-hal", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.3/utils/passthrough/Android.bp b/graphics/composer/2.3/utils/passthrough/Android.bp index 3ae6b1648d..68b706cdc1 100644 --- a/graphics/composer/2.3/utils/passthrough/Android.bp +++ b/graphics/composer/2.3/utils/passthrough/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.3-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.3/utils/vts/Android.bp b/graphics/composer/2.3/utils/vts/Android.bp index 3d81e8f647..7bc07a4428 100644 --- a/graphics/composer/2.3/utils/vts/Android.bp +++ b/graphics/composer/2.3/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.composer@2.3-vts", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.3/vts/functional/Android.bp b/graphics/composer/2.3/vts/functional/Android.bp index 1cbb60e555..d27a1513f4 100644 --- a/graphics/composer/2.3/vts/functional/Android.bp +++ b/graphics/composer/2.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsComposerV2_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/composer/2.4/Android.bp b/graphics/composer/2.4/Android.bp index 2bbe751402..e6b238ba9f 100644 --- a/graphics/composer/2.4/Android.bp +++ b/graphics/composer/2.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.composer@2.4", root: "android.hardware", diff --git a/graphics/composer/2.4/default/Android.bp b/graphics/composer/2.4/default/Android.bp index a30609b1a2..7a91ec1f11 100644 --- a/graphics/composer/2.4/default/Android.bp +++ b/graphics/composer/2.4/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.graphics.composer@2.4-service", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.4/utils/command-buffer/Android.bp b/graphics/composer/2.4/utils/command-buffer/Android.bp index 8acf0e13ca..c966fc4171 100644 --- a/graphics/composer/2.4/utils/command-buffer/Android.bp +++ b/graphics/composer/2.4/utils/command-buffer/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.4-command-buffer", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.4/utils/hal/Android.bp b/graphics/composer/2.4/utils/hal/Android.bp index f4cdea49a8..abf8e0450b 100644 --- a/graphics/composer/2.4/utils/hal/Android.bp +++ b/graphics/composer/2.4/utils/hal/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.4-hal", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.4/utils/passthrough/Android.bp b/graphics/composer/2.4/utils/passthrough/Android.bp index 43d9aaaa78..a851c0a081 100644 --- a/graphics/composer/2.4/utils/passthrough/Android.bp +++ b/graphics/composer/2.4/utils/passthrough/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.composer@2.4-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.4/utils/vts/Android.bp b/graphics/composer/2.4/utils/vts/Android.bp index fc13c2a79c..5ef861c4f7 100644 --- a/graphics/composer/2.4/utils/vts/Android.bp +++ b/graphics/composer/2.4/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.composer@2.4-vts", defaults: ["hidl_defaults"], diff --git a/graphics/composer/2.4/vts/functional/Android.bp b/graphics/composer/2.4/vts/functional/Android.bp index cab549c50b..6089e2da75 100644 --- a/graphics/composer/2.4/vts/functional/Android.bp +++ b/graphics/composer/2.4/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsComposerV2_4TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/composer/2.4/vts/functional/AndroidTest.xml b/graphics/composer/2.4/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..583aa6866c --- /dev/null +++ b/graphics/composer/2.4/vts/functional/AndroidTest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 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. +--> + +<configuration description="Runs VtsHalGraphicsComposerV2_4TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"> + </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.StopServicesSetup"> + </target_preparer> + + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="VtsHalGraphicsComposerV2_4TargetTest->/data/local/tmp/VtsHalGraphicsComposerV2_4TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalGraphicsComposerV2_4TargetTest" /> + <option name="native-test-timeout" value="300000"/> + </test> +</configuration> diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp index 4459bdc7f6..63fdfa6cc5 100644 --- a/graphics/mapper/2.0/Android.bp +++ b/graphics/mapper/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.mapper@2.0", root: "android.hardware", diff --git a/graphics/mapper/2.0/default/Android.bp b/graphics/mapper/2.0/default/Android.bp index 4f641842db..fffea3b5f2 100644 --- a/graphics/mapper/2.0/default/Android.bp +++ b/graphics/mapper/2.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.graphics.mapper@2.0-impl", defaults: ["hidl_defaults"], diff --git a/graphics/mapper/2.0/utils/hal/Android.bp b/graphics/mapper/2.0/utils/hal/Android.bp index 5610a69aac..f5d4506100 100644 --- a/graphics/mapper/2.0/utils/hal/Android.bp +++ b/graphics/mapper/2.0/utils/hal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.mapper@2.0-hal", defaults: ["hidl_defaults"], diff --git a/graphics/mapper/2.0/utils/passthrough/Android.bp b/graphics/mapper/2.0/utils/passthrough/Android.bp index 4f700c867a..23450fb0a7 100644 --- a/graphics/mapper/2.0/utils/passthrough/Android.bp +++ b/graphics/mapper/2.0/utils/passthrough/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.mapper@2.0-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/mapper/2.0/utils/vts/Android.bp b/graphics/mapper/2.0/utils/vts/Android.bp index e43011f0a8..03f925d7bf 100644 --- a/graphics/mapper/2.0/utils/vts/Android.bp +++ b/graphics/mapper/2.0/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.mapper@2.0-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/2.0/vts/functional/Android.bp b/graphics/mapper/2.0/vts/functional/Android.bp index 1f7ae04c15..43e61565fb 100644 --- a/graphics/mapper/2.0/vts/functional/Android.bp +++ b/graphics/mapper/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsMapperV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/2.1/Android.bp b/graphics/mapper/2.1/Android.bp index e5a5ae4d66..4011650d85 100644 --- a/graphics/mapper/2.1/Android.bp +++ b/graphics/mapper/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.mapper@2.1", root: "android.hardware", diff --git a/graphics/mapper/2.1/default/Android.bp b/graphics/mapper/2.1/default/Android.bp index 2ea7f94b82..4f080c417f 100644 --- a/graphics/mapper/2.1/default/Android.bp +++ b/graphics/mapper/2.1/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.graphics.mapper@2.0-impl-2.1", defaults: ["hidl_defaults"], diff --git a/graphics/mapper/2.1/utils/hal/Android.bp b/graphics/mapper/2.1/utils/hal/Android.bp index 2a4cc6e4fb..aff497cea0 100644 --- a/graphics/mapper/2.1/utils/hal/Android.bp +++ b/graphics/mapper/2.1/utils/hal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.mapper@2.1-hal", defaults: ["hidl_defaults"], diff --git a/graphics/mapper/2.1/utils/passthrough/Android.bp b/graphics/mapper/2.1/utils/passthrough/Android.bp index 6946a53c71..d46041b37a 100644 --- a/graphics/mapper/2.1/utils/passthrough/Android.bp +++ b/graphics/mapper/2.1/utils/passthrough/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.graphics.mapper@2.1-passthrough", defaults: ["hidl_defaults"], diff --git a/graphics/mapper/2.1/utils/vts/Android.bp b/graphics/mapper/2.1/utils/vts/Android.bp index abbe50a64c..5c67df9443 100644 --- a/graphics/mapper/2.1/utils/vts/Android.bp +++ b/graphics/mapper/2.1/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.mapper@2.1-vts", defaults: ["hidl_defaults", "VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/2.1/vts/functional/Android.bp b/graphics/mapper/2.1/vts/functional/Android.bp index ccbe40fd96..7bbc9a44f7 100644 --- a/graphics/mapper/2.1/vts/functional/Android.bp +++ b/graphics/mapper/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsMapperV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/3.0/Android.bp b/graphics/mapper/3.0/Android.bp index a14324310c..401a3a22b5 100644 --- a/graphics/mapper/3.0/Android.bp +++ b/graphics/mapper/3.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.mapper@3.0", root: "android.hardware", diff --git a/graphics/mapper/3.0/utils/vts/Android.bp b/graphics/mapper/3.0/utils/vts/Android.bp index c3d480a565..c0d56de1ab 100644 --- a/graphics/mapper/3.0/utils/vts/Android.bp +++ b/graphics/mapper/3.0/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.mapper@3.0-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/3.0/vts/functional/Android.bp b/graphics/mapper/3.0/vts/functional/Android.bp index 3f4abecdd4..e83702703c 100644 --- a/graphics/mapper/3.0/vts/functional/Android.bp +++ b/graphics/mapper/3.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsMapperV3_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/4.0/Android.bp b/graphics/mapper/4.0/Android.bp index 42c4942e85..4084dcda91 100644 --- a/graphics/mapper/4.0/Android.bp +++ b/graphics/mapper/4.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.graphics.mapper@4.0", root: "android.hardware", diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp index 56ff116a43..633149805c 100644 --- a/graphics/mapper/4.0/utils/vts/Android.bp +++ b/graphics/mapper/4.0/utils/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.graphics.mapper@4.0-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/graphics/mapper/4.0/vts/functional/Android.bp b/graphics/mapper/4.0/vts/functional/Android.bp index 2d39daaa0b..11ebdc59a1 100644 --- a/graphics/mapper/4.0/vts/functional/Android.bp +++ b/graphics/mapper/4.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalGraphicsMapperV4_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp index 7786c08bdc..003b106cc2 100644 --- a/health/1.0/Android.bp +++ b/health/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.health@1.0", root: "android.hardware", diff --git a/health/1.0/default/Android.bp b/health/1.0/default/Android.bp index ff4b8759b8..6a21595378 100644 --- a/health/1.0/default/Android.bp +++ b/health/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.health@1.0-convert", vendor_available: true, diff --git a/health/2.0/Android.bp b/health/2.0/Android.bp index 420586e2e2..ddd983dc50 100644 --- a/health/2.0/Android.bp +++ b/health/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.health@2.0", root: "android.hardware", diff --git a/health/2.0/default/Android.bp b/health/2.0/default/Android.bp index 3c5877e1da..73cd553058 100644 --- a/health/2.0/default/Android.bp +++ b/health/2.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.health@2.0-impl_defaults", diff --git a/health/2.0/utils/libhealthhalutils/Android.bp b/health/2.0/utils/libhealthhalutils/Android.bp index 449ef16b30..fa6e67e397 100644 --- a/health/2.0/utils/libhealthhalutils/Android.bp +++ b/health/2.0/utils/libhealthhalutils/Android.bp @@ -16,6 +16,15 @@ // Convenience library for (hwbinder) clients to choose the correct health // service instance. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libhealthhalutils", srcs: ["HealthHalUtils.cpp"], diff --git a/health/2.0/utils/libhealthservice/Android.bp b/health/2.0/utils/libhealthservice/Android.bp index 88c38f2125..8023692247 100644 --- a/health/2.0/utils/libhealthservice/Android.bp +++ b/health/2.0/utils/libhealthservice/Android.bp @@ -3,6 +3,15 @@ // libhealthd and libhealthstoragedefault. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libhealthservice", vendor_available: true, diff --git a/health/2.0/utils/libhealthstoragedefault/Android.bp b/health/2.0/utils/libhealthstoragedefault/Android.bp index 5bc8b9fdef..3de8789713 100644 --- a/health/2.0/utils/libhealthstoragedefault/Android.bp +++ b/health/2.0/utils/libhealthstoragedefault/Android.bp @@ -17,6 +17,15 @@ // Default implementation for (passthrough) clients that statically links to // android.hardware.health@2.0-impl but do no query for storage related // information. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { srcs: ["StorageHealthDefault.cpp"], name: "libhealthstoragedefault", diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp index ab14ca75c3..eb696123f4 100644 --- a/health/2.0/vts/functional/Android.bp +++ b/health/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalHealthV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/health/2.1/Android.bp b/health/2.1/Android.bp index 80a6501664..8a116173fb 100644 --- a/health/2.1/Android.bp +++ b/health/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.health@2.1", root: "android.hardware", diff --git a/health/2.1/default/Android.bp b/health/2.1/default/Android.bp index 3649853a3d..b7bcea5d18 100644 --- a/health/2.1/default/Android.bp +++ b/health/2.1/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.health@2.1-impl-defaults", relative_install_path: "hw", diff --git a/health/2.1/vts/functional/Android.bp b/health/2.1/vts/functional/Android.bp index 7894ca24a8..238a150d10 100644 --- a/health/2.1/vts/functional/Android.bp +++ b/health/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalHealthV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/health/storage/1.0/Android.bp b/health/storage/1.0/Android.bp index b9d892db43..70b2bdce13 100644 --- a/health/storage/1.0/Android.bp +++ b/health/storage/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.health.storage@1.0", root: "android.hardware", diff --git a/health/storage/1.0/default/Android.bp b/health/storage/1.0/default/Android.bp index 3834244cea..7edf9d1a5e 100644 --- a/health/storage/1.0/default/Android.bp +++ b/health/storage/1.0/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.health.storage@1.0-service", vendor: true, diff --git a/health/storage/1.0/vts/functional/Android.bp b/health/storage/1.0/vts/functional/Android.bp index 731ad62434..ccf22ce2e0 100644 --- a/health/storage/1.0/vts/functional/Android.bp +++ b/health/storage/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalHealthStorageV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/health/storage/aidl/Android.bp b/health/storage/aidl/Android.bp index c39a46d48e..bf49466a91 100644 --- a/health/storage/aidl/Android.bp +++ b/health/storage/aidl/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.health.storage", vendor_available: true, diff --git a/health/storage/aidl/default/Android.bp b/health/storage/aidl/default/Android.bp index b53bc35f28..819b885318 100644 --- a/health/storage/aidl/default/Android.bp +++ b/health/storage/aidl/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "libhealth_storage_impl_defaults", vendor: true, diff --git a/health/storage/aidl/vts/functional/Android.bp b/health/storage/aidl/vts/functional/Android.bp index 0e7671df03..be3eac7d98 100644 --- a/health/storage/aidl/vts/functional/Android.bp +++ b/health/storage/aidl/vts/functional/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalHealthStorageTargetTest", defaults: [ diff --git a/health/storage/impl_common/Android.bp b/health/storage/impl_common/Android.bp index e1149c0cb7..925cd5506a 100644 --- a/health/storage/impl_common/Android.bp +++ b/health/storage/impl_common/Android.bp @@ -15,6 +15,15 @@ */ // Common implementation between HIDL and AIDL HAL. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libhealth_storage_impl_common", vendor: true, diff --git a/health/storage/test_common/Android.bp b/health/storage/test_common/Android.bp index 7c6bef414c..a43aae5454 100644 --- a/health/storage/test_common/Android.bp +++ b/health/storage/test_common/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "libhealth_storage_test_common_headers", export_include_dirs: ["include"], diff --git a/health/utils/libhealth2impl/Android.bp b/health/utils/libhealth2impl/Android.bp index 14374a29ee..58417af32b 100644 --- a/health/utils/libhealth2impl/Android.bp +++ b/health/utils/libhealth2impl/Android.bp @@ -14,6 +14,15 @@ // A helper library for health@2.x HAL implementation. // HAL implementations can link to this library and extend the Health class. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libhealth2impl", vendor_available: true, diff --git a/health/utils/libhealthloop/Android.bp b/health/utils/libhealthloop/Android.bp index de0f24fcbb..7aaf90516e 100644 --- a/health/utils/libhealthloop/Android.bp +++ b/health/utils/libhealthloop/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libhealthloop", vendor_available: true, diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index 14aef8ee40..8da664245d 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.identity", vendor_available: true, diff --git a/identity/aidl/default/Android.bp b/identity/aidl/default/Android.bp index 9659f576cf..05b3662035 100644 --- a/identity/aidl/default/Android.bp +++ b/identity/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.identity-libeic-hal-common", vendor_available: true, diff --git a/identity/aidl/default/common/IdentityCredential.cpp b/identity/aidl/default/common/IdentityCredential.cpp index 94779971b1..c8ee0dd67a 100644 --- a/identity/aidl/default/common/IdentityCredential.cpp +++ b/identity/aidl/default/common/IdentityCredential.cpp @@ -253,14 +253,17 @@ ndk::ScopedAStatus IdentityCredential::startRetrieval( } } - // Feed the auth token to secure hardware. - if (!hwProxy_->setAuthToken(authToken.challenge, authToken.userId, authToken.authenticatorId, - int(authToken.authenticatorType), authToken.timestamp.milliSeconds, - authToken.mac, verificationToken_.challenge, - verificationToken_.timestamp.milliSeconds, - int(verificationToken_.securityLevel), verificationToken_.mac)) { - return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( - IIdentityCredentialStore::STATUS_INVALID_DATA, "Invalid Auth Token")); + // Feed the auth token to secure hardware only if they're valid. + if (authToken.timestamp.milliSeconds != 0) { + if (!hwProxy_->setAuthToken( + authToken.challenge, authToken.userId, authToken.authenticatorId, + int(authToken.authenticatorType), authToken.timestamp.milliSeconds, + authToken.mac, verificationToken_.challenge, + verificationToken_.timestamp.milliSeconds, + int(verificationToken_.securityLevel), verificationToken_.mac)) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( + IIdentityCredentialStore::STATUS_INVALID_DATA, "Invalid Auth Token")); + } } // We'll be feeding ACPs interleaved with certificates from the reader diff --git a/identity/aidl/default/libeic/EicPresentation.c b/identity/aidl/default/libeic/EicPresentation.c index 5e9a280d09..9e033b39fb 100644 --- a/identity/aidl/default/libeic/EicPresentation.c +++ b/identity/aidl/default/libeic/EicPresentation.c @@ -336,6 +336,18 @@ bool eicPresentationSetAuthToken(EicPresentation* ctx, uint64_t challenge, uint6 int verificationTokenSecurityLevel, const uint8_t* verificationTokenMac, size_t verificationTokenMacSize) { + // It doesn't make sense to accept any tokens if eicPresentationCreateAuthChallenge() + // was never called. + if (ctx->authChallenge == 0) { + eicDebug("Trying validate tokens when no auth-challenge was previously generated"); + return false; + } + // At least the verification-token must have the same challenge as what was generated. + if (verificationTokenChallenge != ctx->authChallenge) { + eicDebug("Challenge in verification token does not match the challenge " + "previously generated"); + return false; + } if (!eicOpsValidateAuthToken( challenge, secureUserId, authenticatorId, hardwareAuthenticatorType, timeStamp, mac, macSize, verificationTokenChallenge, verificationTokenTimestamp, @@ -360,18 +372,9 @@ static bool checkUserAuth(EicPresentation* ctx, bool userAuthenticationRequired, return false; } + // Only ACP with auth-on-every-presentation - those with timeout == 0 - need the + // challenge to match... if (timeoutMillis == 0) { - if (ctx->authTokenChallenge == 0) { - eicDebug("No challenge in authToken"); - return false; - } - - // If we didn't create a challenge, too bad but user auth with - // timeoutMillis set to 0 needs it. - if (ctx->authChallenge == 0) { - eicDebug("No challenge was created for this session"); - return false; - } if (ctx->authTokenChallenge != ctx->authChallenge) { eicDebug("Challenge in authToken (%" PRIu64 ") doesn't match the challenge " diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp index f487a64799..82c40110eb 100644 --- a/identity/aidl/vts/Android.bp +++ b/identity/aidl/vts/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalIdentityTargetTest", defaults: [ diff --git a/identity/support/Android.bp b/identity/support/Android.bp index 2b6c695442..d00f59a9fa 100644 --- a/identity/support/Android.bp +++ b/identity/support/Android.bp @@ -13,6 +13,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.identity-support-lib", vendor_available: true, diff --git a/identity/support/src/IdentityCredentialSupport.cpp b/identity/support/src/IdentityCredentialSupport.cpp index 6418028c6a..aba89c12dc 100644 --- a/identity/support/src/IdentityCredentialSupport.cpp +++ b/identity/support/src/IdentityCredentialSupport.cpp @@ -928,7 +928,7 @@ optional<vector<vector<uint8_t>>> createAttestation( // translate certificate format from keymaster_cert_chain_t to vector<vector<uint8_t>>. vector<vector<uint8_t>> attestationCertificate; - for (int i = 0; i < cert_chain_out.entry_count; i++) { + for (std::size_t i = 0; i < cert_chain_out.entry_count; i++) { attestationCertificate.insert( attestationCertificate.end(), vector<uint8_t>( diff --git a/input/classifier/1.0/Android.bp b/input/classifier/1.0/Android.bp index b6e54ca56a..37e522d4f5 100644 --- a/input/classifier/1.0/Android.bp +++ b/input/classifier/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.input.classifier@1.0", root: "android.hardware", diff --git a/input/classifier/1.0/default/Android.bp b/input/classifier/1.0/default/Android.bp index 3379a76a81..8ab2ba8b9a 100644 --- a/input/classifier/1.0/default/Android.bp +++ b/input/classifier/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.input.classifier@1.0-service.default", init_rc: ["android.hardware.input.classifier@1.0-service.default.rc"], diff --git a/input/classifier/1.0/vts/functional/Android.bp b/input/classifier/1.0/vts/functional/Android.bp index fc1f5857b2..e170f4a613 100644 --- a/input/classifier/1.0/vts/functional/Android.bp +++ b/input/classifier/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalInputClassifierV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/input/common/1.0/Android.bp b/input/common/1.0/Android.bp index 07ced7ab05..ed0ab9875b 100644 --- a/input/common/1.0/Android.bp +++ b/input/common/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.input.common@1.0", root: "android.hardware", diff --git a/ir/1.0/Android.bp b/ir/1.0/Android.bp index 6a521f7d51..7ed742903c 100644 --- a/ir/1.0/Android.bp +++ b/ir/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.ir@1.0", root: "android.hardware", diff --git a/ir/1.0/default/Android.bp b/ir/1.0/default/Android.bp index 80e0f3c88c..9b99f13da6 100644 --- a/ir/1.0/default/Android.bp +++ b/ir/1.0/default/Android.bp @@ -12,6 +12,15 @@ // 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. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.ir@1.0-impl", defaults: ["hidl_defaults"], diff --git a/ir/1.0/vts/functional/Android.bp b/ir/1.0/vts/functional/Android.bp index 160129f8c5..983f2a44e1 100644 --- a/ir/1.0/vts/functional/Android.bp +++ b/ir/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalIrV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/keymaster/3.0/Android.bp b/keymaster/3.0/Android.bp index d0c7a7cd3e..12f6e3c00e 100644 --- a/keymaster/3.0/Android.bp +++ b/keymaster/3.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.keymaster@3.0", root: "android.hardware", diff --git a/keymaster/3.0/default/Android.mk b/keymaster/3.0/default/Android.mk index 208cb66b2d..053ad671fb 100644 --- a/keymaster/3.0/default/Android.mk +++ b/keymaster/3.0/default/Android.mk @@ -2,6 +2,9 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.keymaster@3.0-impl +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_PROPRIETARY_MODULE := true LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := \ @@ -25,6 +28,9 @@ include $(CLEAR_VARS) LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_PROPRIETARY_MODULE := true LOCAL_MODULE := android.hardware.keymaster@3.0-service +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_INIT_RC := android.hardware.keymaster@3.0-service.rc LOCAL_SRC_FILES := \ service.cpp diff --git a/keymaster/3.0/vts/functional/Android.bp b/keymaster/3.0/vts/functional/Android.bp index 35b9387132..e2ae80373f 100644 --- a/keymaster/3.0/vts/functional/Android.bp +++ b/keymaster/3.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalKeymasterV3_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/keymaster/4.0/Android.bp b/keymaster/4.0/Android.bp index 5774718601..8b4bc5b0da 100644 --- a/keymaster/4.0/Android.bp +++ b/keymaster/4.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.keymaster@4.0", root: "android.hardware", diff --git a/keymaster/4.0/default/Android.bp b/keymaster/4.0/default/Android.bp index f9e39864c7..702a7160bd 100644 --- a/keymaster/4.0/default/Android.bp +++ b/keymaster/4.0/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.keymaster@4.0-service", defaults: ["hidl_defaults"], diff --git a/keymaster/4.0/support/Android.bp b/keymaster/4.0/support/Android.bp index 9c5fbab735..efb64c3821 100644 --- a/keymaster/4.0/support/Android.bp +++ b/keymaster/4.0/support/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "libkeymaster4support", vendor_available: true, diff --git a/keymaster/4.0/vts/functional/Android.bp b/keymaster/4.0/vts/functional/Android.bp index e706c689e6..a7be660c43 100644 --- a/keymaster/4.0/vts/functional/Android.bp +++ b/keymaster/4.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalKeymasterV4_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index f196928093..e0d60fcd23 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -136,6 +136,54 @@ string bin2hex(const hidl_vec<uint8_t>& data) { return retval; } +/* + * DER-encoded PKCS#8 format RSA key. Generated using: + * + * openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -outform der | hexdump -e '30/1 "%02X" "\n"' + */ +string rsa_2048_key = hex2str( + "308204BD020100300D06092A864886F70D0101010500048204A7308204A3" + "0201000282010100BEBC342B56D443B1299F9A6A7056E80A897E318476A5" + "A18029E63B2ED739A61791D339F58DC763D9D14911F2EDEC383DEE11F631" + "9B44510E7A3ECD9B79B97382E49500ACF8117DC89CAF0E621F77756554A2" + "FD4664BFE7AB8B59AB48340DBFA27B93B5A81F6ECDEB02D0759307128DF3" + "E3BAD4055C8B840216DFAA5700670E6C5126F0962FCB70FF308F25049164" + "CCF76CC2DA66A7DD9A81A714C2809D69186133D29D84568E892B6FFBF319" + "9BDB14383EE224407F190358F111A949552ABA6714227D1BD7F6B20DD0CB" + "88F9467B719339F33BFF35B3870B3F62204E4286B0948EA348B524544B5F" + "9838F29EE643B079EEF8A713B220D7806924CDF7295070C5020301000102" + "82010069F377F35F2F584EF075353CCD1CA99738DB3DBC7C7FF35F9366CE" + "176DFD1B135AB10030344ABF5FBECF1D4659FDEF1C0FC430834BE1BE3911" + "951377BB3D563A2EA9CA8F4AD9C48A8CE6FD516A735C662686C7B4B3C09A" + "7B8354133E6F93F790D59EAEB92E84C9A4339302CCE28FDF04CCCAFA7DE3" + "F3A827D4F6F7D38E68B0EC6AB706645BF074A4E4090D06FB163124365FD5" + "EE7A20D350E9958CC30D91326E1B292E9EF5DB408EC42DAF737D20149704" + "D0A678A0FB5B5446863B099228A352D604BA8091A164D01D5AB05397C71E" + "AD20BE2A08FC528FE442817809C787FEE4AB97F97B9130D022153EDC6EB6" + "CBE7B0F8E3473F2E901209B5DB10F93604DB0102818100E83C0998214941" + "EA4F9293F1B77E2E99E6CF305FAF358238E126124FEAF2EB9724B2EA7B78" + "E6032343821A80E55D1D88FB12D220C3F41A56142FEC85796D1917F1E8C7" + "74F142B67D3D6E7B7E6B4383E94DB5929089DBB346D5BDAB40CC2D96EE04" + "09475E175C63BF78CFD744136740838127EA723FF3FE7FA368C1311B4A4E" + "0502818100D240FCC0F5D7715CDE21CB2DC86EA146132EA3B06F61FF2AF5" + "4BF38473F59DADCCE32B5F4CC32DD0BA6F509347B4B5B1B58C39F95E4798" + "CCBB43E83D0119ACF532F359CA743C85199F0286610E200997D731291717" + "9AC9B67558773212EC961E8BCE7A3CC809BC5486A96E4B0E6AF394D94E06" + "6A0900B7B70E82A44FB30053C102818100AD15DA1CBD6A492B66851BA8C3" + "16D38AB700E2CFDDD926A658003513C54BAA152B30021D667D20078F500F" + "8AD3E7F3945D74A891ED1A28EAD0FEEAEC8C14A8E834CF46A13D1378C99D" + "18940823CFDD27EC5810D59339E0C34198AC638E09C87CBB1B634A9864AE" + "9F4D5EB2D53514F67B4CAEC048C8AB849A02E397618F3271350281801FA2" + "C1A5331880A92D8F3E281C617108BF38244F16E352E69ED417C7153F9EC3" + "18F211839C643DCF8B4DD67CE2AC312E95178D5D952F06B1BF779F491692" + "4B70F582A23F11304E02A5E7565AE22A35E74FECC8B6FDC93F92A1A37703" + "E4CF0E63783BD02EB716A7ECBBFA606B10B74D01579522E7EF84D91FC522" + "292108D902C1028180796FE3825F9DCC85DF22D58690065D93898ACD65C0" + "87BEA8DA3A63BF4549B795E2CD0E3BE08CDEBD9FCF1720D9CDC5070D74F4" + "0DED8E1102C52152A31B6165F83A6722AECFCC35A493D7634664B888A08D" + "3EB034F12EA28BFEE346E205D334827F778B16ED40872BD29FCB36536B6E" + "93FFB06778696B4A9D81BB0A9423E63DE5"); + string rsa_key = hex2str( "30820275020100300d06092a864886f70d01010105000482025f3082025b" "02010002818100c6095409047d8634812d5a218176e45c41d60a75b13901" @@ -1905,21 +1953,31 @@ class ImportKeyTest : public KeymasterHidlTest { * Verifies that importing and using an RSA key pair works correctly. */ TEST_P(ImportKeyTest, RsaSuccess) { + uint32_t keysize; + string key; + if (SecLevel() == SecurityLevel::STRONGBOX) { + keysize = 2048; + key = rsa_2048_key; + } else { + keysize = 1024; + key = rsa_key; + } + ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder() - .Authorization(TAG_NO_AUTH_REQUIRED) - .RsaSigningKey(1024, 65537) - .Digest(Digest::SHA_2_256) - .Padding(PaddingMode::RSA_PSS), - KeyFormat::PKCS8, rsa_key)); + .Authorization(TAG_NO_AUTH_REQUIRED) + .RsaSigningKey(keysize, 65537) + .Digest(Digest::SHA_2_256) + .Padding(PaddingMode::RSA_PSS), + KeyFormat::PKCS8, key)); CheckCryptoParam(TAG_ALGORITHM, Algorithm::RSA); - CheckCryptoParam(TAG_KEY_SIZE, 1024U); + CheckCryptoParam(TAG_KEY_SIZE, keysize); CheckCryptoParam(TAG_RSA_PUBLIC_EXPONENT, 65537U); CheckCryptoParam(TAG_DIGEST, Digest::SHA_2_256); CheckCryptoParam(TAG_PADDING, PaddingMode::RSA_PSS); CheckOrigin(); - string message(1024 / 8, 'a'); + string message(keysize / 8, 'a'); auto params = AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Padding(PaddingMode::RSA_PSS); string signature = SignMessage(message, params); VerifyMessage(message, signature, params); @@ -2509,7 +2567,8 @@ TEST_P(EncryptionOperationsTest, RsaPkcs1Success) { string message = "Hello World!"; auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT); string ciphertext1 = EncryptMessage(message, params); - EXPECT_EQ(2048U / 8, ciphertext1.size()); + // Die here on failure because we try to modify ciphertext1 below + ASSERT_EQ(2048U / 8, ciphertext1.size()) << "Failed to encrypt the message"; string ciphertext2 = EncryptMessage(message, params); EXPECT_EQ(2048U / 8, ciphertext2.size()); diff --git a/keymaster/4.0/vts/performance/Android.bp b/keymaster/4.0/vts/performance/Android.bp index 9434bc9de7..d7342ad253 100644 --- a/keymaster/4.0/vts/performance/Android.bp +++ b/keymaster/4.0/vts/performance/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_benchmark { name: "keymaster_benchmark", defaults: ["VtsHalTargetTestDefaults"], diff --git a/keymaster/4.1/Android.bp b/keymaster/4.1/Android.bp index 4e7e944564..e76afbdfa3 100644 --- a/keymaster/4.1/Android.bp +++ b/keymaster/4.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.keymaster@4.1", root: "android.hardware", diff --git a/keymaster/4.1/default/Android.bp b/keymaster/4.1/default/Android.bp index 3442b181bb..3e2289a701 100644 --- a/keymaster/4.1/default/Android.bp +++ b/keymaster/4.1/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.keymaster@4.1-service", defaults: ["hidl_defaults"], diff --git a/keymaster/4.1/support/Android.bp b/keymaster/4.1/support/Android.bp index bdd0ca89ae..fe0d07dd6c 100644 --- a/keymaster/4.1/support/Android.bp +++ b/keymaster/4.1/support/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "libkeymaster4_1support", vendor_available: true, diff --git a/keymaster/4.1/vts/functional/Android.bp b/keymaster/4.1/vts/functional/Android.bp index 5ba05ea4ef..c650bec258 100644 --- a/keymaster/4.1/vts/functional/Android.bp +++ b/keymaster/4.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalKeymasterV4_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp b/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp index 728a523d65..e46cb4868d 100644 --- a/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp +++ b/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp @@ -221,71 +221,78 @@ TEST_P(DeviceUniqueAttestationTest, NonStrongBoxOnly) { TEST_P(DeviceUniqueAttestationTest, Rsa) { if (SecLevel() != SecurityLevel::STRONGBOX) return; - ASSERT_EQ(ErrorCode::OK, - convert(GenerateKey(AuthorizationSetBuilder() - .Authorization(TAG_NO_AUTH_REQUIRED) - .RsaSigningKey(2048, 65537) - .Digest(Digest::SHA_2_256) - .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN) - .Authorization(TAG_INCLUDE_UNIQUE_ID)))); + ASSERT_EQ(ErrorCode::OK, convert(GenerateKey(AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .RsaSigningKey(2048, 65537) + .Digest(Digest::SHA_2_256) + .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN) + .Authorization(TAG_INCLUDE_UNIQUE_ID)))); hidl_vec<hidl_vec<uint8_t>> cert_chain; HidlBuf challenge("challenge"); HidlBuf app_id("foo"); - EXPECT_EQ(ErrorCode::OK, - convert(AttestKey(AuthorizationSetBuilder() - .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) - .Authorization(TAG_ATTESTATION_CHALLENGE, challenge) - .Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), - &cert_chain))); + ErrorCode result = + convert(AttestKey(AuthorizationSetBuilder() + .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) + .Authorization(TAG_ATTESTATION_CHALLENGE, challenge) + .Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), + &cert_chain)); + // It is optional for Strong box to support DeviceUniqueAttestation. + if (result == ErrorCode::CANNOT_ATTEST_IDS) return; + + EXPECT_EQ(ErrorCode::OK, result); EXPECT_EQ(2U, cert_chain.size()); if (dumpAttestations) dumpContent(bin2hex(cert_chain[0])); auto [err, attestation] = parse_attestation_record(cert_chain[0]); ASSERT_EQ(ErrorCode::OK, err); - check_attestation_record(attestation, challenge, - /* sw_enforced */ - AuthorizationSetBuilder() - .Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), - /* hw_enforced */ - AuthorizationSetBuilder() - .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) - .Authorization(TAG_NO_AUTH_REQUIRED) - .RsaSigningKey(2048, 65537) - .Digest(Digest::SHA_2_256) - .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN) - .Authorization(TAG_ORIGIN, KeyOrigin::GENERATED) - .Authorization(TAG_OS_VERSION, os_version()) - .Authorization(TAG_OS_PATCHLEVEL, os_patch_level()), - SecLevel()); + check_attestation_record( + attestation, challenge, + /* sw_enforced */ + AuthorizationSetBuilder().Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), + /* hw_enforced */ + AuthorizationSetBuilder() + .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) + .Authorization(TAG_NO_AUTH_REQUIRED) + .RsaSigningKey(2048, 65537) + .Digest(Digest::SHA_2_256) + .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN) + .Authorization(TAG_ORIGIN, KeyOrigin::GENERATED) + .Authorization(TAG_OS_VERSION, os_version()) + .Authorization(TAG_OS_PATCHLEVEL, os_patch_level()), + SecLevel()); } TEST_P(DeviceUniqueAttestationTest, Ecdsa) { if (SecLevel() != SecurityLevel::STRONGBOX) return; - ASSERT_EQ(ErrorCode::OK, - convert(GenerateKey(AuthorizationSetBuilder() - .Authorization(TAG_NO_AUTH_REQUIRED) - .EcdsaSigningKey(256) - .Digest(Digest::SHA_2_256) - .Authorization(TAG_INCLUDE_UNIQUE_ID)))); + ASSERT_EQ(ErrorCode::OK, convert(GenerateKey(AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .EcdsaSigningKey(256) + .Digest(Digest::SHA_2_256) + .Authorization(TAG_INCLUDE_UNIQUE_ID)))); hidl_vec<hidl_vec<uint8_t>> cert_chain; HidlBuf challenge("challenge"); HidlBuf app_id("foo"); - EXPECT_EQ(ErrorCode::OK, - convert(AttestKey(AuthorizationSetBuilder() - .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) - .Authorization(TAG_ATTESTATION_CHALLENGE, challenge) - .Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), - &cert_chain))); + ErrorCode result = + convert(AttestKey(AuthorizationSetBuilder() + .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) + .Authorization(TAG_ATTESTATION_CHALLENGE, challenge) + .Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), + &cert_chain)); + + // It is optional for Strong box to support DeviceUniqueAttestation. + if (result == ErrorCode::CANNOT_ATTEST_IDS) return; + EXPECT_EQ(ErrorCode::OK, result); EXPECT_EQ(2U, cert_chain.size()); if (dumpAttestations) dumpContent(bin2hex(cert_chain[0])); auto [err, attestation] = parse_attestation_record(cert_chain[0]); ASSERT_EQ(ErrorCode::OK, err); - check_attestation_record(attestation, challenge, + check_attestation_record( + attestation, challenge, /* sw_enforced */ AuthorizationSetBuilder().Authorization(TAG_ATTESTATION_APPLICATION_ID, app_id), /* hw_enforced */ diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp index 56a3ca99e7..b7a261c596 100644 --- a/keymaster/aidl/Android.bp +++ b/keymaster/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.keymaster", vendor_available: true, diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp index ae6d37c387..95eb5ae896 100644 --- a/light/2.0/Android.bp +++ b/light/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.light@2.0", root: "android.hardware", diff --git a/light/2.0/default/Android.bp b/light/2.0/default/Android.bp index 32fcaaff39..e3e7e5b0ca 100644 --- a/light/2.0/default/Android.bp +++ b/light/2.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.light@2.0-impl", defaults: ["hidl_defaults"], diff --git a/light/2.0/vts/functional/Android.bp b/light/2.0/vts/functional/Android.bp index 06590c3a15..91fb8470dc 100644 --- a/light/2.0/vts/functional/Android.bp +++ b/light/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalLightV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -21,4 +30,3 @@ cc_test { static_libs: ["android.hardware.light@2.0"], test_suites: ["general-tests", "vts"], } - diff --git a/light/aidl/Android.bp b/light/aidl/Android.bp index fbcdb321aa..c8973f3c25 100644 --- a/light/aidl/Android.bp +++ b/light/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.light", vendor_available: true, diff --git a/light/aidl/default/Android.bp b/light/aidl/default/Android.bp index 4e43ba9c63..459b8e2248 100644 --- a/light/aidl/default/Android.bp +++ b/light/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.lights-service.example", relative_install_path: "hw", diff --git a/light/aidl/vts/functional/Android.bp b/light/aidl/vts/functional/Android.bp index 4c9356c9ca..c5a85620d2 100644 --- a/light/aidl/vts/functional/Android.bp +++ b/light/aidl/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalLightTargetTest", defaults: [ diff --git a/light/utils/Android.bp b/light/utils/Android.bp index 871f983532..927394e763 100644 --- a/light/utils/Android.bp +++ b/light/utils/Android.bp @@ -16,6 +16,15 @@ // Turns off the screen. // Canonical usage is for init (which can't talk to hals directly). +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "blank_screen", init_rc: ["blank_screen.rc"], diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp index 2dbe466692..6e823f6e4d 100644 --- a/media/1.0/Android.bp +++ b/media/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.media@1.0", root: "android.hardware", diff --git a/media/1.0/xml/Android.mk b/media/1.0/xml/Android.mk index bc44b9eeab..a7952880ab 100644 --- a/media/1.0/xml/Android.mk +++ b/media/1.0/xml/Android.mk @@ -6,9 +6,11 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := media_profiles_V1_0.dtd +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_SRC_FILES := media_profiles.dtd LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) include $(BUILD_PREBUILT) - diff --git a/media/Android.bp b/media/Android.bp index 267c02bdf4..b70da2a3d0 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + filegroup { name: "media_omx_audio_res", path: "res", diff --git a/media/bufferpool/1.0/Android.bp b/media/bufferpool/1.0/Android.bp index 5dbbadd436..175b8a5ae7 100644 --- a/media/bufferpool/1.0/Android.bp +++ b/media/bufferpool/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.media.bufferpool@1.0", root: "android.hardware", diff --git a/media/bufferpool/2.0/Android.bp b/media/bufferpool/2.0/Android.bp index 6a82616b6f..01273c11d6 100644 --- a/media/bufferpool/2.0/Android.bp +++ b/media/bufferpool/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.media.bufferpool@2.0", root: "android.hardware", diff --git a/media/c2/1.0/Android.bp b/media/c2/1.0/Android.bp index 089ce981eb..dc56fef7d8 100644 --- a/media/c2/1.0/Android.bp +++ b/media/c2/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.media.c2@1.0", root: "android.hardware", diff --git a/media/c2/1.1/Android.bp b/media/c2/1.1/Android.bp index a3d31dfaff..885a4c8845 100644 --- a/media/c2/1.1/Android.bp +++ b/media/c2/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.media.c2@1.1", root: "android.hardware", diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp index 5fe73abcf1..e33bab39dd 100644 --- a/media/omx/1.0/Android.bp +++ b/media/omx/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.media.omx@1.0", root: "android.hardware", diff --git a/media/omx/1.0/vts/functional/audio/Android.bp b/media/omx/1.0/vts/functional/audio/Android.bp index ec7357cb3d..a2733c92f1 100644 --- a/media/omx/1.0/vts/functional/audio/Android.bp +++ b/media/omx/1.0/vts/functional/audio/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalMediaOmxV1_0TargetAudioEncTest", stem: "vts_hal_media_omx_v1_0_audio_enc_test", diff --git a/media/omx/1.0/vts/functional/common/Android.bp b/media/omx/1.0/vts/functional/common/Android.bp index 89df4ff3fb..12b6fb292f 100644 --- a/media/omx/1.0/vts/functional/common/Android.bp +++ b/media/omx/1.0/vts/functional/common/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalMediaOmxV1_0CommonUtil", srcs: ["media_hidl_test_common.cpp"], diff --git a/media/omx/1.0/vts/functional/component/Android.bp b/media/omx/1.0/vts/functional/component/Android.bp index 8fb627ad42..9d4d092a52 100644 --- a/media/omx/1.0/vts/functional/component/Android.bp +++ b/media/omx/1.0/vts/functional/component/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalMediaOmxV1_0TargetComponentTest", defaults: ["VtsHalMediaOmxV1_0Defaults"], diff --git a/media/omx/1.0/vts/functional/store/Android.bp b/media/omx/1.0/vts/functional/store/Android.bp index 28d12ffa5d..b34fff1b7b 100644 --- a/media/omx/1.0/vts/functional/store/Android.bp +++ b/media/omx/1.0/vts/functional/store/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalMediaOmxV1_0TargetStoreTest", defaults: ["VtsHalMediaOmxV1_0Defaults"], diff --git a/media/omx/1.0/vts/functional/video/Android.bp b/media/omx/1.0/vts/functional/video/Android.bp index b35c26c0f3..5454f16c67 100644 --- a/media/omx/1.0/vts/functional/video/Android.bp +++ b/media/omx/1.0/vts/functional/video/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalMediaOmxV1_0TargetVideoDecTest", stem: "vts_hal_media_omx_v1_0_video_dec_test", diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp index a50195ee43..bf8db3f6f4 100644 --- a/memtrack/1.0/Android.bp +++ b/memtrack/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.memtrack@1.0", root: "android.hardware", diff --git a/memtrack/1.0/default/Android.bp b/memtrack/1.0/default/Android.bp index 8aa33eefcb..addffe3344 100644 --- a/memtrack/1.0/default/Android.bp +++ b/memtrack/1.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.memtrack@1.0-impl", defaults: ["hidl_defaults"], diff --git a/memtrack/1.0/vts/functional/Android.bp b/memtrack/1.0/vts/functional/Android.bp index 445770ad9b..852cd156bc 100644 --- a/memtrack/1.0/vts/functional/Android.bp +++ b/memtrack/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalMemtrackV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/memtrack/aidl/Android.bp b/memtrack/aidl/Android.bp index fe4d01bad1..29fec2451f 100644 --- a/memtrack/aidl/Android.bp +++ b/memtrack/aidl/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.memtrack", vendor_available: true, diff --git a/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl b/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl index 18587ee770..e78d4d7c32 100644 --- a/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl +++ b/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl @@ -30,6 +30,22 @@ import android.hardware.memtrack.MemtrackType; * GL, graphics, etc. All memory sizes must be in real memory usage, * accounting for stride, bit depth, rounding up to page size, etc. * + * The following getMemory() categories are important for memory accounting in + * `dumpsys meminfo` and should be reported as described below: + * + * - MemtrackType::GRAPHICS and MemtrackRecord::FLAG_SMAPS_UNACCOUNTED + * This should report the PSS of all DMA buffers mapped by the process + * with the specified PID. This PSS can be calculated using ReadDmaBufPss() + * form libdmabufinfo. + * + * - MemtrackType::GL and MemtrackRecord::FLAG_SMAPS_UNACCOUNTED + * This category should report all GPU private allocations for the specified + * PID that are not accounted in /proc/<pid>/smaps. + * + * - MemtrackType::OTHER and MemtrackRecord::FLAG_SMAPS_UNACCOUNTED + * Any other memory not accounted for in /proc/<pid>/smaps if any, otherwise + * this should return 0. + * * Constructor for the interface should be used to perform memtrack management * setup actions and must be called once before any calls to getMemory(). */ @@ -76,7 +92,10 @@ interface IMemtrack { * This information is used to identify GPU devices for GPU specific * memory accounting (e.g. DMA buffer usage). * + * The device name(s) provided in getGpuDeviceInfo() must match the + * device name in the corresponding device(s) sysfs entry. + * * @return vector of DeviceInfo populated for all GPU devices. */ - DeviceInfo[] getGpuDeviceInfo(); + DeviceInfo[] getGpuDeviceInfo(); } diff --git a/memtrack/aidl/default/Android.bp b/memtrack/aidl/default/Android.bp index 8d97bfc703..7a7feea5bf 100644 --- a/memtrack/aidl/default/Android.bp +++ b/memtrack/aidl/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.memtrack-service.example", relative_install_path: "hw", diff --git a/memtrack/aidl/vts/Android.bp b/memtrack/aidl/vts/Android.bp index eff2a563af..8614b478a6 100644 --- a/memtrack/aidl/vts/Android.bp +++ b/memtrack/aidl/vts/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalMemtrackTargetTest", defaults: [ diff --git a/neuralnetworks/1.0/Android.bp b/neuralnetworks/1.0/Android.bp index 20de9d56ec..7bc65ffbf1 100644 --- a/neuralnetworks/1.0/Android.bp +++ b/neuralnetworks/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.neuralnetworks@1.0", root: "android.hardware", diff --git a/neuralnetworks/1.0/utils/Android.bp b/neuralnetworks/1.0/utils/Android.bp index d03361724c..0ad9926df5 100644 --- a/neuralnetworks/1.0/utils/Android.bp +++ b/neuralnetworks/1.0/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_1_0", defaults: ["neuralnetworks_utils_defaults"], diff --git a/neuralnetworks/1.0/utils/src/Conversions.cpp b/neuralnetworks/1.0/utils/src/Conversions.cpp index 7a099cfd49..700b050ce7 100644 --- a/neuralnetworks/1.0/utils/src/Conversions.cpp +++ b/neuralnetworks/1.0/utils/src/Conversions.cpp @@ -162,7 +162,7 @@ GeneralResult<Model> unvalidatedConvert(const hal::V1_0::Model& model) { // Verify number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(model.operands.size(), operations); + NN_TRY(hal::utils::countNumberOfConsumers(model.operands.size(), operations)); CHECK(model.operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < model.operands.size(); ++i) { if (model.operands[i].numberOfConsumers != numberOfConsumers[i]) { @@ -360,7 +360,7 @@ nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) { // Update number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(operands.size(), model.main.operations); + NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), model.main.operations)); CHECK(operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < operands.size(); ++i) { operands[i].numberOfConsumers = numberOfConsumers[i]; diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp index d802911234..9a91560fea 100644 --- a/neuralnetworks/1.0/vts/functional/Android.bp +++ b/neuralnetworks/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "neuralnetworks_vts_functional_defaults", defaults: ["VtsHalTargetTestDefaults"], diff --git a/neuralnetworks/1.1/Android.bp b/neuralnetworks/1.1/Android.bp index 52d866f853..772e5e69a9 100644 --- a/neuralnetworks/1.1/Android.bp +++ b/neuralnetworks/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.neuralnetworks@1.1", root: "android.hardware", diff --git a/neuralnetworks/1.1/utils/Android.bp b/neuralnetworks/1.1/utils/Android.bp index fe0c80ab45..d9e82d47b4 100644 --- a/neuralnetworks/1.1/utils/Android.bp +++ b/neuralnetworks/1.1/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_1_1", defaults: ["neuralnetworks_utils_defaults"], diff --git a/neuralnetworks/1.1/utils/src/Conversions.cpp b/neuralnetworks/1.1/utils/src/Conversions.cpp index 07bf7bc88f..d07f7d00bc 100644 --- a/neuralnetworks/1.1/utils/src/Conversions.cpp +++ b/neuralnetworks/1.1/utils/src/Conversions.cpp @@ -111,7 +111,7 @@ GeneralResult<Model> unvalidatedConvert(const hal::V1_1::Model& model) { // Verify number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(model.operands.size(), operations); + NN_TRY(hal::utils::countNumberOfConsumers(model.operands.size(), operations)); CHECK(model.operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < model.operands.size(); ++i) { if (model.operands[i].numberOfConsumers != numberOfConsumers[i]) { @@ -241,7 +241,7 @@ nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) { // Update number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(operands.size(), model.main.operations); + NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), model.main.operations)); CHECK(operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < operands.size(); ++i) { operands[i].numberOfConsumers = numberOfConsumers[i]; diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp index 405548fe55..826ba9629c 100644 --- a/neuralnetworks/1.1/vts/functional/Android.bp +++ b/neuralnetworks/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalNeuralnetworksV1_1TargetTest", defaults: ["neuralnetworks_vts_functional_defaults"], diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp index 9e1db1e8f8..2b83d3997c 100644 --- a/neuralnetworks/1.2/Android.bp +++ b/neuralnetworks/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.neuralnetworks@1.2", root: "android.hardware", diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index 7cec49e0e2..03aed8605e 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -4711,14 +4711,14 @@ enum DeviceType : int32_t { // HAL equivalent of unknown type and a 1.2 HAL implementation must belong // to one of the categories below. /** The device does not fall into any category below. */ - OTHER = 1, + OTHER = 1, /** The device runs NNAPI models on single or multi-core CPU. */ - CPU = 2, + CPU = 2, /** The device can run NNAPI models and also accelerate graphics APIs such - * as OpenGL ES and Vulkan. */ - GPU = 3, + * as OpenGL ES and Vulkan. */ + GPU = 3, /** Dedicated accelerator for Machine Learning workloads. */ - ACCELERATOR = 4, + ACCELERATOR = 4, }; /** @@ -4895,25 +4895,25 @@ struct Operand { * Additional parameters specific to a particular operand type. */ safe_union ExtraParams { - /** - * No additional parameters. - */ - Monostate none; - - /** - * Symmetric per-channel quantization parameters. - * - * Only applicable to operands of type TENSOR_QUANT8_SYMM_PER_CHANNEL. - */ - SymmPerChannelQuantParams channelQuant; - - /** - * Extension operand parameters. - * - * The framework treats this as an opaque data blob. - * The format is up to individual extensions. - */ - vec<uint8_t> extension; + /** + * No additional parameters. + */ + Monostate none; + + /** + * Symmetric per-channel quantization parameters. + * + * Only applicable to operands of type TENSOR_QUANT8_SYMM_PER_CHANNEL. + */ + SymmPerChannelQuantParams channelQuant; + + /** + * Extension operand parameters. + * + * The framework treats this as an opaque data blob. + * The format is up to individual extensions. + */ + vec<uint8_t> extension; } extraParams; }; @@ -5054,7 +5054,7 @@ struct OutputShape { * Specifies whether or not to measure timing information during execution. */ enum MeasureTiming : int32_t { - NO = 0, + NO = 0, YES = 1, }; diff --git a/neuralnetworks/1.2/types.t b/neuralnetworks/1.2/types.t index 21d88acf8f..4c9fd02403 100644 --- a/neuralnetworks/1.2/types.t +++ b/neuralnetworks/1.2/types.t @@ -107,14 +107,14 @@ enum DeviceType : int32_t { // HAL equivalent of unknown type and a 1.2 HAL implementation must belong // to one of the categories below. /** The device does not fall into any category below. */ - OTHER = 1, + OTHER = 1, /** The device runs NNAPI models on single or multi-core CPU. */ - CPU = 2, + CPU = 2, /** The device can run NNAPI models and also accelerate graphics APIs such - * as OpenGL ES and Vulkan. */ - GPU = 3, + * as OpenGL ES and Vulkan. */ + GPU = 3, /** Dedicated accelerator for Machine Learning workloads. */ - ACCELERATOR = 4, + ACCELERATOR = 4, }; /** @@ -291,25 +291,25 @@ struct Operand { * Additional parameters specific to a particular operand type. */ safe_union ExtraParams { - /** - * No additional parameters. - */ - Monostate none; - - /** - * Symmetric per-channel quantization parameters. - * - * Only applicable to operands of type TENSOR_QUANT8_SYMM_PER_CHANNEL. - */ - SymmPerChannelQuantParams channelQuant; - - /** - * Extension operand parameters. - * - * The framework treats this as an opaque data blob. - * The format is up to individual extensions. - */ - vec<uint8_t> extension; + /** + * No additional parameters. + */ + Monostate none; + + /** + * Symmetric per-channel quantization parameters. + * + * Only applicable to operands of type TENSOR_QUANT8_SYMM_PER_CHANNEL. + */ + SymmPerChannelQuantParams channelQuant; + + /** + * Extension operand parameters. + * + * The framework treats this as an opaque data blob. + * The format is up to individual extensions. + */ + vec<uint8_t> extension; } extraParams; }; @@ -450,7 +450,7 @@ struct OutputShape { * Specifies whether or not to measure timing information during execution. */ enum MeasureTiming : int32_t { - NO = 0, + NO = 0, YES = 1, }; diff --git a/neuralnetworks/1.2/utils/Android.bp b/neuralnetworks/1.2/utils/Android.bp index 695905690e..2921141484 100644 --- a/neuralnetworks/1.2/utils/Android.bp +++ b/neuralnetworks/1.2/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_1_2", defaults: ["neuralnetworks_utils_defaults"], diff --git a/neuralnetworks/1.2/utils/src/Conversions.cpp b/neuralnetworks/1.2/utils/src/Conversions.cpp index 7ae483ede2..86a417a352 100644 --- a/neuralnetworks/1.2/utils/src/Conversions.cpp +++ b/neuralnetworks/1.2/utils/src/Conversions.cpp @@ -227,7 +227,7 @@ GeneralResult<Model> unvalidatedConvert(const hal::V1_2::Model& model) { // Verify number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(model.operands.size(), operations); + NN_TRY(hal::utils::countNumberOfConsumers(model.operands.size(), operations)); CHECK(model.operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < model.operands.size(); ++i) { if (model.operands[i].numberOfConsumers != numberOfConsumers[i]) { @@ -529,7 +529,7 @@ nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) { // Update number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(operands.size(), model.main.operations); + NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), model.main.operations)); CHECK(operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < operands.size(); ++i) { operands[i].numberOfConsumers = numberOfConsumers[i]; diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp index 93edca6126..e313b47e1e 100644 --- a/neuralnetworks/1.2/vts/functional/Android.bp +++ b/neuralnetworks/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalNeuralNetworksV1_2_utils", defaults: ["neuralnetworks_vts_functional_defaults"], diff --git a/neuralnetworks/1.3/Android.bp b/neuralnetworks/1.3/Android.bp index 3e02c909c7..aa8fc39e64 100644 --- a/neuralnetworks/1.3/Android.bp +++ b/neuralnetworks/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.neuralnetworks@1.3", root: "android.hardware", diff --git a/neuralnetworks/1.3/types.hal b/neuralnetworks/1.3/types.hal index 51837fe858..a5dbd5e424 100644 --- a/neuralnetworks/1.3/types.hal +++ b/neuralnetworks/1.3/types.hal @@ -5340,7 +5340,6 @@ enum Priority : int32_t { HIGH, }; - /** * The capabilities of a driver. * diff --git a/neuralnetworks/1.3/types.t b/neuralnetworks/1.3/types.t index 2901d18525..9f69c9e070 100644 --- a/neuralnetworks/1.3/types.t +++ b/neuralnetworks/1.3/types.t @@ -99,7 +99,6 @@ enum Priority : int32_t { HIGH, }; - /** * The capabilities of a driver. * diff --git a/neuralnetworks/1.3/utils/Android.bp b/neuralnetworks/1.3/utils/Android.bp index 41d9521173..2b1dcc40bb 100644 --- a/neuralnetworks/1.3/utils/Android.bp +++ b/neuralnetworks/1.3/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_1_3", defaults: ["neuralnetworks_utils_defaults"], diff --git a/neuralnetworks/1.3/utils/src/Conversions.cpp b/neuralnetworks/1.3/utils/src/Conversions.cpp index 6e74a6239d..320c74c2c6 100644 --- a/neuralnetworks/1.3/utils/src/Conversions.cpp +++ b/neuralnetworks/1.3/utils/src/Conversions.cpp @@ -217,7 +217,7 @@ GeneralResult<Model::Subgraph> unvalidatedConvert(const hal::V1_3::Subgraph& sub // Verify number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(subgraph.operands.size(), operations); + NN_TRY(hal::utils::countNumberOfConsumers(subgraph.operands.size(), operations)); CHECK(subgraph.operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < subgraph.operands.size(); ++i) { if (subgraph.operands[i].numberOfConsumers != numberOfConsumers[i]) { @@ -559,7 +559,7 @@ nn::GeneralResult<Subgraph> unvalidatedConvert(const nn::Model::Subgraph& subgra // Update number of consumers. const auto numberOfConsumers = - hal::utils::countNumberOfConsumers(operands.size(), subgraph.operations); + NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), subgraph.operations)); CHECK(operands.size() == numberOfConsumers.size()); for (size_t i = 0; i < operands.size(); ++i) { operands[i].numberOfConsumers = numberOfConsumers[i]; diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp index ee753bb951..f9752505a3 100644 --- a/neuralnetworks/1.3/vts/functional/Android.bp +++ b/neuralnetworks/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalNeuralNetworksV1_3_utils", defaults: ["neuralnetworks_vts_functional_defaults"], diff --git a/neuralnetworks/TEST_MAPPING b/neuralnetworks/TEST_MAPPING index de846244a1..5d168d2766 100644 --- a/neuralnetworks/TEST_MAPPING +++ b/neuralnetworks/TEST_MAPPING @@ -60,6 +60,17 @@ "include-filter": "-*sample_float_fast*:*sample_float_slow*:*sample_minimal*:*sample_quant*" } ] + }, + { + "name": "VtsHalNeuralnetworksTargetTest", + "options": [ + { + // Do not use any sample driver except sample-all in order to reduce + // testing time. The other sample drivers (fast-float, quant, etc.) + // are subsets of sample-all. + "include-filter": "-*sample_float_fast*:*sample_float_slow*:*sample_minimal*:*sample_quant*" + } + ] } ] } diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp index 0557e43a5a..b1860e2bd0 100644 --- a/neuralnetworks/aidl/Android.bp +++ b/neuralnetworks/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.neuralnetworks", vendor_available: true, diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ByteArray.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/FencedExecutionResult.aidl index 34f2749db9..7952b34632 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ByteArray.aidl +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/FencedExecutionResult.aidl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * Copyright (C) 2021 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. @@ -12,7 +12,8 @@ * 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. - *//////////////////////////////////////////////////////////////////////////////// + */ +/////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// @@ -30,8 +31,9 @@ // with such a backward incompatible change, it has a high risk of breaking // later when a module using the interface is updated, e.g., Mainline modules. -package android.hardware.security.keymint; +package android.hardware.neuralnetworks; @VintfStability -parcelable ByteArray { - byte[] data; +parcelable FencedExecutionResult { + android.hardware.neuralnetworks.IFencedExecutionCallback callback; + @nullable ParcelFileDescriptor syncFence; } diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/IPreparedModel.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/IPreparedModel.aidl index 3ca155009a..1f7cbe0e4b 100644 --- a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/IPreparedModel.aidl +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/current/android/hardware/neuralnetworks/IPreparedModel.aidl @@ -34,7 +34,7 @@ package android.hardware.neuralnetworks; @VintfStability interface IPreparedModel { android.hardware.neuralnetworks.ExecutionResult executeSynchronously(in android.hardware.neuralnetworks.Request request, in boolean measureTiming, in long deadline, in long loopTimeoutDuration); - android.hardware.neuralnetworks.IFencedExecutionCallback executeFenced(in android.hardware.neuralnetworks.Request request, in ParcelFileDescriptor[] waitFor, in boolean measureTiming, in long deadline, in long loopTimeoutDuration, in long duration, out @nullable ParcelFileDescriptor syncFence); + android.hardware.neuralnetworks.FencedExecutionResult executeFenced(in android.hardware.neuralnetworks.Request request, in ParcelFileDescriptor[] waitFor, in boolean measureTiming, in long deadline, in long loopTimeoutDuration, in long duration); const long DEFAULT_LOOP_TIMEOUT_DURATION_NS = 2000000000; const long MAXIMUM_LOOP_TIMEOUT_DURATION_NS = 15000000000; } diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/FencedExecutionResult.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/FencedExecutionResult.aidl new file mode 100644 index 0000000000..ba3be31f37 --- /dev/null +++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/FencedExecutionResult.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 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. + */ + +package android.hardware.neuralnetworks; + +import android.hardware.neuralnetworks.IFencedExecutionCallback; + +/** + * A result from running an asynchronous execution of a prepared model. + */ +@VintfStability +parcelable FencedExecutionResult { + /** + * IFencedExecutionCallback can be used to query information like duration and error + * status when the execution is completed. + */ + IFencedExecutionCallback callback; + /** + * The sync fence that will be signaled when the task is completed. The + * sync fence will be set to error if a critical error, e.g. hardware + * failure or kernel panic, occurs when doing execution. + */ + @nullable ParcelFileDescriptor syncFence; +} diff --git a/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl b/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl index 2414a4a1b6..0240e3c0df 100644 --- a/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl +++ b/neuralnetworks/aidl/android/hardware/neuralnetworks/IPreparedModel.aidl @@ -19,7 +19,7 @@ package android.hardware.neuralnetworks; import android.hardware.common.NativeHandle; import android.hardware.neuralnetworks.ErrorStatus; import android.hardware.neuralnetworks.ExecutionResult; -import android.hardware.neuralnetworks.IFencedExecutionCallback; +import android.hardware.neuralnetworks.FencedExecutionResult; import android.hardware.neuralnetworks.Request; /** @@ -152,11 +152,8 @@ interface IPreparedModel { * complete after all sync fences in waitFor are signaled. If the execution * cannot be finished within the duration, the execution may be aborted. Passing * -1 means the duration is omitted. Other negative values are invalid. - * @param out syncFence The sync fence that will be signaled when the task is completed. The - * sync fence will be set to error if a critical error, e.g. hardware - * failure or kernel panic, occurs when doing execution. - * @return The IFencedExecutionCallback can be used to query information like duration and error - * status when the execution is completed. + * @return The FencedExecutionResult parcelable, containing IFencedExecutionCallback and the + * sync fence. * @throws ServiceSpecificException with one of the following ErrorStatus values: * - DEVICE_UNAVAILABLE if driver is offline or busy * - GENERAL_FAILURE if there is an unspecified error @@ -166,7 +163,7 @@ interface IPreparedModel { * deadline * - RESOURCE_EXHAUSTED_* if the task was aborted by the driver */ - IFencedExecutionCallback executeFenced(in Request request, in ParcelFileDescriptor[] waitFor, + FencedExecutionResult executeFenced(in Request request, in ParcelFileDescriptor[] waitFor, in boolean measureTiming, in long deadline, in long loopTimeoutDuration, - in long duration, out @nullable ParcelFileDescriptor syncFence); + in long duration); } diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp index 147d401201..2673caef0e 100644 --- a/neuralnetworks/aidl/utils/Android.bp +++ b/neuralnetworks/aidl/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_aidl", defaults: ["neuralnetworks_utils_defaults"], diff --git a/neuralnetworks/aidl/vts/functional/Android.bp b/neuralnetworks/aidl/vts/functional/Android.bp index aa7afbf6a7..7804c2a765 100644 --- a/neuralnetworks/aidl/vts/functional/Android.bp +++ b/neuralnetworks/aidl/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalNeuralnetworksTargetTest", defaults: [ diff --git a/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp index 4beb828253..4eb704b6e0 100644 --- a/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp +++ b/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp @@ -571,33 +571,32 @@ void EvaluatePreparedModel(const std::shared_ptr<IDevice>& device, case Executor::FENCED: { SCOPED_TRACE("fenced"); ErrorStatus result = ErrorStatus::NONE; - ndk::ScopedFileDescriptor syncFenceFd; - std::shared_ptr<IFencedExecutionCallback> fencedCallback; + FencedExecutionResult executionResult; auto ret = preparedModel->executeFenced(request, {}, testConfig.measureTiming, kNoDeadline, loopTimeoutDuration, kNoDuration, - &syncFenceFd, &fencedCallback); + &executionResult); ASSERT_TRUE(ret.isOk() || ret.getExceptionCode() == EX_SERVICE_SPECIFIC) << ret.getDescription(); if (!ret.isOk()) { result = static_cast<ErrorStatus>(ret.getServiceSpecificError()); executionStatus = result; - } else if (syncFenceFd.get() != -1) { + } else if (executionResult.syncFence.get() != -1) { std::vector<ndk::ScopedFileDescriptor> waitFor; - auto dupFd = dup(syncFenceFd.get()); + auto dupFd = dup(executionResult.syncFence.get()); ASSERT_NE(dupFd, -1); waitFor.emplace_back(dupFd); // If a sync fence is returned, try start another run waiting for the sync fence. ret = preparedModel->executeFenced(request, waitFor, testConfig.measureTiming, kNoDeadline, loopTimeoutDuration, kNoDuration, - &syncFenceFd, &fencedCallback); + &executionResult); ASSERT_TRUE(ret.isOk()); - waitForSyncFence(syncFenceFd.get()); + waitForSyncFence(executionResult.syncFence.get()); } if (result == ErrorStatus::NONE) { - ASSERT_NE(fencedCallback, nullptr); + ASSERT_NE(executionResult.callback, nullptr); Timing timingFenced; - auto ret = - fencedCallback->getExecutionInfo(&timing, &timingFenced, &executionStatus); + auto ret = executionResult.callback->getExecutionInfo(&timing, &timingFenced, + &executionStatus); ASSERT_TRUE(ret.isOk()); } break; diff --git a/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp b/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp index a37a0caa29..1929750d28 100644 --- a/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp +++ b/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp @@ -198,8 +198,8 @@ class InvalidPreparedModel : public BnPreparedModel { static_cast<int32_t>(ErrorStatus::GENERAL_FAILURE)); } ndk::ScopedAStatus executeFenced(const Request&, const std::vector<ndk::ScopedFileDescriptor>&, - bool, int64_t, int64_t, int64_t, ndk::ScopedFileDescriptor*, - std::shared_ptr<IFencedExecutionCallback>*) override { + bool, int64_t, int64_t, int64_t, + FencedExecutionResult*) override { return ndk::ScopedAStatus::fromServiceSpecificError( static_cast<int32_t>(ErrorStatus::GENERAL_FAILURE)); } @@ -893,25 +893,24 @@ class MemoryDomainExecutionTest ErrorStatus executeFenced(const std::shared_ptr<IPreparedModel>& preparedModel, const Request& request) { - ndk::ScopedFileDescriptor syncFence; - std::shared_ptr<IFencedExecutionCallback> fencedCallback; + FencedExecutionResult executionResult; const auto ret = preparedModel->executeFenced(request, {}, false, kNoDeadline, kOmittedTimeoutDuration, kNoDuration, - &syncFence, &fencedCallback); + &executionResult); if (!ret.isOk()) { EXPECT_EQ(ret.getExceptionCode(), EX_SERVICE_SPECIFIC); return static_cast<ErrorStatus>(ret.getServiceSpecificError()); } - if (syncFence.get() != -1) { - waitForSyncFence(syncFence.get()); + if (executionResult.syncFence.get() != -1) { + waitForSyncFence(executionResult.syncFence.get()); } - EXPECT_NE(fencedCallback, nullptr); + EXPECT_NE(executionResult.callback, nullptr); ErrorStatus executionStatus = ErrorStatus::GENERAL_FAILURE; Timing time = kNoTiming; Timing timeFenced = kNoTiming; const auto retExecutionInfo = - fencedCallback->getExecutionInfo(&time, &timeFenced, &executionStatus); + executionResult.callback->getExecutionInfo(&time, &timeFenced, &executionStatus); EXPECT_TRUE(retExecutionInfo.isOk()); EXPECT_EQ(time, kNoTiming); return executionStatus; diff --git a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp index b84d981abd..6d84e1ed7b 100644 --- a/neuralnetworks/aidl/vts/functional/ValidateModel.cpp +++ b/neuralnetworks/aidl/vts/functional/ValidateModel.cpp @@ -1310,8 +1310,10 @@ static void mutateExecutionPriorityTest(const std::shared_ptr<IDevice>& device, ////////////////////////// ENTRY POINT ////////////////////////////// void validateModel(const std::shared_ptr<IDevice>& device, const Model& model) { - const auto numberOfConsumers = nn::countNumberOfConsumers( - model.main.operands.size(), nn::convert(model.main.operations).value()); + const auto numberOfConsumers = + nn::countNumberOfConsumers(model.main.operands.size(), + nn::convert(model.main.operations).value()) + .value(); mutateExecutionOrderTest(device, model, numberOfConsumers); mutateOperandTypeTest(device, model); mutateOperandRankTest(device, model); diff --git a/neuralnetworks/aidl/vts/functional/ValidateRequest.cpp b/neuralnetworks/aidl/vts/functional/ValidateRequest.cpp index db8f429f13..3be4c1b97d 100644 --- a/neuralnetworks/aidl/vts/functional/ValidateRequest.cpp +++ b/neuralnetworks/aidl/vts/functional/ValidateRequest.cpp @@ -68,11 +68,10 @@ static void validate(const std::shared_ptr<IPreparedModel>& preparedModel, // fenced { SCOPED_TRACE(message + " [executeFenced]"); - ndk::ScopedFileDescriptor syncFence; - std::shared_ptr<IFencedExecutionCallback> callback; + FencedExecutionResult executionResult; const auto executeStatus = preparedModel->executeFenced(request, {}, false, kNoDeadline, kOmittedTimeoutDuration, - kNoDuration, &syncFence, &callback); + kNoDuration, &executionResult); ASSERT_FALSE(executeStatus.isOk()); ASSERT_EQ(executeStatus.getExceptionCode(), EX_SERVICE_SPECIFIC); ASSERT_EQ(static_cast<ErrorStatus>(executeStatus.getServiceSpecificError()), diff --git a/neuralnetworks/utils/adapter/Android.bp b/neuralnetworks/utils/adapter/Android.bp new file mode 100644 index 0000000000..d073106a5f --- /dev/null +++ b/neuralnetworks/utils/adapter/Android.bp @@ -0,0 +1,46 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_static { + name: "neuralnetworks_utils_hal_adapter", + defaults: ["neuralnetworks_utils_defaults"], + srcs: ["src/*"], + local_include_dirs: ["include/nnapi/hal"], + export_include_dirs: ["include"], + static_libs: [ + "neuralnetworks_types", + "neuralnetworks_utils_hal_1_0", + "neuralnetworks_utils_hal_1_1", + "neuralnetworks_utils_hal_1_2", + "neuralnetworks_utils_hal_1_3", + ], + shared_libs: [ + "android.hardware.neuralnetworks@1.0", + "android.hardware.neuralnetworks@1.1", + "android.hardware.neuralnetworks@1.2", + "android.hardware.neuralnetworks@1.3", + "libfmq", + ], +} diff --git a/neuralnetworks/utils/adapter/include/nnapi/hal/Adapter.h b/neuralnetworks/utils/adapter/include/nnapi/hal/Adapter.h new file mode 100644 index 0000000000..da00a090ed --- /dev/null +++ b/neuralnetworks/utils/adapter/include/nnapi/hal/Adapter.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_ADAPTER_H +#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_ADAPTER_H + +#include <android/hardware/neuralnetworks/1.3/IDevice.h> +#include <nnapi/IDevice.h> +#include <nnapi/Types.h> +#include <sys/types.h> +#include <functional> +#include <memory> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { + +/** + * A self-contained unit of work to be executed. + */ +using Task = std::function<void()>; + +/** + * A type-erased executor which executes a task asynchronously. + * + * This executor is also provided with an Application ID (Android User ID) and an optional deadline + * for when the caller expects is the upper bound for the amount of time to complete the task. + */ +using Executor = std::function<void(Task, uid_t, nn::OptionalTimePoint)>; + +/** + * Adapt an NNAPI canonical interface object to a HIDL NN HAL interface object. + * + * The IPreparedModel object created from IDevice::prepareModel or IDevice::preparedModelFromCache + * must return "const nn::Model*" from IPreparedModel::getUnderlyingResource(). + * + * @param device NNAPI canonical IDevice interface object to be adapted. + * @param executor Type-erased executor to handle executing tasks asynchronously. + * @return HIDL NN HAL IDevice interface object. + */ +sp<V1_3::IDevice> adapt(nn::SharedDevice device, Executor executor); + +/** + * Adapt an NNAPI canonical interface object to a HIDL NN HAL interface object. + * + * The IPreparedModel object created from IDevice::prepareModel or IDevice::preparedModelFromCache + * must return "const nn::Model*" from IPreparedModel::getUnderlyingResource(). + * + * This function uses a default executor, which will execute tasks from a detached thread. + * + * @param device NNAPI canonical IDevice interface object to be adapted. + * @return HIDL NN HAL IDevice interface object. + */ +sp<V1_3::IDevice> adapt(nn::SharedDevice device); + +} // namespace android::hardware::neuralnetworks::adapter + +#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_ADAPTER_H diff --git a/neuralnetworks/utils/adapter/include/nnapi/hal/Buffer.h b/neuralnetworks/utils/adapter/include/nnapi/hal/Buffer.h new file mode 100644 index 0000000000..e53c7d4f09 --- /dev/null +++ b/neuralnetworks/utils/adapter/include/nnapi/hal/Buffer.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_BUFFER_H +#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_BUFFER_H + +#include <android/hardware/neuralnetworks/1.3/IBuffer.h> +#include <android/hardware/neuralnetworks/1.3/types.h> +#include <nnapi/IBuffer.h> +#include <nnapi/Types.h> +#include <memory> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { + +// Class that adapts nn::IBuffer to V1_3::IBuffer. +class Buffer final : public V1_3::IBuffer { + public: + explicit Buffer(nn::SharedBuffer buffer); + + Return<V1_3::ErrorStatus> copyTo(const hidl_memory& dst) override; + Return<V1_3::ErrorStatus> copyFrom(const hidl_memory& src, + const hidl_vec<uint32_t>& dimensions) override; + + private: + const nn::SharedBuffer kBuffer; +}; + +} // namespace android::hardware::neuralnetworks::adapter + +#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_BUFFER_H diff --git a/neuralnetworks/utils/adapter/include/nnapi/hal/Device.h b/neuralnetworks/utils/adapter/include/nnapi/hal/Device.h new file mode 100644 index 0000000000..148d0a0341 --- /dev/null +++ b/neuralnetworks/utils/adapter/include/nnapi/hal/Device.h @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_DEVICE_H +#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_DEVICE_H + +#include "nnapi/hal/Adapter.h" + +#include <android/hardware/neuralnetworks/1.0/IPreparedModelCallback.h> +#include <android/hardware/neuralnetworks/1.0/types.h> +#include <android/hardware/neuralnetworks/1.1/types.h> +#include <android/hardware/neuralnetworks/1.2/IPreparedModelCallback.h> +#include <android/hardware/neuralnetworks/1.2/types.h> +#include <android/hardware/neuralnetworks/1.3/IDevice.h> +#include <android/hardware/neuralnetworks/1.3/IPreparedModelCallback.h> +#include <android/hardware/neuralnetworks/1.3/types.h> +#include <nnapi/IDevice.h> +#include <nnapi/Types.h> +#include <memory> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { + +using CacheToken = hidl_array<uint8_t, nn::kByteSizeOfCacheToken>; + +// Class that adapts nn::IDevice to V1_3::IDevice. +class Device final : public V1_3::IDevice { + public: + Device(nn::SharedDevice device, Executor executor); + + Return<void> getCapabilities(getCapabilities_cb cb) override; + Return<void> getCapabilities_1_1(getCapabilities_1_1_cb cb) override; + Return<void> getCapabilities_1_2(getCapabilities_1_2_cb cb) override; + Return<void> getCapabilities_1_3(getCapabilities_1_3_cb cb) override; + Return<void> getVersionString(getVersionString_cb cb) override; + Return<void> getType(getType_cb cb) override; + Return<void> getSupportedExtensions(getSupportedExtensions_cb) override; + Return<void> getSupportedOperations(const V1_0::Model& model, + getSupportedOperations_cb cb) override; + Return<void> getSupportedOperations_1_1(const V1_1::Model& model, + getSupportedOperations_1_1_cb cb) override; + Return<void> getSupportedOperations_1_2(const V1_2::Model& model, + getSupportedOperations_1_2_cb cb) override; + Return<void> getSupportedOperations_1_3(const V1_3::Model& model, + getSupportedOperations_1_3_cb cb) override; + Return<void> getNumberOfCacheFilesNeeded(getNumberOfCacheFilesNeeded_cb cb) override; + Return<V1_0::ErrorStatus> prepareModel( + const V1_0::Model& model, const sp<V1_0::IPreparedModelCallback>& callback) override; + Return<V1_0::ErrorStatus> prepareModel_1_1( + const V1_1::Model& model, V1_1::ExecutionPreference preference, + const sp<V1_0::IPreparedModelCallback>& callback) override; + Return<V1_0::ErrorStatus> prepareModel_1_2( + const V1_2::Model& model, V1_1::ExecutionPreference preference, + const hidl_vec<hidl_handle>& modelCache, const hidl_vec<hidl_handle>& dataCache, + const CacheToken& token, const sp<V1_2::IPreparedModelCallback>& callback) override; + Return<V1_3::ErrorStatus> prepareModel_1_3( + const V1_3::Model& model, V1_1::ExecutionPreference preference, V1_3::Priority priority, + const V1_3::OptionalTimePoint& deadline, const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, const CacheToken& token, + const sp<V1_3::IPreparedModelCallback>& callback) override; + Return<V1_0::ErrorStatus> prepareModelFromCache( + const hidl_vec<hidl_handle>& modelCache, const hidl_vec<hidl_handle>& dataCache, + const CacheToken& token, const sp<V1_2::IPreparedModelCallback>& callback) override; + Return<V1_3::ErrorStatus> prepareModelFromCache_1_3( + const V1_3::OptionalTimePoint& deadline, const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, const CacheToken& token, + const sp<V1_3::IPreparedModelCallback>& callback) override; + Return<V1_0::DeviceStatus> getStatus() override; + Return<void> allocate(const V1_3::BufferDesc& desc, + const hidl_vec<sp<V1_3::IPreparedModel>>& preparedModels, + const hidl_vec<V1_3::BufferRole>& inputRoles, + const hidl_vec<V1_3::BufferRole>& outputRoles, allocate_cb cb) override; + + private: + const nn::SharedDevice kDevice; + const Executor kExecutor; +}; + +} // namespace android::hardware::neuralnetworks::adapter + +#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_DEVICE_H diff --git a/neuralnetworks/utils/adapter/include/nnapi/hal/PreparedModel.h b/neuralnetworks/utils/adapter/include/nnapi/hal/PreparedModel.h new file mode 100644 index 0000000000..65763b8d19 --- /dev/null +++ b/neuralnetworks/utils/adapter/include/nnapi/hal/PreparedModel.h @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_PREPARED_MODEL_H +#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_PREPARED_MODEL_H + +#include "nnapi/hal/Adapter.h" + +#include <android/hardware/neuralnetworks/1.0/IExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.0/types.h> +#include <android/hardware/neuralnetworks/1.2/IBurstCallback.h> +#include <android/hardware/neuralnetworks/1.2/IExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.2/types.h> +#include <android/hardware/neuralnetworks/1.3/IExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.3/IPreparedModel.h> +#include <android/hardware/neuralnetworks/1.3/types.h> +#include <nnapi/IPreparedModel.h> +#include <nnapi/Types.h> +#include <memory> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { + +// Class that adapts nn::IPreparedModel to V1_3::IPreparedModel. +class PreparedModel final : public V1_3::IPreparedModel { + public: + PreparedModel(nn::SharedPreparedModel preparedModel, Executor executor, uid_t userId); + + Return<V1_0::ErrorStatus> execute(const V1_0::Request& request, + const sp<V1_0::IExecutionCallback>& callback) override; + Return<V1_0::ErrorStatus> execute_1_2(const V1_0::Request& request, V1_2::MeasureTiming measure, + const sp<V1_2::IExecutionCallback>& callback) override; + Return<V1_3::ErrorStatus> execute_1_3(const V1_3::Request& request, V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + const sp<V1_3::IExecutionCallback>& callback) override; + Return<void> executeSynchronously(const V1_0::Request& request, V1_2::MeasureTiming measure, + executeSynchronously_cb cb) override; + Return<void> executeSynchronously_1_3(const V1_3::Request& request, V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + executeSynchronously_1_3_cb cb) override; + Return<void> configureExecutionBurst( + const sp<V1_2::IBurstCallback>& callback, + const MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel, + const MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel, + configureExecutionBurst_cb cb) override; + Return<void> executeFenced(const V1_3::Request& request, const hidl_vec<hidl_handle>& waitFor, + V1_2::MeasureTiming measure, const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + const V1_3::OptionalTimeoutDuration& duration, + executeFenced_cb callback) override; + + nn::SharedPreparedModel getUnderlyingPreparedModel() const; + + private: + const nn::SharedPreparedModel kPreparedModel; + const Executor kExecutor; + const uid_t kUserId; +}; + +} // namespace android::hardware::neuralnetworks::adapter + +#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_PREPARED_MODEL_H diff --git a/neuralnetworks/utils/adapter/src/Adapter.cpp b/neuralnetworks/utils/adapter/src/Adapter.cpp new file mode 100644 index 0000000000..d6f53f05a5 --- /dev/null +++ b/neuralnetworks/utils/adapter/src/Adapter.cpp @@ -0,0 +1,46 @@ +/* + * 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 "Adapter.h" + +#include "Device.h" + +#include <android/hardware/neuralnetworks/1.3/IDevice.h> +#include <nnapi/IDevice.h> +#include <nnapi/Types.h> +#include <sys/types.h> + +#include <functional> +#include <memory> +#include <thread> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { + +sp<V1_3::IDevice> adapt(nn::SharedDevice device, Executor executor) { + return sp<Device>::make(std::move(device), std::move(executor)); +} + +sp<V1_3::IDevice> adapt(nn::SharedDevice device) { + Executor defaultExecutor = [](Task task, uid_t /*uid*/, nn::OptionalTimePoint /*deadline*/) { + std::thread(std::move(task)).detach(); + }; + return adapt(std::move(device), std::move(defaultExecutor)); +} + +} // namespace android::hardware::neuralnetworks::adapter diff --git a/neuralnetworks/utils/adapter/src/Buffer.cpp b/neuralnetworks/utils/adapter/src/Buffer.cpp new file mode 100644 index 0000000000..3a04bf6b79 --- /dev/null +++ b/neuralnetworks/utils/adapter/src/Buffer.cpp @@ -0,0 +1,83 @@ +/* + * 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 "Buffer.h" + +#include <android-base/logging.h> +#include <android/hardware/neuralnetworks/1.3/IBuffer.h> +#include <android/hardware/neuralnetworks/1.3/types.h> +#include <nnapi/IBuffer.h> +#include <nnapi/TypeUtils.h> +#include <nnapi/Types.h> +#include <nnapi/hal/1.3/Utils.h> +#include <memory> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { +namespace { + +template <typename Type> +auto convertInput(const Type& object) -> decltype(nn::convert(std::declval<Type>())) { + auto result = nn::convert(object); + if (!result.has_value()) { + result.error().code = nn::ErrorStatus::INVALID_ARGUMENT; + } + return result; +} + +nn::GeneralResult<void> copyTo(const nn::SharedBuffer& buffer, const hidl_memory& dst) { + const auto memory = NN_TRY(convertInput(dst)); + NN_TRY(buffer->copyTo(memory)); + return {}; +} + +nn::GeneralResult<void> copyFrom(const nn::SharedBuffer& buffer, const hidl_memory& src, + const hidl_vec<uint32_t>& dimensions) { + const auto memory = NN_TRY(convertInput(src)); + NN_TRY(buffer->copyFrom(memory, dimensions)); + return {}; +} + +} // namespace + +Buffer::Buffer(nn::SharedBuffer buffer) : kBuffer(std::move(buffer)) { + CHECK(kBuffer != nullptr); +} + +Return<V1_3::ErrorStatus> Buffer::copyTo(const hidl_memory& dst) { + auto result = adapter::copyTo(kBuffer, dst); + if (!result.has_value()) { + const auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Buffer::copyTo failed with " << code << ": " << message; + return V1_3::utils::convert(code).value(); + } + return V1_3::ErrorStatus::NONE; +} + +Return<V1_3::ErrorStatus> Buffer::copyFrom(const hidl_memory& src, + const hidl_vec<uint32_t>& dimensions) { + auto result = adapter::copyFrom(kBuffer, src, dimensions); + if (!result.has_value()) { + const auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Buffer::copyFrom failed with " << code << ": " << message; + return V1_3::utils::convert(code).value(); + } + return V1_3::ErrorStatus::NONE; +} + +} // namespace android::hardware::neuralnetworks::adapter diff --git a/neuralnetworks/utils/adapter/src/Device.cpp b/neuralnetworks/utils/adapter/src/Device.cpp new file mode 100644 index 0000000000..96142c3577 --- /dev/null +++ b/neuralnetworks/utils/adapter/src/Device.cpp @@ -0,0 +1,556 @@ +/* + * 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 "Device.h" + +#include "Buffer.h" +#include "PreparedModel.h" + +#include <android-base/logging.h> +#include <android/hardware/neuralnetworks/1.0/IPreparedModelCallback.h> +#include <android/hardware/neuralnetworks/1.0/types.h> +#include <android/hardware/neuralnetworks/1.1/types.h> +#include <android/hardware/neuralnetworks/1.2/IPreparedModelCallback.h> +#include <android/hardware/neuralnetworks/1.2/types.h> +#include <android/hardware/neuralnetworks/1.3/IDevice.h> +#include <android/hardware/neuralnetworks/1.3/IPreparedModelCallback.h> +#include <android/hardware/neuralnetworks/1.3/types.h> +#include <hwbinder/IPCThreadState.h> +#include <nnapi/IBuffer.h> +#include <nnapi/IDevice.h> +#include <nnapi/IPreparedModel.h> +#include <nnapi/Result.h> +#include <nnapi/TypeUtils.h> +#include <nnapi/Types.h> +#include <nnapi/hal/1.0/Conversions.h> +#include <nnapi/hal/1.0/Utils.h> +#include <nnapi/hal/1.1/Conversions.h> +#include <nnapi/hal/1.1/Utils.h> +#include <nnapi/hal/1.2/Conversions.h> +#include <nnapi/hal/1.2/Utils.h> +#include <nnapi/hal/1.3/Conversions.h> +#include <nnapi/hal/1.3/Utils.h> +#include <sys/types.h> + +#include <memory> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { +namespace { + +template <typename Type> +auto convertInput(const Type& object) -> decltype(nn::convert(std::declval<Type>())) { + auto result = nn::convert(object); + if (!result.has_value()) { + result.error().code = nn::ErrorStatus::INVALID_ARGUMENT; + } + return result; +} + +using PrepareModelResult = nn::GeneralResult<nn::SharedPreparedModel>; + +sp<PreparedModel> adaptPreparedModel(nn::SharedPreparedModel preparedModel, Executor executor, + uid_t userId) { + if (preparedModel == nullptr) { + return nullptr; + } + return sp<PreparedModel>::make(std::move(preparedModel), std::move(executor), userId); +} + +void notify(V1_0::IPreparedModelCallback* callback, nn::ErrorStatus status, + const sp<PreparedModel>& hidlPreparedModel) { + if (callback != nullptr) { + const auto hidlStatus = V1_0::utils::convert(status).value(); + const auto ret = callback->notify(hidlStatus, hidlPreparedModel); + if (!ret.isOk()) { + LOG(ERROR) << "V1_0::IPreparedModelCallback::notify failed with " << ret.description(); + } + } +} + +void notify(V1_2::IPreparedModelCallback* callback, nn::ErrorStatus status, + const sp<PreparedModel>& hidlPreparedModel) { + if (callback != nullptr) { + const auto hidlStatus = V1_2::utils::convert(status).value(); + const auto ret = callback->notify_1_2(hidlStatus, hidlPreparedModel); + if (!ret.isOk()) { + LOG(ERROR) << "V1_2::IPreparedModelCallback::notify_1_2 failed with " + << ret.description(); + } + } +} + +void notify(V1_3::IPreparedModelCallback* callback, nn::ErrorStatus status, + const sp<PreparedModel>& hidlPreparedModel) { + if (callback != nullptr) { + const auto hidlStatus = V1_3::utils::convert(status).value(); + const auto ret = callback->notify_1_3(hidlStatus, hidlPreparedModel); + if (!ret.isOk()) { + LOG(ERROR) << "V1_3::IPreparedModelCallback::notify_1_3 failed with " + << ret.description(); + } + } +} + +template <typename CallbackType> +void notify(CallbackType* callback, PrepareModelResult result, Executor executor, uid_t userId) { + if (!result.has_value()) { + const auto [message, status] = std::move(result).error(); + LOG(ERROR) << message; + notify(callback, status, nullptr); + } else { + auto preparedModel = std::move(result).value(); + auto hidlPreparedModel = + adaptPreparedModel(std::move(preparedModel), std::move(executor), userId); + notify(callback, nn::ErrorStatus::NONE, std::move(hidlPreparedModel)); + } +} + +template <typename ModelType> +nn::GeneralResult<hidl_vec<bool>> getSupportedOperations(const nn::SharedDevice& device, + const ModelType& model) { + const auto nnModel = NN_TRY(convertInput(model)); + return NN_TRY(device->getSupportedOperations(nnModel)); +} + +nn::GeneralResult<void> prepareModel(const nn::SharedDevice& device, const Executor& executor, + const V1_0::Model& model, + const sp<V1_0::IPreparedModelCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnModel = NN_TRY(convertInput(model)); + + const uid_t userId = hardware::IPCThreadState::self()->getCallingUid(); + Task task = [device, nnModel = std::move(nnModel), userId, executor, callback] { + auto result = device->prepareModel(nnModel, nn::ExecutionPreference::DEFAULT, + nn::Priority::DEFAULT, {}, {}, {}, {}); + notify(callback.get(), std::move(result), executor, userId); + }; + executor(std::move(task), userId, {}); + + return {}; +} + +nn::GeneralResult<void> prepareModel_1_1(const nn::SharedDevice& device, const Executor& executor, + const V1_1::Model& model, + V1_1::ExecutionPreference preference, + const sp<V1_0::IPreparedModelCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnModel = NN_TRY(convertInput(model)); + const auto nnPreference = NN_TRY(convertInput(preference)); + + const uid_t userId = hardware::IPCThreadState::self()->getCallingUid(); + Task task = [device, nnModel = std::move(nnModel), nnPreference, userId, executor, callback] { + auto result = + device->prepareModel(nnModel, nnPreference, nn::Priority::DEFAULT, {}, {}, {}, {}); + notify(callback.get(), std::move(result), executor, userId); + }; + executor(std::move(task), userId, {}); + + return {}; +} + +nn::GeneralResult<void> prepareModel_1_2(const nn::SharedDevice& device, const Executor& executor, + const V1_2::Model& model, + V1_1::ExecutionPreference preference, + const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, + const CacheToken& token, + const sp<V1_2::IPreparedModelCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnModel = NN_TRY(convertInput(model)); + const auto nnPreference = NN_TRY(convertInput(preference)); + auto nnModelCache = NN_TRY(convertInput(modelCache)); + auto nnDataCache = NN_TRY(convertInput(dataCache)); + const auto nnToken = nn::CacheToken(token); + + const uid_t userId = hardware::IPCThreadState::self()->getCallingUid(); + Task task = [device, nnModel = std::move(nnModel), nnPreference, + nnModelCache = std::move(nnModelCache), nnDataCache = std::move(nnDataCache), + nnToken, userId, executor, callback] { + auto result = device->prepareModel(nnModel, nnPreference, nn::Priority::DEFAULT, {}, + nnModelCache, nnDataCache, nnToken); + notify(callback.get(), std::move(result), executor, userId); + }; + executor(std::move(task), userId, {}); + + return {}; +} + +nn::GeneralResult<void> prepareModel_1_3( + const nn::SharedDevice& device, const Executor& executor, const V1_3::Model& model, + V1_1::ExecutionPreference preference, V1_3::Priority priority, + const V1_3::OptionalTimePoint& deadline, const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, const CacheToken& token, + const sp<V1_3::IPreparedModelCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnModel = NN_TRY(convertInput(model)); + const auto nnPreference = NN_TRY(convertInput(preference)); + const auto nnPriority = NN_TRY(convertInput(priority)); + const auto nnDeadline = NN_TRY(convertInput(deadline)); + auto nnModelCache = NN_TRY(convertInput(modelCache)); + auto nnDataCache = NN_TRY(convertInput(dataCache)); + const auto nnToken = nn::CacheToken(token); + + const uid_t userId = hardware::IPCThreadState::self()->getCallingUid(); + Task task = [device, nnModel = std::move(nnModel), nnPreference, nnPriority, nnDeadline, + nnModelCache = std::move(nnModelCache), nnDataCache = std::move(nnDataCache), + nnToken, userId, executor, callback] { + auto result = device->prepareModel(nnModel, nnPreference, nnPriority, nnDeadline, + nnModelCache, nnDataCache, nnToken); + notify(callback.get(), std::move(result), executor, userId); + }; + executor(std::move(task), userId, nnDeadline); + + return {}; +} + +nn::GeneralResult<void> prepareModelFromCache(const nn::SharedDevice& device, + const Executor& executor, + const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, + const CacheToken& token, + const sp<V1_2::IPreparedModelCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnModelCache = NN_TRY(convertInput(modelCache)); + auto nnDataCache = NN_TRY(convertInput(dataCache)); + const auto nnToken = nn::CacheToken(token); + + const uid_t userId = hardware::IPCThreadState::self()->getCallingUid(); + Task task = [device, nnModelCache = std::move(nnModelCache), + nnDataCache = std::move(nnDataCache), nnToken, userId, executor, callback] { + auto result = device->prepareModelFromCache({}, nnModelCache, nnDataCache, nnToken); + notify(callback.get(), std::move(result), executor, userId); + }; + executor(std::move(task), userId, {}); + + return {}; +} + +nn::GeneralResult<void> prepareModelFromCache_1_3( + const nn::SharedDevice& device, const Executor& executor, + const V1_3::OptionalTimePoint& deadline, const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, const CacheToken& token, + const sp<V1_3::IPreparedModelCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + const auto nnDeadline = NN_TRY(convertInput(deadline)); + auto nnModelCache = NN_TRY(convertInput(modelCache)); + auto nnDataCache = NN_TRY(convertInput(dataCache)); + const auto nnToken = nn::CacheToken(token); + + const uid_t userId = hardware::IPCThreadState::self()->getCallingUid(); + auto task = [device, nnDeadline, nnModelCache = std::move(nnModelCache), + nnDataCache = std::move(nnDataCache), nnToken, userId, executor, callback] { + auto result = device->prepareModelFromCache(nnDeadline, nnModelCache, nnDataCache, nnToken); + notify(callback.get(), std::move(result), executor, userId); + }; + executor(std::move(task), userId, nnDeadline); + + return {}; +} + +nn::GeneralResult<nn::SharedPreparedModel> downcast(const sp<V1_3::IPreparedModel>& preparedModel) { + if (preparedModel == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "preparedModel is nullptr"; + } + if (preparedModel->isRemote()) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Cannot convert remote models"; + } + + // This static_cast is safe because adapter::PreparedModel is the only class that implements + // the IPreparedModel interface in the adapter service code. + const auto* casted = static_cast<const PreparedModel*>(preparedModel.get()); + return casted->getUnderlyingPreparedModel(); +} + +nn::GeneralResult<std::vector<nn::SharedPreparedModel>> downcastAll( + const hidl_vec<sp<V1_3::IPreparedModel>>& preparedModels) { + std::vector<nn::SharedPreparedModel> canonical; + canonical.reserve(preparedModels.size()); + for (const auto& preparedModel : preparedModels) { + canonical.push_back(NN_TRY(downcast(preparedModel))); + } + return canonical; +} + +nn::GeneralResult<std::pair<sp<V1_3::IBuffer>, uint32_t>> allocate( + const nn::SharedDevice& device, const V1_3::BufferDesc& desc, + const hidl_vec<sp<V1_3::IPreparedModel>>& preparedModels, + const hidl_vec<V1_3::BufferRole>& inputRoles, + const hidl_vec<V1_3::BufferRole>& outputRoles) { + auto nnDesc = NN_TRY(convertInput(desc)); + auto nnPreparedModels = NN_TRY(downcastAll(preparedModels)); + auto nnInputRoles = NN_TRY(convertInput(inputRoles)); + auto nnOutputRoles = NN_TRY(convertInput(outputRoles)); + + auto buffer = NN_TRY(device->allocate(nnDesc, nnPreparedModels, nnInputRoles, nnOutputRoles)); + + const nn::Request::MemoryDomainToken token = buffer->getToken(); + auto hidlBuffer = sp<Buffer>::make(std::move(buffer)); + return std::make_pair(std::move(hidlBuffer), static_cast<uint32_t>(token)); +} + +} // namespace + +Device::Device(nn::SharedDevice device, Executor executor) + : kDevice(std::move(device)), kExecutor(std::move(executor)) { + CHECK(kDevice != nullptr); + CHECK(kExecutor != nullptr); +} + +Return<void> Device::getCapabilities(getCapabilities_cb cb) { + const auto capabilities = V1_0::utils::convert(kDevice->getCapabilities()).value(); + cb(V1_0::ErrorStatus::NONE, capabilities); + return Void(); +} + +Return<void> Device::getCapabilities_1_1(getCapabilities_1_1_cb cb) { + const auto capabilities = V1_1::utils::convert(kDevice->getCapabilities()).value(); + cb(V1_0::ErrorStatus::NONE, capabilities); + return Void(); +} + +Return<void> Device::getCapabilities_1_2(getCapabilities_1_2_cb cb) { + const auto capabilities = V1_2::utils::convert(kDevice->getCapabilities()).value(); + cb(V1_0::ErrorStatus::NONE, capabilities); + return Void(); +} + +Return<void> Device::getCapabilities_1_3(getCapabilities_1_3_cb cb) { + const auto capabilities = V1_3::utils::convert(kDevice->getCapabilities()).value(); + cb(V1_3::ErrorStatus::NONE, capabilities); + return Void(); +} + +Return<void> Device::getVersionString(getVersionString_cb cb) { + cb(V1_0::ErrorStatus::NONE, kDevice->getVersionString()); + return Void(); +} + +Return<void> Device::getType(getType_cb cb) { + const auto maybeDeviceType = V1_2::utils::convert(kDevice->getType()); + if (!maybeDeviceType.has_value()) { + const auto& [message, code] = maybeDeviceType.error(); + LOG(ERROR) << "adapter::Device::getType failed with " << code << ": " << message; + cb(V1_2::utils::convert(code).value(), {}); + } else { + cb(V1_0::ErrorStatus::NONE, maybeDeviceType.value()); + } + return Void(); +} + +Return<void> Device::getSupportedExtensions(getSupportedExtensions_cb cb) { + const auto maybeSupportedExtensions = V1_2::utils::convert(kDevice->getSupportedExtensions()); + if (!maybeSupportedExtensions.has_value()) { + const auto& [message, code] = maybeSupportedExtensions.error(); + LOG(ERROR) << "adapter::Device::getSupportedExtensions failed with " << code << ": " + << message; + cb(V1_2::utils::convert(code).value(), {}); + } else { + cb(V1_0::ErrorStatus::NONE, maybeSupportedExtensions.value()); + } + return Void(); +} + +Return<void> Device::getSupportedOperations(const V1_0::Model& model, + getSupportedOperations_cb cb) { + const auto result = adapter::getSupportedOperations(kDevice, model); + if (!result.has_value()) { + const auto& [message, code] = result.error(); + LOG(ERROR) << "adapter::Device::getSupportedOperations_1_0 failed with " << code << ": " + << message; + cb(V1_0::utils::convert(code).value(), {}); + } else { + cb(V1_0::ErrorStatus::NONE, result.value()); + } + return Void(); +} + +Return<void> Device::getSupportedOperations_1_1(const V1_1::Model& model, + getSupportedOperations_1_1_cb cb) { + const auto result = adapter::getSupportedOperations(kDevice, model); + if (!result.has_value()) { + const auto& [message, code] = result.error(); + LOG(ERROR) << "adapter::Device::getSupportedOperations_1_1 failed with " << code << ": " + << message; + cb(V1_1::utils::convert(code).value(), {}); + } else { + cb(V1_0::ErrorStatus::NONE, result.value()); + } + return Void(); +} + +Return<void> Device::getSupportedOperations_1_2(const V1_2::Model& model, + getSupportedOperations_1_2_cb cb) { + const auto result = adapter::getSupportedOperations(kDevice, model); + if (!result.has_value()) { + const auto& [message, code] = result.error(); + LOG(ERROR) << "adapter::Device::getSupportedOperations_1_2 failed with " << code << ": " + << message; + cb(V1_2::utils::convert(code).value(), {}); + } else { + cb(V1_0::ErrorStatus::NONE, result.value()); + } + return Void(); +} + +Return<void> Device::getSupportedOperations_1_3(const V1_3::Model& model, + getSupportedOperations_1_3_cb cb) { + const auto result = adapter::getSupportedOperations(kDevice, model); + if (!result.has_value()) { + const auto& [message, code] = result.error(); + LOG(ERROR) << "adapter::Device::getSupportedOperations_1_3 failed with " << code << ": " + << message; + cb(V1_3::utils::convert(code).value(), {}); + } else { + cb(V1_3::ErrorStatus::NONE, result.value()); + } + return Void(); +} + +Return<void> Device::getNumberOfCacheFilesNeeded(getNumberOfCacheFilesNeeded_cb cb) { + const auto [numModelCache, numDataCache] = kDevice->getNumberOfCacheFilesNeeded(); + cb(V1_0::ErrorStatus::NONE, numModelCache, numDataCache); + return Void(); +} + +Return<V1_0::ErrorStatus> Device::prepareModel(const V1_0::Model& model, + const sp<V1_0::IPreparedModelCallback>& callback) { + auto result = adapter::prepareModel(kDevice, kExecutor, model, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::prepareModel failed with " << code << ": " << message; + notify(callback.get(), code, nullptr); + return V1_0::utils::convert(code).value(); + } + return V1_0::ErrorStatus::NONE; +} + +Return<V1_0::ErrorStatus> Device::prepareModel_1_1( + const V1_1::Model& model, V1_1::ExecutionPreference preference, + const sp<V1_0::IPreparedModelCallback>& callback) { + auto result = adapter::prepareModel_1_1(kDevice, kExecutor, model, preference, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::prepareModel_1_1 failed with " << code << ": " << message; + notify(callback.get(), code, nullptr); + return V1_1::utils::convert(code).value(); + } + return V1_0::ErrorStatus::NONE; +} + +Return<V1_0::ErrorStatus> Device::prepareModel_1_2( + const V1_2::Model& model, V1_1::ExecutionPreference preference, + const hidl_vec<hidl_handle>& modelCache, const hidl_vec<hidl_handle>& dataCache, + const CacheToken& token, const sp<V1_2::IPreparedModelCallback>& callback) { + auto result = adapter::prepareModel_1_2(kDevice, kExecutor, model, preference, modelCache, + dataCache, token, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::prepareModel_1_2 failed with " << code << ": " << message; + notify(callback.get(), code, nullptr); + return V1_2::utils::convert(code).value(); + } + return V1_0::ErrorStatus::NONE; +} + +Return<V1_3::ErrorStatus> Device::prepareModel_1_3( + const V1_3::Model& model, V1_1::ExecutionPreference preference, V1_3::Priority priority, + const V1_3::OptionalTimePoint& deadline, const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, const CacheToken& token, + const sp<V1_3::IPreparedModelCallback>& callback) { + auto result = adapter::prepareModel_1_3(kDevice, kExecutor, model, preference, priority, + deadline, modelCache, dataCache, token, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::prepareModel_1_3 failed with " << code << ": " << message; + notify(callback.get(), code, nullptr); + return V1_3::utils::convert(code).value(); + } + return V1_3::ErrorStatus::NONE; +} + +Return<V1_0::ErrorStatus> Device::prepareModelFromCache( + const hidl_vec<hidl_handle>& modelCache, const hidl_vec<hidl_handle>& dataCache, + const CacheToken& token, const sp<V1_2::IPreparedModelCallback>& callback) { + auto result = adapter::prepareModelFromCache(kDevice, kExecutor, modelCache, dataCache, token, + callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::prepareModelFromCache failed with " << code << ": " + << message; + notify(callback.get(), code, nullptr); + return V1_2::utils::convert(code).value(); + } + return V1_0::ErrorStatus::NONE; +} + +Return<V1_3::ErrorStatus> Device::prepareModelFromCache_1_3( + const V1_3::OptionalTimePoint& deadline, const hidl_vec<hidl_handle>& modelCache, + const hidl_vec<hidl_handle>& dataCache, const CacheToken& token, + const sp<V1_3::IPreparedModelCallback>& callback) { + auto result = adapter::prepareModelFromCache_1_3(kDevice, kExecutor, deadline, modelCache, + dataCache, token, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::prepareModelFromCache_1_3 failed with " << code << ": " + << message; + notify(callback.get(), code, nullptr); + return V1_3::utils::convert(code).value(); + } + return V1_3::ErrorStatus::NONE; +} + +Return<V1_0::DeviceStatus> Device::getStatus() { + return V1_0::DeviceStatus::AVAILABLE; +} + +Return<void> Device::allocate(const V1_3::BufferDesc& desc, + const hidl_vec<sp<V1_3::IPreparedModel>>& preparedModels, + const hidl_vec<V1_3::BufferRole>& inputRoles, + const hidl_vec<V1_3::BufferRole>& outputRoles, allocate_cb cb) { + auto result = adapter::allocate(kDevice, desc, preparedModels, inputRoles, outputRoles); + if (!result.has_value()) { + const auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::Device::allocate failed with " << code << ": " << message; + cb(V1_3::utils::convert(code).value(), nullptr, /*token=*/0); + return Void(); + } + auto [buffer, token] = std::move(result).value(); + cb(V1_3::ErrorStatus::NONE, buffer, token); + return Void(); +} + +} // namespace android::hardware::neuralnetworks::adapter diff --git a/neuralnetworks/utils/adapter/src/PreparedModel.cpp b/neuralnetworks/utils/adapter/src/PreparedModel.cpp new file mode 100644 index 0000000000..8968c2cc91 --- /dev/null +++ b/neuralnetworks/utils/adapter/src/PreparedModel.cpp @@ -0,0 +1,417 @@ +/* + * 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 "PreparedModel.h" + +#include <ExecutionBurstServer.h> +#include <android-base/logging.h> +#include <android/hardware/neuralnetworks/1.0/IExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.0/types.h> +#include <android/hardware/neuralnetworks/1.2/IBurstCallback.h> +#include <android/hardware/neuralnetworks/1.2/IExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.2/types.h> +#include <android/hardware/neuralnetworks/1.3/IExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.3/IFencedExecutionCallback.h> +#include <android/hardware/neuralnetworks/1.3/IPreparedModel.h> +#include <android/hardware/neuralnetworks/1.3/types.h> +#include <hwbinder/IPCThreadState.h> +#include <nnapi/IPreparedModel.h> +#include <nnapi/TypeUtils.h> +#include <nnapi/Types.h> +#include <nnapi/Validation.h> +#include <nnapi/hal/1.0/Utils.h> +#include <nnapi/hal/1.2/Utils.h> +#include <nnapi/hal/1.3/Conversions.h> +#include <nnapi/hal/1.3/Utils.h> +#include <nnapi/hal/HandleError.h> +#include <sys/types.h> + +#include <memory> +#include <thread> + +// See hardware/interfaces/neuralnetworks/utils/README.md for more information on HIDL interface +// lifetimes across processes and for protecting asynchronous calls across HIDL. + +namespace android::hardware::neuralnetworks::adapter { +namespace { + +template <typename Type> +auto convertInput(const Type& object) -> decltype(nn::convert(std::declval<Type>())) { + auto result = nn::convert(object); + if (!result.has_value()) { + result.error().code = nn::ErrorStatus::INVALID_ARGUMENT; + } + return result; +} + +class FencedExecutionCallback final : public V1_3::IFencedExecutionCallback { + public: + explicit FencedExecutionCallback(const nn::ExecuteFencedInfoCallback& callback) + : kCallback(callback) { + CHECK(callback != nullptr); + } + + Return<void> getExecutionInfo(getExecutionInfo_cb cb) override { + const auto result = kCallback(); + if (!result.has_value()) { + const auto& [message, code] = result.error(); + const auto status = + V1_3::utils::convert(code).value_or(V1_3::ErrorStatus::GENERAL_FAILURE); + LOG(ERROR) << message; + cb(status, V1_2::utils::kNoTiming, V1_2::utils::kNoTiming); + return Void(); + } + const auto [timingLaunched, timingFenced] = result.value(); + const auto hidlTimingLaunched = V1_3::utils::convert(timingLaunched).value(); + const auto hidlTimingFenced = V1_3::utils::convert(timingFenced).value(); + cb(V1_3::ErrorStatus::NONE, hidlTimingLaunched, hidlTimingFenced); + return Void(); + } + + private: + const nn::ExecuteFencedInfoCallback kCallback; +}; + +using ExecutionResult = nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>>; + +void notify(V1_0::IExecutionCallback* callback, nn::ErrorStatus status, + const std::vector<nn::OutputShape>& /*outputShapes*/, const nn::Timing& /*timing*/) { + if (callback != nullptr) { + const auto hidlStatus = V1_0::utils::convert(status).value(); + const auto ret = callback->notify(hidlStatus); + if (!ret.isOk()) { + LOG(ERROR) << "V1_0::IExecutionCallback::notify failed with " << ret.description(); + } + } +} + +void notify(V1_2::IExecutionCallback* callback, nn::ErrorStatus status, + const std::vector<nn::OutputShape>& outputShapes, const nn::Timing& timing) { + if (callback != nullptr) { + const auto hidlStatus = V1_2::utils::convert(status).value(); + const auto hidlOutputShapes = V1_2::utils::convert(outputShapes).value(); + const auto hidlTiming = V1_2::utils::convert(timing).value(); + const auto ret = callback->notify_1_2(hidlStatus, hidlOutputShapes, hidlTiming); + if (!ret.isOk()) { + LOG(ERROR) << "V1_2::IExecutionCallback::notify_1_2 failed with " << ret.description(); + } + } +} + +void notify(V1_3::IExecutionCallback* callback, nn::ErrorStatus status, + const std::vector<nn::OutputShape>& outputShapes, const nn::Timing& timing) { + if (callback != nullptr) { + const auto hidlStatus = V1_3::utils::convert(status).value(); + const auto hidlOutputShapes = V1_3::utils::convert(outputShapes).value(); + const auto hidlTiming = V1_3::utils::convert(timing).value(); + const auto ret = callback->notify_1_3(hidlStatus, hidlOutputShapes, hidlTiming); + if (!ret.isOk()) { + LOG(ERROR) << "V1_3::IExecutionCallback::notify_1_3 failed with " << ret.description(); + } + } +} + +template <typename CallbackType> +void notify(CallbackType* callback, ExecutionResult result) { + if (!result.has_value()) { + const auto [message, status, outputShapes] = std::move(result).error(); + LOG(ERROR) << message; + notify(callback, status, outputShapes, {}); + } else { + const auto [outputShapes, timing] = std::move(result).value(); + notify(callback, nn::ErrorStatus::NONE, outputShapes, timing); + } +} + +nn::GeneralResult<void> execute(const nn::SharedPreparedModel& preparedModel, uid_t userId, + const Executor& executor, const V1_0::Request& request, + const sp<V1_0::IExecutionCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnRequest = NN_TRY(convertInput(request)); + + const std::any resource = preparedModel->getUnderlyingResource(); + if (const auto* model = std::any_cast<const nn::Model*>(&resource)) { + CHECK(*model != nullptr); + NN_TRY(utils::makeGeneralFailure(nn::validateRequestForModel(nnRequest, **model), + nn::ErrorStatus::INVALID_ARGUMENT)); + } + + Task task = [preparedModel, nnRequest = std::move(nnRequest), callback] { + auto result = preparedModel->execute(nnRequest, nn::MeasureTiming::NO, {}, {}); + notify(callback.get(), std::move(result)); + }; + executor(std::move(task), userId, {}); + + return {}; +} + +nn::GeneralResult<void> execute_1_2(const nn::SharedPreparedModel& preparedModel, uid_t userId, + const Executor& executor, const V1_0::Request& request, + V1_2::MeasureTiming measure, + const sp<V1_2::IExecutionCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnRequest = NN_TRY(convertInput(request)); + const auto nnMeasure = NN_TRY(convertInput(measure)); + + const std::any resource = preparedModel->getUnderlyingResource(); + if (const auto* model = std::any_cast<const nn::Model*>(&resource)) { + CHECK(*model != nullptr); + NN_TRY(utils::makeGeneralFailure(nn::validateRequestForModel(nnRequest, **model), + nn::ErrorStatus::INVALID_ARGUMENT)); + } + + Task task = [preparedModel, nnRequest = std::move(nnRequest), nnMeasure, callback] { + auto result = preparedModel->execute(nnRequest, nnMeasure, {}, {}); + notify(callback.get(), std::move(result)); + }; + executor(std::move(task), userId, {}); + + return {}; +} + +nn::GeneralResult<void> execute_1_3(const nn::SharedPreparedModel& preparedModel, uid_t userId, + const Executor& executor, const V1_3::Request& request, + V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + const sp<V1_3::IExecutionCallback>& callback) { + if (callback.get() == nullptr) { + return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "Invalid callback"; + } + + auto nnRequest = NN_TRY(convertInput(request)); + const auto nnMeasure = NN_TRY(convertInput(measure)); + const auto nnDeadline = NN_TRY(convertInput(deadline)); + const auto nnLoopTimeoutDuration = NN_TRY(convertInput(loopTimeoutDuration)); + + const std::any resource = preparedModel->getUnderlyingResource(); + if (const auto* model = std::any_cast<const nn::Model*>(&resource)) { + CHECK(*model != nullptr); + NN_TRY(utils::makeGeneralFailure(nn::validateRequestForModel(nnRequest, **model), + nn::ErrorStatus::INVALID_ARGUMENT)); + } + + Task task = [preparedModel, nnRequest = std::move(nnRequest), nnMeasure, nnDeadline, + nnLoopTimeoutDuration, callback] { + auto result = + preparedModel->execute(nnRequest, nnMeasure, nnDeadline, nnLoopTimeoutDuration); + notify(callback.get(), std::move(result)); + }; + executor(std::move(task), userId, nnDeadline); + + return {}; +} + +nn::ExecutionResult<std::pair<hidl_vec<V1_2::OutputShape>, V1_2::Timing>> executeSynchronously( + const nn::SharedPreparedModel& preparedModel, const V1_0::Request& request, + V1_2::MeasureTiming measure) { + const auto nnRequest = NN_TRY(utils::makeExecutionFailure(convertInput(request))); + const auto nnMeasure = NN_TRY(utils::makeExecutionFailure(convertInput(measure))); + + const auto [outputShapes, timing] = + NN_TRY(preparedModel->execute(nnRequest, nnMeasure, {}, {})); + + auto hidlOutputShapes = NN_TRY(utils::makeExecutionFailure(V1_2::utils::convert(outputShapes))); + const auto hidlTiming = NN_TRY(utils::makeExecutionFailure(V1_2::utils::convert(timing))); + return std::make_pair(std::move(hidlOutputShapes), hidlTiming); +} + +nn::ExecutionResult<std::pair<hidl_vec<V1_2::OutputShape>, V1_2::Timing>> executeSynchronously_1_3( + const nn::SharedPreparedModel& preparedModel, const V1_3::Request& request, + V1_2::MeasureTiming measure, const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration) { + const auto nnRequest = NN_TRY(utils::makeExecutionFailure(convertInput(request))); + const auto nnMeasure = NN_TRY(utils::makeExecutionFailure(convertInput(measure))); + const auto nnDeadline = NN_TRY(utils::makeExecutionFailure(convertInput(deadline))); + const auto nnLoopTimeoutDuration = + NN_TRY(utils::makeExecutionFailure(convertInput(loopTimeoutDuration))); + + const auto [outputShapes, timing] = + NN_TRY(preparedModel->execute(nnRequest, nnMeasure, nnDeadline, nnLoopTimeoutDuration)); + + auto hidlOutputShapes = NN_TRY(utils::makeExecutionFailure(V1_3::utils::convert(outputShapes))); + const auto hidlTiming = NN_TRY(utils::makeExecutionFailure(V1_3::utils::convert(timing))); + return std::make_pair(std::move(hidlOutputShapes), hidlTiming); +} + +nn::GeneralResult<std::vector<nn::SyncFence>> convertSyncFences( + const hidl_vec<hidl_handle>& handles) { + std::vector<nn::SyncFence> syncFences; + syncFences.reserve(handles.size()); + for (const auto& handle : handles) { + auto nativeHandle = NN_TRY(convertInput(handle)); + auto syncFence = NN_TRY(utils::makeGeneralFailure( + nn::SyncFence::create(std::move(nativeHandle)), nn::ErrorStatus::INVALID_ARGUMENT)); + syncFences.push_back(std::move(syncFence)); + } + return syncFences; +} + +nn::GeneralResult<std::pair<hidl_handle, sp<V1_3::IFencedExecutionCallback>>> executeFenced( + const nn::SharedPreparedModel& preparedModel, const V1_3::Request& request, + const hidl_vec<hidl_handle>& waitFor, V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + const V1_3::OptionalTimeoutDuration& duration) { + const auto nnRequest = NN_TRY(convertInput(request)); + const auto nnWaitFor = NN_TRY(convertSyncFences(waitFor)); + const auto nnMeasure = NN_TRY(convertInput(measure)); + const auto nnDeadline = NN_TRY(convertInput(deadline)); + const auto nnLoopTimeoutDuration = NN_TRY(convertInput(loopTimeoutDuration)); + const auto nnDuration = NN_TRY(convertInput(duration)); + + auto [syncFence, executeFencedCallback] = NN_TRY(preparedModel->executeFenced( + nnRequest, nnWaitFor, nnMeasure, nnDeadline, nnLoopTimeoutDuration, nnDuration)); + + auto hidlSyncFence = NN_TRY(V1_3::utils::convert(syncFence.getSharedHandle())); + auto hidlExecuteFencedCallback = sp<FencedExecutionCallback>::make(executeFencedCallback); + return std::make_pair(std::move(hidlSyncFence), std::move(hidlExecuteFencedCallback)); +} + +} // namespace + +PreparedModel::PreparedModel(nn::SharedPreparedModel preparedModel, Executor executor, uid_t userId) + : kPreparedModel(std::move(preparedModel)), kExecutor(std::move(executor)), kUserId(userId) { + CHECK(kPreparedModel != nullptr); + CHECK(kExecutor != nullptr); +} + +nn::SharedPreparedModel PreparedModel::getUnderlyingPreparedModel() const { + return kPreparedModel; +} + +Return<V1_0::ErrorStatus> PreparedModel::execute(const V1_0::Request& request, + const sp<V1_0::IExecutionCallback>& callback) { + auto result = adapter::execute(kPreparedModel, kUserId, kExecutor, request, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::PreparedModel::execute failed with " << code << ": " << message; + notify(callback.get(), code, {}, {}); + return V1_0::utils::convert(code).value(); + } + return V1_0::ErrorStatus::NONE; +} + +Return<V1_0::ErrorStatus> PreparedModel::execute_1_2(const V1_0::Request& request, + V1_2::MeasureTiming measure, + const sp<V1_2::IExecutionCallback>& callback) { + auto result = + adapter::execute_1_2(kPreparedModel, kUserId, kExecutor, request, measure, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::PreparedModel::execute_1_2 failed with " << code << ": " << message; + notify(callback.get(), code, {}, {}); + return V1_2::utils::convert(code).value(); + } + return V1_0::ErrorStatus::NONE; +} + +Return<V1_3::ErrorStatus> PreparedModel::execute_1_3( + const V1_3::Request& request, V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + const sp<V1_3::IExecutionCallback>& callback) { + auto result = adapter::execute_1_3(kPreparedModel, kUserId, kExecutor, request, measure, + deadline, loopTimeoutDuration, callback); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::PreparedModel::execute_1_3 failed with " << code << ": " << message; + notify(callback.get(), code, {}, {}); + return V1_3::utils::convert(code).value(); + } + return V1_3::ErrorStatus::NONE; +} + +Return<void> PreparedModel::executeSynchronously(const V1_0::Request& request, + V1_2::MeasureTiming measure, + executeSynchronously_cb cb) { + auto result = adapter::executeSynchronously(kPreparedModel, request, measure); + if (!result.has_value()) { + auto [message, code, outputShapes] = std::move(result).error(); + LOG(ERROR) << "adapter::PreparedModel::executeSynchronously failed with " << code << ": " + << message; + cb(V1_2::utils::convert(code).value(), V1_2::utils::convert(outputShapes).value(), + V1_2::utils::kNoTiming); + return Void(); + } + auto [outputShapes, timing] = std::move(result).value(); + cb(V1_0::ErrorStatus::NONE, outputShapes, timing); + return Void(); +} + +Return<void> PreparedModel::executeSynchronously_1_3( + const V1_3::Request& request, V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, executeSynchronously_1_3_cb cb) { + auto result = adapter::executeSynchronously_1_3(kPreparedModel, request, measure, deadline, + loopTimeoutDuration); + if (!result.has_value()) { + auto [message, code, outputShapes] = std::move(result).error(); + LOG(ERROR) << "adapter::PreparedModel::executeSynchronously_1_3 failed with " << code + << ": " << message; + cb(V1_3::utils::convert(code).value(), V1_3::utils::convert(outputShapes).value(), + V1_2::utils::kNoTiming); + return Void(); + } + auto [outputShapes, timing] = std::move(result).value(); + cb(V1_3::ErrorStatus::NONE, outputShapes, timing); + return Void(); +} + +Return<void> PreparedModel::configureExecutionBurst( + const sp<V1_2::IBurstCallback>& callback, + const MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel, + const MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel, + configureExecutionBurst_cb cb) { + const sp<V1_2::IBurstContext> burst = nn::ExecutionBurstServer::create( + callback, requestChannel, resultChannel, this, std::chrono::microseconds{0}); + + if (burst == nullptr) { + cb(V1_0::ErrorStatus::GENERAL_FAILURE, {}); + } else { + cb(V1_0::ErrorStatus::NONE, burst); + } + return Void(); +} + +Return<void> PreparedModel::executeFenced(const V1_3::Request& request, + const hidl_vec<hidl_handle>& waitFor, + V1_2::MeasureTiming measure, + const V1_3::OptionalTimePoint& deadline, + const V1_3::OptionalTimeoutDuration& loopTimeoutDuration, + const V1_3::OptionalTimeoutDuration& duration, + executeFenced_cb callback) { + auto result = adapter::executeFenced(kPreparedModel, request, waitFor, measure, deadline, + loopTimeoutDuration, duration); + if (!result.has_value()) { + auto [message, code] = std::move(result).error(); + LOG(ERROR) << "adapter::PreparedModel::executeFenced failed with " << code << ": " + << message; + callback(V1_3::utils::convert(code).value(), {}, nullptr); + return Void(); + } + auto [syncFence, executeFencedCallback] = std::move(result).value(); + callback(V1_3::ErrorStatus::NONE, syncFence, executeFencedCallback); + return Void(); +} + +} // namespace android::hardware::neuralnetworks::adapter diff --git a/neuralnetworks/utils/common/Android.bp b/neuralnetworks/utils/common/Android.bp index 50295f1aad..6162fe8cbc 100644 --- a/neuralnetworks/utils/common/Android.bp +++ b/neuralnetworks/utils/common/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_common", defaults: ["neuralnetworks_utils_defaults"], diff --git a/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h b/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h index 547f203d6d..2f6112a4c9 100644 --- a/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h +++ b/neuralnetworks/utils/common/include/nnapi/hal/CommonUtils.h @@ -71,8 +71,8 @@ nn::GeneralResult<std::reference_wrapper<const nn::Request>> flushDataFromPointe nn::GeneralResult<void> unflushDataFromSharedToPointer( const nn::Request& request, const std::optional<nn::Request>& maybeRequestInShared); -std::vector<uint32_t> countNumberOfConsumers(size_t numberOfOperands, - const std::vector<nn::Operation>& operations); +nn::GeneralResult<std::vector<uint32_t>> countNumberOfConsumers( + size_t numberOfOperands, const std::vector<nn::Operation>& operations); nn::GeneralResult<hidl_memory> createHidlMemoryFromSharedMemory(const nn::SharedMemory& memory); nn::GeneralResult<nn::SharedMemory> createSharedMemoryFromHidlMemory(const hidl_memory& memory); diff --git a/neuralnetworks/utils/common/src/CommonUtils.cpp b/neuralnetworks/utils/common/src/CommonUtils.cpp index 7a5035f6fc..924ecb2d1b 100644 --- a/neuralnetworks/utils/common/src/CommonUtils.cpp +++ b/neuralnetworks/utils/common/src/CommonUtils.cpp @@ -246,9 +246,9 @@ nn::GeneralResult<void> unflushDataFromSharedToPointer( return {}; } -std::vector<uint32_t> countNumberOfConsumers(size_t numberOfOperands, - const std::vector<nn::Operation>& operations) { - return nn::countNumberOfConsumers(numberOfOperands, operations); +nn::GeneralResult<std::vector<uint32_t>> countNumberOfConsumers( + size_t numberOfOperands, const std::vector<nn::Operation>& operations) { + return makeGeneralFailure(nn::countNumberOfConsumers(numberOfOperands, operations)); } nn::GeneralResult<hidl_memory> createHidlMemoryFromSharedMemory(const nn::SharedMemory& memory) { diff --git a/neuralnetworks/utils/service/Android.bp b/neuralnetworks/utils/service/Android.bp index 402598c7aa..9f8b9bbbfd 100644 --- a/neuralnetworks/utils/service/Android.bp +++ b/neuralnetworks/utils/service/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "neuralnetworks_utils_hal_service", defaults: ["neuralnetworks_utils_defaults"], diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp index 667922a4ac..55c8639dfd 100644 --- a/nfc/1.0/Android.bp +++ b/nfc/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.nfc@1.0", root: "android.hardware", diff --git a/nfc/1.0/default/Android.bp b/nfc/1.0/default/Android.bp index 9827edd454..a0cefeead2 100644 --- a/nfc/1.0/default/Android.bp +++ b/nfc/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.nfc@1.0-impl", defaults: ["hidl_defaults"], diff --git a/nfc/1.0/vts/functional/Android.bp b/nfc/1.0/vts/functional/Android.bp index 40ba22ee2f..0d3f0c95d6 100644 --- a/nfc/1.0/vts/functional/Android.bp +++ b/nfc/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalNfcV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/nfc/1.1/Android.bp b/nfc/1.1/Android.bp index a8976b06c4..a8463cf0fe 100644 --- a/nfc/1.1/Android.bp +++ b/nfc/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.nfc@1.1", root: "android.hardware", diff --git a/nfc/1.1/vts/functional/Android.bp b/nfc/1.1/vts/functional/Android.bp index 1c18418514..4439531d9f 100644 --- a/nfc/1.1/vts/functional/Android.bp +++ b/nfc/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalNfcV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/nfc/1.2/Android.bp b/nfc/1.2/Android.bp index 514d5313aa..4831ab9133 100644 --- a/nfc/1.2/Android.bp +++ b/nfc/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.nfc@1.2", root: "android.hardware", diff --git a/nfc/1.2/vts/functional/Android.bp b/nfc/1.2/vts/functional/Android.bp index 83e7a8e58e..ff7bd3a8d8 100644 --- a/nfc/1.2/vts/functional/Android.bp +++ b/nfc/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalNfcV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/oemlock/1.0/Android.bp b/oemlock/1.0/Android.bp index 8ab2911b8e..da536c4b49 100644 --- a/oemlock/1.0/Android.bp +++ b/oemlock/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.oemlock@1.0", root: "android.hardware", diff --git a/oemlock/1.0/vts/functional/Android.bp b/oemlock/1.0/vts/functional/Android.bp index 4dd92b53d6..f1b8d2f8ee 100644 --- a/oemlock/1.0/vts/functional/Android.bp +++ b/oemlock/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalOemLockV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/oemlock/aidl/Android.bp b/oemlock/aidl/Android.bp index bfc99e7b5f..439d43d760 100644 --- a/oemlock/aidl/Android.bp +++ b/oemlock/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.oemlock", vendor_available: true, diff --git a/oemlock/aidl/default/Android.bp b/oemlock/aidl/default/Android.bp index 464b0a3d60..84136fe701 100644 --- a/oemlock/aidl/default/Android.bp +++ b/oemlock/aidl/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.oemlock-service.example", relative_install_path: "hw", diff --git a/oemlock/aidl/vts/Android.bp b/oemlock/aidl/vts/Android.bp index 18b53c2e7d..840d20aa50 100644 --- a/oemlock/aidl/vts/Android.bp +++ b/oemlock/aidl/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalOemLockTargetTest", defaults: [ diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp index 7381c709c9..68596ef64f 100644 --- a/power/1.0/Android.bp +++ b/power/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.power@1.0", root: "android.hardware", diff --git a/power/1.0/default/Android.bp b/power/1.0/default/Android.bp index 74fb13fb80..d99ef9d833 100644 --- a/power/1.0/default/Android.bp +++ b/power/1.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.power@1.0-impl", defaults: ["hidl_defaults"], diff --git a/power/1.0/vts/functional/Android.bp b/power/1.0/vts/functional/Android.bp index 27b945651c..7d90a839e8 100644 --- a/power/1.0/vts/functional/Android.bp +++ b/power/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/power/1.1/Android.bp b/power/1.1/Android.bp index e026e7021f..259be4268e 100644 --- a/power/1.1/Android.bp +++ b/power/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.power@1.1", root: "android.hardware", diff --git a/power/1.1/vts/functional/Android.bp b/power/1.1/vts/functional/Android.bp index 2860fdb10a..4270ab7bc8 100644 --- a/power/1.1/vts/functional/Android.bp +++ b/power/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/power/1.2/Android.bp b/power/1.2/Android.bp index ccf66dc1a6..aad89e047b 100644 --- a/power/1.2/Android.bp +++ b/power/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.power@1.2", root: "android.hardware", diff --git a/power/1.2/vts/functional/Android.bp b/power/1.2/vts/functional/Android.bp index 5d1b2a4973..ab4b60166f 100644 --- a/power/1.2/vts/functional/Android.bp +++ b/power/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/power/1.3/Android.bp b/power/1.3/Android.bp index 15955e5db5..93467975ba 100644 --- a/power/1.3/Android.bp +++ b/power/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.power@1.3", root: "android.hardware", diff --git a/power/1.3/vts/functional/Android.bp b/power/1.3/vts/functional/Android.bp index d8e1c050ad..c1186e3a67 100644 --- a/power/1.3/vts/functional/Android.bp +++ b/power/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/power/aidl/Android.bp b/power/aidl/Android.bp index 40086520fa..054fea5467 100644 --- a/power/aidl/Android.bp +++ b/power/aidl/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.power", vendor_available: true, diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp index de04bcdcfc..5aa6893e67 100644 --- a/power/aidl/default/Android.bp +++ b/power/aidl/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.power-service.example", relative_install_path: "hw", diff --git a/power/aidl/vts/Android.bp b/power/aidl/vts/Android.bp index 008073bdf8..1051b03823 100644 --- a/power/aidl/vts/Android.bp +++ b/power/aidl/vts/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerTargetTest", defaults: [ diff --git a/power/stats/1.0/Android.bp b/power/stats/1.0/Android.bp index 2a71490522..72da04e1d5 100644 --- a/power/stats/1.0/Android.bp +++ b/power/stats/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.power.stats@1.0", root: "android.hardware", diff --git a/power/stats/1.0/default/Android.bp b/power/stats/1.0/default/Android.bp index 0321da1354..f0bbef1dc9 100644 --- a/power/stats/1.0/default/Android.bp +++ b/power/stats/1.0/default/Android.bp @@ -11,6 +11,15 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.power.stats@1.0-service.mock", relative_install_path: "hw", diff --git a/power/stats/1.0/vts/functional/Android.bp b/power/stats/1.0/vts/functional/Android.bp index d5f1da2d9d..5a448d845f 100644 --- a/power/stats/1.0/vts/functional/Android.bp +++ b/power/stats/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerStatsV1_0TargetTest", defaults: [ diff --git a/power/stats/aidl/Android.bp b/power/stats/aidl/Android.bp index 1688b12d9a..f4955e2835 100644 --- a/power/stats/aidl/Android.bp +++ b/power/stats/aidl/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.power.stats", vendor_available: true, diff --git a/power/stats/aidl/OWNERS b/power/stats/aidl/OWNERS new file mode 100644 index 0000000000..b290b496b9 --- /dev/null +++ b/power/stats/aidl/OWNERS @@ -0,0 +1,3 @@ +bsschwar@google.com +krossmo@google.com +tstrudel@google.com diff --git a/power/stats/aidl/default/Android.bp b/power/stats/aidl/default/Android.bp index 595ecd62d5..417dc97f0b 100644 --- a/power/stats/aidl/default/Android.bp +++ b/power/stats/aidl/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.power.stats-service.example", relative_install_path: "hw", diff --git a/power/stats/aidl/default/FakeEnergyConsumer.h b/power/stats/aidl/default/FakeEnergyConsumer.h new file mode 100644 index 0000000000..f41aa6ea86 --- /dev/null +++ b/power/stats/aidl/default/FakeEnergyConsumer.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2021 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 <PowerStats.h> + +#include <android-base/chrono_utils.h> + +#include <chrono> +#include <random> + +namespace aidl { +namespace android { +namespace hardware { +namespace power { +namespace stats { + +class FakeEnergyConsumer : public PowerStats::IEnergyConsumer { + public: + FakeEnergyConsumer(EnergyConsumerType type, std::string name) : mType(type), mName(name) { + mResult.timestampMs = 0; + mResult.energyUWs = 0; + mResult.attribution = {}; + } + + ~FakeEnergyConsumer() = default; + + std::string getName() override { return mName; } + + EnergyConsumerType getType() override { return mType; } + + std::optional<EnergyConsumerResult> getEnergyConsumed() override { + mFakeEnergyConsumerResult.update(&mResult); + return mResult; + } + + private: + class FakeEnergyConsumerResult { + public: + FakeEnergyConsumerResult() : mDistribution(1, 100) {} + void update(EnergyConsumerResult* result) { + // generates number in the range 1..100 + auto randNum = std::bind(mDistribution, mGenerator); + + // Get current time since boot in milliseconds + uint64_t now = std::chrono::time_point_cast<std::chrono::milliseconds>( + ::android::base::boot_clock::now()) + .time_since_epoch() + .count(); + result->timestampMs = now; + result->energyUWs += randNum() * 100; + } + + private: + std::default_random_engine mGenerator; + std::uniform_int_distribution<int> mDistribution; + }; + + EnergyConsumerType mType; + std::string mName; + FakeEnergyConsumerResult mFakeEnergyConsumerResult; + EnergyConsumerResult mResult; +}; + +} // namespace stats +} // namespace power +} // namespace hardware +} // namespace android +} // namespace aidl
\ No newline at end of file diff --git a/power/stats/aidl/default/FakeEnergyMeter.h b/power/stats/aidl/default/FakeEnergyMeter.h new file mode 100644 index 0000000000..f0d4ee7dfc --- /dev/null +++ b/power/stats/aidl/default/FakeEnergyMeter.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2021 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 <PowerStats.h> + +#include <android-base/chrono_utils.h> + +#include <chrono> +#include <random> + +namespace aidl { +namespace android { +namespace hardware { +namespace power { +namespace stats { + +class FakeEnergyMeter : public PowerStats::IEnergyMeter { + public: + FakeEnergyMeter(std::vector<std::pair<std::string, std::string>> channelNames) { + int32_t channelId = 0; + for (const auto& [name, subsystem] : channelNames) { + Channel c; + c.id = channelId++; + c.name = name; + c.subsystem = subsystem; + + EnergyMeasurement m; + m.id = c.id; + m.timestampMs = 0; + m.durationMs = 0; + m.energyUWs = 0; + + mChannels.push_back(c); + mEnergyMeasurements.push_back(m); + } + } + ~FakeEnergyMeter() = default; + ndk::ScopedAStatus readEnergyMeter(const std::vector<int32_t>& in_channelIds, + std::vector<EnergyMeasurement>* _aidl_return) override { + for (auto& measurement : mEnergyMeasurements) { + mFakeEnergyMeasurement.update(&measurement); + } + + if (in_channelIds.empty()) { + *_aidl_return = mEnergyMeasurements; + } else { + for (int32_t id : in_channelIds) { + if (id >= 0 && id < mEnergyMeasurements.size()) { + _aidl_return->push_back(mEnergyMeasurements[id]); + } + } + } + + return ndk::ScopedAStatus::ok(); + } + + ndk::ScopedAStatus getEnergyMeterInfo(std::vector<Channel>* _aidl_return) override { + *_aidl_return = mChannels; + return ndk::ScopedAStatus::ok(); + } + + private: + class FakeEnergyMeasurement { + public: + FakeEnergyMeasurement() : mDistribution(1, 100) {} + void update(EnergyMeasurement* measurement) { + // generates number in the range 1..100 + auto randNum = std::bind(mDistribution, mGenerator); + + // Get current time since boot in milliseconds + uint64_t now = std::chrono::time_point_cast<std::chrono::milliseconds>( + ::android::base::boot_clock::now()) + .time_since_epoch() + .count(); + measurement->timestampMs = now; + measurement->durationMs = now; + measurement->energyUWs += randNum() * 100; + } + + private: + std::default_random_engine mGenerator; + std::uniform_int_distribution<int> mDistribution; + }; + + std::vector<Channel> mChannels; + FakeEnergyMeasurement mFakeEnergyMeasurement; + std::vector<EnergyMeasurement> mEnergyMeasurements; +}; + +} // namespace stats +} // namespace power +} // namespace hardware +} // namespace android +} // namespace aidl
\ No newline at end of file diff --git a/power/stats/aidl/default/FakeStateResidencyDataProvider.h b/power/stats/aidl/default/FakeStateResidencyDataProvider.h new file mode 100644 index 0000000000..2eeab61dbc --- /dev/null +++ b/power/stats/aidl/default/FakeStateResidencyDataProvider.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2021 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 <PowerStats.h> + +#include <random> + +namespace aidl { +namespace android { +namespace hardware { +namespace power { +namespace stats { + +class FakeStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider { + public: + FakeStateResidencyDataProvider(const std::string& name, std::vector<State> states) + : mName(name), mStates(states) { + for (const auto& state : mStates) { + StateResidency r; + r.id = state.id; + r.totalTimeInStateMs = 0; + r.totalStateEntryCount = 0; + r.lastEntryTimestampMs = 0; + mResidencies.push_back(r); + } + } + ~FakeStateResidencyDataProvider() = default; + + // Methods from PowerStats::IStateResidencyDataProvider + bool getStateResidencies( + std::unordered_map<std::string, std::vector<StateResidency>>* residencies) override { + for (auto& residency : mResidencies) { + mFakeStateResidency.update(&residency); + } + + residencies->emplace(mName, mResidencies); + return true; + } + + std::unordered_map<std::string, std::vector<State>> getInfo() override { + return {{mName, mStates}}; + } + + private: + class FakeStateResidency { + public: + FakeStateResidency() : mDistribution(1, 100) {} + void update(StateResidency* residency) { + // generates number in the range 1..100 + auto randNum = std::bind(mDistribution, mGenerator); + + residency->totalTimeInStateMs += randNum() * 100; + residency->totalStateEntryCount += randNum(); + residency->lastEntryTimestampMs += randNum() * 100; + } + + private: + std::default_random_engine mGenerator; + std::uniform_int_distribution<int> mDistribution; + }; + + const std::string mName; + const std::vector<State> mStates; + FakeStateResidency mFakeStateResidency; + std::vector<StateResidency> mResidencies; +}; + +} // namespace stats +} // namespace power +} // namespace hardware +} // namespace android +} // namespace aidl
\ No newline at end of file diff --git a/power/stats/aidl/default/PowerStats.cpp b/power/stats/aidl/default/PowerStats.cpp index 0ffbd083c6..13735026c5 100644 --- a/power/stats/aidl/default/PowerStats.cpp +++ b/power/stats/aidl/default/PowerStats.cpp @@ -18,46 +18,157 @@ #include <android-base/logging.h> +#include <numeric> + namespace aidl { namespace android { namespace hardware { namespace power { namespace stats { +void PowerStats::addStateResidencyDataProvider(std::unique_ptr<IStateResidencyDataProvider> p) { + if (!p) { + return; + } + + int32_t id = mPowerEntityInfos.size(); + + for (const auto& [entityName, states] : p->getInfo()) { + PowerEntity i = { + .id = id++, + .name = entityName, + .states = states, + }; + mPowerEntityInfos.emplace_back(i); + mStateResidencyDataProviders.emplace_back(std::move(p)); + } +} + +void PowerStats::addEnergyConsumer(std::unique_ptr<IEnergyConsumer> p) { + if (!p) { + return; + } + + EnergyConsumerType type = p->getType(); + std::string name = p->getName(); + int32_t count = count_if(mEnergyConsumerInfos.begin(), mEnergyConsumerInfos.end(), + [&type](const EnergyConsumer& c) { return type == c.type; }); + int32_t id = mEnergyConsumers.size(); + mEnergyConsumerInfos.emplace_back( + EnergyConsumer{.id = id, .ordinal = count, .type = type, .name = name}); + mEnergyConsumers.emplace_back(std::move(p)); +} + +void PowerStats::setEnergyMeter(std::unique_ptr<IEnergyMeter> p) { + mEnergyMeter = std::move(p); +} + ndk::ScopedAStatus PowerStats::getPowerEntityInfo(std::vector<PowerEntity>* _aidl_return) { - (void)_aidl_return; + *_aidl_return = mPowerEntityInfos; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus PowerStats::getStateResidency(const std::vector<int32_t>& in_powerEntityIds, std::vector<StateResidencyResult>* _aidl_return) { - (void)in_powerEntityIds; - (void)_aidl_return; - return ndk::ScopedAStatus::ok(); + if (mPowerEntityInfos.empty()) { + return ndk::ScopedAStatus::ok(); + } + + // If in_powerEntityIds is empty then return data for all supported entities + if (in_powerEntityIds.empty()) { + std::vector<int32_t> v(mPowerEntityInfos.size()); + std::iota(std::begin(v), std::end(v), 0); + return getStateResidency(v, _aidl_return); + } + + binder_status_t err = STATUS_OK; + + std::unordered_map<std::string, std::vector<StateResidency>> stateResidencies; + + for (const int32_t id : in_powerEntityIds) { + // skip any invalid ids + if (id < 0 || id >= mPowerEntityInfos.size()) { + continue; + } + + // Check to see if we already have data for the given id + std::string powerEntityName = mPowerEntityInfos[id].name; + if (stateResidencies.find(powerEntityName) == stateResidencies.end()) { + mStateResidencyDataProviders[id]->getStateResidencies(&stateResidencies); + } + + // Append results if we have them + auto stateResidency = stateResidencies.find(powerEntityName); + if (stateResidency != stateResidencies.end()) { + StateResidencyResult res = { + .id = id, + .stateResidencyData = stateResidency->second, + }; + _aidl_return->emplace_back(res); + } else { + // Failed to retrieve results for the given id. + err = STATUS_FAILED_TRANSACTION; + } + } + + return ndk::ScopedAStatus::fromStatus(err); } ndk::ScopedAStatus PowerStats::getEnergyConsumerInfo(std::vector<EnergyConsumer>* _aidl_return) { - (void)_aidl_return; + *_aidl_return = mEnergyConsumerInfos; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus PowerStats::getEnergyConsumed(const std::vector<int32_t>& in_energyConsumerIds, std::vector<EnergyConsumerResult>* _aidl_return) { - (void)in_energyConsumerIds; - (void)_aidl_return; - return ndk::ScopedAStatus::ok(); + if (mEnergyConsumers.empty()) { + return ndk::ScopedAStatus::ok(); + } + + // If in_powerEntityIds is empty then return data for all supported energy consumers + if (in_energyConsumerIds.empty()) { + std::vector<int32_t> v(mEnergyConsumerInfos.size()); + std::iota(std::begin(v), std::end(v), 0); + return getEnergyConsumed(v, _aidl_return); + } + + binder_status_t err = STATUS_OK; + + for (const auto id : in_energyConsumerIds) { + // skip any invalid ids + if (id < 0 || id >= mEnergyConsumers.size()) { + continue; + } + + auto optionalResult = mEnergyConsumers[id]->getEnergyConsumed(); + if (optionalResult) { + EnergyConsumerResult result = optionalResult.value(); + result.id = id; + _aidl_return->emplace_back(result); + } else { + // Failed to retrieve results for the given id. + err = STATUS_FAILED_TRANSACTION; + } + } + + return ndk::ScopedAStatus::fromStatus(err); } ndk::ScopedAStatus PowerStats::getEnergyMeterInfo(std::vector<Channel>* _aidl_return) { - (void)_aidl_return; - return ndk::ScopedAStatus::ok(); + if (!mEnergyMeter) { + return ndk::ScopedAStatus::ok(); + } + + return mEnergyMeter->getEnergyMeterInfo(_aidl_return); } ndk::ScopedAStatus PowerStats::readEnergyMeter(const std::vector<int32_t>& in_channelIds, std::vector<EnergyMeasurement>* _aidl_return) { - (void)in_channelIds; - (void)_aidl_return; - return ndk::ScopedAStatus::ok(); + if (!mEnergyMeter) { + return ndk::ScopedAStatus::ok(); + } + + return mEnergyMeter->readEnergyMeter(in_channelIds, _aidl_return); } } // namespace stats diff --git a/power/stats/aidl/default/PowerStats.h b/power/stats/aidl/default/PowerStats.h index cb98e553f3..f4c5e69569 100644 --- a/power/stats/aidl/default/PowerStats.h +++ b/power/stats/aidl/default/PowerStats.h @@ -18,6 +18,8 @@ #include <aidl/android/hardware/power/stats/BnPowerStats.h> +#include <unordered_map> + namespace aidl { namespace android { namespace hardware { @@ -26,7 +28,37 @@ namespace stats { class PowerStats : public BnPowerStats { public: + class IStateResidencyDataProvider { + public: + virtual ~IStateResidencyDataProvider() = default; + virtual bool getStateResidencies( + std::unordered_map<std::string, std::vector<StateResidency>>* residencies) = 0; + virtual std::unordered_map<std::string, std::vector<State>> getInfo() = 0; + }; + + class IEnergyConsumer { + public: + virtual ~IEnergyConsumer() = default; + virtual std::string getName() = 0; + virtual EnergyConsumerType getType() = 0; + virtual std::optional<EnergyConsumerResult> getEnergyConsumed() = 0; + }; + + class IEnergyMeter { + public: + virtual ~IEnergyMeter() = default; + virtual ndk::ScopedAStatus readEnergyMeter( + const std::vector<int32_t>& in_channelIds, + std::vector<EnergyMeasurement>* _aidl_return) = 0; + virtual ndk::ScopedAStatus getEnergyMeterInfo(std::vector<Channel>* _aidl_return) = 0; + }; + PowerStats() = default; + + void addStateResidencyDataProvider(std::unique_ptr<IStateResidencyDataProvider> p); + void addEnergyConsumer(std::unique_ptr<IEnergyConsumer> p); + void setEnergyMeter(std::unique_ptr<IEnergyMeter> p); + // Methods from aidl::android::hardware::power::stats::IPowerStats ndk::ScopedAStatus getPowerEntityInfo(std::vector<PowerEntity>* _aidl_return) override; ndk::ScopedAStatus getStateResidency(const std::vector<int32_t>& in_powerEntityIds, @@ -37,6 +69,15 @@ class PowerStats : public BnPowerStats { ndk::ScopedAStatus getEnergyMeterInfo(std::vector<Channel>* _aidl_return) override; ndk::ScopedAStatus readEnergyMeter(const std::vector<int32_t>& in_channelIds, std::vector<EnergyMeasurement>* _aidl_return) override; + + private: + std::vector<std::unique_ptr<IStateResidencyDataProvider>> mStateResidencyDataProviders; + std::vector<PowerEntity> mPowerEntityInfos; + + std::vector<std::unique_ptr<IEnergyConsumer>> mEnergyConsumers; + std::vector<EnergyConsumer> mEnergyConsumerInfos; + + std::unique_ptr<IEnergyMeter> mEnergyMeter; }; } // namespace stats diff --git a/power/stats/aidl/default/main.cpp b/power/stats/aidl/default/main.cpp index 0469b4c21d..2fe3d2e103 100644 --- a/power/stats/aidl/default/main.cpp +++ b/power/stats/aidl/default/main.cpp @@ -16,16 +16,61 @@ #include "PowerStats.h" +#include "FakeEnergyConsumer.h" +#include "FakeEnergyMeter.h" +#include "FakeStateResidencyDataProvider.h" + #include <android-base/logging.h> #include <android/binder_manager.h> #include <android/binder_process.h> +using aidl::android::hardware::power::stats::EnergyConsumerType; +using aidl::android::hardware::power::stats::FakeEnergyConsumer; +using aidl::android::hardware::power::stats::FakeEnergyMeter; +using aidl::android::hardware::power::stats::FakeStateResidencyDataProvider; using aidl::android::hardware::power::stats::PowerStats; +using aidl::android::hardware::power::stats::State; + +void setFakeEnergyMeter(std::shared_ptr<PowerStats> p) { + p->setEnergyMeter( + std::make_unique<FakeEnergyMeter>(std::vector<std::pair<std::string, std::string>>{ + {"Rail1", "Display"}, + {"Rail2", "CPU"}, + {"Rail3", "Modem"}, + })); +} + +void addFakeStateResidencyDataProvider1(std::shared_ptr<PowerStats> p) { + p->addStateResidencyDataProvider(std::make_unique<FakeStateResidencyDataProvider>( + "CPU", std::vector<State>{{0, "Idle"}, {1, "Active"}})); +} + +void addFakeStateResidencyDataProvider2(std::shared_ptr<PowerStats> p) { + p->addStateResidencyDataProvider(std::make_unique<FakeStateResidencyDataProvider>( + "Display", std::vector<State>{{0, "Off"}, {1, "On"}})); +} + +void addFakeEnergyConsumer1(std::shared_ptr<PowerStats> p) { + p->addEnergyConsumer(std::make_unique<FakeEnergyConsumer>(EnergyConsumerType::OTHER, "GPU")); +} + +void addFakeEnergyConsumer2(std::shared_ptr<PowerStats> p) { + p->addEnergyConsumer( + std::make_unique<FakeEnergyConsumer>(EnergyConsumerType::MOBILE_RADIO, "MODEM")); +} int main() { ABinderProcess_setThreadPoolMaxThreadCount(0); std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>(); + setFakeEnergyMeter(p); + + addFakeStateResidencyDataProvider1(p); + addFakeStateResidencyDataProvider2(p); + + addFakeEnergyConsumer1(p); + addFakeEnergyConsumer2(p); + const std::string instance = std::string() + PowerStats::descriptor + "/default"; binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str()); CHECK(status == STATUS_OK); diff --git a/power/stats/aidl/vts/Android.bp b/power/stats/aidl/vts/Android.bp index 31fb990905..b556548ece 100644 --- a/power/stats/aidl/vts/Android.bp +++ b/power/stats/aidl/vts/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalPowerStatsTargetTest", defaults: [ diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp index f3cc2e0ad4..cd64bca66a 100644 --- a/radio/1.0/Android.bp +++ b/radio/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.0", root: "android.hardware", diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal index 236dbf5bd6..66cd4f0008 100644 --- a/radio/1.0/IRadio.hal +++ b/radio/1.0/IRadio.hal @@ -385,7 +385,10 @@ interface IRadio { * Note this is for backward compatibility with the old radio modem. The modem * must not use this param for any other reason. * - * Response function is IRadioResponse.setupDataCallResponse() + * Response function is IRadioResponse.setupDataCallResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher, use @1.2::IRadio.setupDataCall_1_2() instead. */ oneway setupDataCall(int32_t serial, RadioTechnology radioTechnology, DataProfileInfo dataProfileInfo, bool modemCognitive, bool roamingAllowed, @@ -546,7 +549,10 @@ interface IRadio { * false => No specific reason specified * true => Radio shutdown requested * - * Response function is IRadioResponse.deactivateDataCallResponse() + * Response function is IRadioResponse.deactivateDataCallResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher, use @1.2::IRadio.deactivateDataCall_1_2() instead. */ oneway deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown); @@ -1456,7 +1462,10 @@ interface IRadio { * @param reportInterval desired reporting interval (ms). * @param pullMode LCE service mode. true: PULL; false: PUSH. * - * Response callback is IRadioResponse.startLceServiceResponse() + * Response callback is IRadioResponse.startLceServiceResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher which use the always-on LCE that relies on indications. */ oneway startLceService(int32_t serial, int32_t reportInterval, bool pullMode); @@ -1466,7 +1475,10 @@ interface IRadio { * * @param serial Serial number of request. * - * Response callback is IRadioResponse.stopLceServiceResponse() + * Response callback is IRadioResponse.stopLceServiceResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher which use the always-on LCE that relies on indications. */ oneway stopLceService(int32_t serial); @@ -1475,7 +1487,10 @@ interface IRadio { * * @param serial Serial number of request. * - * Response callback is IRadioResponse.pullLceDataResponse() + * Response callback is IRadioResponse.pullLceDataResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher which use the always-on LCE that relies on indications. */ oneway pullLceData(int32_t serial); @@ -1546,7 +1561,10 @@ interface IRadio { * @param indicationFilter 32-bit bitmap of IndicationFilter. Bits set to 1 indicate the * indications are enabled. See IndicationFilter for the definition of each bit. * - * Response callback is IRadioResponse.setIndicationFilterResponse() + * Response callback is IRadioResponse.setIndicationFilterResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher, use @1.2::IRadio.setIndicationFilter_1_2() instead. */ oneway setIndicationFilter(int32_t serial, bitfield<IndicationFilter> indicationFilter); @@ -1560,7 +1578,10 @@ interface IRadio { * @param serial Serial number of request * @param powerUp True if powering up the sim card * - * Response callback is IRadioResponse.setSimCardPowerResponse() + * Response callback is IRadioResponse.setSimCardPowerResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.1::IRadio or higher is supported. + * + * DEPRECATED in @1.1 or higher, use @1.1::IRadio.setSimCardPower_1_1() instead. */ oneway setSimCardPower(int32_t serial, bool powerUp); diff --git a/radio/1.0/IRadioIndication.hal b/radio/1.0/IRadioIndication.hal index eb07226ffc..eb6c8ef8ce 100644 --- a/radio/1.0/IRadioIndication.hal +++ b/radio/1.0/IRadioIndication.hal @@ -427,6 +427,9 @@ interface IRadioIndication { * * @param type Type of radio indication * @param lce LceData information + * + * DEPRECATED in @1.2 and above, use + * @1.2::IRadioIndication.currentLinkCapacityEstimate() instead. */ oneway lceData(RadioIndicationType type, LceDataInfo lce); diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal index c1b16b7b83..00cec9f0d1 100644 --- a/radio/1.0/IRadioResponse.hal +++ b/radio/1.0/IRadioResponse.hal @@ -590,10 +590,10 @@ interface IRadioResponse { * RadioError:NONE must be returned on both success and failure of setup with the * DataCallResponse.status containing the actual status * For all other errors the DataCallResponse is ignored. + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:RADIO_NOT_AVAILABLE * RadioError:OP_NOT_ALLOWED_BEFORE_REG_TO_NW * RadioError:OP_NOT_ALLOWED_DURING_VOICE_CALL - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY @@ -856,12 +856,12 @@ interface IRadioResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_CALL_ID * RadioError:INVALID_STATE * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:NO_RESOURCES @@ -2420,11 +2420,11 @@ interface IRadioResponse { * @param statusInfo LceStatusInfo indicating LCE status * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:LCE_NOT_SUPPORTED * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -2436,6 +2436,7 @@ interface IRadioResponse { * @param statusInfo LceStatusInfo indicating LCE status * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:LCE_NOT_SUPPORTED @@ -2443,7 +2444,6 @@ interface IRadioResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ oneway stopLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo); @@ -2453,6 +2453,7 @@ interface IRadioResponse { * @param lceInfo LceDataInfo indicating LCE data as defined in types.hal * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:LCE_NOT_SUPPORTED @@ -2460,7 +2461,6 @@ interface IRadioResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ oneway pullLceDataResponse(RadioResponseInfo info, LceDataInfo lceInfo); @@ -2534,13 +2534,13 @@ interface IRadioResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE * RadioError:INVALID_ARGUMENTS * RadioError:RADIO_NOT_AVAILABLE * RadioError:NO_MEMORY * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -2550,9 +2550,9 @@ interface IRadioResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.1 or higher is supported. * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp index 13fc5425ac..2c0e70a59a 100644 --- a/radio/1.0/vts/functional/Android.bp +++ b/radio/1.0/vts/functional/Android.bp @@ -14,49 +14,70 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], - srcs: ["radio_hidl_hal_cell_broadcast.cpp", - "radio_hidl_hal_data.cpp", - "radio_hidl_hal_icc.cpp", - "radio_hidl_hal_ims.cpp", - "radio_hidl_hal_misc.cpp", - "radio_hidl_hal_sms.cpp", - "radio_hidl_hal_stk.cpp", - "radio_hidl_hal_test.cpp", - "radio_hidl_hal_voice.cpp", - "radio_indication.cpp", - "radio_response.cpp", - "VtsHalRadioV1_0TargetTest.cpp", - "vts_test_util.cpp"], + srcs: [ + "radio_hidl_hal_cell_broadcast.cpp", + "radio_hidl_hal_data.cpp", + "radio_hidl_hal_icc.cpp", + "radio_hidl_hal_ims.cpp", + "radio_hidl_hal_misc.cpp", + "radio_hidl_hal_sms.cpp", + "radio_hidl_hal_stk.cpp", + "radio_hidl_hal_test.cpp", + "radio_hidl_hal_voice.cpp", + "radio_indication.cpp", + "radio_response.cpp", + "VtsHalRadioV1_0TargetTest.cpp", + "vts_test_util.cpp", + ], static_libs: [ "android.hardware.radio@1.0", + "android.hardware.radio@1.1", + "android.hardware.radio@1.2", ], test_config: "vts_hal_radio_target_test.xml", - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } cc_test { name: "VtsHalSapV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], - srcs: ["sap_callback.cpp", - "sap_hidl_hal_api.cpp", - "sap_hidl_hal_test.cpp", - "VtsHalSapV1_0TargetTest.cpp", - "vts_test_util.cpp"], + srcs: [ + "sap_callback.cpp", + "sap_hidl_hal_api.cpp", + "sap_hidl_hal_test.cpp", + "VtsHalSapV1_0TargetTest.cpp", + "vts_test_util.cpp", + ], static_libs: [ "android.hardware.radio@1.0", ], test_config: "vts_hal_sap_target_test.xml", - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } cc_library_static { name: "RadioVtsTestUtilBase", defaults: ["VtsHalTargetTestDefaults"], - srcs : [ - "vts_test_util.cpp" + srcs: [ + "vts_test_util.cpp", ], shared_libs: [ "android.hardware.radio@1.0", diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp index e3ee9d4ff3..655b869333 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp @@ -15,6 +15,7 @@ */ #include <android-base/logging.h> +#include <android/hardware/radio/1.2/IRadio.h> #include <radio_hidl_hal_utils_v1_0.h> using namespace ::android::hardware::radio::V1_0; @@ -139,6 +140,9 @@ TEST_P(RadioHidlTest, setupDataCall) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // setupDataCall is deprecated on radio::V1_2 with setupDataCall_1_2 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW, @@ -164,6 +168,9 @@ TEST_P(RadioHidlTest, deactivateDataCall) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // deactivateDataCall is deprecated on radio::V1_2 with deactiveDataCall_1_2 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp index 3f964732f6..624d00381f 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -15,6 +15,7 @@ */ #include <android-base/logging.h> +#include <android/hardware/radio/1.2/IRadio.h> #include <radio_hidl_hal_utils_v1_0.h> /* @@ -771,6 +772,9 @@ TEST_P(RadioHidlTest, startLceService) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // HAL 1.2 and later use the always-on LCE that relies on indications. + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp->rspInfo.error, @@ -792,6 +796,9 @@ TEST_P(RadioHidlTest, stopLceService) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // HAL 1.2 and later use the always-on LCE that relies on indications. + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::LCE_NOT_SUPPORTED, @@ -812,6 +819,9 @@ TEST_P(RadioHidlTest, pullLceData) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // HAL 1.2 and later use the always-on LCE that relies on indications. + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::INTERNAL_ERR, @@ -971,6 +981,9 @@ TEST_P(RadioHidlTest, setIndicationFilter) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // setIndicationFilter is deprecated on radio::V1_2 with setIndicationFilter_1_2 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl; if (cardStatus.cardState == CardState::ABSENT) { @@ -992,6 +1005,9 @@ TEST_P(RadioHidlTest, setSimCardPower) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type); EXPECT_EQ(serial, radioRsp->rspInfo.serial); + // setSimCardPower is deprecated on radio::V1_1 with setSimCardPower_1_1 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_1); + if (cardStatus.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h index 8a551f7c36..e3e9473055 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h +++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h @@ -38,6 +38,8 @@ using ::android::sp; #define TIMEOUT_PERIOD 75 #define RADIO_SERVICE_NAME "slot1" +#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(__ver__) \ + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, radio, radioRsp) class RadioHidlTest; extern CardStatus cardStatus; diff --git a/radio/1.0/vts/functional/vts_test_util.cpp b/radio/1.0/vts/functional/vts_test_util.cpp index 9a2d089899..fc372011ed 100644 --- a/radio/1.0/vts/functional/vts_test_util.cpp +++ b/radio/1.0/vts/functional/vts_test_util.cpp @@ -19,6 +19,8 @@ #include <iostream> #include "VtsCoreUtil.h" +#define WAIT_TIMEOUT_PERIOD 75 + int GetRandomSerialNumber() { return rand(); } @@ -99,4 +101,33 @@ bool isVoiceEmergencyOnly(RegState state) { ::android::hardware::radio::V1_0::RegState::NOT_REG_MT_SEARCHING_OP_EM == state || ::android::hardware::radio::V1_0::RegState::REG_DENIED_EM == state || ::android::hardware::radio::V1_0::RegState::UNKNOWN_EM == state; -}
\ No newline at end of file +} + +/* + * Notify that the response message is received. + */ +void RadioResponseWaiter::notify(int receivedSerial) { + std::unique_lock<std::mutex> lock(mtx_); + if (serial == receivedSerial) { + count_++; + cv_.notify_one(); + } +} + +/* + * Wait till the response message is notified or till WAIT_TIMEOUT_PERIOD. + */ +std::cv_status RadioResponseWaiter::wait() { + std::unique_lock<std::mutex> lock(mtx_); + + std::cv_status status = std::cv_status::no_timeout; + auto now = std::chrono::system_clock::now(); + while (count_ == 0) { + status = cv_.wait_until(lock, now + std::chrono::seconds(WAIT_TIMEOUT_PERIOD)); + if (status == std::cv_status::timeout) { + return status; + } + } + count_--; + return status; +} diff --git a/radio/1.0/vts/functional/vts_test_util.h b/radio/1.0/vts/functional/vts_test_util.h index 218e8236b0..eeb1d299ab 100644 --- a/radio/1.0/vts/functional/vts_test_util.h +++ b/radio/1.0/vts/functional/vts_test_util.h @@ -14,6 +14,8 @@ * limitations under the License. */ +#pragma once + #include <android-base/logging.h> #include <android/hardware/radio/1.0/types.h> @@ -25,6 +27,20 @@ using ::android::hardware::radio::V1_0::RegState; using ::android::hardware::radio::V1_0::SapResultCode; using namespace std; +/* + * MACRO used to skip test case when radio response return error REQUEST_NOT_SUPPORTED + * on HAL versions which has deprecated the request interfaces. The MACRO can only be used + * AFTER receiving radio response. + */ +#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, __radio__, __radioRsp__) \ + do { \ + sp<::android::hardware::radio::V##__ver__::IRadio> __radio = \ + ::android::hardware::radio::V##__ver__::IRadio::castFrom(__radio__); \ + if (__radio && __radioRsp__->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED) { \ + GTEST_SKIP() << "REQUEST_NOT_SUPPORTED"; \ + } \ + } while (0) + enum CheckFlag { CHECK_DEFAULT = 0, CHECK_GENERAL_ERROR = 1, @@ -81,4 +97,24 @@ bool isVoiceEmergencyOnly(RegState state); /* * Check if voice status is in service. */ -bool isVoiceInService(RegState state);
\ No newline at end of file +bool isVoiceInService(RegState state); + +/** + * Used when waiting for an asynchronous response from the HAL. + */ +class RadioResponseWaiter { + protected: + std::mutex mtx_; + std::condition_variable cv_; + int count_; + + public: + /* Serial number for radio request */ + int serial; + + /* Used as a mechanism to inform the test about data/event callback */ + void notify(int receivedSerial); + + /* Test code calls this function to wait for response */ + std::cv_status wait(); +}; diff --git a/radio/1.1/Android.bp b/radio/1.1/Android.bp index b325015824..abff05c382 100644 --- a/radio/1.1/Android.bp +++ b/radio/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.1", root: "android.hardware", diff --git a/radio/1.1/IRadio.hal b/radio/1.1/IRadio.hal index 22d27d4563..de2135ad74 100644 --- a/radio/1.1/IRadio.hal +++ b/radio/1.1/IRadio.hal @@ -77,7 +77,10 @@ interface IRadio extends @1.0::IRadio { * @param serial Serial number of request. * @param request Defines the radio networks/bands/channels which need to be scanned. * - * Response function is IRadioResponse.startNetworkScanResponse() + * Response function is IRadioResponse.startNetworkScanResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.2::IRadio or higher is supported. + * + * DEPRECATED in @1.2 or higher, use @1.2::IRadio.startNetworkScan_1_2() instead. */ oneway startNetworkScan(int32_t serial, NetworkScanRequest request); diff --git a/radio/1.1/IRadioResponse.hal b/radio/1.1/IRadioResponse.hal index 759602b004..7dc1bc6a7b 100644 --- a/radio/1.1/IRadioResponse.hal +++ b/radio/1.1/IRadioResponse.hal @@ -51,6 +51,7 @@ interface IRadioResponse extends @1.0::IRadioResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: + * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED @@ -59,7 +60,6 @@ interface IRadioResponse extends @1.0::IRadioResponse { * RadioError:NO_MEMORY * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED */ oneway startNetworkScanResponse(RadioResponseInfo info); diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp index e1278b926a..b3def8e1d3 100644 --- a/radio/1.1/vts/functional/Android.bp +++ b/radio/1.1/vts/functional/Android.bp @@ -14,21 +14,36 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], - srcs: ["radio_hidl_hal_api.cpp", - "radio_hidl_hal_test.cpp", - "radio_indication.cpp", - "radio_response.cpp", - "VtsHalRadioV1_1TargetTest.cpp"], + srcs: [ + "radio_hidl_hal_api.cpp", + "radio_hidl_hal_test.cpp", + "radio_indication.cpp", + "radio_response.cpp", + "VtsHalRadioV1_1TargetTest.cpp", + ], static_libs: [ "RadioVtsTestUtilBase", + "android.hardware.radio@1.2", "android.hardware.radio@1.1", "android.hardware.radio@1.0", ], header_libs: [ "radio.util.header@1.0", ], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp index 08121fde2b..389944bb2a 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.1/vts/functional/radio_hidl_hal_api.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <android/hardware/radio/1.2/IRadio.h> #include <radio_hidl_hal_utils_v1_1.h> #include <vector> @@ -107,6 +108,9 @@ TEST_P(RadioHidlTest_v1_1, startNetworkScan) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial); + // startNetworkScan is deprecated on radio::V1_2 with startNetworkScan_1_2 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ALOGI("startNetworkScan, rspInfo.error = %d\n", (int32_t)radioRsp_v1_1->rspInfo.error); ASSERT_TRUE(CheckAnyOfErrors( @@ -131,6 +135,9 @@ TEST_P(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial); + // startNetworkScan is deprecated on radio::V1_2 with startNetworkScan_1_2 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_2); + if (cardStatus.cardState == CardState::ABSENT) { ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %d\n", (int32_t)radioRsp_v1_1->rspInfo.error); diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h index b81ee13127..bafde77e06 100644 --- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h +++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h @@ -40,6 +40,8 @@ using ::android::sp; #define TIMEOUT_PERIOD 75 #define RADIO_SERVICE_NAME "slot1" +#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(__ver__) \ + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, radio_v1_1, radioRsp_v1_1) class RadioHidlTest_v1_1; extern CardStatus cardStatus; diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp index 0a4caf11f5..924c77a9a6 100644 --- a/radio/1.2/Android.bp +++ b/radio/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.2", root: "android.hardware", diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal index 87b0add5da..6d48ca0a45 100644 --- a/radio/1.2/IRadio.hal +++ b/radio/1.2/IRadio.hal @@ -37,7 +37,10 @@ interface IRadio extends @1.1::IRadio { * @param serial Serial number of request. * @param request Defines the radio networks/bands/channels which need to be scanned. * - * Response function is IRadioResponse.startNetworkScanResponse() + * Response function is IRadioResponse.startNetworkScanResponse() which may return + * RadioError:REQUEST_NOT_SUPPORTED if @1.4::IRadio or higher is supported. + * + * DEPRECATED in @1.4 or higher, use @1.4::IRadio.startNetworkScan_1_4() instead. */ oneway startNetworkScan_1_2(int32_t serial, NetworkScanRequest request); diff --git a/radio/1.2/default/Android.bp b/radio/1.2/default/Android.bp index 74fcf11170..7b3dd1f8b3 100644 --- a/radio/1.2/default/Android.bp +++ b/radio/1.2/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.radio@1.2-radio-service", init_rc: ["android.hardware.radio@1.2-radio-service.rc"], diff --git a/radio/1.2/vts/functional/Android.bp b/radio/1.2/vts/functional/Android.bp index 56f2d5fb49..a62000f6ef 100644 --- a/radio/1.2/vts/functional/Android.bp +++ b/radio/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -27,6 +36,8 @@ cc_test { ], static_libs: [ "RadioVtsTestUtilBase", + "android.hardware.radio@1.4", + "android.hardware.radio@1.3", "android.hardware.radio@1.2", "android.hardware.radio@1.1", "android.hardware.radio@1.0", @@ -34,5 +45,8 @@ cc_test { "android.hardware.radio.config@1.1", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index acb1b0ef6d..2400bde9ae 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <android/hardware/radio/1.4/IRadio.h> #include <radio_hidl_hal_utils_v1_2.h> #include <vector> @@ -57,6 +58,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_2->rspInfo.error, {RadioError::SIM_ABSENT})); @@ -94,6 +98,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidArgument) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -126,6 +133,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidInterval1, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -158,6 +168,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidInterval2, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -190,6 +203,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime1) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidMaxSearchTime1, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -222,6 +238,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidMaxSearchTime2) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidMaxSearchTime2, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -254,6 +273,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity1) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidPeriodicity1, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -286,6 +308,9 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidPeriodicity2) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidPeriodicity2, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -322,6 +347,9 @@ TEST_P(RadioHidlTest_v1_2, DISABLED_startNetworkScan_GoodRequest1) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { @@ -359,6 +387,9 @@ TEST_P(RadioHidlTest_v1_2, DISABLED_startNetworkScan_GoodRequest2) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_2->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_2->rspInfo.serial); + // startNetworkScan_1_2 is deprecated in radio::V1_4 with startNetworkScan_1_4 + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(1_4); + ALOGI("startNetworkScan_InvalidArgument, rspInfo.error = %s\n", toString(radioRsp_v1_2->rspInfo.error).c_str()); if (cardStatus.base.cardState == CardState::ABSENT) { diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h index 479340cd88..81286d2930 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h +++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h @@ -50,6 +50,8 @@ using ::android::hardware::radio::V1_0::RadioResponseType; #define TIMEOUT_PERIOD 75 #define RADIO_SERVICE_NAME "slot1" +#define SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL_VERSION_AT_LEAST(__ver__) \ + SKIP_TEST_IF_REQUEST_NOT_SUPPORTED_WITH_HAL(__ver__, radio_v1_2, radioRsp_v1_2) class RadioHidlTest_v1_2; extern ::android::hardware::radio::V1_2::CardStatus cardStatus; @@ -682,4 +684,4 @@ class RadioHidlTest_v1_2 : public ::testing::TestWithParam<std::string> { /* radio config service handle */ sp<IRadioConfig> radioConfig; -};
\ No newline at end of file +}; diff --git a/radio/1.3/Android.bp b/radio/1.3/Android.bp index 1c8e6c2242..8d24b2b683 100644 --- a/radio/1.3/Android.bp +++ b/radio/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.3", root: "android.hardware", diff --git a/radio/1.3/vts/functional/Android.bp b/radio/1.3/vts/functional/Android.bp index e32258f5d3..d96d39114d 100644 --- a/radio/1.3/vts/functional/Android.bp +++ b/radio/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -32,5 +41,8 @@ cc_test { "android.hardware.radio@1.0", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp index 6c3a7d2563..385f2d324d 100644 --- a/radio/1.4/Android.bp +++ b/radio/1.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.4", root: "android.hardware", diff --git a/radio/1.4/vts/functional/Android.bp b/radio/1.4/vts/functional/Android.bp index 369b55b7a2..167dec8522 100644 --- a/radio/1.4/vts/functional/Android.bp +++ b/radio/1.4/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_4TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -35,5 +44,8 @@ cc_test { "android.hardware.radio.config@1.1", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"] + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/1.5/Android.bp b/radio/1.5/Android.bp index 74de0fddd2..a36f296c2b 100644 --- a/radio/1.5/Android.bp +++ b/radio/1.5/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.5", root: "android.hardware", diff --git a/radio/1.5/vts/functional/Android.bp b/radio/1.5/vts/functional/Android.bp index cd54d274fd..4549d3c2b2 100644 --- a/radio/1.5/vts/functional/Android.bp +++ b/radio/1.5/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_5TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -36,5 +45,8 @@ cc_test { "android.hardware.radio.config@1.1", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"] + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/1.6/Android.bp b/radio/1.6/Android.bp index fc3191f630..4b79c0a43e 100644 --- a/radio/1.6/Android.bp +++ b/radio/1.6/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio@1.6", root: "android.hardware", diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal index 714be47571..d20133235e 100644 --- a/radio/1.6/IRadio.hal +++ b/radio/1.6/IRadio.hal @@ -103,6 +103,12 @@ interface IRadio extends @1.5::IRadio { * - Support simultaneous data call contexts up to DataRegStateResult.maxDataCalls specified * in the response of getDataRegistrationState. * + * The differences relative to the 1.5 version of the API are: + * - The addition of new parameters pduSessionId, sliceInfo, trafficDescriptor, and + * matchAllRuleAllowed. + * - If an existing data call should be used for the request, that must be indicated in the + * response by setting SetupDataCallResult::cid to the context id of that call. + * * @param serial Serial number of request. * @param accessNetwork The access network to setup the data call. If the data connection cannot * be established on the specified access network then it should be responded with an error. @@ -122,7 +128,8 @@ interface IRadio extends @1.5::IRadio { * Reference: 3GPP TS 24.007 section 11.2.3.1b * @param sliceInfo SliceInfo to be used for the data connection when a handover occurs from * EPDG to 5G. It is valid only when accessNetwork is AccessNetwork:NGRAN. If the slice - * passed from EPDG is rejected, then the data failure cause must be DataCallFailCause:SLICE_REJECTED. + * passed from EPDG is rejected, then the data failure cause must be + * DataCallFailCause:SLICE_REJECTED. * @param trafficDescriptor TrafficDescriptor for which data connection needs to be * established. It is used for URSP traffic matching as described in TS 24.526 * Section 4.2.2. It includes an optional DNN which, if present, must be used for traffic diff --git a/radio/1.6/types.hal b/radio/1.6/types.hal index 5d363c95a0..6400c63b11 100644 --- a/radio/1.6/types.hal +++ b/radio/1.6/types.hal @@ -274,7 +274,8 @@ enum HandoverFailureMode : int32_t { /** * Overwritten from @1.5::SetupDataCallResult in order to change the suggestedRetryTime * to 64-bit value. In the future, this must be extended instead of overwritten. - * Also added defaultQos, qosSessions, and handoverFailureMode in this version. + * Also added defaultQos, qosSessions, handoverFailureMode, pduSessionId, sliceInfo, + * and traffic descriptors in this version. */ struct SetupDataCallResult { /** Data call fail cause. DataCallFailCause.NONE if no error. */ @@ -706,8 +707,10 @@ struct RegStateResult { RegState regState; /** - * Indicates the available voice radio technology, valid values as - * defined by RadioTechnology. + * Indicates the available voice radio technology, valid values as defined by RadioTechnology, + * except LTE_CA, which is no longer a valid value on 1.5 or above. When the device is on + * carrier aggregation, vendor RIL service should properly report multiple PhysicalChannelConfig + * elements through IRadio::currentPhysicalChannelConfigs_1_6. */ RadioTechnology rat; @@ -847,7 +850,7 @@ enum DataCallFailCause : @1.4::DataCallFailCause { MATCH_ALL_RULE_NOT_ALLOWED = 0x8CD, /** - * If connection failed for all matching URSP rules + * If connection failed for all matching URSP rules. */ ALL_MATCHING_RULES_FAILED = 0x8CE, }; @@ -923,17 +926,17 @@ enum NgranBands : @1.5::NgranBands { * This safe_union represents an optional DNN. DNN stands for Data Network Name * and represents an APN as defined in 3GPP TS 23.003. */ -safe_union OptionalDNN { +safe_union OptionalDnn { Monostate noinit; string value; }; /** - * This safe_union represents an optional OSAppId. + * This safe_union represents an optional OsAppId. */ -safe_union OptionalOSAppId { +safe_union OptionalOsAppId { Monostate noinit; - OSAppId value; + OsAppId value; }; /** @@ -954,21 +957,21 @@ struct TrafficDescriptor { * DNN stands for Data Network Name and represents an APN as defined in * 3GPP TS 23.003. */ - OptionalDNN dnn; + OptionalDnn dnn; /** - * Indicates the OSId + OSAppId (used as category in Android). + * Indicates the OsId + OsAppId (used as category in Android). */ - OptionalOSAppId osAppId; + OptionalOsAppId osAppId; }; /** - * This struct represents the OSId + OSAppId as defined in TS 24.526 Section 5.2 + * This struct represents the OsId + OsAppId as defined in TS 24.526 Section 5.2 */ -struct OSAppId { +struct OsAppId { /** - * Byte array representing OSId + OSAppId. The minimum length of the array is - * 18 and maximum length is 272 (16 bytes for OSId + 1 byte for OSAppId length - * + up to 255 bytes for OSAppId). + * Byte array representing OsId + OsAppId. The minimum length of the array is + * 18 and maximum length is 272 (16 bytes for OsId + 1 byte for OsAppId length + * + up to 255 bytes for OsAppId). */ vec<uint8_t> osAppId; }; @@ -985,7 +988,7 @@ struct SlicingConfig { /** * Struct containing all NSSAIs (list of slice info). */ - Nssais nsaids; + Nssais nssais; }; /** diff --git a/radio/1.6/vts/functional/Android.bp b/radio/1.6/vts/functional/Android.bp index db90f88618..65b0dd03ba 100644 --- a/radio/1.6/vts/functional/Android.bp +++ b/radio/1.6/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioV1_6TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -27,6 +36,7 @@ cc_test { ], static_libs: [ "RadioVtsTestUtilBase", + "RadioConfigVtsTestResponse", "android.hardware.radio@1.6", "android.hardware.radio@1.5", "android.hardware.radio@1.4", @@ -36,8 +46,13 @@ cc_test { "android.hardware.radio@1.0", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", + "android.hardware.radio.config@1.2", + "android.hardware.radio.config@1.3", + ], + header_libs: [ + "radio.util.header@1.0", + "radio.config.util.header@1.3", ], - header_libs: ["radio.util.header@1.0"], test_suites: [ "general-tests", "vts", diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp index fb50990a28..e82c01a049 100644 --- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp @@ -130,7 +130,7 @@ TEST_P(RadioHidlTest_v1_6, setupDataCall_1_6_osAppId) { memset(&optionalTrafficDescriptor, 0, sizeof(optionalTrafficDescriptor)); ::android::hardware::radio::V1_6::TrafficDescriptor trafficDescriptor; - ::android::hardware::radio::V1_6::OSAppId osAppId; + ::android::hardware::radio::V1_6::OsAppId osAppId; osAppId.osAppId = 1; trafficDescriptor.osAppId.value(osAppId); optionalTrafficDescriptor.value(trafficDescriptor); diff --git a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp index 59f768201d..6255f66f69 100644 --- a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp +++ b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp @@ -45,35 +45,6 @@ void RadioHidlTest_v1_6::SetUp() { EXPECT_EQ(CardState::PRESENT, cardStatus.base.base.base.cardState); } -/* - * Notify that the response message is received. - */ -void RadioHidlTest_v1_6::notify(int receivedSerial) { - std::unique_lock<std::mutex> lock(mtx_); - if (serial == receivedSerial) { - count_++; - cv_.notify_one(); - } -} - -/* - * Wait till the response message is notified or till TIMEOUT_PERIOD. - */ -std::cv_status RadioHidlTest_v1_6::wait() { - std::unique_lock<std::mutex> lock(mtx_); - - std::cv_status status = std::cv_status::no_timeout; - auto now = std::chrono::system_clock::now(); - while (count_ == 0) { - status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); - if (status == std::cv_status::timeout) { - return status; - } - } - count_--; - return status; -} - void RadioHidlTest_v1_6::clearPotentialEstablishedCalls() { // Get the current call Id to hangup the established emergency call. serial = GetRandomSerialNumber(); @@ -108,3 +79,31 @@ void RadioHidlTest_v1_6::getDataCallList() { radio_v1_6->getDataCallList_1_6(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); } + +/** + * Specific features on the Radio Hal rely on Radio Hal Capabilities. The VTS + * tests related to that features must not run if the related capability is + * disabled. + * <p/> + * Typical usage within VTS: + * if (getRadioHalCapabilities().modemReducedFeatureSet) return; + */ +HalDeviceCapabilities RadioHidlTest_v1_6::getRadioHalCapabilities() { + sp<::android::hardware::radio::config::V1_3::IRadioConfig> radioConfig_v1_3 = + ::android::hardware::radio::config::V1_3::IRadioConfig::getService(); + if (radioConfig_v1_3.get() == nullptr) { + // If v1_3 isn't present, the values are initialized to false + HalDeviceCapabilities radioHalCapabilities; + memset(&radioHalCapabilities, 0, sizeof(radioHalCapabilities)); + return radioHalCapabilities; + } else { + // Get radioHalDeviceCapabilities from the radio config + sp<RadioConfigResponse> radioConfigRsp = new (std::nothrow) RadioConfigResponse(*this); + radioConfig_v1_3->setResponseFunctions(radioConfigRsp, nullptr); + serial = GetRandomSerialNumber(); + + radioConfig_v1_3->getHalDeviceCapabilities(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + return radioConfigRsp->halDeviceCapabilities; + } +} diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h index f610f2af76..23378b53d0 100644 --- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h +++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h @@ -18,16 +18,12 @@ #include <android-base/logging.h> -#include <gtest/gtest.h> -#include <hidl/GtestPrinter.h> -#include <hidl/ServiceManagement.h> -#include <utils/Log.h> +#include "radio_config_hidl_hal_utils.h" + #include <chrono> #include <condition_variable> #include <mutex> -#include <android/hardware/radio/config/1.1/IRadioConfig.h> - #include <android/hardware/radio/1.6/IRadio.h> #include <android/hardware/radio/1.6/IRadioIndication.h> #include <android/hardware/radio/1.6/IRadioResponse.h> @@ -42,14 +38,15 @@ using namespace ::android::hardware::radio::V1_3; using namespace ::android::hardware::radio::V1_2; using namespace ::android::hardware::radio::V1_1; using namespace ::android::hardware::radio::V1_0; +using namespace ::android::hardware::radio::config::V1_3; using ::android::sp; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; +using ::android::hardware::radio::config::V1_3::HalDeviceCapabilities; -#define TIMEOUT_PERIOD 75 #define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 #define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 @@ -61,7 +58,7 @@ extern ::android::hardware::radio::V1_5::CardStatus cardStatus; /* Callback class for radio response v1_6 */ class RadioResponse_v1_6 : public ::android::hardware::radio::V1_6::IRadioResponse { protected: - RadioHidlTest_v1_6& parent_v1_6; + RadioResponseWaiter& parent_v1_6; public: hidl_vec<RadioBandMode> radioBandModes; @@ -105,7 +102,7 @@ class RadioResponse_v1_6 : public ::android::hardware::radio::V1_6::IRadioRespon ::android::hardware::radio::V1_5::CellIdentity barringCellIdentity; ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::BarringInfo> barringInfos; - RadioResponse_v1_6(RadioHidlTest_v1_6& parent_v1_6); + RadioResponse_v1_6(RadioResponseWaiter& parent_v1_6); virtual ~RadioResponse_v1_6() = default; Return<void> getIccCardStatusResponse( @@ -1079,15 +1076,9 @@ class RadioIndication_v1_6 : public ::android::hardware::radio::V1_6::IRadioIndi }; // The main test class for Radio HIDL. -class RadioHidlTest_v1_6 : public ::testing::TestWithParam<std::string> { +class RadioHidlTest_v1_6 : public ::testing::TestWithParam<std::string>, + public RadioResponseWaiter { protected: - std::mutex mtx_; - std::condition_variable cv_; - int count_; - - /* Serial number for radio request */ - int serial; - /* Clear Potential Established Calls */ void clearPotentialEstablishedCalls(); @@ -1100,11 +1091,7 @@ class RadioHidlTest_v1_6 : public ::testing::TestWithParam<std::string> { public: virtual void SetUp() override; - /* Used as a mechanism to inform the test about data/event callback */ - void notify(int receivedSerial); - - /* Test code calls this function to wait for response */ - std::cv_status wait(); + HalDeviceCapabilities getRadioHalCapabilities(); /* radio service handle */ sp<::android::hardware::radio::V1_6::IRadio> radio_v1_6; diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp index 027e9acd74..8034fd2437 100644 --- a/radio/1.6/vts/functional/radio_response.cpp +++ b/radio/1.6/vts/functional/radio_response.cpp @@ -18,7 +18,7 @@ ::android::hardware::radio::V1_5::CardStatus cardStatus; -RadioResponse_v1_6::RadioResponse_v1_6(RadioHidlTest_v1_6& parent) : parent_v1_6(parent) {} +RadioResponse_v1_6::RadioResponse_v1_6(RadioResponseWaiter& parent) : parent_v1_6(parent) {} /* 1.0 Apis */ Return<void> RadioResponse_v1_6::getIccCardStatusResponse( @@ -1059,6 +1059,7 @@ Return<void> RadioResponse_v1_6::setupDataCallResponse_1_6( parent_v1_6.notify(info.serial); return Void(); } + Return<void> RadioResponse_v1_6::setNrDualConnectivityStateResponse( const ::android::hardware::radio::V1_6::RadioResponseInfo& info) { rspInfo = info; diff --git a/radio/config/1.0/Android.bp b/radio/config/1.0/Android.bp index eea4c34b90..9e317b378e 100644 --- a/radio/config/1.0/Android.bp +++ b/radio/config/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio.config@1.0", root: "android.hardware", diff --git a/radio/config/1.0/default/Android.bp b/radio/config/1.0/default/Android.bp index a0f4214fa8..e221ceb9fc 100644 --- a/radio/config/1.0/default/Android.bp +++ b/radio/config/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.radio.config@1.0-service", init_rc: ["android.hardware.radio.config@1.0-service.rc"], diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp index 330209eed0..36aecff13c 100644 --- a/radio/config/1.0/vts/functional/Android.bp +++ b/radio/config/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioConfigV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -29,5 +38,8 @@ cc_test { "android.hardware.radio.config@1.0", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp index 69d9a836fc..b1705f98ec 100644 --- a/radio/config/1.1/Android.bp +++ b/radio/config/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio.config@1.1", root: "android.hardware", diff --git a/radio/config/1.1/vts/functional/Android.bp b/radio/config/1.1/vts/functional/Android.bp index f60331d1c3..9037b793a7 100644 --- a/radio/config/1.1/vts/functional/Android.bp +++ b/radio/config/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioConfigV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -29,5 +38,8 @@ cc_test { "android.hardware.radio.config@1.1", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/config/1.2/Android.bp b/radio/config/1.2/Android.bp index f751868af3..3327af4d86 100644 --- a/radio/config/1.2/Android.bp +++ b/radio/config/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio.config@1.2", root: "android.hardware", diff --git a/radio/config/1.2/vts/functional/Android.bp b/radio/config/1.2/vts/functional/Android.bp index fdc83b73fc..1a15d3f5fa 100644 --- a/radio/config/1.2/vts/functional/Android.bp +++ b/radio/config/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioConfigV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -31,5 +40,8 @@ cc_test { "android.hardware.radio.config@1.2", ], header_libs: ["radio.util.header@1.0"], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/radio/config/1.3/Android.bp b/radio/config/1.3/Android.bp index ace0de96f9..cc5944df44 100644 --- a/radio/config/1.3/Android.bp +++ b/radio/config/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio.config@1.3", root: "android.hardware", diff --git a/radio/config/1.3/types.hal b/radio/config/1.3/types.hal index ba964bfda9..8915970d67 100644 --- a/radio/config/1.3/types.hal +++ b/radio/config/1.3/types.hal @@ -21,8 +21,14 @@ package android.hardware.radio.config@1.3; */ struct HalDeviceCapabilities { /** - * True indicates that the modem is missing features within the current - * version of the Radio HAL. + * True indicates that the modem does NOT support the following features: + * <ul> + * <li>Providing either + * android.hardware.radio@1.6::LinkCapacityEstimate:secondaryDownlinkCapacityKbps + * or android.hardware.radio@1.6::LinkCapacityEstimate:secondaryUplinkCapacityKbps + * when given from android.hardware.radio@1.6::RadioIndication:currentLinkCapacityEstimate + * </li> + * </ul> */ bool modemReducedFeatureSet1; }; diff --git a/radio/config/1.3/vts/functional/Android.bp b/radio/config/1.3/vts/functional/Android.bp index abd081f9df..20c480ff3d 100644 --- a/radio/config/1.3/vts/functional/Android.bp +++ b/radio/config/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRadioConfigV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -37,3 +46,26 @@ cc_test { "vts", ], } + +cc_library_static { + name: "RadioConfigVtsTestResponse", + defaults: ["VtsHalTargetTestDefaults"], + srcs : [ + "radio_config_response.cpp", + "radio_config_hidl_hal_test.cpp", + ], + header_libs: ["radio.util.header@1.0"], + static_libs: ["RadioVtsTestUtilBase"], + shared_libs: [ + "android.hardware.radio@1.0", + "android.hardware.radio.config@1.0", + "android.hardware.radio.config@1.1", + "android.hardware.radio.config@1.2", + "android.hardware.radio.config@1.3", + ], +} + +cc_library_headers { + name: "radio.config.util.header@1.3", + export_include_dirs: ["."], +} diff --git a/radio/config/1.3/vts/functional/radio_config_hidl_hal_test.cpp b/radio/config/1.3/vts/functional/radio_config_hidl_hal_test.cpp index de8365aee8..da614645f5 100644 --- a/radio/config/1.3/vts/functional/radio_config_hidl_hal_test.cpp +++ b/radio/config/1.3/vts/functional/radio_config_hidl_hal_test.cpp @@ -31,32 +31,3 @@ void RadioConfigHidlTest::SetUp() { radioConfig->setResponseFunctions(radioConfigRsp, nullptr); } - -/* - * Notify that the response message is received. - */ -void RadioConfigHidlTest::notify(int receivedSerial) { - std::unique_lock<std::mutex> lock(mtx_); - if (serial == receivedSerial) { - count_++; - cv_.notify_one(); - } -} - -/* - * Wait till the response message is notified or till TIMEOUT_PERIOD. - */ -std::cv_status RadioConfigHidlTest::wait() { - std::unique_lock<std::mutex> lock(mtx_); - - std::cv_status status = std::cv_status::no_timeout; - auto now = std::chrono::system_clock::now(); - while (count_ == 0) { - status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); - if (status == std::cv_status::timeout) { - return status; - } - } - count_--; - return status; -} diff --git a/radio/config/1.3/vts/functional/radio_config_hidl_hal_utils.h b/radio/config/1.3/vts/functional/radio_config_hidl_hal_utils.h index 439eb705b6..895ae08c23 100644 --- a/radio/config/1.3/vts/functional/radio_config_hidl_hal_utils.h +++ b/radio/config/1.3/vts/functional/radio_config_hidl_hal_utils.h @@ -14,6 +14,8 @@ * limitations under the License. */ +#pragma once + #include <android-base/logging.h> #include <chrono> @@ -49,7 +51,6 @@ using ::android::hardware::radio::config::V1_3::HalDeviceCapabilities; using ::android::hardware::radio::config::V1_3::IRadioConfig; using ::android::hardware::radio::V1_0::RadioResponseInfo; -#define TIMEOUT_PERIOD 75 #define RADIO_SERVICE_NAME "slot1" class RadioConfigHidlTest; @@ -57,13 +58,14 @@ class RadioConfigHidlTest; /* Callback class for radio config response */ class RadioConfigResponse : public IRadioConfigResponse { protected: - RadioConfigHidlTest& parent; + RadioResponseWaiter& parent; public: RadioResponseInfo rspInfo; PhoneCapability phoneCap; + HalDeviceCapabilities halDeviceCapabilities; - RadioConfigResponse(RadioConfigHidlTest& parent); + RadioConfigResponse(RadioResponseWaiter& parent); virtual ~RadioConfigResponse() = default; Return<void> getSimSlotsStatusResponse( @@ -107,26 +109,13 @@ class RadioConfigIndication : public IRadioConfigIndication { }; // The main test class for Radio config HIDL. -class RadioConfigHidlTest : public ::testing::TestWithParam<std::string> { - protected: - std::mutex mtx_; - std::condition_variable cv_; - int count_; - +class RadioConfigHidlTest : public ::testing::TestWithParam<std::string>, + public RadioResponseWaiter { public: virtual void SetUp() override; - /* Used as a mechanism to inform the test about data/event callback */ - void notify(int receivedSerial); - - /* Test code calls this function to wait for response */ - std::cv_status wait(); - void updateSimCardStatus(); - /* Serial number for radio request */ - int serial; - /* radio config service handle */ sp<IRadioConfig> radioConfig; diff --git a/radio/config/1.3/vts/functional/radio_config_response.cpp b/radio/config/1.3/vts/functional/radio_config_response.cpp index 2a8b28ba7c..11e3cce147 100644 --- a/radio/config/1.3/vts/functional/radio_config_response.cpp +++ b/radio/config/1.3/vts/functional/radio_config_response.cpp @@ -18,7 +18,7 @@ // SimSlotStatus slotStatus; -RadioConfigResponse::RadioConfigResponse(RadioConfigHidlTest& parent) : parent(parent) {} +RadioConfigResponse::RadioConfigResponse(RadioResponseWaiter& parent) : parent(parent) {} Return<void> RadioConfigResponse::getSimSlotsStatusResponse( const ::android::hardware::radio::V1_0::RadioResponseInfo& /* info */, @@ -65,6 +65,7 @@ Return<void> RadioConfigResponse::setModemsConfigResponse( Return<void> RadioConfigResponse::getHalDeviceCapabilitiesResponse( const ::android::hardware::radio::V1_6::RadioResponseInfo& /* info */, - const ::android::hardware::radio::config::V1_3::HalDeviceCapabilities& /* capabilities */) { + const ::android::hardware::radio::config::V1_3::HalDeviceCapabilities& capabilities) { + halDeviceCapabilities = capabilities; return Void(); -}
\ No newline at end of file +} diff --git a/radio/deprecated/1.0/Android.bp b/radio/deprecated/1.0/Android.bp index 1a7cb940ae..53f6da51b9 100644 --- a/radio/deprecated/1.0/Android.bp +++ b/radio/deprecated/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.radio.deprecated@1.0", root: "android.hardware", diff --git a/rebootescrow/aidl/Android.bp b/rebootescrow/aidl/Android.bp index 75faa1a65b..c764f86e9f 100644 --- a/rebootescrow/aidl/Android.bp +++ b/rebootescrow/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.rebootescrow", vendor_available: true, diff --git a/rebootescrow/aidl/default/Android.bp b/rebootescrow/aidl/default/Android.bp index e6a4e7ab4f..b9fb2a9665 100644 --- a/rebootescrow/aidl/default/Android.bp +++ b/rebootescrow/aidl/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "librebootescrowdefaultimpl", vendor: true, diff --git a/rebootescrow/aidl/vts/functional/Android.bp b/rebootescrow/aidl/vts/functional/Android.bp index abd4937f62..76b678467e 100644 --- a/rebootescrow/aidl/vts/functional/Android.bp +++ b/rebootescrow/aidl/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRebootEscrowTargetTest", defaults: [ diff --git a/renderscript/1.0/Android.bp b/renderscript/1.0/Android.bp index d3b5abed9a..1f2ac15f8f 100644 --- a/renderscript/1.0/Android.bp +++ b/renderscript/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.renderscript@1.0", root: "android.hardware", diff --git a/renderscript/1.0/default/Android.bp b/renderscript/1.0/default/Android.bp index 4fa85c63bf..c68e370a1e 100644 --- a/renderscript/1.0/default/Android.bp +++ b/renderscript/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.renderscript@1.0-impl", defaults: ["hidl_defaults"], diff --git a/renderscript/1.0/vts/functional/Android.bp b/renderscript/1.0/vts/functional/Android.bp index 327c09edb5..4b665b11f2 100644 --- a/renderscript/1.0/vts/functional/Android.bp +++ b/renderscript/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalRenderscriptV1_0TargetTest", srcs: [ diff --git a/secure_element/1.0/Android.bp b/secure_element/1.0/Android.bp index a32b9d1401..520d3a37df 100644 --- a/secure_element/1.0/Android.bp +++ b/secure_element/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.secure_element@1.0", root: "android.hardware", diff --git a/secure_element/1.0/vts/functional/Android.bp b/secure_element/1.0/vts/functional/Android.bp index d428c6f771..735d7c9ac5 100644 --- a/secure_element/1.0/vts/functional/Android.bp +++ b/secure_element/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSecureElementV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/secure_element/1.1/Android.bp b/secure_element/1.1/Android.bp index 08e6c8855e..3874fda5ac 100644 --- a/secure_element/1.1/Android.bp +++ b/secure_element/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.secure_element@1.1", root: "android.hardware", diff --git a/secure_element/1.1/vts/functional/Android.bp b/secure_element/1.1/vts/functional/Android.bp index 200aed829d..d63e7c469d 100644 --- a/secure_element/1.1/vts/functional/Android.bp +++ b/secure_element/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSecureElementV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/secure_element/1.2/Android.bp b/secure_element/1.2/Android.bp index 03df5f9d68..6de92dfa47 100644 --- a/secure_element/1.2/Android.bp +++ b/secure_element/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.secure_element@1.2", root: "android.hardware", diff --git a/secure_element/1.2/vts/functional/Android.bp b/secure_element/1.2/vts/functional/Android.bp index 9a7ca45b54..63a0a198fe 100644 --- a/secure_element/1.2/vts/functional/Android.bp +++ b/secure_element/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSecureElementV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp index 5652827a92..54cb4b8ebb 100644 --- a/security/keymint/aidl/Android.bp +++ b/security/keymint/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.security.keymint", vendor_available: true, diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl index 3faba48abd..2eb6e35d1a 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ErrorCode.aidl @@ -115,6 +115,7 @@ enum ErrorCode { MISSING_NOT_AFTER = -81, MISSING_ISSUER_SUBJECT = -82, INVALID_ISSUER_SUBJECT = -83, + BOOT_LEVEL_EXCEEDED = -84, UNIMPLEMENTED = -100, VERSION_MISMATCH = -101, UNKNOWN_ERROR = -1000, diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/HardwareAuthToken.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/HardwareAuthToken.aidl index bd304f18e2..30fe6dc1dd 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/HardwareAuthToken.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/HardwareAuthToken.aidl @@ -36,7 +36,7 @@ parcelable HardwareAuthToken { long challenge; long userId; long authenticatorId; - android.hardware.security.keymint.HardwareAuthenticatorType authenticatorType; + android.hardware.security.keymint.HardwareAuthenticatorType authenticatorType = android.hardware.security.keymint.HardwareAuthenticatorType.NONE; android.hardware.security.secureclock.Timestamp timestamp; byte[] mac; } diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl index d3c691086b..7150c4412c 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl @@ -45,5 +45,6 @@ interface IKeyMintDevice { android.hardware.security.keymint.BeginResult begin(in android.hardware.security.keymint.KeyPurpose purpose, in byte[] keyBlob, in android.hardware.security.keymint.KeyParameter[] params, in android.hardware.security.keymint.HardwareAuthToken authToken); void deviceLocked(in boolean passwordOnly, in @nullable android.hardware.security.secureclock.TimeStampToken timestampToken); void earlyBootEnded(); + byte[] performOperation(in byte[] request); const int AUTH_TOKEN_MAC_LENGTH = 32; } diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintOperation.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintOperation.aidl index a9b9a05a09..80ed526880 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintOperation.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintOperation.aidl @@ -33,7 +33,8 @@ package android.hardware.security.keymint; @VintfStability interface IKeyMintOperation { - int update(in @nullable android.hardware.security.keymint.KeyParameterArray inParams, in @nullable byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken inAuthToken, in @nullable android.hardware.security.secureclock.TimeStampToken inTimeStampToken, out @nullable android.hardware.security.keymint.KeyParameterArray outParams, out @nullable android.hardware.security.keymint.ByteArray output); - byte[] finish(in @nullable android.hardware.security.keymint.KeyParameterArray inParams, in @nullable byte[] input, in @nullable byte[] inSignature, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken inTimeStampToken, out @nullable android.hardware.security.keymint.KeyParameterArray outParams); + void updateAad(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken); + byte[] update(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken); + byte[] finish(in @nullable byte[] input, in @nullable byte[] signature, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timestampToken, in @nullable byte[] confirmationToken); void abort(); } diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyCharacteristics.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyCharacteristics.aidl index b430da95aa..994bd4c55d 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyCharacteristics.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyCharacteristics.aidl @@ -33,6 +33,6 @@ package android.hardware.security.keymint; @VintfStability parcelable KeyCharacteristics { - android.hardware.security.keymint.SecurityLevel securityLevel; + android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE; android.hardware.security.keymint.KeyParameter[] authorizations; } diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyMintHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyMintHardwareInfo.aidl index d06312a290..7747c59871 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyMintHardwareInfo.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyMintHardwareInfo.aidl @@ -34,7 +34,7 @@ package android.hardware.security.keymint; @RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability parcelable KeyMintHardwareInfo { int versionNumber; - android.hardware.security.keymint.SecurityLevel securityLevel; + android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE; @utf8InCpp String keyMintName; @utf8InCpp String keyMintAuthorName; boolean timestampTokenRequired; diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameter.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameter.aidl index f534952e62..21b083cfec 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameter.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameter.aidl @@ -33,6 +33,6 @@ package android.hardware.security.keymint; @RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability parcelable KeyParameter { - android.hardware.security.keymint.Tag tag; + android.hardware.security.keymint.Tag tag = android.hardware.security.keymint.Tag.INVALID; android.hardware.security.keymint.KeyParameterValue value; } diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameterArray.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameterArray.aidl deleted file mode 100644 index 2706623768..0000000000 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/KeyParameterArray.aidl +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - *//////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m <name>-update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.hardware.security.keymint; -@VintfStability -parcelable KeyParameterArray { - android.hardware.security.keymint.KeyParameter[] params; -} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl index 03982e3621..2469d27aea 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl @@ -98,4 +98,5 @@ enum Tag { CERTIFICATE_SUBJECT = -1879047185, CERTIFICATE_NOT_BEFORE = 1610613744, CERTIFICATE_NOT_AFTER = 1610613745, + MAX_BOOT_LEVEL = 805307378, } diff --git a/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl b/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl index 57651303bf..95b38f2958 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/ErrorCode.aidl @@ -105,6 +105,7 @@ enum ErrorCode { MISSING_NOT_AFTER = -81, MISSING_ISSUER_SUBJECT = -82, INVALID_ISSUER_SUBJECT = -83, + BOOT_LEVEL_EXCEEDED = -84, UNIMPLEMENTED = -100, VERSION_MISMATCH = -101, diff --git a/security/keymint/aidl/android/hardware/security/keymint/HardwareAuthToken.aidl b/security/keymint/aidl/android/hardware/security/keymint/HardwareAuthToken.aidl index 417a0b1dbe..57150d5da6 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/HardwareAuthToken.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/HardwareAuthToken.aidl @@ -16,17 +16,17 @@ package android.hardware.security.keymint; -import android.hardware.security.secureclock.Timestamp; import android.hardware.security.keymint.HardwareAuthenticatorType; +import android.hardware.security.secureclock.Timestamp; /** * HardwareAuthToken is used to prove successful user authentication, to unlock the use of a key. * * HardwareAuthTokens are produced by other secure environment applications, notably GateKeeper and - * biometric authenticators, in response to successful user authentication events. These tokens are passed to - * begin(), update(), and finish() to prove that authentication occurred. See those methods for - * more details. It is up to the caller to determine which of the generated auth tokens is - * appropriate for a given key operation. + * biometric authenticators, in response to successful user authentication events. These tokens are + * passed to begin(), update(), and finish() to prove that authentication occurred. See those + * methods for more details. It is up to the caller to determine which of the generated auth tokens + * is appropriate for a given key operation. */ @VintfStability @RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true) @@ -55,7 +55,7 @@ parcelable HardwareAuthToken { * authenticatorType describes the type of authentication that took place, e.g. password or * fingerprint. */ - HardwareAuthenticatorType authenticatorType; + HardwareAuthenticatorType authenticatorType = HardwareAuthenticatorType.NONE; /** * timestamp indicates when the user authentication took place, in milliseconds since some diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl index 13e98af8bd..384416e692 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl @@ -18,7 +18,6 @@ package android.hardware.security.keymint; import android.hardware.security.keymint.AttestationKey; import android.hardware.security.keymint.BeginResult; -import android.hardware.security.keymint.ByteArray; import android.hardware.security.keymint.HardwareAuthToken; import android.hardware.security.keymint.IKeyMintOperation; import android.hardware.security.keymint.KeyCreationResult; @@ -761,4 +760,18 @@ interface IKeyMintDevice { * an EARLY_BOOT_ONLY key after this method is called must fail with Error::INVALID_KEY_BLOB. */ void earlyBootEnded(); + + /** + * Called by the client to perform a KeyMint operation. + * + * This method is added primarily as a placeholder. Details will be fleshed before the KeyMint + * V1 interface is frozen. Until then, implementations must return ErrorCode::UNIMPLEMENTED. + * + * @param request is an encrypted buffer containing a description of the operation the client + * wishes to perform. Structure, content and encryption are TBD. + * + * @return an encrypted buffer containing the result of the operation. Structure, content and + * encryption are TBD. + */ + byte[] performOperation(in byte[] request); } diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl index 8c49602413..1c2511b34e 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl @@ -16,15 +16,75 @@ package android.hardware.security.keymint; -import android.hardware.security.keymint.ByteArray; import android.hardware.security.keymint.HardwareAuthToken; import android.hardware.security.keymint.KeyParameter; -import android.hardware.security.keymint.KeyParameterArray; import android.hardware.security.secureclock.TimeStampToken; @VintfStability interface IKeyMintOperation { /** + * Provides additional authentication data (AAD) to a cryptographic operation begun with + * begin(), provided in the input argument. This method only applies to AEAD modes. This + * method may be called multiple times, supplying the AAD in chunks, but may not be called after + * update() is called. If updateAad() is called after update(), it must return + * ErrorCode::INVALID_TAG. + * + * If operation is in an invalid state (was aborted or had an error) update() must return + * ErrorCode::INVALID_OPERATION_HANDLE. + * + * If this method returns an error code other than ErrorCode::OK, the operation is aborted and + * the operation handle must be invalidated. Any future use of the handle, with this method, + * finish, or abort, must return ErrorCode::INVALID_OPERATION_HANDLE. + * + * == Authorization Enforcement == + * + * Key authorization enforcement is performed primarily in begin(). The one exception is the + * case where the key has: + * + * o One or more Tag::USER_SECURE_IDs, and + * + * o Does not have a Tag::AUTH_TIMEOUT + * + * In this case, the key requires an authorization per operation, and the update method must + * receive a non-null and valid HardwareAuthToken. For the auth token to be valid, all of the + * following has to be true: + * + * o The HMAC field must validate correctly. + * + * o At least one of the Tag::USER_SECURE_ID values from the key must match at least one of + * the secure ID values in the token. + * + * o The key must have a Tag::USER_AUTH_TYPE that matches the auth type in the token. + * + * o The challenge field in the auth token must contain the operationHandle + * + * If any of these conditions are not met, update() must return + * ErrorCode::KEY_USER_NOT_AUTHENTICATED. + * + * The caller must provide the auth token on every call to updateAad(), update() and finish(). + * + * + * For GCM encryption, the AEAD tag must be appended to the ciphertext by finish(). During + * decryption, the last Tag::MAC_LENGTH bytes of the data provided to the last update call must + * be the AEAD tag. Since a given invocation of update cannot know if it's the last invocation, + * it must process all but the tag length and buffer the possible tag data for processing during + * finish(). + * + * @param input Additional Authentication Data to be processed. + * + * @param authToken Authentication token. Can be nullable if not provided. + * + * @param timeStampToken timestamp token, certifies the freshness of an auth token in case + * the security domain of this KeyMint instance has a different clock than the + * authenticator issuing the auth token. + * + * @return error Returns ErrorCode encountered in keymint as service specific errors. See the + * ErrorCode enum in ErrorCode.aidl. + */ + void updateAad(in byte[] input, in @nullable HardwareAuthToken authToken, + in @nullable TimeStampToken timeStampToken); + + /** * Provides data to, and possibly receives output from, an ongoing cryptographic operation begun * with begin(). * @@ -96,53 +156,28 @@ interface IKeyMintOperation { * * -- AES keys -- * - * AES GCM mode supports "associated authentication data," provided via the Tag::ASSOCIATED_DATA - * tag in the inParams argument. The associated data may be provided in repeated calls - * (important if the data is too large to send in a single block) but must always precede data - * to be encrypted or decrypted. An update call may receive both associated data and data to - * encrypt/decrypt, but subsequent updates must not include associated data. If the caller - * provides associated data to an update call after a call that includes data to - * encrypt/decrypt, update() must return ErrorCode::INVALID_TAG. - * * For GCM encryption, the AEAD tag must be appended to the ciphertext by finish(). During * decryption, the last Tag::MAC_LENGTH bytes of the data provided to the last update call must * be the AEAD tag. Since a given invocation of update cannot know if it's the last invocation, * it must process all but the tag length and buffer the possible tag data for processing during * finish(). * - * TODO: update() needs to be refactored b/168665179. - * - * @param inParams Additional parameters for the operation. For AEAD modes, this is used to - * specify Tag::ADDITIONAL_DATA. Note that additional data may be provided in multiple - * calls to update(), but only until input data has been provided. - * * @param input Data to be processed. Note that update() may or may not consume all of the data * provided. See return value. * - * @param inTimeStampToken timestamp token, certifies the freshness of an auth token in case - * the security domain of this KeyMint instance has a different clock than the - * authenticator issuing the auth token. + * @param authToken Authentication token. Can be nullable if not provided. + * + * @param timeStampToken certifies the freshness of an auth token in case the security domain of + * this KeyMint instance has a different clock than the authenticator issuing the auth + * token. * * @return error Returns ErrorCode encountered in keymint as service specific errors. See the * ErrorCode enum in ErrorCode.aidl. * - * @return int Amount of data that was consumed by update(). If this is less than the - * amount provided, the caller may provide the remainder in a subsequent call to - * update() or finish(). Every call to update must consume at least one byte, unless - * the input is empty, and implementations should consume as much data as reasonably - * possible for each call. - * - * @return outParams returns the updated key parameters from the blob, if needed. - * operation. - * - * @return out variable output The output data, if any. + * @return byte[] The output data, if any. */ - int update(in @nullable KeyParameterArray inParams, - in @nullable byte[] input, - in @nullable HardwareAuthToken inAuthToken, - in @nullable TimeStampToken inTimeStampToken, - out @nullable KeyParameterArray outParams, - out @nullable ByteArray output); + byte[] update(in byte[] input, in @nullable HardwareAuthToken authToken, + in @nullable TimeStampToken timeStampToken); /** * Finalizes a cryptographic operation begun with begin() and invalidates operation. @@ -229,8 +264,7 @@ interface IKeyMintOperation { * * TODO: update() will need to be refactored into 2 function. b/168665179. * - * @param inParams Additional parameters for the operation. For AEAD modes, this is used to - * specify Tag::ADDITIONAL_DATA, but only if no input data was provided to update(). + * @param inParams Additional parameters for the operation. * * @param input Data to be processed, per the parameters established in the call to begin(). * finish() must consume all provided data or return ErrorCode::INVALID_INPUT_LENGTH. @@ -240,19 +274,21 @@ interface IKeyMintOperation { * * @param authToken Authentication token. Can be nullable if not provided. * - * @param inTimeStampToken timestamp token, certifies the freshness of an auth token in case - * the security domain of this KeyMint instance has a different clock than the - * authenticator issuing the auth token. + * @param timestampToken certifies the freshness of an auth token in case the security domain of + * this KeyMint instance has a different clock than the authenticator issuing the auth + * token. * - * @return outParams Any output parameters generated by finish(). + * @param confirmationToken is the confirmation token required by keys with + * Tag::TRUSTED_CONFIRMATION_REQUIRED. * * @return The output data, if any. + * + * @return outParams Any output parameters generated by finish(). */ - byte[] finish(in @nullable KeyParameterArray inParams, in @nullable byte[] input, - in @nullable byte[] inSignature, - in @nullable HardwareAuthToken authToken, - in @nullable TimeStampToken inTimeStampToken, - out @nullable KeyParameterArray outParams); + byte[] finish(in @nullable byte[] input, in @nullable byte[] signature, + in @nullable HardwareAuthToken authToken, + in @nullable TimeStampToken timestampToken, + in @nullable byte[] confirmationToken); /** * Aborts a cryptographic operation begun with begin(), freeing all internal resources. If an diff --git a/security/keymint/aidl/android/hardware/security/keymint/KeyCharacteristics.aidl b/security/keymint/aidl/android/hardware/security/keymint/KeyCharacteristics.aidl index edd4d8f841..3a32e4d224 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/KeyCharacteristics.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/KeyCharacteristics.aidl @@ -31,6 +31,6 @@ import android.hardware.security.keymint.SecurityLevel; */ @VintfStability parcelable KeyCharacteristics { - SecurityLevel securityLevel; + SecurityLevel securityLevel = SecurityLevel.SOFTWARE; KeyParameter[] authorizations; } diff --git a/security/keymint/aidl/android/hardware/security/keymint/KeyMintHardwareInfo.aidl b/security/keymint/aidl/android/hardware/security/keymint/KeyMintHardwareInfo.aidl index 2fcaf4cf3b..ae0d152f16 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/KeyMintHardwareInfo.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/KeyMintHardwareInfo.aidl @@ -34,7 +34,7 @@ parcelable KeyMintHardwareInfo { /* securityLevel is the security level of the IKeyMintDevice implementation accessed * through this aidl package. */ - SecurityLevel securityLevel; + SecurityLevel securityLevel = SecurityLevel.SOFTWARE; /* keyMintName is the name of the IKeyMintDevice implementation. */ @utf8InCpp String keyMintName; diff --git a/security/keymint/aidl/android/hardware/security/keymint/KeyParameter.aidl b/security/keymint/aidl/android/hardware/security/keymint/KeyParameter.aidl index f3ed96b83f..bf6c9b204d 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/KeyParameter.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/KeyParameter.aidl @@ -16,8 +16,8 @@ package android.hardware.security.keymint; -import android.hardware.security.keymint.Tag; import android.hardware.security.keymint.KeyParameterValue; +import android.hardware.security.keymint.Tag; /** * Identifies the key authorization parameters to be used with keyMint. This is usually @@ -26,6 +26,6 @@ import android.hardware.security.keymint.KeyParameterValue; @VintfStability @RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true) parcelable KeyParameter { - Tag tag; + Tag tag = Tag.INVALID; KeyParameterValue value; } diff --git a/security/keymint/aidl/android/hardware/security/keymint/KeyParameterArray.aidl b/security/keymint/aidl/android/hardware/security/keymint/KeyParameterArray.aidl deleted file mode 100644 index acab43591c..0000000000 --- a/security/keymint/aidl/android/hardware/security/keymint/KeyParameterArray.aidl +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -package android.hardware.security.keymint; - -import android.hardware.security.keymint.KeyParameter; - -/** - * Identifies the key authorization parameters to be used with keyMint. This is usually - * provided as an array of KeyParameters to IKeyMintDevice or Operation. - */ -@VintfStability -parcelable KeyParameterArray { - /** - * Identify list of key parameters corresponding to a particular key blob. - */ - KeyParameter[] params; -} diff --git a/security/keymint/aidl/android/hardware/security/keymint/SecurityLevel.aidl b/security/keymint/aidl/android/hardware/security/keymint/SecurityLevel.aidl index c63859c782..ecbde8c97c 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/SecurityLevel.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/SecurityLevel.aidl @@ -44,13 +44,15 @@ enum SecurityLevel { /** * The TRUSTED_ENVIRONMENT security level represents a KeyMint implementation that runs in an - * Android process, or a tag enforced by such an implementation. An attacker who completely - * compromises Android, including the Linux kernel, does not have the ability to subvert it. At - * attacker who can find an exploit that gains them control of the trusted environment, or who - * has access to the physical device and can mount a sophisticated hardware attack, may be able - * to defeat it. + * isolated execution environment that is securely isolated from the code running on the kernel + * and above, and which satisfies the requirements specified in CDD 9.11.1 [C-1-2]. An attacker + * who completely compromises Android, including the Linux kernel, does not have the ability to + * subvert it. An attacker who can find an exploit that gains them control of the trusted + * environment, or who has access to the physical device and can mount a sophisticated hardware + * attack, may be able to defeat it. */ TRUSTED_ENVIRONMENT = 1, + /** * The STRONGBOX security level represents a KeyMint implementation that runs in security * hardware that satisfies the requirements specified in CDD 9.11.2. Roughly speaking, these diff --git a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl index 4f58cbeb76..aa9aa6f1c9 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl @@ -883,11 +883,7 @@ enum Tag { STORAGE_KEY = (7 << 28) /* TagType:BOOL */ | 722, /** - * Tag::ASSOCIATED_DATA Provides "associated data" for AES-GCM encryption or decryption. This - * tag is provided to update and specifies data that is not encrypted/decrypted, but is used in - * computing the GCM tag. - * - * Must never appear KeyCharacteristics. + * TODO: Delete when keystore1 is deleted. */ ASSOCIATED_DATA = (9 << 28) /* TagType:BYTES */ | 1000, @@ -964,4 +960,15 @@ enum Tag { * or importKey. */ CERTIFICATE_NOT_AFTER = (6 << 28) /* TagType:DATE */ | 1009, + + /** + * Tag::MAX_BOOT_LEVEL specifies a maximum boot level at which a key should function. + * + * Over the course of the init process, the boot level will be raised to + * monotonically increasing integer values. Implementations MUST NOT allow the key + * to be used once the boot level advances beyond the value of this tag. + * + * Cannot be hardware enforced in this version. + */ + MAX_BOOT_LEVEL = (3 << 28) /* TagType:UINT */ | 1010, } diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp index e160548931..63b91fefdf 100644 --- a/security/keymint/aidl/default/Android.bp +++ b/security/keymint/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.security.keymint-service", relative_install_path: "hw", diff --git a/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp b/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp index f2651fbce7..2373b2682b 100644 --- a/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp +++ b/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp @@ -259,8 +259,9 @@ cppbor::Array buildCertReqRecipients(const bytevec& pubkey, const bytevec& kid) } static keymaster_key_param_t kKeyMintEcdsaP256Params[] = { - Authorization(TAG_PURPOSE, KM_PURPOSE_SIGN), Authorization(TAG_ALGORITHM, KM_ALGORITHM_EC), - Authorization(TAG_KEY_SIZE, 256), Authorization(TAG_DIGEST, KM_DIGEST_SHA_2_256), + Authorization(TAG_PURPOSE, KM_PURPOSE_ATTEST_KEY), + Authorization(TAG_ALGORITHM, KM_ALGORITHM_EC), Authorization(TAG_KEY_SIZE, 256), + Authorization(TAG_DIGEST, KM_DIGEST_SHA_2_256), Authorization(TAG_EC_CURVE, KM_EC_CURVE_P_256), Authorization(TAG_NO_AUTH_REQUIRED), // The certificate generated by KM will be discarded, these values don't matter. Authorization(TAG_CERTIFICATE_NOT_BEFORE, 0), Authorization(TAG_CERTIFICATE_NOT_AFTER, 0)}; diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp index 24fe61641c..991d77a43b 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsAidlKeyMintTargetTest", defaults: [ diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index d61a081232..3e87b6b2da 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp @@ -386,122 +386,50 @@ ErrorCode KeyMintAidlTestBase::Begin(KeyPurpose purpose, const AuthorizationSet& return result; } -ErrorCode KeyMintAidlTestBase::Update(const AuthorizationSet& in_params, const string& input, - AuthorizationSet* out_params, string* output, - int32_t* input_consumed) { +ErrorCode KeyMintAidlTestBase::UpdateAad(const string& input) { + return GetReturnErrorCode(op_->updateAad(vector<uint8_t>(input.begin(), input.end()), + {} /* hardwareAuthToken */, + {} /* verificationToken */)); +} + +ErrorCode KeyMintAidlTestBase::Update(const string& input, string* output) { SCOPED_TRACE("Update"); Status result; - EXPECT_NE(op_, nullptr); - if (!op_) { - return ErrorCode::UNEXPECTED_NULL_POINTER; - } + if (!output) return ErrorCode::UNEXPECTED_NULL_POINTER; - KeyParameterArray key_params; - key_params.params = in_params.vector_data(); + std::vector<uint8_t> o_put; + result = op_->update(vector<uint8_t>(input.begin(), input.end()), {}, {}, &o_put); - KeyParameterArray in_keyParams; - in_keyParams.params = in_params.vector_data(); - - optional<KeyParameterArray> out_keyParams; - optional<ByteArray> o_put; - result = op_->update(in_keyParams, vector<uint8_t>(input.begin(), input.end()), {}, {}, - &out_keyParams, &o_put, input_consumed); - - if (result.isOk()) { - if (o_put) { - output->append(o_put->data.begin(), o_put->data.end()); - } - - if (out_keyParams) { - out_params->push_back(AuthorizationSet(out_keyParams->params)); - } - } + if (result.isOk()) output->append(o_put.begin(), o_put.end()); return GetReturnErrorCode(result); } -ErrorCode KeyMintAidlTestBase::Update(const string& input, string* out, int32_t* input_consumed) { - SCOPED_TRACE("Update"); - AuthorizationSet out_params; - ErrorCode result = - Update(AuthorizationSet() /* in_params */, input, &out_params, out, input_consumed); - EXPECT_TRUE(out_params.empty()); - return result; -} - -ErrorCode KeyMintAidlTestBase::Finish(const AuthorizationSet& in_params, const string& input, - const string& signature, AuthorizationSet* out_params, +ErrorCode KeyMintAidlTestBase::Finish(const string& input, const string& signature, string* output) { SCOPED_TRACE("Finish"); Status result; EXPECT_NE(op_, nullptr); - if (!op_) { - return ErrorCode::UNEXPECTED_NULL_POINTER; - } - - KeyParameterArray key_params; - key_params.params = in_params.vector_data(); - - KeyParameterArray in_keyParams; - in_keyParams.params = in_params.vector_data(); - - optional<KeyParameterArray> out_keyParams; - optional<vector<uint8_t>> o_put; + if (!op_) return ErrorCode::UNEXPECTED_NULL_POINTER; vector<uint8_t> oPut; - result = op_->finish(in_keyParams, vector<uint8_t>(input.begin(), input.end()), - vector<uint8_t>(signature.begin(), signature.end()), {}, {}, - &out_keyParams, &oPut); - - if (result.isOk()) { - if (out_keyParams) { - out_params->push_back(AuthorizationSet(out_keyParams->params)); - } + result = op_->finish(vector<uint8_t>(input.begin(), input.end()), + vector<uint8_t>(signature.begin(), signature.end()), {} /* authToken */, + {} /* timestampToken */, {} /* confirmationToken */, &oPut); - output->append(oPut.begin(), oPut.end()); - } + if (result.isOk()) output->append(oPut.begin(), oPut.end()); - op_.reset(); + op_ = {}; return GetReturnErrorCode(result); } -ErrorCode KeyMintAidlTestBase::Finish(const string& message, string* output) { - SCOPED_TRACE("Finish"); - AuthorizationSet out_params; - string finish_output; - ErrorCode result = Finish(AuthorizationSet() /* in_params */, message, "" /* signature */, - &out_params, output); - if (result != ErrorCode::OK) { - return result; - } - EXPECT_EQ(0U, out_params.size()); - return result; -} - -ErrorCode KeyMintAidlTestBase::Finish(const string& message, const string& signature, - string* output) { - SCOPED_TRACE("Finish"); - AuthorizationSet out_params; - ErrorCode result = - Finish(AuthorizationSet() /* in_params */, message, signature, &out_params, output); - - if (result != ErrorCode::OK) { - return result; - } - - EXPECT_EQ(0U, out_params.size()); - return result; -} - ErrorCode KeyMintAidlTestBase::Abort(const std::shared_ptr<IKeyMintOperation>& op) { SCOPED_TRACE("Abort"); EXPECT_NE(op, nullptr); - if (!op) { - return ErrorCode::UNEXPECTED_NULL_POINTER; - } + if (!op) return ErrorCode::UNEXPECTED_NULL_POINTER; Status retval = op->abort(); EXPECT_TRUE(retval.isOk()); @@ -512,9 +440,7 @@ ErrorCode KeyMintAidlTestBase::Abort() { SCOPED_TRACE("Abort"); EXPECT_NE(op_, nullptr); - if (!op_) { - return ErrorCode::UNEXPECTED_NULL_POINTER; - } + if (!op_) return ErrorCode::UNEXPECTED_NULL_POINTER; Status retval = op_->abort(); return static_cast<ErrorCode>(retval.getServiceSpecificError()); @@ -530,30 +456,13 @@ void KeyMintAidlTestBase::AbortIfNeeded() { auto KeyMintAidlTestBase::ProcessMessage(const vector<uint8_t>& key_blob, KeyPurpose operation, const string& message, const AuthorizationSet& in_params) - -> std::tuple<ErrorCode, string, AuthorizationSet /* out_params */> { + -> std::tuple<ErrorCode, string> { AuthorizationSet begin_out_params; ErrorCode result = Begin(operation, key_blob, in_params, &begin_out_params); - AuthorizationSet out_params(std::move(begin_out_params)); - if (result != ErrorCode::OK) { - return {result, {}, out_params}; - } + if (result != ErrorCode::OK) return {result, {}}; string output; - int32_t consumed = 0; - AuthorizationSet update_params; - AuthorizationSet update_out_params; - result = Update(update_params, message, &update_out_params, &output, &consumed); - out_params.push_back(update_out_params); - if (result != ErrorCode::OK) { - return {result, output, out_params}; - } - - string unused; - AuthorizationSet finish_params; - AuthorizationSet finish_out_params; - result = Finish(finish_params, message.substr(consumed), unused, &finish_out_params, &output); - out_params.push_back(finish_out_params); - return {result, output, out_params}; + return {Finish(message, &output), output}; } string KeyMintAidlTestBase::ProcessMessage(const vector<uint8_t>& key_blob, KeyPurpose operation, @@ -561,30 +470,14 @@ string KeyMintAidlTestBase::ProcessMessage(const vector<uint8_t>& key_blob, KeyP AuthorizationSet* out_params) { SCOPED_TRACE("ProcessMessage"); AuthorizationSet begin_out_params; - ErrorCode result = Begin(operation, key_blob, in_params, &begin_out_params); + ErrorCode result = Begin(operation, key_blob, in_params, out_params); EXPECT_EQ(ErrorCode::OK, result); if (result != ErrorCode::OK) { return ""; } string output; - int32_t consumed = 0; - AuthorizationSet update_params; - AuthorizationSet update_out_params; - result = Update(update_params, message, &update_out_params, &output, &consumed); - EXPECT_EQ(ErrorCode::OK, result); - if (result != ErrorCode::OK) { - return ""; - } - - string unused; - AuthorizationSet finish_params; - AuthorizationSet finish_out_params; - EXPECT_EQ(ErrorCode::OK, - Finish(finish_params, message.substr(consumed), unused, &finish_out_params, &output)); - - out_params->push_back(begin_out_params); - out_params->push_back(finish_out_params); + EXPECT_EQ(ErrorCode::OK, Finish(message, &output)); return output; } @@ -674,21 +567,9 @@ void KeyMintAidlTestBase::VerifyMessage(const vector<uint8_t>& key_blob, const s ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::VERIFY, key_blob, params, &begin_out_params)); string output; - AuthorizationSet update_params; - AuthorizationSet update_out_params; - int32_t consumed; - ASSERT_EQ(ErrorCode::OK, - Update(update_params, message, &update_out_params, &output, &consumed)); - EXPECT_TRUE(output.empty()); - EXPECT_GT(consumed, 0U); - - string unused; - AuthorizationSet finish_params; - AuthorizationSet finish_out_params; - EXPECT_EQ(ErrorCode::OK, Finish(finish_params, message.substr(consumed), signature, - &finish_out_params, &output)); - op_.reset(); + EXPECT_EQ(ErrorCode::OK, Finish(message, signature, &output)); EXPECT_TRUE(output.empty()); + op_ = {}; } void KeyMintAidlTestBase::VerifyMessage(const string& message, const string& signature, @@ -955,14 +836,14 @@ AuthorizationSet KeyMintAidlTestBase::SwEnforcedAuthorizations( } ErrorCode KeyMintAidlTestBase::UseAesKey(const vector<uint8_t>& aesKeyBlob) { - auto [result, ciphertext, out_params] = ProcessMessage( + auto [result, ciphertext] = ProcessMessage( aesKeyBlob, KeyPurpose::ENCRYPT, "1234567890123456", AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::NONE)); return result; } ErrorCode KeyMintAidlTestBase::UseHmacKey(const vector<uint8_t>& hmacKeyBlob) { - auto [result, mac, out_params] = ProcessMessage( + auto [result, mac] = ProcessMessage( hmacKeyBlob, KeyPurpose::SIGN, "1234567890123456", AuthorizationSetBuilder().Authorization(TAG_MAC_LENGTH, 128).Digest(Digest::SHA_2_256)); return result; @@ -970,16 +851,15 @@ ErrorCode KeyMintAidlTestBase::UseHmacKey(const vector<uint8_t>& hmacKeyBlob) { ErrorCode KeyMintAidlTestBase::UseRsaKey(const vector<uint8_t>& rsaKeyBlob) { std::string message(2048 / 8, 'a'); - auto [result, signature, out_params] = ProcessMessage( + auto [result, signature] = ProcessMessage( rsaKeyBlob, KeyPurpose::SIGN, message, AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE)); return result; } ErrorCode KeyMintAidlTestBase::UseEcdsaKey(const vector<uint8_t>& ecdsaKeyBlob) { - auto [result, signature, out_params] = - ProcessMessage(ecdsaKeyBlob, KeyPurpose::SIGN, "a", - AuthorizationSetBuilder().Digest(Digest::SHA_2_256)); + auto [result, signature] = ProcessMessage(ecdsaKeyBlob, KeyPurpose::SIGN, "a", + AuthorizationSetBuilder().Digest(Digest::SHA_2_256)); return result; } diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h index 452d2b6f6d..0aef81bd6f 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h @@ -112,15 +112,14 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam<string> { AuthorizationSet* out_params); ErrorCode Begin(KeyPurpose purpose, const AuthorizationSet& in_params); - ErrorCode Update(const AuthorizationSet& in_params, const string& input, - AuthorizationSet* out_params, string* output, int32_t* input_consumed); - ErrorCode Update(const string& input, string* out, int32_t* input_consumed); + ErrorCode UpdateAad(const string& input); + ErrorCode Update(const string& input, string* output); - ErrorCode Finish(const AuthorizationSet& in_params, const string& input, - const string& signature, AuthorizationSet* out_params, string* output); - ErrorCode Finish(const string& message, string* output); ErrorCode Finish(const string& message, const string& signature, string* output); - ErrorCode Finish(string* output) { return Finish(string(), output); } + ErrorCode Finish(const string& message, string* output) { + return Finish(message, {} /* signature */, output); + } + ErrorCode Finish(string* output) { return Finish({} /* message */, output); } ErrorCode Abort(); ErrorCode Abort(const shared_ptr<IKeyMintOperation>& op); @@ -129,9 +128,9 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam<string> { string ProcessMessage(const vector<uint8_t>& key_blob, KeyPurpose operation, const string& message, const AuthorizationSet& in_params, AuthorizationSet* out_params); - std::tuple<ErrorCode, std::string /* processedMessage */, AuthorizationSet /* out_params */> - ProcessMessage(const vector<uint8_t>& key_blob, KeyPurpose operation, - const std::string& message, const AuthorizationSet& in_params); + std::tuple<ErrorCode, std::string /* processedMessage */> ProcessMessage( + const vector<uint8_t>& key_blob, KeyPurpose operation, const std::string& message, + const AuthorizationSet& in_params); string SignMessage(const vector<uint8_t>& key_blob, const string& message, const AuthorizationSet& params); string SignMessage(const string& message, const AuthorizationSet& params); @@ -262,7 +261,7 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam<string> { ErrorCode UseRsaKey(const vector<uint8_t>& rsaKeyBlob); ErrorCode UseEcdsaKey(const vector<uint8_t>& ecdsaKeyBlob); - private: + protected: std::shared_ptr<IKeyMintDevice> keymint_; uint32_t os_version_; uint32_t os_patch_level_; diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp index 71aae90f30..7ecfa3723f 100644 --- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp @@ -2751,39 +2751,22 @@ TEST_P(EncryptionOperationsTest, AesIncremental) { for (int increment = 1; increment <= 240; ++increment) { for (auto block_mode : block_modes) { string message(240, 'a'); - auto params = AuthorizationSetBuilder() - .BlockMode(block_mode) - .Padding(PaddingMode::NONE) - .Authorization(TAG_MAC_LENGTH, 128) /* for GCM */; + auto params = + AuthorizationSetBuilder().BlockMode(block_mode).Padding(PaddingMode::NONE); + if (block_mode == BlockMode::GCM) { + params.Authorization(TAG_MAC_LENGTH, 128) /* for GCM */; + } AuthorizationSet output_params; EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &output_params)); string ciphertext; - int32_t input_consumed; string to_send; for (size_t i = 0; i < message.size(); i += increment) { - to_send.append(message.substr(i, increment)); - EXPECT_EQ(ErrorCode::OK, Update(to_send, &ciphertext, &input_consumed)); - EXPECT_EQ(to_send.length(), input_consumed); - to_send = to_send.substr(input_consumed); - EXPECT_EQ(0U, to_send.length()); - - switch (block_mode) { - case BlockMode::ECB: - case BlockMode::CBC: - // Implementations must take as many blocks as possible, leaving less - // than a block. - EXPECT_LE(to_send.length(), 16U); - break; - case BlockMode::GCM: - case BlockMode::CTR: - // Implementations must always take all the data. - EXPECT_EQ(0U, to_send.length()); - break; - } + EXPECT_EQ(ErrorCode::OK, Update(message.substr(i, increment), &ciphertext)); } - EXPECT_EQ(ErrorCode::OK, Finish(to_send, &ciphertext)) << "Error sending " << to_send; + EXPECT_EQ(ErrorCode::OK, Finish(to_send, &ciphertext)) + << "Error sending " << to_send << " with block mode " << block_mode; switch (block_mode) { case BlockMode::GCM: @@ -2818,9 +2801,7 @@ TEST_P(EncryptionOperationsTest, AesIncremental) { string plaintext; for (size_t i = 0; i < ciphertext.size(); i += increment) { - to_send.append(ciphertext.substr(i, increment)); - EXPECT_EQ(ErrorCode::OK, Update(to_send, &plaintext, &input_consumed)); - to_send = to_send.substr(input_consumed); + EXPECT_EQ(ErrorCode::OK, Update(ciphertext.substr(i, increment), &plaintext)); } ErrorCode error = Finish(to_send, &plaintext); ASSERT_EQ(ErrorCode::OK, error) << "Decryption failed for block mode " << block_mode @@ -3077,17 +3058,13 @@ TEST_P(EncryptionOperationsTest, AesGcmRoundTripSuccess) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto update_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size()); - // Encrypt AuthorizationSet begin_out_params; ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params)) << "Begin encrypt"; string ciphertext; - AuthorizationSet update_out_params; - ASSERT_EQ(ErrorCode::OK, Finish(update_params, message, "", &update_out_params, &ciphertext)); - + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); + ASSERT_EQ(ErrorCode::OK, Finish(message, &ciphertext)); ASSERT_EQ(ciphertext.length(), message.length() + 16); // Grab nonce @@ -3095,12 +3072,9 @@ TEST_P(EncryptionOperationsTest, AesGcmRoundTripSuccess) { // Decrypt. ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params)) << "Begin decrypt"; + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); string plaintext; - int32_t input_consumed; - ASSERT_EQ(ErrorCode::OK, - Update(update_params, ciphertext, &update_out_params, &plaintext, &input_consumed)); - EXPECT_EQ(ciphertext.size(), input_consumed); - EXPECT_EQ(ErrorCode::OK, Finish("", &plaintext)); + EXPECT_EQ(ErrorCode::OK, Finish(ciphertext, &plaintext)); EXPECT_EQ(message.length(), plaintext.length()); EXPECT_EQ(message, plaintext); } @@ -3127,17 +3101,15 @@ TEST_P(EncryptionOperationsTest, AesGcmRoundTripWithDelaySuccess) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto update_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size()); - // Encrypt AuthorizationSet begin_out_params; ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params)) << "Begin encrypt"; string ciphertext; AuthorizationSet update_out_params; + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); sleep(5); - ASSERT_EQ(ErrorCode::OK, Finish(update_params, message, "", &update_out_params, &ciphertext)); + ASSERT_EQ(ErrorCode::OK, Finish(message, &ciphertext)); ASSERT_EQ(ciphertext.length(), message.length() + 16); @@ -3147,11 +3119,9 @@ TEST_P(EncryptionOperationsTest, AesGcmRoundTripWithDelaySuccess) { // Decrypt. ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params)) << "Begin decrypt"; string plaintext; - int32_t input_consumed; + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); sleep(5); - ASSERT_EQ(ErrorCode::OK, - Update(update_params, ciphertext, &update_out_params, &plaintext, &input_consumed)); - EXPECT_EQ(ciphertext.size(), input_consumed); + ASSERT_EQ(ErrorCode::OK, Update(ciphertext, &plaintext)); sleep(5); EXPECT_EQ(ErrorCode::OK, Finish("", &plaintext)); EXPECT_EQ(message.length(), plaintext.length()); @@ -3230,9 +3200,6 @@ TEST_P(EncryptionOperationsTest, AesGcmTooShortTagOnDecrypt) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto finish_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size()); - // Encrypt AuthorizationSet begin_out_params; EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &begin_out_params)); @@ -3241,8 +3208,8 @@ TEST_P(EncryptionOperationsTest, AesGcmTooShortTagOnDecrypt) { AuthorizationSet finish_out_params; string ciphertext; - EXPECT_EQ(ErrorCode::OK, - Finish(finish_params, message, "" /* signature */, &finish_out_params, &ciphertext)); + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); + EXPECT_EQ(ErrorCode::OK, Finish(message, &ciphertext)); params = AuthorizationSetBuilder() .Authorizations(begin_out_params) @@ -3326,16 +3293,13 @@ TEST_P(EncryptionOperationsTest, AesGcmAadNoData) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto finish_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size()); - // Encrypt AuthorizationSet begin_out_params; EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &begin_out_params)); string ciphertext; AuthorizationSet finish_out_params; - EXPECT_EQ(ErrorCode::OK, Finish(finish_params, "" /* input */, "" /* signature */, - &finish_out_params, &ciphertext)); + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); + EXPECT_EQ(ErrorCode::OK, Finish(&ciphertext)); EXPECT_TRUE(finish_out_params.empty()); // Grab nonce @@ -3343,9 +3307,9 @@ TEST_P(EncryptionOperationsTest, AesGcmAadNoData) { // Decrypt. EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params)); + ASSERT_EQ(ErrorCode::OK, UpdateAad(aad)); string plaintext; - EXPECT_EQ(ErrorCode::OK, Finish(finish_params, ciphertext, "" /* signature */, - &finish_out_params, &plaintext)); + EXPECT_EQ(ErrorCode::OK, Finish(ciphertext, &plaintext)); EXPECT_TRUE(finish_out_params.empty()); @@ -3374,43 +3338,26 @@ TEST_P(EncryptionOperationsTest, AesGcmMultiPartAad) { .Authorization(TAG_MAC_LENGTH, tag_bits); AuthorizationSet begin_out_params; - auto update_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foo", (size_t)3); - EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params)); // No data, AAD only. + EXPECT_EQ(ErrorCode::OK, UpdateAad("foo")); + EXPECT_EQ(ErrorCode::OK, UpdateAad("foo")); string ciphertext; - int32_t input_consumed; - AuthorizationSet update_out_params; - EXPECT_EQ(ErrorCode::OK, Update(update_params, "" /* input */, &update_out_params, &ciphertext, - &input_consumed)); - EXPECT_EQ(0U, input_consumed); - EXPECT_EQ(0U, ciphertext.size()); - EXPECT_TRUE(update_out_params.empty()); - - // AAD and data. - EXPECT_EQ(ErrorCode::OK, - Update(update_params, message, &update_out_params, &ciphertext, &input_consumed)); - EXPECT_EQ(message.size(), input_consumed); - EXPECT_TRUE(update_out_params.empty()); + EXPECT_EQ(ErrorCode::OK, Update(message, &ciphertext)); + EXPECT_EQ(ErrorCode::OK, Finish(&ciphertext)); - EXPECT_EQ(ErrorCode::OK, Finish("" /* input */, &ciphertext)); // Expect 128-bit (16-byte) tag appended to ciphertext. - EXPECT_EQ(message.size() + (tag_bits >> 3), ciphertext.size()); + EXPECT_EQ(message.size() + (tag_bits / 8), ciphertext.size()); // Grab nonce. begin_params.push_back(begin_out_params); // Decrypt - update_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foofoo", (size_t)6); - EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad("foofoo")); string plaintext; - EXPECT_EQ(ErrorCode::OK, Finish(update_params, ciphertext, "" /* signature */, - &update_out_params, &plaintext)); - EXPECT_TRUE(update_out_params.empty()); + EXPECT_EQ(ErrorCode::OK, Finish(ciphertext, &plaintext)); EXPECT_EQ(message, plaintext); } @@ -3434,32 +3381,14 @@ TEST_P(EncryptionOperationsTest, AesGcmAadOutOfOrder) { .Authorization(TAG_MAC_LENGTH, 128); AuthorizationSet begin_out_params; - auto update_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foo", (size_t)3); - EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params)); - // No data, AAD only. + EXPECT_EQ(ErrorCode::OK, UpdateAad("foo")); string ciphertext; - int32_t input_consumed; - AuthorizationSet update_out_params; - EXPECT_EQ(ErrorCode::OK, Update(update_params, "" /* input */, &update_out_params, &ciphertext, - &input_consumed)); - EXPECT_EQ(0U, input_consumed); - EXPECT_EQ(0U, ciphertext.size()); - EXPECT_TRUE(update_out_params.empty()); + EXPECT_EQ(ErrorCode::OK, Update(message, &ciphertext)); + EXPECT_EQ(ErrorCode::INVALID_TAG, UpdateAad("foo")); - // AAD and data. - EXPECT_EQ(ErrorCode::OK, - Update(update_params, message, &update_out_params, &ciphertext, &input_consumed)); - EXPECT_EQ(message.size(), input_consumed); - EXPECT_TRUE(update_out_params.empty()); - - // More AAD - EXPECT_EQ(ErrorCode::INVALID_TAG, - Update(update_params, "", &update_out_params, &ciphertext, &input_consumed)); - - op_.reset(); + op_ = {}; } /* @@ -3481,28 +3410,21 @@ TEST_P(EncryptionOperationsTest, AesGcmBadAad) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto finish_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foobar", (size_t)6); - // Encrypt AuthorizationSet begin_out_params; EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad("foobar")); string ciphertext; - AuthorizationSet finish_out_params; - EXPECT_EQ(ErrorCode::OK, - Finish(finish_params, message, "" /* signature */, &finish_out_params, &ciphertext)); + EXPECT_EQ(ErrorCode::OK, Finish(message, &ciphertext)); // Grab nonce begin_params.push_back(begin_out_params); - finish_params = AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, - "barfoo" /* Wrong AAD */, (size_t)6); - // Decrypt. EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params, &begin_out_params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad("barfoo")); string plaintext; - EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(finish_params, ciphertext, "" /* signature */, - &finish_out_params, &plaintext)); + EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(ciphertext, &plaintext)); } /* @@ -3524,25 +3446,22 @@ TEST_P(EncryptionOperationsTest, AesGcmWrongNonce) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto finish_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foobar", (size_t)6); - // Encrypt AuthorizationSet begin_out_params; EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad("foobar")); string ciphertext; AuthorizationSet finish_out_params; - EXPECT_EQ(ErrorCode::OK, - Finish(finish_params, message, "" /* signature */, &finish_out_params, &ciphertext)); + EXPECT_EQ(ErrorCode::OK, Finish(message, &ciphertext)); // Wrong nonce begin_params.push_back(TAG_NONCE, AidlBuf("123456789012")); // Decrypt. EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params, &begin_out_params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad("foobar")); string plaintext; - EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(finish_params, ciphertext, "" /* signature */, - &finish_out_params, &plaintext)); + EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(ciphertext, &plaintext)); // With wrong nonce, should have gotten garbage plaintext (or none). EXPECT_NE(message, plaintext); @@ -3569,17 +3488,12 @@ TEST_P(EncryptionOperationsTest, AesGcmCorruptTag) { .Padding(PaddingMode::NONE) .Authorization(TAG_MAC_LENGTH, 128); - auto finish_params = - AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size()); - // Encrypt AuthorizationSet begin_out_params; EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &begin_out_params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad(aad)); string ciphertext; - AuthorizationSet finish_out_params; - EXPECT_EQ(ErrorCode::OK, - Finish(finish_params, message, "" /* signature */, &finish_out_params, &ciphertext)); - EXPECT_TRUE(finish_out_params.empty()); + EXPECT_EQ(ErrorCode::OK, Finish(message, &ciphertext)); // Corrupt tag ++(*ciphertext.rbegin()); @@ -3589,10 +3503,9 @@ TEST_P(EncryptionOperationsTest, AesGcmCorruptTag) { // Decrypt. EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params)); + EXPECT_EQ(ErrorCode::OK, UpdateAad(aad)); string plaintext; - EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(finish_params, ciphertext, "" /* signature */, - &finish_out_params, &plaintext)); - EXPECT_TRUE(finish_out_params.empty()); + EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(ciphertext, &plaintext)); } /* @@ -3704,9 +3617,7 @@ TEST_P(EncryptionOperationsTest, TripleDesEcbPkcs7PaddingCorrupted) { begin_params.push_back(TAG_PADDING, PaddingMode::PKCS7); EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params)); string plaintext; - int32_t input_consumed; - EXPECT_EQ(ErrorCode::OK, Update(ciphertext, &plaintext, &input_consumed)); - EXPECT_EQ(ciphertext.size(), input_consumed); + EXPECT_EQ(ErrorCode::OK, Update(ciphertext, &plaintext)); EXPECT_EQ(ErrorCode::INVALID_ARGUMENT, Finish(&plaintext)); } @@ -4020,9 +3931,7 @@ TEST_P(EncryptionOperationsTest, TripleDesCbcPkcs7PaddingCorrupted) { .Authorization(TAG_NONCE, iv); EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params)); string plaintext; - int32_t input_consumed; - EXPECT_EQ(ErrorCode::OK, Update(ciphertext, &plaintext, &input_consumed)); - EXPECT_EQ(ciphertext.size(), input_consumed); + EXPECT_EQ(ErrorCode::OK, Update(ciphertext, &plaintext)); EXPECT_EQ(ErrorCode::INVALID_ARGUMENT, Finish(&plaintext)); } @@ -4046,10 +3955,8 @@ TEST_P(EncryptionOperationsTest, TripleDesCbcIncrementalNoPadding) { EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, input_params, &output_params)); string ciphertext; - int32_t input_consumed; for (size_t i = 0; i < message.size(); i += increment) - EXPECT_EQ(ErrorCode::OK, - Update(message.substr(i, increment), &ciphertext, &input_consumed)); + EXPECT_EQ(ErrorCode::OK, Update(message.substr(i, increment), &ciphertext)); EXPECT_EQ(ErrorCode::OK, Finish(&ciphertext)); EXPECT_EQ(message.size(), ciphertext.size()); @@ -4062,8 +3969,7 @@ TEST_P(EncryptionOperationsTest, TripleDesCbcIncrementalNoPadding) { EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, input_params, &output_params)); string plaintext; for (size_t i = 0; i < ciphertext.size(); i += increment) - EXPECT_EQ(ErrorCode::OK, - Update(ciphertext.substr(i, increment), &plaintext, &input_consumed)); + EXPECT_EQ(ErrorCode::OK, Update(ciphertext.substr(i, increment), &plaintext)); EXPECT_EQ(ErrorCode::OK, Finish(&plaintext)); EXPECT_EQ(ciphertext.size(), plaintext.size()); EXPECT_EQ(message, plaintext); @@ -4727,7 +4633,7 @@ TEST_P(KeyAgreementTest, Ecdh) { INSTANTIATE_KEYMINT_AIDL_TEST(KeyAgreementTest); -typedef KeyMintAidlTestBase EarlyBootKeyTest; +using EarlyBootKeyTest = KeyMintAidlTestBase; TEST_P(EarlyBootKeyTest, CreateEarlyBootKeys) { auto [aesKeyData, hmacKeyData, rsaKeyData, ecdsaKeyData] = @@ -4784,9 +4690,10 @@ TEST_P(EarlyBootKeyTest, DISABLED_FullTest) { CheckedDeleteKey(&rsaKeyData.blob); CheckedDeleteKey(&ecdsaKeyData.blob); } + INSTANTIATE_KEYMINT_AIDL_TEST(EarlyBootKeyTest); -typedef KeyMintAidlTestBase UnlockedDeviceRequiredTest; +using UnlockedDeviceRequiredTest = KeyMintAidlTestBase; // This may be a problematic test. It can't be run repeatedly without unlocking the device in // between runs... and on most test devices there are no enrolled credentials so it can't be @@ -4818,8 +4725,19 @@ TEST_P(UnlockedDeviceRequiredTest, DISABLED_KeysBecomeUnusable) { CheckedDeleteKey(&rsaKeyData.blob); CheckedDeleteKey(&ecdsaKeyData.blob); } + INSTANTIATE_KEYMINT_AIDL_TEST(UnlockedDeviceRequiredTest); +using PerformOperationTest = KeyMintAidlTestBase; + +TEST_P(PerformOperationTest, RequireUnimplemented) { + vector<uint8_t> response; + auto result = keymint_->performOperation({} /* request */, &response); + ASSERT_EQ(GetReturnErrorCode(result), ErrorCode::UNIMPLEMENTED); +} + +INSTANTIATE_KEYMINT_AIDL_TEST(PerformOperationTest); + } // namespace aidl::android::hardware::security::keymint::test int main(int argc, char** argv) { diff --git a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index 45f9df6307..db53a8f8fa 100644 --- a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -80,7 +80,7 @@ INSTANTIATE_REM_PROV_AIDL_TEST(GenerateKeyTests); /** * Generate and validate a production-mode key. MAC tag can't be verified. */ -TEST_P(GenerateKeyTests, DISABLED_generateEcdsaP256Key_prodMode) { +TEST_P(GenerateKeyTests, generateEcdsaP256Key_prodMode) { MacedPublicKey macedPubKey; bytevec privateKeyBlob; bool testMode = false; @@ -133,7 +133,7 @@ TEST_P(GenerateKeyTests, DISABLED_generateEcdsaP256Key_prodMode) { /** * Generate and validate a test-mode key. */ -TEST_P(GenerateKeyTests, DISABLED_generateEcdsaP256Key_testMode) { +TEST_P(GenerateKeyTests, generateEcdsaP256Key_testMode) { MacedPublicKey macedPubKey; bytevec privateKeyBlob; bool testMode = true; @@ -224,7 +224,7 @@ class CertificateRequestTest : public VtsRemotelyProvisionedComponentTests { * Generate an empty certificate request in test mode, and decrypt and verify the structure and * content. */ -TEST_P(CertificateRequestTest, DISABLED_EmptyRequest_testMode) { +TEST_P(CertificateRequestTest, EmptyRequest_testMode) { bool testMode = true; bytevec keysToSignMac; ProtectedData protectedData; @@ -294,7 +294,7 @@ TEST_P(CertificateRequestTest, DISABLED_EmptyRequest_testMode) { * TODO(swillden): Get a valid GEEK and use it so the generation can succeed, though we won't be * able to decrypt. */ -TEST_P(CertificateRequestTest, DISABLED_EmptyRequest_prodMode) { +TEST_P(CertificateRequestTest, EmptyRequest_prodMode) { bool testMode = false; bytevec keysToSignMac; ProtectedData protectedData; @@ -309,7 +309,7 @@ TEST_P(CertificateRequestTest, DISABLED_EmptyRequest_prodMode) { /** * Generate a non-empty certificate request in test mode. Decrypt, parse and validate the contents. */ -TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_testMode) { +TEST_P(CertificateRequestTest, NonEmptyRequest_testMode) { bool testMode = true; generateKeys(testMode, 4 /* numKeys */); @@ -379,7 +379,7 @@ TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_testMode) { * TODO(swillden): Get a valid GEEK and use it so the generation can succeed, though we won't be * able to decrypt. */ -TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_prodMode) { +TEST_P(CertificateRequestTest, NonEmptyRequest_prodMode) { bool testMode = false; generateKeys(testMode, 4 /* numKeys */); @@ -396,7 +396,7 @@ TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_prodMode) { * Generate a non-empty certificate request in test mode, with prod keys. Must fail with * STATUS_PRODUCTION_KEY_IN_TEST_REQUEST. */ -TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_prodKeyInTestCert) { +TEST_P(CertificateRequestTest, NonEmptyRequest_prodKeyInTestCert) { generateKeys(false /* testMode */, 2 /* numKeys */); bytevec keysToSignMac; @@ -414,7 +414,7 @@ TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_prodKeyInTestCert) { * Generate a non-empty certificate request in prod mode, with test keys. Must fail with * STATUS_TEST_KEY_IN_PRODUCTION_REQUEST. */ -TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_testKeyInProdCert) { +TEST_P(CertificateRequestTest, NonEmptyRequest_testKeyInProdCert) { generateKeys(true /* testMode */, 2 /* numKeys */); bytevec keysToSignMac; diff --git a/security/keymint/aidl/vts/performance/Android.bp b/security/keymint/aidl/vts/performance/Android.bp index 03240c3459..79ed0d5442 100644 --- a/security/keymint/aidl/vts/performance/Android.bp +++ b/security/keymint/aidl/vts/performance/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_benchmark { name: "VtsAidlKeyMintBenchmarkTest", defaults: [ diff --git a/security/keymint/aidl/vts/performance/KeyMintBenchmark.cpp b/security/keymint/aidl/vts/performance/KeyMintBenchmark.cpp index f87ca7821b..6c795f5ac0 100644 --- a/security/keymint/aidl/vts/performance/KeyMintBenchmark.cpp +++ b/security/keymint/aidl/vts/performance/KeyMintBenchmark.cpp @@ -206,41 +206,15 @@ class KeyMintBenchmarkTest { return std::move(builder); } - optional<string> Process(const string& message, const AuthorizationSet& /*in_params*/, - AuthorizationSet* out_params, const string& signature = "") { - static const int HIDL_BUFFER_LIMIT = 1 << 14; // 16KB + optional<string> Process(const string& message, const string& signature = "") { ErrorCode result; - // Update - AuthorizationSet update_params; - AuthorizationSet update_out_params; string output; - string aidl_output; - int32_t input_consumed = 0; - int32_t aidl_input_consumed = 0; - while (message.length() - input_consumed > 0) { - result = Update(update_params, message.substr(input_consumed, HIDL_BUFFER_LIMIT), - &update_out_params, &aidl_output, &aidl_input_consumed); - if (result != ErrorCode::OK) { - error_ = result; - return {}; - } - output.append(aidl_output); - input_consumed += aidl_input_consumed; - aidl_output.clear(); - } - - // Finish - AuthorizationSet finish_params; - AuthorizationSet finish_out_params; - result = Finish(finish_params, message.substr(input_consumed), signature, - &finish_out_params, &aidl_output); + result = Finish(message, signature, &output); if (result != ErrorCode::OK) { error_ = result; return {}; } - output.append(aidl_output); - out_params->push_back(finish_out_params); return output; } @@ -296,66 +270,36 @@ class KeyMintBenchmarkTest { name_.assign(info.keyMintName.begin(), info.keyMintName.end()); } - ErrorCode Finish(const AuthorizationSet& in_params, const string& input, - const string& signature, AuthorizationSet* out_params, string* output) { - Status result; + ErrorCode Finish(const string& input, const string& signature, string* output) { if (!op_) { std::cerr << "Finish: Operation is nullptr" << std::endl; return ErrorCode::UNEXPECTED_NULL_POINTER; } - KeyParameterArray key_params; - key_params.params = in_params.vector_data(); - - KeyParameterArray in_keyParams; - in_keyParams.params = in_params.vector_data(); - - std::optional<KeyParameterArray> out_keyParams; - std::optional<vector<uint8_t>> o_put; vector<uint8_t> oPut; - result = op_->finish(in_keyParams, vector<uint8_t>(input.begin(), input.end()), - vector<uint8_t>(signature.begin(), signature.end()), {}, {}, - &out_keyParams, &oPut); + Status result = + op_->finish(vector<uint8_t>(input.begin(), input.end()), + vector<uint8_t>(signature.begin(), signature.end()), {} /* authToken */, + {} /* timestampToken */, {} /* confirmationToken */, &oPut); + + if (result.isOk()) output->append(oPut.begin(), oPut.end()); - if (result.isOk()) { - if (out_keyParams) { - out_params->push_back(AuthorizationSet(out_keyParams->params)); - } - output->append(oPut.begin(), oPut.end()); - } op_.reset(); return GetReturnErrorCode(result); } - ErrorCode Update(const AuthorizationSet& in_params, const string& input, - AuthorizationSet* out_params, string* output, int32_t* input_consumed) { + ErrorCode Update(const string& input, string* output) { Status result; if (!op_) { std::cerr << "Update: Operation is nullptr" << std::endl; return ErrorCode::UNEXPECTED_NULL_POINTER; } - KeyParameterArray key_params; - key_params.params = in_params.vector_data(); - - KeyParameterArray in_keyParams; - in_keyParams.params = in_params.vector_data(); - - std::optional<KeyParameterArray> out_keyParams; - std::optional<ByteArray> o_put; - result = op_->update(in_keyParams, vector<uint8_t>(input.begin(), input.end()), {}, {}, - &out_keyParams, &o_put, input_consumed); - - if (result.isOk()) { - if (o_put) { - output->append(o_put->data.begin(), o_put->data.end()); - } - - if (out_keyParams) { - out_params->push_back(AuthorizationSet(out_keyParams->params)); - } - } + std::vector<uint8_t> o_put; + result = op_->update(vector<uint8_t>(input.begin(), input.end()), {} /* authToken */, + {} /* timestampToken */, &o_put); + if (result.isOk() && output) *output = {o_put.begin(), o_put.end()}; return GetReturnErrorCode(result); } @@ -493,7 +437,7 @@ static void sign(benchmark::State& state, string transform, int keySize, int msg } state.ResumeTiming(); out_params.Clear(); - if (!keymintTest->Process(message, in_params, &out_params)) { + if (!keymintTest->Process(message)) { state.SkipWithError(("Sign error, " + std::to_string(keymintTest->getError())).c_str()); break; } @@ -516,7 +460,7 @@ static void verify(benchmark::State& state, string transform, int keySize, int m ("Error beginning sign, " + std::to_string(keymintTest->getError())).c_str()); return; } - std::optional<string> signature = keymintTest->Process(message, in_params, &out_params); + std::optional<string> signature = keymintTest->Process(message); if (!signature) { state.SkipWithError(("Sign error, " + std::to_string(keymintTest->getError())).c_str()); return; @@ -534,7 +478,7 @@ static void verify(benchmark::State& state, string transform, int keySize, int m return; } state.ResumeTiming(); - if (!keymintTest->Process(message, in_params, &out_params, *signature)) { + if (!keymintTest->Process(message, *signature)) { state.SkipWithError( ("Verify error, " + std::to_string(keymintTest->getError())).c_str()); break; @@ -612,7 +556,7 @@ static void encrypt(benchmark::State& state, string transform, int keySize, int } out_params.Clear(); state.ResumeTiming(); - if (!keymintTest->Process(message, in_params, &out_params)) { + if (!keymintTest->Process(message)) { state.SkipWithError( ("Encryption error, " + std::to_string(keymintTest->getError())).c_str()); break; @@ -636,7 +580,7 @@ static void decrypt(benchmark::State& state, string transform, int keySize, int ("Encryption begin error, " + std::to_string(keymintTest->getError())).c_str()); return; } - auto encryptedMessage = keymintTest->Process(message, in_params, &out_params); + auto encryptedMessage = keymintTest->Process(message); if (!encryptedMessage) { state.SkipWithError( ("Encryption error, " + std::to_string(keymintTest->getError())).c_str()); @@ -653,7 +597,7 @@ static void decrypt(benchmark::State& state, string transform, int keySize, int return; } state.ResumeTiming(); - if (!keymintTest->Process(*encryptedMessage, in_params, &out_params)) { + if (!keymintTest->Process(*encryptedMessage)) { state.SkipWithError( ("Decryption error, " + std::to_string(keymintTest->getError())).c_str()); break; diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp index 02558745d5..fe04ede49f 100644 --- a/security/keymint/support/Android.bp +++ b/security/keymint/support/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "libkeymint_support", cflags: [ diff --git a/security/keymint/support/include/keymint_support/keymint_tags.h b/security/keymint/support/include/keymint_support/keymint_tags.h index 479a11d137..ae21125213 100644 --- a/security/keymint/support/include/keymint_support/keymint_tags.h +++ b/security/keymint/support/include/keymint_support/keymint_tags.h @@ -130,6 +130,7 @@ DECLARE_TYPED_TAG(CERTIFICATE_SERIAL); DECLARE_TYPED_TAG(CERTIFICATE_SUBJECT); DECLARE_TYPED_TAG(CERTIFICATE_NOT_BEFORE); DECLARE_TYPED_TAG(CERTIFICATE_NOT_AFTER); +DECLARE_TYPED_TAG(MAX_BOOT_LEVEL); #undef DECLARE_TYPED_TAG diff --git a/security/secureclock/aidl/Android.bp b/security/secureclock/aidl/Android.bp index 5a6d7ae538..c8e5c025ff 100644 --- a/security/secureclock/aidl/Android.bp +++ b/security/secureclock/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.security.secureclock", vendor_available: true, diff --git a/security/secureclock/aidl/vts/functional/Android.bp b/security/secureclock/aidl/vts/functional/Android.bp index 1619eab235..6dfa4175c7 100644 --- a/security/secureclock/aidl/vts/functional/Android.bp +++ b/security/secureclock/aidl/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsAidlSecureClockTargetTest", defaults: [ diff --git a/security/sharedsecret/aidl/Android.bp b/security/sharedsecret/aidl/Android.bp index ab441106f7..16830598f5 100644 --- a/security/sharedsecret/aidl/Android.bp +++ b/security/sharedsecret/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.security.sharedsecret", vendor_available: true, diff --git a/security/sharedsecret/aidl/vts/functional/Android.bp b/security/sharedsecret/aidl/vts/functional/Android.bp index 76bf7ff762..1bc5bebc91 100644 --- a/security/sharedsecret/aidl/vts/functional/Android.bp +++ b/security/sharedsecret/aidl/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsAidlSharedSecretTargetTest", defaults: [ diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp index 109367106a..c81ee6dbc9 100644 --- a/sensors/1.0/Android.bp +++ b/sensors/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.sensors@1.0", root: "android.hardware", diff --git a/sensors/1.0/default/Android.bp b/sensors/1.0/default/Android.bp index 98f46ae354..b2d3c49cf2 100644 --- a/sensors/1.0/default/Android.bp +++ b/sensors/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.sensors@1.0-impl", defaults: ["hidl_defaults"], diff --git a/sensors/1.0/vts/functional/Android.bp b/sensors/1.0/vts/functional/Android.bp index c77733bba2..9a92fb3150 100644 --- a/sensors/1.0/vts/functional/Android.bp +++ b/sensors/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSensorsV1_0TargetTest", cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], diff --git a/sensors/2.0/Android.bp b/sensors/2.0/Android.bp index d71f07b355..5a22b1f308 100644 --- a/sensors/2.0/Android.bp +++ b/sensors/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.sensors@2.0", root: "android.hardware", diff --git a/sensors/2.0/default/Android.bp b/sensors/2.0/default/Android.bp index bb383273a6..04a490e44e 100644 --- a/sensors/2.0/default/Android.bp +++ b/sensors/2.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.sensors@2.0-service.mock", defaults: ["hidl_defaults"], diff --git a/sensors/2.0/multihal/Android.bp b/sensors/2.0/multihal/Android.bp index bf51fcdbbc..ae5c3422a9 100644 --- a/sensors/2.0/multihal/Android.bp +++ b/sensors/2.0/multihal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.sensors@2.0-service.multihal", defaults: [ diff --git a/sensors/2.0/vts/functional/Android.bp b/sensors/2.0/vts/functional/Android.bp index 83ebc6b807..cf7c9fae75 100644 --- a/sensors/2.0/vts/functional/Android.bp +++ b/sensors/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSensorsV2_0TargetTest", cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], diff --git a/sensors/2.1/Android.bp b/sensors/2.1/Android.bp index 9ba3248085..5dd511af73 100644 --- a/sensors/2.1/Android.bp +++ b/sensors/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.sensors@2.1", root: "android.hardware", diff --git a/sensors/2.1/default/Android.bp b/sensors/2.1/default/Android.bp index 27b439d422..0be81e11d7 100644 --- a/sensors/2.1/default/Android.bp +++ b/sensors/2.1/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.sensors@2.1-service.mock", defaults: ["hidl_defaults"], diff --git a/sensors/2.1/multihal/Android.bp b/sensors/2.1/multihal/Android.bp index 6a7cac9f25..3846e19e05 100644 --- a/sensors/2.1/multihal/Android.bp +++ b/sensors/2.1/multihal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.sensors@2.1-service.multihal", defaults: [ diff --git a/sensors/2.1/vts/functional/Android.bp b/sensors/2.1/vts/functional/Android.bp index d257993329..3659e11ffc 100644 --- a/sensors/2.1/vts/functional/Android.bp +++ b/sensors/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSensorsV2_1TargetTest", cflags: [ diff --git a/sensors/common/default/2.X/Android.bp b/sensors/common/default/2.X/Android.bp index 8b0d52f06a..82c942f701 100644 --- a/sensors/common/default/2.X/Android.bp +++ b/sensors/common/default/2.X/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "android.hardware.sensors@2.X-shared-impl", vendor: true, diff --git a/sensors/common/default/2.X/multihal/Android.bp b/sensors/common/default/2.X/multihal/Android.bp index c80c47a4bf..b0ad934826 100644 --- a/sensors/common/default/2.X/multihal/Android.bp +++ b/sensors/common/default/2.X/multihal/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.sensors@2.X-multihal-defaults", header_libs: [ diff --git a/sensors/common/default/2.X/multihal/tests/Android.bp b/sensors/common/default/2.X/multihal/tests/Android.bp index 1b60f4b505..d8e7ce6a5c 100644 --- a/sensors/common/default/2.X/multihal/tests/Android.bp +++ b/sensors/common/default/2.X/multihal/tests/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "android.hardware.sensors@2.X-fakesubhal-defaults", srcs: [ diff --git a/sensors/common/utils/Android.bp b/sensors/common/utils/Android.bp index aec6c4b58b..97e857c680 100644 --- a/sensors/common/utils/Android.bp +++ b/sensors/common/utils/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_headers { name: "android.hardware.sensors@2.X-shared-utils", vendor_available: true, diff --git a/sensors/common/vts/2_X/Android.bp b/sensors/common/vts/2_X/Android.bp index e5eceb5ed5..4cf6a08382 100644 --- a/sensors/common/vts/2_X/Android.bp +++ b/sensors/common/vts/2_X/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "VtsHalSensorsV2_XTargetTest-defaults", cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], diff --git a/sensors/common/vts/utils/Android.bp b/sensors/common/vts/utils/Android.bp index baaed6cc20..44bed6e002 100644 --- a/sensors/common/vts/utils/Android.bp +++ b/sensors/common/vts/utils/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalSensorsTargetTestUtils", defaults: ["VtsHalTargetTestDefaults"], diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp index 07c05bc656..996105cc8f 100644 --- a/soundtrigger/2.0/Android.bp +++ b/soundtrigger/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.soundtrigger@2.0", root: "android.hardware", diff --git a/soundtrigger/2.0/default/Android.bp b/soundtrigger/2.0/default/Android.bp index 1f9ae45ed1..8236e3012e 100644 --- a/soundtrigger/2.0/default/Android.bp +++ b/soundtrigger/2.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.soundtrigger@2.0-core", defaults: ["hidl_defaults"], diff --git a/soundtrigger/2.0/default/Android.mk b/soundtrigger/2.0/default/Android.mk index 835a020800..17e44403c0 100644 --- a/soundtrigger/2.0/default/Android.mk +++ b/soundtrigger/2.0/default/Android.mk @@ -18,6 +18,9 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.soundtrigger@2.0-impl +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_VENDOR_MODULE := true LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := \ diff --git a/soundtrigger/2.0/vts/functional/Android.bp b/soundtrigger/2.0/vts/functional/Android.bp index 86697bda3d..403fa9b1e0 100644 --- a/soundtrigger/2.0/vts/functional/Android.bp +++ b/soundtrigger/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSoundtriggerV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/soundtrigger/2.1/Android.bp b/soundtrigger/2.1/Android.bp index 024e0f6b5a..7f6503c81f 100644 --- a/soundtrigger/2.1/Android.bp +++ b/soundtrigger/2.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.soundtrigger@2.1", root: "android.hardware", diff --git a/soundtrigger/2.1/default/Android.mk b/soundtrigger/2.1/default/Android.mk index b8d0407e4e..602f5a7130 100644 --- a/soundtrigger/2.1/default/Android.mk +++ b/soundtrigger/2.1/default/Android.mk @@ -18,6 +18,9 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.soundtrigger@2.1-impl +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_VENDOR_MODULE := true LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := \ diff --git a/soundtrigger/2.1/vts/functional/Android.bp b/soundtrigger/2.1/vts/functional/Android.bp index 9de913b641..b0133509a0 100644 --- a/soundtrigger/2.1/vts/functional/Android.bp +++ b/soundtrigger/2.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSoundtriggerV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/soundtrigger/2.2/Android.bp b/soundtrigger/2.2/Android.bp index dbf4f8bacd..f126eed116 100644 --- a/soundtrigger/2.2/Android.bp +++ b/soundtrigger/2.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.soundtrigger@2.2", root: "android.hardware", diff --git a/soundtrigger/2.2/default/Android.bp b/soundtrigger/2.2/default/Android.bp index db37c5b36a..768b9d6111 100644 --- a/soundtrigger/2.2/default/Android.bp +++ b/soundtrigger/2.2/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.soundtrigger@2.2-impl", relative_install_path: "hw", diff --git a/soundtrigger/2.2/vts/functional/Android.bp b/soundtrigger/2.2/vts/functional/Android.bp index b7967d966f..faf6d58155 100644 --- a/soundtrigger/2.2/vts/functional/Android.bp +++ b/soundtrigger/2.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSoundtriggerV2_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/soundtrigger/2.3/Android.bp b/soundtrigger/2.3/Android.bp index 480df4daa4..e65c0ad953 100644 --- a/soundtrigger/2.3/Android.bp +++ b/soundtrigger/2.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.soundtrigger@2.3", root: "android.hardware", diff --git a/soundtrigger/2.3/default/Android.bp b/soundtrigger/2.3/default/Android.bp index be2c8b0961..acb7ffebb4 100644 --- a/soundtrigger/2.3/default/Android.bp +++ b/soundtrigger/2.3/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.soundtrigger@2.3-impl", relative_install_path: "hw", diff --git a/soundtrigger/2.3/vts/functional/Android.bp b/soundtrigger/2.3/vts/functional/Android.bp index 2c1b9e594e..e613db5093 100644 --- a/soundtrigger/2.3/vts/functional/Android.bp +++ b/soundtrigger/2.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalSoundtriggerV2_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp index 0aeccd6a39..ed0507859f 100644 --- a/tests/bar/1.0/Android.bp +++ b/tests/bar/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.bar@1.0", root: "android.hardware", diff --git a/tests/bar/1.0/default/Android.bp b/tests/bar/1.0/default/Android.bp index 8e3d072318..fd0cf0b145 100644 --- a/tests/bar/1.0/default/Android.bp +++ b/tests/bar/1.0/default/Android.bp @@ -1,5 +1,14 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.bar@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp index ed18876561..0594f295cf 100644 --- a/tests/baz/1.0/Android.bp +++ b/tests/baz/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.baz@1.0", root: "android.hardware", diff --git a/tests/baz/1.0/default/Android.bp b/tests/baz/1.0/default/Android.bp index 4096d47576..64ccb14b36 100644 --- a/tests/baz/1.0/default/Android.bp +++ b/tests/baz/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.baz@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/expression/1.0/Android.bp b/tests/expression/1.0/Android.bp index 4bc3848c9a..8942e76756 100644 --- a/tests/expression/1.0/Android.bp +++ b/tests/expression/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.expression@1.0", root: "android.hardware", diff --git a/tests/extension/light/2.0/Android.bp b/tests/extension/light/2.0/Android.bp index e19a9137c1..9e38ec9425 100644 --- a/tests/extension/light/2.0/Android.bp +++ b/tests/extension/light/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.extension.light@2.0", root: "android.hardware", diff --git a/tests/extension/light/2.0/default/Android.bp b/tests/extension/light/2.0/default/Android.bp index d8d8dd5e40..7a85da6b62 100644 --- a/tests/extension/light/2.0/default/Android.bp +++ b/tests/extension/light/2.0/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.tests.extension.light@2.0-service", defaults: ["hidl_defaults"], diff --git a/tests/extension/vibrator/aidl/Android.bp b/tests/extension/vibrator/aidl/Android.bp index c64779cb4c..4d544e11fb 100644 --- a/tests/extension/vibrator/aidl/Android.bp +++ b/tests/extension/vibrator/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { // This is an example test interface showing how to add functionality // with setExtension/getExtension diff --git a/tests/extension/vibrator/aidl/client/Android.bp b/tests/extension/vibrator/aidl/client/Android.bp index 108d000970..fb34d7e771 100644 --- a/tests/extension/vibrator/aidl/client/Android.bp +++ b/tests/extension/vibrator/aidl/client/Android.bp @@ -2,6 +2,15 @@ // context. All this code would look the same if it was running in system // server for example. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "android.hardware.tests.extension.vibrator-client", srcs: [ diff --git a/tests/extension/vibrator/aidl/default/Android.bp b/tests/extension/vibrator/aidl/default/Android.bp index 2486588225..a200292330 100644 --- a/tests/extension/vibrator/aidl/default/Android.bp +++ b/tests/extension/vibrator/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.tests.extension.vibrator-service.example", relative_install_path: "hw", diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp index 2f97fcaf78..1c6ec5887f 100644 --- a/tests/foo/1.0/Android.bp +++ b/tests/foo/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.foo@1.0", root: "android.hardware", diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp index 48d6894dd0..48f5b75006 100644 --- a/tests/foo/1.0/default/Android.bp +++ b/tests/foo/1.0/default/Android.bp @@ -1,5 +1,14 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.foo@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/foo/1.0/default/lib/Android.bp b/tests/foo/1.0/default/lib/Android.bp index ba2081e779..818e1c3127 100644 --- a/tests/foo/1.0/default/lib/Android.bp +++ b/tests/foo/1.0/default/lib/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "libfootest", defaults: ["hidl_defaults"], diff --git a/tests/hash/1.0/Android.bp b/tests/hash/1.0/Android.bp index 109557629e..4d250bf2cd 100644 --- a/tests/hash/1.0/Android.bp +++ b/tests/hash/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.hash@1.0", root: "android.hardware", diff --git a/tests/hash/1.0/default/Android.bp b/tests/hash/1.0/default/Android.bp index 410b759e38..c1e0d9b5c9 100644 --- a/tests/hash/1.0/default/Android.bp +++ b/tests/hash/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.hash@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/inheritance/1.0/Android.bp b/tests/inheritance/1.0/Android.bp index 0042b57b70..574f8dd599 100644 --- a/tests/inheritance/1.0/Android.bp +++ b/tests/inheritance/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.inheritance@1.0", root: "android.hardware", diff --git a/tests/inheritance/1.0/default/Android.bp b/tests/inheritance/1.0/default/Android.bp index 4a0c876a3a..ff1cf538ac 100644 --- a/tests/inheritance/1.0/default/Android.bp +++ b/tests/inheritance/1.0/default/Android.bp @@ -1,5 +1,14 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.inheritance@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/lazy/1.0/Android.bp b/tests/lazy/1.0/Android.bp index d2f81756e3..3ee307a0fd 100644 --- a/tests/lazy/1.0/Android.bp +++ b/tests/lazy/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.lazy@1.0", root: "android.hardware", diff --git a/tests/lazy/1.1/Android.bp b/tests/lazy/1.1/Android.bp index ccedd8d576..9429a23e87 100644 --- a/tests/lazy/1.1/Android.bp +++ b/tests/lazy/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.lazy@1.1", root: "android.hardware", diff --git a/tests/libhwbinder/1.0/Android.bp b/tests/libhwbinder/1.0/Android.bp index 13af77cc90..8f45656706 100644 --- a/tests/libhwbinder/1.0/Android.bp +++ b/tests/libhwbinder/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.libhwbinder@1.0", root: "android.hardware", diff --git a/tests/libhwbinder/1.0/default/Android.bp b/tests/libhwbinder/1.0/default/Android.bp index 3bf08ed87c..1f8035006a 100644 --- a/tests/libhwbinder/1.0/default/Android.bp +++ b/tests/libhwbinder/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.libhwbinder@1.0-impl.test", defaults: ["hidl_defaults"], diff --git a/tests/libhwbinder/aidl/Android.bp b/tests/libhwbinder/aidl/Android.bp index c9e09f7516..2b83f2b725 100644 --- a/tests/libhwbinder/aidl/Android.bp +++ b/tests/libhwbinder/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.libbinder", defaults: ["hidl_defaults"], diff --git a/tests/memory/1.0/Android.bp b/tests/memory/1.0/Android.bp index 6612e31164..4bb724bcaf 100644 --- a/tests/memory/1.0/Android.bp +++ b/tests/memory/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.memory@1.0", root: "android.hardware", diff --git a/tests/memory/1.0/default/Android.bp b/tests/memory/1.0/default/Android.bp index 0293953b9b..71d1b3d2ba 100644 --- a/tests/memory/1.0/default/Android.bp +++ b/tests/memory/1.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.memory@1.0-impl", defaults: ["hidl_defaults"], @@ -32,4 +41,4 @@ cc_library { // These are static libs only for testing purposes and portability. Shared // libs should be used on device. static_libs: ["android.hardware.tests.memory@1.0"], -}
\ No newline at end of file +} diff --git a/tests/memory/2.0/Android.bp b/tests/memory/2.0/Android.bp index d24bd21312..6eace8d69e 100644 --- a/tests/memory/2.0/Android.bp +++ b/tests/memory/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.memory@2.0", root: "android.hardware", diff --git a/tests/msgq/1.0/Android.bp b/tests/msgq/1.0/Android.bp index eea1ce6029..8dd38702b1 100644 --- a/tests/msgq/1.0/Android.bp +++ b/tests/msgq/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.msgq@1.0", root: "android.hardware", diff --git a/tests/msgq/1.0/default/Android.bp b/tests/msgq/1.0/default/Android.bp index a0d6f31fd9..5f116e7371 100644 --- a/tests/msgq/1.0/default/Android.bp +++ b/tests/msgq/1.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.msgq@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/multithread/1.0/Android.bp b/tests/multithread/1.0/Android.bp index ed3a687777..62bffb3d57 100644 --- a/tests/multithread/1.0/Android.bp +++ b/tests/multithread/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.multithread@1.0", root: "android.hardware", diff --git a/tests/multithread/1.0/default/Android.bp b/tests/multithread/1.0/default/Android.bp index ff899386e3..80ab55ec3b 100644 --- a/tests/multithread/1.0/default/Android.bp +++ b/tests/multithread/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.multithread@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/safeunion/1.0/Android.bp b/tests/safeunion/1.0/Android.bp index f1ec267768..ca1edfc6ea 100644 --- a/tests/safeunion/1.0/Android.bp +++ b/tests/safeunion/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.safeunion@1.0", root: "android.hardware", diff --git a/tests/safeunion/1.0/default/Android.bp b/tests/safeunion/1.0/default/Android.bp index 759a49c63a..94fee852cb 100644 --- a/tests/safeunion/1.0/default/Android.bp +++ b/tests/safeunion/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.safeunion@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tests/safeunion/cpp/1.0/Android.bp b/tests/safeunion/cpp/1.0/Android.bp index 221643a392..6c670f633f 100644 --- a/tests/safeunion/cpp/1.0/Android.bp +++ b/tests/safeunion/cpp/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.safeunion.cpp@1.0", root: "android.hardware", diff --git a/tests/safeunion/cpp/1.0/default/Android.bp b/tests/safeunion/cpp/1.0/default/Android.bp index 618f295f25..25f37508af 100644 --- a/tests/safeunion/cpp/1.0/default/Android.bp +++ b/tests/safeunion/cpp/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.safeunion.cpp@1.0-impl", relative_install_path: "hw", diff --git a/tests/trie/1.0/Android.bp b/tests/trie/1.0/Android.bp index 3cb67c7577..e7025406dc 100644 --- a/tests/trie/1.0/Android.bp +++ b/tests/trie/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tests.trie@1.0", root: "android.hardware", diff --git a/tests/trie/1.0/default/Android.bp b/tests/trie/1.0/default/Android.bp index 4ca705c16d..3690802b66 100644 --- a/tests/trie/1.0/default/Android.bp +++ b/tests/trie/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library { name: "android.hardware.tests.trie@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tetheroffload/config/1.0/Android.bp b/tetheroffload/config/1.0/Android.bp index e774048751..116c9b6264 100644 --- a/tetheroffload/config/1.0/Android.bp +++ b/tetheroffload/config/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tetheroffload.config@1.0", root: "android.hardware", diff --git a/tetheroffload/config/1.0/vts/functional/Android.bp b/tetheroffload/config/1.0/vts/functional/Android.bp index ad5a1b1af4..fe03d8f710 100644 --- a/tetheroffload/config/1.0/vts/functional/Android.bp +++ b/tetheroffload/config/1.0/vts/functional/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTetheroffloadConfigV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tetheroffload/control/1.0/Android.bp b/tetheroffload/control/1.0/Android.bp index 4bcaed2dbf..acb5ee8a1b 100644 --- a/tetheroffload/control/1.0/Android.bp +++ b/tetheroffload/control/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tetheroffload.control@1.0", root: "android.hardware", diff --git a/tetheroffload/control/1.0/vts/functional/Android.bp b/tetheroffload/control/1.0/vts/functional/Android.bp index ddf382626f..dc3b00c1ad 100644 --- a/tetheroffload/control/1.0/vts/functional/Android.bp +++ b/tetheroffload/control/1.0/vts/functional/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTetheroffloadControlV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tetheroffload/control/1.1/Android.bp b/tetheroffload/control/1.1/Android.bp index 18c8ea97d1..e87ff5c71b 100644 --- a/tetheroffload/control/1.1/Android.bp +++ b/tetheroffload/control/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tetheroffload.control@1.1", root: "android.hardware", diff --git a/tetheroffload/control/1.1/vts/functional/Android.bp b/tetheroffload/control/1.1/vts/functional/Android.bp index ab29350805..3eea59ba05 100644 --- a/tetheroffload/control/1.1/vts/functional/Android.bp +++ b/tetheroffload/control/1.1/vts/functional/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTetheroffloadControlV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp index 10eeddc07d..f6cf294017 100644 --- a/thermal/1.0/Android.bp +++ b/thermal/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.thermal@1.0", root: "android.hardware", diff --git a/thermal/1.0/default/Android.bp b/thermal/1.0/default/Android.bp index 194a9f8aa0..18bc046f4e 100644 --- a/thermal/1.0/default/Android.bp +++ b/thermal/1.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.thermal@1.0-impl", defaults: ["hidl_defaults"], diff --git a/thermal/1.0/vts/functional/Android.bp b/thermal/1.0/vts/functional/Android.bp index 5ccf07af17..c73008ac7c 100644 --- a/thermal/1.0/vts/functional/Android.bp +++ b/thermal/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalThermalV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -21,4 +30,3 @@ cc_test { static_libs: ["android.hardware.thermal@1.0"], test_suites: ["general-tests", "vts"], } - diff --git a/thermal/1.1/Android.bp b/thermal/1.1/Android.bp index 7dc30a324d..ef2fa208e6 100644 --- a/thermal/1.1/Android.bp +++ b/thermal/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.thermal@1.1", root: "android.hardware", diff --git a/thermal/1.1/vts/functional/Android.bp b/thermal/1.1/vts/functional/Android.bp index b869ece290..89fef1b890 100644 --- a/thermal/1.1/vts/functional/Android.bp +++ b/thermal/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalThermalV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/thermal/2.0/Android.bp b/thermal/2.0/Android.bp index 3d9cea1230..eb47b38431 100644 --- a/thermal/2.0/Android.bp +++ b/thermal/2.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.thermal@2.0", root: "android.hardware", diff --git a/thermal/2.0/default/Android.bp b/thermal/2.0/default/Android.bp index 7b72694018..a63ffbc34c 100644 --- a/thermal/2.0/default/Android.bp +++ b/thermal/2.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.thermal@2.0-service.mock", defaults: ["hidl_defaults"], diff --git a/thermal/2.0/vts/functional/Android.bp b/thermal/2.0/vts/functional/Android.bp index 026cb62577..f26c1af3b1 100644 --- a/thermal/2.0/vts/functional/Android.bp +++ b/thermal/2.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalThermalV2_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -24,4 +33,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp index 0e0f284d51..889399ab43 100644 --- a/tv/cec/1.0/Android.bp +++ b/tv/cec/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tv.cec@1.0", root: "android.hardware", diff --git a/tv/cec/1.0/default/Android.bp b/tv/cec/1.0/default/Android.bp index 239a527faa..fc4298d86c 100644 --- a/tv/cec/1.0/default/Android.bp +++ b/tv/cec/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.tv.cec@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tv/cec/1.1/Android.bp b/tv/cec/1.1/Android.bp index c2d4e54407..27b4f03767 100644 --- a/tv/cec/1.1/Android.bp +++ b/tv/cec/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tv.cec@1.1", root: "android.hardware", diff --git a/tv/cec/1.1/default/Android.bp b/tv/cec/1.1/default/Android.bp index e0dff0d033..b536d23b29 100644 --- a/tv/cec/1.1/default/Android.bp +++ b/tv/cec/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.tv.cec@1.1-service", defaults: ["hidl_defaults"], diff --git a/tv/cec/1.1/vts/functional/Android.bp b/tv/cec/1.1/vts/functional/Android.bp index 5fc7093fa8..5a6548d4dc 100644 --- a/tv/cec/1.1/vts/functional/Android.bp +++ b/tv/cec/1.1/vts/functional/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTvCecV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp index 1121f4ed46..292ec6331a 100644 --- a/tv/input/1.0/Android.bp +++ b/tv/input/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tv.input@1.0", root: "android.hardware", diff --git a/tv/input/1.0/default/Android.bp b/tv/input/1.0/default/Android.bp index 5f6b7e75be..f572003f1c 100644 --- a/tv/input/1.0/default/Android.bp +++ b/tv/input/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.tv.input@1.0-impl", defaults: ["hidl_defaults"], diff --git a/tv/input/1.0/vts/functional/Android.bp b/tv/input/1.0/vts/functional/Android.bp index 29d4e21de2..fad1c90f61 100644 --- a/tv/input/1.0/vts/functional/Android.bp +++ b/tv/input/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTvInputV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tv/tuner/1.0/Android.bp b/tv/tuner/1.0/Android.bp index e5786418f5..237f4957e2 100644 --- a/tv/tuner/1.0/Android.bp +++ b/tv/tuner/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tv.tuner@1.0", root: "android.hardware", diff --git a/tv/tuner/1.0/default/Android.bp b/tv/tuner/1.0/default/Android.bp index 5711889aa4..ae15b6cc22 100644 --- a/tv/tuner/1.0/default/Android.bp +++ b/tv/tuner/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "tuner_service_defaults", defaults: ["hidl_defaults"], @@ -24,7 +33,7 @@ cc_defaults { "libfmq", "libhidlbase", "libhidlmemory", - "libion", + "libdmabufheap", "liblog", "libstagefright_foundation", "libutils", diff --git a/tv/tuner/1.0/default/Filter.cpp b/tv/tuner/1.0/default/Filter.cpp index ce748e5098..7b50f8ce38 100644 --- a/tv/tuner/1.0/default/Filter.cpp +++ b/tv/tuner/1.0/default/Filter.cpp @@ -16,9 +16,11 @@ #define LOG_TAG "android.hardware.tv.tuner@1.0-Filter" -#include "Filter.h" +#include <BufferAllocator/BufferAllocator.h> #include <utils/Log.h> +#include "Filter.h" + namespace android { namespace hardware { namespace tv { @@ -622,15 +624,15 @@ void Filter::detachFilterFromRecord() { } int Filter::createAvIonFd(int size) { - // Create an ion fd and allocate an av fd mapped to a buffer to it. - int ion_fd = ion_open(); - if (ion_fd == -1) { - ALOGE("[Filter] Failed to open ion fd %d", errno); + // Create an DMA-BUF fd and allocate an av fd mapped to a buffer to it. + auto buffer_allocator = std::make_unique<BufferAllocator>(); + if (!buffer_allocator) { + ALOGE("[Filter] Unable to create BufferAllocator object"); return -1; } int av_fd = -1; - ion_alloc_fd(dup(ion_fd), size, 0 /*align*/, ION_HEAP_SYSTEM_MASK, 0 /*flags*/, &av_fd); - if (av_fd == -1) { + av_fd = buffer_allocator->Alloc("system-uncached", size); + if (av_fd < 0) { ALOGE("[Filter] Failed to create av fd %d", errno); return -1; } diff --git a/tv/tuner/1.0/vts/functional/Android.bp b/tv/tuner/1.0/vts/functional/Android.bp index 7b130ea00b..c27a935c2e 100644 --- a/tv/tuner/1.0/vts/functional/Android.bp +++ b/tv/tuner/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTvTunerV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tv/tuner/1.0/vts/functional/FilterTests.cpp b/tv/tuner/1.0/vts/functional/FilterTests.cpp index 240aa9f149..1a09290725 100644 --- a/tv/tuner/1.0/vts/functional/FilterTests.cpp +++ b/tv/tuner/1.0/vts/functional/FilterTests.cpp @@ -78,24 +78,20 @@ bool FilterCallback::readFilterEventData() { DemuxFilterEvent filterEvent = mFilterEvent; ALOGW("[vts] reading from filter FMQ or buffer %d", mFilterId); // todo separate filter handlers - for (int i = 0; i < filterEvent.events.size(); i++) { - switch (mFilterEventType) { - case FilterEventType::SECTION: - mDataLength = filterEvent.events[i].section().dataLength; + for (auto event : filterEvent.events) { + switch (event.getDiscriminator()) { + case DemuxFilterEvent::Event::hidl_discriminator::section: + mDataLength = event.section().dataLength; break; - case FilterEventType::PES: - mDataLength = filterEvent.events[i].pes().dataLength; - break; - case FilterEventType::MEDIA: - return dumpAvData(filterEvent.events[i].media()); - case FilterEventType::RECORD: - return readRecordData(filterEvent.events[i].tsRecord()); - case FilterEventType::MMTPRECORD: - break; - case FilterEventType::DOWNLOAD: + case DemuxFilterEvent::Event::hidl_discriminator::pes: + mDataLength = event.pes().dataLength; break; + case DemuxFilterEvent::Event::hidl_discriminator::media: + return dumpAvData(event.media()); + case DemuxFilterEvent::Event::hidl_discriminator::tsRecord: + return readRecordData(event.tsRecord()); default: - break; + continue; } // EXPECT_TRUE(mDataLength == goldenDataOutputBuffer.size()) << "buffer size does not // match"; @@ -150,11 +146,6 @@ AssertionResult FilterTests::openFilterInDemux(DemuxFilterType type, uint32_t bu mFilter = filter; status = result; }); - - if (status == Result::SUCCESS) { - mFilterCallback->setFilterEventType(getFilterEventType(type)); - } - return AssertionResult(status == Result::SUCCESS); } diff --git a/tv/tuner/1.0/vts/functional/FilterTests.h b/tv/tuner/1.0/vts/functional/FilterTests.h index c61fa18c3c..7bc4832171 100644 --- a/tv/tuner/1.0/vts/functional/FilterTests.h +++ b/tv/tuner/1.0/vts/functional/FilterTests.h @@ -66,17 +66,6 @@ using ::testing::AssertionResult; using namespace std; -enum FilterEventType : uint8_t { - UNDEFINED, - SECTION, - MEDIA, - PES, - RECORD, - MMTPRECORD, - DOWNLOAD, - TEMI, -}; - using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; using MQDesc = MQDescriptorSync<uint8_t>; @@ -104,7 +93,6 @@ class FilterCallback : public IFilterCallback { void setFilterId(uint32_t filterId) { mFilterId = filterId; } void setFilterInterface(sp<IFilter> filter) { mFilter = filter; } - void setFilterEventType(FilterEventType type) { mFilterEventType = type; } void testFilterDataOutput(); @@ -130,7 +118,6 @@ class FilterCallback : public IFilterCallback { uint32_t mFilterId; sp<IFilter> mFilter; - FilterEventType mFilterEventType; std::unique_ptr<FilterMQ> mFilterMQ; EventFlag* mFilterMQEventFlag; DemuxFilterEvent mFilterEvent; @@ -168,53 +155,6 @@ class FilterTests { AssertionResult closeFilter(uint32_t filterId); AssertionResult closeTimeFilter(); - FilterEventType getFilterEventType(DemuxFilterType type) { - FilterEventType eventType = FilterEventType::UNDEFINED; - switch (type.mainType) { - case DemuxFilterMainType::TS: - switch (type.subType.tsFilterType()) { - case DemuxTsFilterType::UNDEFINED: - break; - case DemuxTsFilterType::SECTION: - eventType = FilterEventType::SECTION; - break; - case DemuxTsFilterType::PES: - eventType = FilterEventType::PES; - break; - case DemuxTsFilterType::TS: - break; - case DemuxTsFilterType::AUDIO: - case DemuxTsFilterType::VIDEO: - eventType = FilterEventType::MEDIA; - break; - case DemuxTsFilterType::PCR: - break; - case DemuxTsFilterType::RECORD: - eventType = FilterEventType::RECORD; - break; - case DemuxTsFilterType::TEMI: - eventType = FilterEventType::TEMI; - break; - } - break; - case DemuxFilterMainType::MMTP: - /*mmtpSettings*/ - break; - case DemuxFilterMainType::IP: - /*ipSettings*/ - break; - case DemuxFilterMainType::TLV: - /*tlvSettings*/ - break; - case DemuxFilterMainType::ALP: - /*alpSettings*/ - break; - default: - break; - } - return eventType; - } - protected: static AssertionResult failure() { return ::testing::AssertionFailure(); } diff --git a/tv/tuner/1.1/Android.bp b/tv/tuner/1.1/Android.bp index daa3683fd7..40bea6f7c8 100644 --- a/tv/tuner/1.1/Android.bp +++ b/tv/tuner/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.tv.tuner@1.1", root: "android.hardware", diff --git a/tv/tuner/1.1/default/Android.bp b/tv/tuner/1.1/default/Android.bp index 4401f7cd2c..a612802527 100644 --- a/tv/tuner/1.1/default/Android.bp +++ b/tv/tuner/1.1/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "tuner_service_defaults@1.1", defaults: ["hidl_defaults"], @@ -22,6 +31,7 @@ cc_defaults { "android.hardware.tv.tuner@1.1", "android.hidl.memory@1.0", "libcutils", + "libdmabufheap", "libfmq", "libhidlbase", "libhidlmemory", diff --git a/tv/tuner/1.1/default/Demux.cpp b/tv/tuner/1.1/default/Demux.cpp index 66c95dc3c2..db25c2e43d 100644 --- a/tv/tuner/1.1/default/Demux.cpp +++ b/tv/tuner/1.1/default/Demux.cpp @@ -27,12 +27,16 @@ namespace V1_0 { namespace implementation { #define WAIT_TIMEOUT 3000000000 + Demux::Demux(uint32_t demuxId, sp<Tuner> tuner) { mDemuxId = demuxId; mTunerService = tuner; } -Demux::~Demux() {} +Demux::~Demux() { + mFrontendInputThreadRunning = false; + std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); +} Return<Result> Demux::setFrontendDataSource(uint32_t frontendId) { ALOGV("%s", __FUNCTION__); @@ -171,6 +175,8 @@ Return<Result> Demux::close() { mFilters.clear(); mLastUsedFilterId = -1; mTunerService->removeDemux(mDemuxId); + mFrontendInputThreadRunning = false; + std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); return Result::SUCCESS; } @@ -322,6 +328,7 @@ uint16_t Demux::getFilterTpid(uint64_t filterId) { } void Demux::startFrontendInputLoop() { + mFrontendInputThreadRunning = true; pthread_create(&mFrontendInputThread, NULL, __threadLoopFrontend, this); pthread_setname_np(mFrontendInputThread, "frontend_input_thread"); } @@ -333,9 +340,11 @@ void* Demux::__threadLoopFrontend(void* user) { } void Demux::frontendInputThreadLoop() { - std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); - mFrontendInputThreadRunning = true; + if (!mFrontendInputThreadRunning) { + return; + } + std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); if (!mDvrPlayback) { ALOGW("[Demux] No software Frontend input configured. Ending Frontend thread loop."); mFrontendInputThreadRunning = false; diff --git a/tv/tuner/1.1/default/Dvr.cpp b/tv/tuner/1.1/default/Dvr.cpp index 3a4ef1bee7..93bb6a875b 100644 --- a/tv/tuner/1.1/default/Dvr.cpp +++ b/tv/tuner/1.1/default/Dvr.cpp @@ -37,7 +37,10 @@ Dvr::Dvr(DvrType type, uint32_t bufferSize, const sp<IDvrCallback>& cb, sp<Demux mDemux = demux; } -Dvr::~Dvr() {} +Dvr::~Dvr() { + mDvrThreadRunning = false; + lock_guard<mutex> lock(mDvrThreadLock); +} Return<void> Dvr::getQueueDesc(getQueueDesc_cb _hidl_cb) { ALOGV("%s", __FUNCTION__); @@ -118,6 +121,9 @@ Return<Result> Dvr::detachFilter(const sp<V1_0::IFilter>& filter) { Return<Result> Dvr::start() { ALOGV("%s", __FUNCTION__); + if (mDvrThreadRunning) { + return Result::SUCCESS; + } if (!mCallback) { return Result::NOT_INITIALIZED; @@ -128,6 +134,7 @@ Return<Result> Dvr::start() { } if (mType == DvrType::PLAYBACK) { + mDvrThreadRunning = true; pthread_create(&mDvrThread, NULL, __threadLoopPlayback, this); pthread_setname_np(mDvrThread, "playback_waiting_loop"); } else if (mType == DvrType::RECORD) { @@ -144,7 +151,6 @@ Return<Result> Dvr::stop() { ALOGV("%s", __FUNCTION__); mDvrThreadRunning = false; - lock_guard<mutex> lock(mDvrThreadLock); mIsRecordStarted = false; @@ -164,6 +170,8 @@ Return<Result> Dvr::flush() { Return<Result> Dvr::close() { ALOGV("%s", __FUNCTION__); + mDvrThreadRunning = false; + lock_guard<mutex> lock(mDvrThreadLock); return Result::SUCCESS; } @@ -199,7 +207,6 @@ void* Dvr::__threadLoopPlayback(void* user) { void Dvr::playbackThreadLoop() { ALOGD("[Dvr] playback threadLoop start."); lock_guard<mutex> lock(mDvrThreadLock); - mDvrThreadRunning = true; while (mDvrThreadRunning) { uint32_t efState = 0; diff --git a/tv/tuner/1.1/default/Filter.cpp b/tv/tuner/1.1/default/Filter.cpp index 6b2413c97e..7d609ea3dc 100644 --- a/tv/tuner/1.1/default/Filter.cpp +++ b/tv/tuner/1.1/default/Filter.cpp @@ -16,9 +16,11 @@ #define LOG_TAG "android.hardware.tv.tuner@1.1-Filter" -#include "Filter.h" +#include <BufferAllocator/BufferAllocator.h> #include <utils/Log.h> +#include "Filter.h" + namespace android { namespace hardware { namespace tv { @@ -72,12 +74,14 @@ Filter::Filter(DemuxFilterType type, uint64_t filterId, uint32_t bufferSize, sp<V1_1::IFilterCallback> filterCallback_v1_1 = V1_1::IFilterCallback::castFrom(cb); if (filterCallback_v1_1 != NULL) { mCallback_1_1 = filterCallback_v1_1; - } else { - mCallback = cb; } + mCallback = cb; } -Filter::~Filter() {} +Filter::~Filter() { + mFilterThreadRunning = false; + std::lock_guard<std::mutex> lock(mFilterThreadLock); +} Return<void> Filter::getId64Bit(getId64Bit_cb _hidl_cb) { ALOGV("%s", __FUNCTION__); @@ -137,15 +141,54 @@ Return<Result> Filter::configure(const DemuxFilterSettings& settings) { Return<Result> Filter::start() { ALOGV("%s", __FUNCTION__); - + mFilterThreadRunning = true; + // All the filter event callbacks in start are for testing purpose. + switch (mType.mainType) { + case DemuxFilterMainType::TS: + mCallback->onFilterEvent(createMediaEvent()); + mCallback->onFilterEvent(createTsRecordEvent()); + mCallback->onFilterEvent(createTemiEvent()); + // clients could still pass 1.0 callback + if (mCallback_1_1 != NULL) { + mCallback_1_1->onFilterEvent_1_1(createTsRecordEvent(), createTsRecordEventExt()); + } + break; + case DemuxFilterMainType::MMTP: + mCallback->onFilterEvent(createDownloadEvent()); + mCallback->onFilterEvent(createMmtpRecordEvent()); + if (mCallback_1_1 != NULL) { + mCallback_1_1->onFilterEvent_1_1(createMmtpRecordEvent(), + createMmtpRecordEventExt()); + } + break; + case DemuxFilterMainType::IP: + mCallback->onFilterEvent(createSectionEvent()); + mCallback->onFilterEvent(createIpPayloadEvent()); + break; + case DemuxFilterMainType::TLV: { + if (mCallback_1_1 != NULL) { + DemuxFilterEvent emptyFilterEvent; + mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, createMonitorEvent()); + } + break; + } + case DemuxFilterMainType::ALP: { + if (mCallback_1_1 != NULL) { + DemuxFilterEvent emptyFilterEvent; + mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, createRestartEvent()); + } + break; + } + default: + break; + } return startFilterLoop(); } Return<Result> Filter::stop() { ALOGV("%s", __FUNCTION__); - mFilterThreadRunning = false; - + std::lock_guard<std::mutex> lock(mFilterThreadLock); return Result::SUCCESS; } @@ -185,6 +228,8 @@ Return<Result> Filter::releaseAvHandle(const hidl_handle& avMemory, uint64_t avD Return<Result> Filter::close() { ALOGV("%s", __FUNCTION__); + mFilterThreadRunning = false; + std::lock_guard<std::mutex> lock(mFilterThreadLock); return mDemux->removeFilter(mFilterId); } @@ -216,11 +261,14 @@ Return<void> Filter::getAvSharedHandle(getAvSharedHandle_cb _hidl_cb) { int av_fd = createAvIonFd(BUFFER_SIZE_16M); if (av_fd == -1) { _hidl_cb(Result::UNKNOWN_ERROR, NULL, 0); + return Void(); } native_handle_t* nativeHandle = createNativeHandle(av_fd); if (nativeHandle == NULL) { + ::close(av_fd); _hidl_cb(Result::UNKNOWN_ERROR, NULL, 0); + return Void(); } mSharedAvMemHandle.setTo(nativeHandle, /*shouldOwn=*/true); ::close(av_fd); @@ -331,9 +379,11 @@ void* Filter::__threadLoopFilter(void* user) { } void Filter::filterThreadLoop() { - ALOGD("[Filter] filter %" PRIu64 " threadLoop start.", mFilterId); + if (!mFilterThreadRunning) { + return; + } std::lock_guard<std::mutex> lock(mFilterThreadLock); - mFilterThreadRunning = true; + ALOGD("[Filter] filter %" PRIu64 " threadLoop start.", mFilterId); // For the first time of filter output, implementation needs to send the filter // Event Callback without waiting for the DATA_CONSUMED to init the process. @@ -382,6 +432,9 @@ void Filter::filterThreadLoop() { // We do not wait for the last round of written data to be read to finish the thread // because the VTS can verify the reading itself. for (int i = 0; i < SECTION_WRITE_COUNT; i++) { + if (!mFilterThreadRunning) { + break; + } while (mFilterThreadRunning && mIsUsingFMQ) { status_t status = mFilterEventFlag->wait( static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_CONSUMED), &efState, @@ -417,9 +470,8 @@ void Filter::filterThreadLoop() { break; } } - mFilterThreadRunning = false; + break; } - ALOGD("[Filter] filter thread ended."); } @@ -779,15 +831,15 @@ void Filter::detachFilterFromRecord() { } int Filter::createAvIonFd(int size) { - // Create an ion fd and allocate an av fd mapped to a buffer to it. - int ion_fd = ion_open(); - if (ion_fd == -1) { - ALOGE("[Filter] Failed to open ion fd %d", errno); + // Create an DMA-BUF fd and allocate an av fd mapped to a buffer to it. + auto buffer_allocator = std::make_unique<BufferAllocator>(); + if (!buffer_allocator) { + ALOGE("[Filter] Unable to create BufferAllocator object"); return -1; } int av_fd = -1; - ion_alloc_fd(dup(ion_fd), size, 0 /*align*/, ION_HEAP_SYSTEM_MASK, 0 /*flags*/, &av_fd); - if (av_fd == -1) { + av_fd = buffer_allocator->Alloc("system-uncached", size); + if (av_fd < 0) { ALOGE("[Filter] Failed to create av fd %d", errno); return -1; } @@ -918,6 +970,182 @@ bool Filter::sameFile(int fd1, int fd2) { } return (stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino); } + +DemuxFilterEvent Filter::createMediaEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].media({ + .streamId = 1, + .isPtsPresent = true, + .pts = 2, + .dataLength = 3, + .offset = 4, + .isSecureMemory = true, + .mpuSequenceNumber = 6, + .isPesPrivateData = true, + }); + + event.events[0].media().extraMetaData.audio({ + .adFade = 1, + .adPan = 2, + .versionTextTag = 3, + .adGainCenter = 4, + .adGainFront = 5, + .adGainSurround = 6, + }); + + int av_fd = createAvIonFd(BUFFER_SIZE_16M); + if (av_fd == -1) { + return event; + } + + native_handle_t* nativeHandle = createNativeHandle(av_fd); + if (nativeHandle == NULL) { + ::close(av_fd); + ALOGE("[Filter] Failed to create native_handle %d", errno); + return event; + } + + // Create a dataId and add a <dataId, av_fd> pair into the dataId2Avfd map + uint64_t dataId = mLastUsedDataId++ /*createdUID*/; + mDataId2Avfd[dataId] = dup(av_fd); + event.events[0].media().avDataId = dataId; + + hidl_handle handle; + handle.setTo(nativeHandle, /*shouldOwn=*/true); + event.events[0].media().avMemory = std::move(handle); + ::close(av_fd); + + return event; +} + +DemuxFilterEvent Filter::createTsRecordEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + DemuxPid pid; + pid.tPid(1); + DemuxFilterTsRecordEvent::ScIndexMask mask; + mask.sc(1); + event.events[0].tsRecord({ + .pid = pid, + .tsIndexMask = 1, + .scIndexMask = mask, + .byteNumber = 2, + }); + return event; +} + +V1_1::DemuxFilterEventExt Filter::createTsRecordEventExt() { + V1_1::DemuxFilterEventExt event; + event.events.resize(1); + + event.events[0].tsRecord({ + .pts = 1, + .firstMbInSlice = 2, // random address + }); + return event; +} + +DemuxFilterEvent Filter::createMmtpRecordEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].mmtpRecord({ + .scHevcIndexMask = 1, + .byteNumber = 2, + }); + return event; +} + +V1_1::DemuxFilterEventExt Filter::createMmtpRecordEventExt() { + V1_1::DemuxFilterEventExt event; + event.events.resize(1); + + event.events[0].mmtpRecord({ + .pts = 1, + .mpuSequenceNumber = 2, + .firstMbInSlice = 3, + .tsIndexMask = 4, + }); + return event; +} + +DemuxFilterEvent Filter::createSectionEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].section({ + .tableId = 1, + .version = 2, + .sectionNum = 3, + .dataLength = 0, + }); + return event; +} + +DemuxFilterEvent Filter::createPesEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].pes({ + .streamId = static_cast<DemuxStreamId>(1), + .dataLength = 1, + .mpuSequenceNumber = 2, + }); + return event; +} + +DemuxFilterEvent Filter::createDownloadEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].download({ + .itemId = 1, + .mpuSequenceNumber = 2, + .itemFragmentIndex = 3, + .lastItemFragmentIndex = 4, + .dataLength = 0, + }); + return event; +} + +DemuxFilterEvent Filter::createIpPayloadEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].ipPayload({ + .dataLength = 0, + }); + return event; +} + +DemuxFilterEvent Filter::createTemiEvent() { + DemuxFilterEvent event; + event.events.resize(1); + + event.events[0].temi({.pts = 1, .descrTag = 2, .descrData = {3}}); + return event; +} + +V1_1::DemuxFilterEventExt Filter::createMonitorEvent() { + V1_1::DemuxFilterEventExt event; + event.events.resize(1); + + V1_1::DemuxFilterMonitorEvent monitor; + monitor.scramblingStatus(V1_1::ScramblingStatus::SCRAMBLED); + event.events[0].monitorEvent(monitor); + return event; +} + +V1_1::DemuxFilterEventExt Filter::createRestartEvent() { + V1_1::DemuxFilterEventExt event; + event.events.resize(1); + + event.events[0].startId(1); + return event; +} } // namespace implementation } // namespace V1_0 } // namespace tuner diff --git a/tv/tuner/1.1/default/Filter.h b/tv/tuner/1.1/default/Filter.h index 3a4246e095..659bebf178 100644 --- a/tv/tuner/1.1/default/Filter.h +++ b/tv/tuner/1.1/default/Filter.h @@ -198,6 +198,18 @@ class Filter : public V1_1::IFilter { Result createShareMemMediaEvents(vector<uint8_t> output); bool sameFile(int fd1, int fd2); + DemuxFilterEvent createMediaEvent(); + DemuxFilterEvent createTsRecordEvent(); + V1_1::DemuxFilterEventExt createTsRecordEventExt(); + DemuxFilterEvent createMmtpRecordEvent(); + V1_1::DemuxFilterEventExt createMmtpRecordEventExt(); + DemuxFilterEvent createSectionEvent(); + DemuxFilterEvent createPesEvent(); + DemuxFilterEvent createDownloadEvent(); + DemuxFilterEvent createIpPayloadEvent(); + DemuxFilterEvent createTemiEvent(); + V1_1::DemuxFilterEventExt createMonitorEvent(); + V1_1::DemuxFilterEventExt createRestartEvent(); /** * Lock to protect writes to the FMQs */ diff --git a/tv/tuner/1.1/default/Frontend.cpp b/tv/tuner/1.1/default/Frontend.cpp index 243891c996..e3fbdadc3f 100644 --- a/tv/tuner/1.1/default/Frontend.cpp +++ b/tv/tuner/1.1/default/Frontend.cpp @@ -88,18 +88,6 @@ Return<Result> Frontend::stopTune() { Return<Result> Frontend::scan(const FrontendSettings& settings, FrontendScanType type) { ALOGV("%s", __FUNCTION__); - - if (mType == FrontendType::ATSC) { - FrontendScanMessage msg; - msg.isLocked(true); - mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg); - mIsLocked = true; - return Result::SUCCESS; - } - if (mType != FrontendType::DVBT) { - return Result::UNAVAILABLE; - } - FrontendScanMessage msg; if (mIsLocked) { @@ -108,15 +96,96 @@ Return<Result> Frontend::scan(const FrontendSettings& settings, FrontendScanType return Result::SUCCESS; } - uint32_t frequency = settings.dvbt().frequency; + uint32_t frequency; + switch (settings.getDiscriminator()) { + case FrontendSettings::hidl_discriminator::analog: + frequency = settings.analog().frequency; + break; + case FrontendSettings::hidl_discriminator::atsc: + frequency = settings.atsc().frequency; + break; + case FrontendSettings::hidl_discriminator::atsc3: + frequency = settings.atsc3().frequency; + break; + case FrontendSettings::hidl_discriminator::dvbs: + frequency = settings.dvbs().frequency; + break; + case FrontendSettings::hidl_discriminator::dvbc: + frequency = settings.dvbc().frequency; + break; + case FrontendSettings::hidl_discriminator::dvbt: + frequency = settings.dvbt().frequency; + break; + case FrontendSettings::hidl_discriminator::isdbs: + frequency = settings.isdbs().frequency; + break; + case FrontendSettings::hidl_discriminator::isdbs3: + frequency = settings.isdbs3().frequency; + break; + case FrontendSettings::hidl_discriminator::isdbt: + frequency = settings.isdbt().frequency; + break; + } + if (type == FrontendScanType::SCAN_BLIND) { frequency += 100; } + msg.frequencies({frequency}); mCallback->onScanMessage(FrontendScanMessageType::FREQUENCY, msg); - msg.isLocked(true); - mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg); - mIsLocked = true; + + msg.progressPercent(20); + mCallback->onScanMessage(FrontendScanMessageType::PROGRESS_PERCENT, msg); + + msg.symbolRates({30}); + mCallback->onScanMessage(FrontendScanMessageType::SYMBOL_RATE, msg); + + if (mType == FrontendType::DVBT) { + msg.hierarchy(FrontendDvbtHierarchy::HIERARCHY_NON_NATIVE); + mCallback->onScanMessage(FrontendScanMessageType::HIERARCHY, msg); + } + + if (mType == FrontendType::ANALOG) { + msg.analogType(FrontendAnalogType::PAL); + mCallback->onScanMessage(FrontendScanMessageType::ANALOG_TYPE, msg); + } + + msg.plpIds({3}); + mCallback->onScanMessage(FrontendScanMessageType::PLP_IDS, msg); + + msg.groupIds({2}); + mCallback->onScanMessage(FrontendScanMessageType::GROUP_IDS, msg); + + msg.inputStreamIds({1}); + mCallback->onScanMessage(FrontendScanMessageType::INPUT_STREAM_IDS, msg); + + FrontendScanMessage::Standard s; + switch (mType) { + case FrontendType::DVBT: + s.tStd(FrontendDvbtStandard::AUTO); + msg.std(s); + mCallback->onScanMessage(FrontendScanMessageType::STANDARD, msg); + break; + case FrontendType::DVBS: + s.sStd(FrontendDvbsStandard::AUTO); + msg.std(s); + mCallback->onScanMessage(FrontendScanMessageType::STANDARD, msg); + break; + case FrontendType::ANALOG: + s.sifStd(FrontendAnalogSifStandard::AUTO); + msg.std(s); + mCallback->onScanMessage(FrontendScanMessageType::STANDARD, msg); + break; + default: + break; + } + + FrontendScanAtsc3PlpInfo info{ + .plpId = 1, + .bLlsFlag = false, + }; + msg.atsc3PlpInfos({info}); + mCallback->onScanMessage(FrontendScanMessageType::ATSC3_PLP_INFO, msg); sp<V1_1::IFrontendCallback> frontendCallback_v1_1 = V1_1::IFrontendCallback::castFrom(mCallback); @@ -129,15 +198,20 @@ Return<Result> Frontend::scan(const FrontendSettings& settings, FrontendScanType frontendCallback_v1_1->onScanMessageExt1_1( V1_1::FrontendScanMessageTypeExt1_1::HIGH_PRIORITY, msg); } else { - ALOGD("[Filter] Couldn't cast to V1_1 IFrontendCallback"); + ALOGD("[Frontend] Couldn't cast to V1_1 IFrontendCallback"); } + msg.isLocked(true); + mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg); + mIsLocked = true; + return Result::SUCCESS; } Return<Result> Frontend::scan_1_1(const FrontendSettings& settings, FrontendScanType type, - const V1_1::FrontendSettingsExt1_1& /*settingsExt1_1*/) { + const V1_1::FrontendSettingsExt1_1& settingsExt1_1) { ALOGV("%s", __FUNCTION__); + ALOGD("[Frontend] scan_1_1 end frequency %d", settingsExt1_1.endFrequency); return scan(settings, type); } @@ -196,8 +270,38 @@ Return<void> Frontend::getStatus(const hidl_vec<FrontendStatusType>& statusTypes } case FrontendStatusType::MODULATION: { FrontendModulationStatus modulationStatus; - modulationStatus.isdbs(FrontendIsdbsModulation::MOD_BPSK); // value = 1 << 1 - status.modulation(modulationStatus); + switch (mType) { + case FrontendType::ISDBS: { + modulationStatus.isdbs( + FrontendIsdbsModulation::MOD_BPSK); // value = 1 << 1 + status.modulation(modulationStatus); + break; + } + case FrontendType::DVBC: { + modulationStatus.dvbc(FrontendDvbcModulation::MOD_16QAM); // value = 1 << 1 + status.modulation(modulationStatus); + break; + } + case FrontendType::DVBS: { + modulationStatus.dvbs(FrontendDvbsModulation::MOD_QPSK); // value = 1 << 1 + status.modulation(modulationStatus); + break; + } + case FrontendType::ISDBS3: { + modulationStatus.isdbs3( + FrontendIsdbs3Modulation::MOD_BPSK); // value = 1 << 1 + status.modulation(modulationStatus); + break; + } + case FrontendType::ISDBT: { + modulationStatus.isdbt( + FrontendIsdbtModulation::MOD_DQPSK); // value = 1 << 1 + status.modulation(modulationStatus); + break; + } + default: + break; + } break; } case FrontendStatusType::SPECTRAL: { @@ -282,15 +386,70 @@ Return<void> Frontend::getStatusExt1_1(const hidl_vec<V1_1::FrontendStatusTypeEx V1_1::FrontendStatusTypeExt1_1 type = statusTypes[i]; V1_1::FrontendStatusExt1_1 status; - // assign randomly selected values for testing. - // TODO: assign status values according to the frontend type switch (type) { case V1_1::FrontendStatusTypeExt1_1::MODULATIONS: { vector<V1_1::FrontendModulation> modulations; V1_1::FrontendModulation modulation; - modulation.isdbs(FrontendIsdbsModulation::MOD_BPSK); // value = 1 << 1 - modulations.push_back(modulation); - status.modulations(modulations); + switch ((int)mType) { + case (int)FrontendType::ISDBS: { + modulation.isdbs(FrontendIsdbsModulation::MOD_BPSK); // value = 1 << 1 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::DVBC: { + modulation.dvbc(FrontendDvbcModulation::MOD_16QAM); // value = 1 << 1 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::DVBS: { + modulation.dvbs(FrontendDvbsModulation::MOD_QPSK); // value = 1 << 1 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::DVBT: { + // value = 1 << 16 + modulation.dvbt(V1_1::FrontendDvbtConstellation::CONSTELLATION_16QAM_R); + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::ISDBS3: { + modulation.isdbs3(FrontendIsdbs3Modulation::MOD_BPSK); // value = 1 << 1 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::ISDBT: { + modulation.isdbt(FrontendIsdbtModulation::MOD_DQPSK); // value = 1 << 1 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::ATSC: { + modulation.atsc(FrontendAtscModulation::MOD_8VSB); // value = 1 << 2 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)FrontendType::ATSC3: { + modulation.atsc3(FrontendAtsc3Modulation::MOD_QPSK); // value = 1 << 1 + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + case (int)V1_1::FrontendType::DTMB: { + // value = 1 << 1 + modulation.dtmb(V1_1::FrontendDtmbModulation::CONSTELLATION_4QAM); + modulations.push_back(modulation); + status.modulations(modulations); + break; + } + default: + break; + } break; } case V1_1::FrontendStatusTypeExt1_1::BERS: { @@ -306,20 +465,86 @@ Return<void> Frontend::getStatusExt1_1(const hidl_vec<V1_1::FrontendStatusTypeEx } case V1_1::FrontendStatusTypeExt1_1::BANDWIDTH: { V1_1::FrontendBandwidth bandwidth; - bandwidth.dvbt(FrontendDvbtBandwidth::BANDWIDTH_8MHZ); - status.bandwidth(bandwidth); + switch ((int)mType) { + case (int)FrontendType::DVBC: { + // value = 1 << 1 + bandwidth.dvbc(V1_1::FrontendDvbcBandwidth::BANDWIDTH_6MHZ); + status.bandwidth(bandwidth); + break; + } + case (int)FrontendType::DVBT: { + // value = 1 << 1 + bandwidth.dvbt(FrontendDvbtBandwidth::BANDWIDTH_8MHZ); + status.bandwidth(bandwidth); + break; + } + case (int)FrontendType::ISDBT: { + bandwidth.isdbt(FrontendIsdbtBandwidth::BANDWIDTH_8MHZ); // value = 1 << 1 + status.bandwidth(bandwidth); + break; + } + case (int)FrontendType::ATSC3: { + bandwidth.atsc3(FrontendAtsc3Bandwidth::BANDWIDTH_6MHZ); // value = 1 << 1 + status.bandwidth(bandwidth); + break; + } + case (int)V1_1::FrontendType::DTMB: { + // value = 1 << 1 + bandwidth.dtmb(V1_1::FrontendDtmbBandwidth::BANDWIDTH_8MHZ); + status.bandwidth(bandwidth); + break; + } + default: + break; + } break; } case V1_1::FrontendStatusTypeExt1_1::GUARD_INTERVAL: { V1_1::FrontendGuardInterval interval; - interval.dvbt(FrontendDvbtGuardInterval::INTERVAL_1_32); // value = 1 << 1 - status.interval(interval); + switch ((int)mType) { + case (int)FrontendType::DVBT: { + interval.dvbt(FrontendDvbtGuardInterval::INTERVAL_1_32); // value = 1 << 1 + status.interval(interval); + break; + } + case (int)FrontendType::ISDBT: { + interval.isdbt(FrontendDvbtGuardInterval::INTERVAL_1_32); // value = 1 << 1 + status.interval(interval); + break; + } + case (int)V1_1::FrontendType::DTMB: { + // value = 1 << 1 + interval.dtmb(V1_1::FrontendDtmbGuardInterval::PN_420_VARIOUS); + status.interval(interval); + break; + } + default: + break; + } break; } case V1_1::FrontendStatusTypeExt1_1::TRANSMISSION_MODE: { V1_1::FrontendTransmissionMode transMode; - transMode.dvbt(V1_1::FrontendDvbtTransmissionMode::AUTO); // value = 1 << 0 - status.transmissionMode(transMode); + switch ((int)mType) { + case (int)FrontendType::DVBT: { + // value = 1 << 8 + transMode.dvbt(V1_1::FrontendDvbtTransmissionMode::MODE_16K_E); + status.transmissionMode(transMode); + break; + } + case (int)FrontendType::ISDBT: { + transMode.isdbt(FrontendIsdbtMode::MODE_1); // value = 1 << 1 + status.transmissionMode(transMode); + break; + } + case (int)V1_1::FrontendType::DTMB: { + transMode.dtmb(V1_1::FrontendDtmbTransmissionMode::C1); // value = 1 << 1 + status.transmissionMode(transMode); + break; + } + default: + break; + } break; } case V1_1::FrontendStatusTypeExt1_1::UEC: { @@ -332,9 +557,32 @@ Return<void> Frontend::getStatusExt1_1(const hidl_vec<V1_1::FrontendStatusTypeEx } case V1_1::FrontendStatusTypeExt1_1::INTERLEAVINGS: { V1_1::FrontendInterleaveMode interleave; - interleave.atsc3(FrontendAtsc3TimeInterleaveMode::AUTO); - vector<V1_1::FrontendInterleaveMode> interleaving = {interleave}; - status.interleaving(interleaving); + switch ((int)mType) { + case (int)FrontendType::DVBC: { + // value = 1 << 1 + interleave.dvbc( + V1_1::FrontendCableTimeInterleaveMode::INTERLEAVING_128_1_0); + vector<V1_1::FrontendInterleaveMode> interleaving = {interleave}; + status.interleaving(interleaving); + break; + } + case (int)FrontendType::ATSC3: { + // value = 1 << 1 + interleave.atsc3(FrontendAtsc3TimeInterleaveMode::CTI); + vector<V1_1::FrontendInterleaveMode> interleaving = {interleave}; + status.interleaving(interleaving); + break; + } + case (int)V1_1::FrontendType::DTMB: { + // value = 1 << 1 + interleave.dtmb(V1_1::FrontendDtmbTimeInterleaveMode::TIMER_INT_240); + vector<V1_1::FrontendInterleaveMode> interleaving = {interleave}; + status.interleaving(interleaving); + break; + } + default: + break; + } break; } case V1_1::FrontendStatusTypeExt1_1::ISDBT_SEGMENTS: { @@ -349,8 +597,28 @@ Return<void> Frontend::getStatusExt1_1(const hidl_vec<V1_1::FrontendStatusTypeEx } case V1_1::FrontendStatusTypeExt1_1::ROLL_OFF: { V1_1::FrontendRollOff rollOff; - rollOff.isdbs(FrontendIsdbsRolloff::ROLLOFF_0_35); - status.rollOff(rollOff); + switch (mType) { + case FrontendType::DVBS: { + // value = 1 + rollOff.dvbs(FrontendDvbsRolloff::ROLLOFF_0_35); + status.rollOff(rollOff); + break; + } + case FrontendType::ISDBS: { + // value = 1 + rollOff.isdbs(FrontendIsdbsRolloff::ROLLOFF_0_35); + status.rollOff(rollOff); + break; + } + case FrontendType::ISDBS3: { + // value = 1 + rollOff.isdbs3(FrontendIsdbs3Rolloff::ROLLOFF_0_03); + status.rollOff(rollOff); + break; + } + default: + break; + } break; } case V1_1::FrontendStatusTypeExt1_1::IS_MISO: { diff --git a/tv/tuner/1.1/default/Tuner.cpp b/tv/tuner/1.1/default/Tuner.cpp index 6cc99494bb..38b2a26da0 100644 --- a/tv/tuner/1.1/default/Tuner.cpp +++ b/tv/tuner/1.1/default/Tuner.cpp @@ -33,38 +33,91 @@ namespace implementation { Tuner::Tuner() { // Static Frontends array to maintain local frontends information // Array index matches their FrontendId in the default impl - mFrontendSize = 9; + mFrontendSize = 10; mFrontends[0] = new Frontend(FrontendType::ISDBS, 0, this); - mFrontends[1] = new Frontend(FrontendType::ATSC, 1, this); + mFrontends[1] = new Frontend(FrontendType::ATSC3, 1, this); mFrontends[2] = new Frontend(FrontendType::DVBC, 2, this); mFrontends[3] = new Frontend(FrontendType::DVBS, 3, this); mFrontends[4] = new Frontend(FrontendType::DVBT, 4, this); mFrontends[5] = new Frontend(FrontendType::ISDBT, 5, this); mFrontends[6] = new Frontend(FrontendType::ANALOG, 6, this); mFrontends[7] = new Frontend(FrontendType::ATSC, 7, this); - mFrontends[8] = - new Frontend(static_cast<V1_0::FrontendType>(V1_1::FrontendType::DTMB), 8, this); + mFrontends[8] = new Frontend(FrontendType::ISDBS3, 8, this); + mFrontends[9] = + new Frontend(static_cast<V1_0::FrontendType>(V1_1::FrontendType::DTMB), 9, this); FrontendInfo::FrontendCapabilities caps; + vector<FrontendStatusType> statusCaps; + caps = FrontendInfo::FrontendCapabilities(); caps.isdbsCaps(FrontendIsdbsCapabilities()); mFrontendCaps[0] = caps; + statusCaps = { + FrontendStatusType::DEMOD_LOCK, + FrontendStatusType::SNR, + FrontendStatusType::FEC, + FrontendStatusType::MODULATION, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::ROLL_OFF), + }; + mFrontendStatusCaps[0] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); - caps.atscCaps(FrontendAtscCapabilities()); + caps.atsc3Caps(FrontendAtsc3Capabilities()); mFrontendCaps[1] = caps; + statusCaps = { + FrontendStatusType::BER, + FrontendStatusType::PER, + FrontendStatusType::ATSC3_PLP_INFO, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::BERS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::INTERLEAVINGS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::BANDWIDTH), + }; + mFrontendStatusCaps[1] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); caps.dvbcCaps(FrontendDvbcCapabilities()); mFrontendCaps[2] = caps; + statusCaps = { + FrontendStatusType::PRE_BER, + FrontendStatusType::SIGNAL_QUALITY, + FrontendStatusType::MODULATION, + FrontendStatusType::SPECTRAL, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::CODERATES), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::INTERLEAVINGS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::BANDWIDTH), + }; + mFrontendStatusCaps[2] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); caps.dvbsCaps(FrontendDvbsCapabilities()); mFrontendCaps[3] = caps; + statusCaps = { + FrontendStatusType::SIGNAL_STRENGTH, + FrontendStatusType::SYMBOL_RATE, + FrontendStatusType::MODULATION, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::ROLL_OFF), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::IS_MISO), + }; + mFrontendStatusCaps[3] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); caps.dvbtCaps(FrontendDvbtCapabilities()); mFrontendCaps[4] = caps; + statusCaps = { + FrontendStatusType::EWBS, + FrontendStatusType::PLP_ID, + FrontendStatusType::HIERARCHY, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::BANDWIDTH), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::GUARD_INTERVAL), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::TRANSMISSION_MODE), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::T2_SYSTEM_ID), + }; + mFrontendStatusCaps[4] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); FrontendIsdbtCapabilities isdbtCaps{ @@ -77,14 +130,60 @@ Tuner::Tuner() { }; caps.isdbtCaps(isdbtCaps); mFrontendCaps[5] = caps; + statusCaps = { + FrontendStatusType::AGC, + FrontendStatusType::LNA, + FrontendStatusType::MODULATION, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::BANDWIDTH), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::GUARD_INTERVAL), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::TRANSMISSION_MODE), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::ISDBT_SEGMENTS), + }; + mFrontendStatusCaps[5] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); caps.analogCaps(FrontendAnalogCapabilities()); mFrontendCaps[6] = caps; + statusCaps = { + FrontendStatusType::LAYER_ERROR, + FrontendStatusType::MER, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::UEC), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::TS_DATA_RATES), + }; + mFrontendStatusCaps[6] = statusCaps; caps = FrontendInfo::FrontendCapabilities(); caps.atscCaps(FrontendAtscCapabilities()); mFrontendCaps[7] = caps; + statusCaps = { + FrontendStatusType::FREQ_OFFSET, + FrontendStatusType::RF_LOCK, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::IS_LINEAR), + }; + mFrontendStatusCaps[7] = statusCaps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.isdbs3Caps(FrontendIsdbs3Capabilities()); + mFrontendCaps[8] = caps; + statusCaps = { + FrontendStatusType::DEMOD_LOCK, + FrontendStatusType::MODULATION, + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::ROLL_OFF), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::IS_SHORT_FRAMES), + }; + mFrontendStatusCaps[8] = statusCaps; + + statusCaps = { + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::INTERLEAVINGS), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::BANDWIDTH), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::GUARD_INTERVAL), + static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::TRANSMISSION_MODE), + }; + mFrontendStatusCaps[9] = statusCaps; mLnbs.resize(2); mLnbs[0] = new Lnb(0); @@ -160,17 +259,6 @@ Return<void> Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _h return Void(); } - vector<FrontendStatusType> statusCaps = { - FrontendStatusType::DEMOD_LOCK, - FrontendStatusType::SNR, - FrontendStatusType::FEC, - FrontendStatusType::MODULATION, - FrontendStatusType::PLP_ID, - FrontendStatusType::LAYER_ERROR, - FrontendStatusType::ATSC3_PLP_INFO, - static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::MODULATIONS), - static_cast<FrontendStatusType>(V1_1::FrontendStatusTypeExt1_1::ROLL_OFF), - }; // assign randomly selected values for testing. info = { .type = mFrontends[frontendId]->getFrontendType(), @@ -180,7 +268,7 @@ Return<void> Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _h .maxSymbolRate = 1145, .acquireRange = 30, .exclusiveGroupId = 57, - .statusCaps = statusCaps, + .statusCaps = mFrontendStatusCaps[frontendId], .frontendCaps = mFrontendCaps[frontendId], }; diff --git a/tv/tuner/1.1/default/Tuner.h b/tv/tuner/1.1/default/Tuner.h index fda3636939..97bc99544a 100644 --- a/tv/tuner/1.1/default/Tuner.h +++ b/tv/tuner/1.1/default/Tuner.h @@ -79,6 +79,7 @@ class Tuner : public ITuner { // Static mFrontends array to maintain local frontends information map<uint32_t, sp<Frontend>> mFrontends; map<uint32_t, FrontendInfo::FrontendCapabilities> mFrontendCaps; + map<uint32_t, vector<FrontendStatusType>> mFrontendStatusCaps; V1_1::FrontendDtmbCapabilities mDtmbCaps; map<uint32_t, uint32_t> mFrontendToDemux; map<uint32_t, sp<Demux>> mDemuxes; diff --git a/tv/tuner/1.1/vts/functional/Android.bp b/tv/tuner/1.1/vts/functional/Android.bp index 73cd0578c1..92e587b699 100644 --- a/tv/tuner/1.1/vts/functional/Android.bp +++ b/tv/tuner/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalTvTunerV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/tv/tuner/1.1/vts/functional/FilterTests.cpp b/tv/tuner/1.1/vts/functional/FilterTests.cpp index d8fad3d5d2..1617642693 100644 --- a/tv/tuner/1.1/vts/functional/FilterTests.cpp +++ b/tv/tuner/1.1/vts/functional/FilterTests.cpp @@ -274,6 +274,7 @@ AssertionResult FilterTests::startFilter(uint64_t filterId) { AssertionResult FilterTests::stopFilter(uint64_t filterId) { EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; Result status = mFilters[filterId]->stop(); + return AssertionResult(status == Result::SUCCESS); } diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.cpp b/tv/tuner/1.1/vts/functional/FrontendTests.cpp index 0948f743ad..887f8b8131 100644 --- a/tv/tuner/1.1/vts/functional/FrontendTests.cpp +++ b/tv/tuner/1.1/vts/functional/FrontendTests.cpp @@ -305,6 +305,36 @@ AssertionResult FrontendTests::getFrontendDtmbCaps(uint32_t id) { return AssertionResult(status == Result::SUCCESS); } +AssertionResult FrontendTests::linkCiCam(uint32_t ciCamId) { + sp<android::hardware::tv::tuner::V1_1::IFrontend> frontend_1_1; + frontend_1_1 = android::hardware::tv::tuner::V1_1::IFrontend::castFrom(mFrontend); + if (frontend_1_1 == nullptr) { + EXPECT_TRUE(false) << "Couldn't get 1.1 IFrontend from the Hal implementation."; + return failure(); + } + + Result status; + uint32_t ltsId; + frontend_1_1->linkCiCam(ciCamId, [&](Result r, uint32_t id) { + status = r; + ltsId = id; + }); + + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FrontendTests::unlinkCiCam(uint32_t ciCamId) { + sp<android::hardware::tv::tuner::V1_1::IFrontend> frontend_1_1; + frontend_1_1 = android::hardware::tv::tuner::V1_1::IFrontend::castFrom(mFrontend); + if (frontend_1_1 == nullptr) { + EXPECT_TRUE(false) << "Couldn't get 1.1 IFrontend from the Hal implementation."; + return failure(); + } + + Result status = frontend_1_1->unlinkCiCam(ciCamId); + return AssertionResult(status == Result::SUCCESS); +} + void FrontendTests::verifyFrontendStatusExt1_1(vector<FrontendStatusTypeExt1_1> statusTypes, vector<FrontendStatusExt1_1> expectStatuses) { ASSERT_TRUE(mFrontend) << "Frontend is not opened yet."; @@ -465,6 +495,10 @@ void FrontendTests::tuneTest(FrontendConfig frontendConf) { ASSERT_TRUE(feId != INVALID_ID); ASSERT_TRUE(openFrontendById(feId)); ASSERT_TRUE(setFrontendCallback()); + if (frontendConf.canConnectToCiCam) { + ASSERT_TRUE(linkCiCam(frontendConf.ciCamId)); + ASSERT_TRUE(unlinkCiCam(frontendConf.ciCamId)); + } ASSERT_TRUE(tuneFrontend(frontendConf, false /*testWithDemux*/)); verifyFrontendStatusExt1_1(frontendConf.tuneStatusTypes, frontendConf.expectTuneStatuses); ASSERT_TRUE(stopTuneFrontend(false /*testWithDemux*/)); diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.h b/tv/tuner/1.1/vts/functional/FrontendTests.h index 243d9decd7..43c1579cb7 100644 --- a/tv/tuner/1.1/vts/functional/FrontendTests.h +++ b/tv/tuner/1.1/vts/functional/FrontendTests.h @@ -123,6 +123,9 @@ class FrontendTests { AssertionResult closeFrontend(); AssertionResult getFrontendDtmbCaps(uint32_t); + AssertionResult linkCiCam(uint32_t ciCamId); + AssertionResult unlinkCiCam(uint32_t ciCamId); + void getFrontendIdByType(FrontendType feType, uint32_t& feId); void tuneTest(FrontendConfig frontendConf); void scanTest(FrontendConfig frontend, FrontendScanType type); diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp index 2dcb9a14e5..2e6c87fb5a 100644 --- a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp +++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp @@ -211,6 +211,11 @@ TEST_P(TunerFrontendHidlTest, GetFrontendDtmbCaps) { mFrontendTests.getFrontendDtmbCapsTest(); } +TEST_P(TunerFrontendHidlTest, LinkToCiCam) { + description("Test Frontend link to CiCam"); + mFrontendTests.tuneTest(frontendArray[defaultFrontend]); +} + INSTANTIATE_TEST_SUITE_P( PerInstance, TunerBroadcastHidlTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)), diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h index beae223e4b..ecdf683b24 100644 --- a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h +++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h @@ -103,6 +103,8 @@ struct FilterConfig { struct FrontendConfig { bool isSoftwareFe; + bool canConnectToCiCam; + uint32_t ciCamId; FrontendType type; FrontendSettings settings; FrontendSettingsExt1_1 settingsExt1_1; @@ -121,6 +123,7 @@ static FrontendConfig frontendArray[FILTER_MAX]; static FrontendConfig frontendScanArray[SCAN_MAX]; static FilterConfig filterArray[FILTER_MAX]; static DvrConfig dvrArray[DVR_MAX]; +static int defaultFrontend = DVBT; /** Configuration array for the frontend tune test */ inline void initFrontendConfig() { @@ -150,6 +153,8 @@ inline void initFrontendConfig() { frontendArray[DVBT].tuneStatusTypes = types; frontendArray[DVBT].expectTuneStatuses = statuses; frontendArray[DVBT].isSoftwareFe = true; + frontendArray[DVBT].canConnectToCiCam = true; + frontendArray[DVBT].ciCamId = 0; frontendArray[DVBT].settingsExt1_1.settingExt.dvbt({ .transmissionMode = android::hardware::tv::tuner::V1_1::FrontendDvbtTransmissionMode::MODE_8K_E, diff --git a/tv/tuner/assets/Android.bp b/tv/tuner/assets/Android.bp index b58b645515..79244edbb0 100644 --- a/tv/tuner/assets/Android.bp +++ b/tv/tuner/assets/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + genrule { name: "tuner_frontend_input_es", srcs: ["tuner_frontend_input.es"], diff --git a/usb/1.0/Android.bp b/usb/1.0/Android.bp index 607d1aca79..d5d3500496 100644 --- a/usb/1.0/Android.bp +++ b/usb/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb@1.0", root: "android.hardware", diff --git a/usb/1.0/default/Android.bp b/usb/1.0/default/Android.bp index 98d9064474..5f56fe0262 100644 --- a/usb/1.0/default/Android.bp +++ b/usb/1.0/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.usb@1.0-service", defaults: ["hidl_defaults"], diff --git a/usb/1.0/vts/functional/Android.bp b/usb/1.0/vts/functional/Android.bp index ae31bd2d30..d976a06116 100644 --- a/usb/1.0/vts/functional/Android.bp +++ b/usb/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalUsbV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/usb/1.1/Android.bp b/usb/1.1/Android.bp index 8742e77c57..9c3e0dc434 100644 --- a/usb/1.1/Android.bp +++ b/usb/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb@1.1", root: "android.hardware", diff --git a/usb/1.1/vts/functional/Android.bp b/usb/1.1/vts/functional/Android.bp index 5bec94af66..f514009cda 100644 --- a/usb/1.1/vts/functional/Android.bp +++ b/usb/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalUsbV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -24,4 +33,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/usb/1.2/Android.bp b/usb/1.2/Android.bp index 8b9f0fb609..0d4430df06 100644 --- a/usb/1.2/Android.bp +++ b/usb/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb@1.2", root: "android.hardware", diff --git a/usb/1.2/vts/functional/Android.bp b/usb/1.2/vts/functional/Android.bp index d6aaf2d9aa..688e725708 100644 --- a/usb/1.2/vts/functional/Android.bp +++ b/usb/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalUsbV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/usb/1.3/Android.bp b/usb/1.3/Android.bp index 17367d3d8d..c48da37934 100644 --- a/usb/1.3/Android.bp +++ b/usb/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb@1.3", root: "android.hardware", diff --git a/usb/1.3/vts/functional/Android.bp b/usb/1.3/vts/functional/Android.bp index b62bb9d03f..6a1ce1e1ce 100644 --- a/usb/1.3/vts/functional/Android.bp +++ b/usb/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalUsbV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/usb/gadget/1.0/Android.bp b/usb/gadget/1.0/Android.bp index 21f152c36c..bb602fa595 100644 --- a/usb/gadget/1.0/Android.bp +++ b/usb/gadget/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb.gadget@1.0", root: "android.hardware", diff --git a/usb/gadget/1.1/Android.bp b/usb/gadget/1.1/Android.bp index e5100697cc..388f11cc3c 100644 --- a/usb/gadget/1.1/Android.bp +++ b/usb/gadget/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb.gadget@1.1", root: "android.hardware", diff --git a/usb/gadget/1.1/default/Android.bp b/usb/gadget/1.1/default/Android.bp index 68e2a29857..789a4f0c2b 100644 --- a/usb/gadget/1.1/default/Android.bp +++ b/usb/gadget/1.1/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.usb.gadget@1.1-service", defaults: ["hidl_defaults"], diff --git a/usb/gadget/1.1/default/lib/Android.bp b/usb/gadget/1.1/default/lib/Android.bp index bba83409cc..bf7bb37b83 100644 --- a/usb/gadget/1.1/default/lib/Android.bp +++ b/usb/gadget/1.1/default/lib/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libusbconfigfs", vendor_available: true, diff --git a/usb/gadget/1.2/Android.bp b/usb/gadget/1.2/Android.bp index 386f00fcfc..dc3589708d 100644 --- a/usb/gadget/1.2/Android.bp +++ b/usb/gadget/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.usb.gadget@1.2", root: "android.hardware", diff --git a/usb/gadget/1.2/default/Android.bp b/usb/gadget/1.2/default/Android.bp index 9c73a59dc2..713ce83046 100644 --- a/usb/gadget/1.2/default/Android.bp +++ b/usb/gadget/1.2/default/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.usb.gadget@1.2-service", defaults: ["hidl_defaults"], diff --git a/usb/gadget/1.2/default/lib/Android.bp b/usb/gadget/1.2/default/lib/Android.bp index 727de136cb..3bf46e36a8 100644 --- a/usb/gadget/1.2/default/lib/Android.bp +++ b/usb/gadget/1.2/default/lib/Android.bp @@ -14,6 +14,15 @@ * limitations under the License. */ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libusbconfigfs-2", vendor_available: true, diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp index d6321fb163..1ae1cef04d 100644 --- a/vibrator/1.0/Android.bp +++ b/vibrator/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.vibrator@1.0", root: "android.hardware", diff --git a/vibrator/1.0/default/Android.bp b/vibrator/1.0/default/Android.bp index 1385eacbd7..d495f711d3 100644 --- a/vibrator/1.0/default/Android.bp +++ b/vibrator/1.0/default/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.vibrator@1.0-impl", defaults: ["hidl_defaults"], diff --git a/vibrator/1.0/vts/functional/Android.bp b/vibrator/1.0/vts/functional/Android.bp index 4ec1aa8064..83377e79bd 100644 --- a/vibrator/1.0/vts/functional/Android.bp +++ b/vibrator/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalVibratorV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -21,4 +30,3 @@ cc_test { static_libs: ["android.hardware.vibrator@1.0"], test_suites: ["general-tests", "vts"], } - diff --git a/vibrator/1.1/Android.bp b/vibrator/1.1/Android.bp index 0302220b56..357c1f0c66 100644 --- a/vibrator/1.1/Android.bp +++ b/vibrator/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.vibrator@1.1", root: "android.hardware", diff --git a/vibrator/1.1/vts/functional/Android.bp b/vibrator/1.1/vts/functional/Android.bp index b291e7ce50..f97a343226 100644 --- a/vibrator/1.1/vts/functional/Android.bp +++ b/vibrator/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalVibratorV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -24,4 +33,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/vibrator/1.2/Android.bp b/vibrator/1.2/Android.bp index 1fa01144fa..42f97d4351 100644 --- a/vibrator/1.2/Android.bp +++ b/vibrator/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.vibrator@1.2", root: "android.hardware", diff --git a/vibrator/1.2/vts/functional/Android.bp b/vibrator/1.2/vts/functional/Android.bp index 7bf69d06d3..40171ae863 100644 --- a/vibrator/1.2/vts/functional/Android.bp +++ b/vibrator/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalVibratorV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -25,4 +34,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/vibrator/1.3/Android.bp b/vibrator/1.3/Android.bp index d742388879..124f5d1834 100644 --- a/vibrator/1.3/Android.bp +++ b/vibrator/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.vibrator@1.3", root: "android.hardware", diff --git a/vibrator/1.3/example/Android.bp b/vibrator/1.3/example/Android.bp index 07f1c26db3..7e9bf8f1f5 100644 --- a/vibrator/1.3/example/Android.bp +++ b/vibrator/1.3/example/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.vibrator@1.3-service.example", vendor: true, diff --git a/vibrator/1.3/vts/functional/Android.bp b/vibrator/1.3/vts/functional/Android.bp index 5215ed04cf..0fcbf0771b 100644 --- a/vibrator/1.3/vts/functional/Android.bp +++ b/vibrator/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalVibratorV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -26,4 +35,3 @@ cc_test { ], test_suites: ["general-tests", "vts"], } - diff --git a/vibrator/aidl/Android.bp b/vibrator/aidl/Android.bp index 97663538fa..4363407d77 100644 --- a/vibrator/aidl/Android.bp +++ b/vibrator/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.vibrator", vendor_available: true, @@ -7,7 +16,7 @@ aidl_interface { stability: "vintf", backend: { java: { - platform_apis: true, + sdk_version: "module_current", }, ndk: { vndk: { diff --git a/vibrator/aidl/OWNERS b/vibrator/aidl/OWNERS new file mode 100644 index 0000000000..4bd56146ca --- /dev/null +++ b/vibrator/aidl/OWNERS @@ -0,0 +1,4 @@ +chasewu@google.com +leungv@google.com +lsandrade@google.com +michaelwr@google.com diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl index 8cb259ffaa..0995d2d7af 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositeEffect.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (C) 2019 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositePrimitive.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositePrimitive.aidl index 3071dce32b..0b4b527359 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositePrimitive.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/CompositePrimitive.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (C) 2019 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/Effect.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/Effect.aidl index 5ed4dc5ad6..0d2b340a6c 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/Effect.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/Effect.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (C) 2019 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/EffectStrength.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/EffectStrength.aidl index 802d236309..808644a4b5 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/EffectStrength.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/EffectStrength.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (C) 2019 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrator.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrator.aidl index 2de1d7bde7..1f2d946836 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrator.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrator.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (C) 2019 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped @@ -33,6 +48,8 @@ interface IVibrator { android.hardware.vibrator.Effect[] getSupportedAlwaysOnEffects(); void alwaysOnEnable(in int id, in android.hardware.vibrator.Effect effect, in android.hardware.vibrator.EffectStrength strength); void alwaysOnDisable(in int id); + float getResonantFrequency(); + float getQFactor(); const int CAP_ON_CALLBACK = 1; const int CAP_PERFORM_CALLBACK = 2; const int CAP_AMPLITUDE_CONTROL = 4; @@ -40,4 +57,6 @@ interface IVibrator { const int CAP_EXTERNAL_AMPLITUDE_CONTROL = 16; const int CAP_COMPOSE_EFFECTS = 32; const int CAP_ALWAYS_ON_CONTROL = 64; + const int CAP_GET_RESONANT_FREQUENCY = 128; + const int CAP_GET_Q_FACTOR = 256; } diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorCallback.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorCallback.aidl index 3a1e7d865b..f99ecc1143 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorCallback.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorCallback.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (C) 2019 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl index 99cd448f41..8e3ac88e8c 100644 --- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl +++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl @@ -1,14 +1,29 @@ -/////////////////////////////////////////////////////////////////////////////// +/* + * 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. + *//////////////////////////////////////////////////////////////////////////////// // THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // /////////////////////////////////////////////////////////////////////////////// -// This file is a snapshot of an AIDL interface (or parcelable). Do not try to -// edit this file. It looks like you are doing that because you have modified -// an AIDL interface in a backward-incompatible way, e.g., deleting a function -// from an interface or a field from a parcelable and it broke the build. That -// breakage is intended. +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m <name>-update-api`. // -// You must not make a backward incompatible changes to the AIDL files built +// You must not make a backward incompatible change to any AIDL file built // with the aidl_interface module type with versions property set. The module // type is used to build AIDL files in a way that they can be used across // independently updatable components of the system. If a device is shipped diff --git a/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl b/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl index cd7b60340c..cba76dc745 100644 --- a/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl +++ b/vibrator/aidl/android/hardware/vibrator/IVibrator.aidl @@ -52,6 +52,14 @@ interface IVibrator { * Whether alwaysOnEnable/alwaysOnDisable is supported. */ const int CAP_ALWAYS_ON_CONTROL = 1 << 6; + /** + * Whether getResonantFrequency is supported. + */ + const int CAP_GET_RESONANT_FREQUENCY = 1 << 7; + /** + * Whether getQFactor is supported. + */ + const int CAP_GET_Q_FACTOR = 1 << 8; /** * Determine capabilities of the vibrator HAL (CAP_* mask) @@ -230,4 +238,20 @@ interface IVibrator { * @param id The device-specific always-on source ID to disable. */ void alwaysOnDisable(in int id); + + /** + * Retrieve the measured resonant frequency of the actuator. This may not be supported + * and this support is reflected in getCapabilities (CAP_GET_RESONANT_FREQUENCY) + * + * @return Measured resonant frequency in Hz. + */ + float getResonantFrequency(); + + /** + * Retrieve the measured Q factor. This may not be supported + * and this support is reflected in getCapabilities (CAP_GET_Q_FACTOR) + * + * @return Measured Q factor. + */ + float getQFactor(); } diff --git a/vibrator/aidl/default/Android.bp b/vibrator/aidl/default/Android.bp index b44f11dc94..d463f51511 100644 --- a/vibrator/aidl/default/Android.bp +++ b/vibrator/aidl/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "libvibratorexampleimpl", vendor: true, diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp index 1021e620ce..bf61bfec91 100644 --- a/vibrator/aidl/default/Vibrator.cpp +++ b/vibrator/aidl/default/Vibrator.cpp @@ -27,12 +27,16 @@ namespace vibrator { static constexpr int32_t kComposeDelayMaxMs = 1000; static constexpr int32_t kComposeSizeMax = 256; +static constexpr float kResonantFrequency = 150.0; +static constexpr float kQFactor = 11.0; + ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) { LOG(INFO) << "Vibrator reporting capabilities"; *_aidl_return = IVibrator::CAP_ON_CALLBACK | IVibrator::CAP_PERFORM_CALLBACK | IVibrator::CAP_AMPLITUDE_CONTROL | IVibrator::CAP_EXTERNAL_CONTROL | IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL | IVibrator::CAP_COMPOSE_EFFECTS | - IVibrator::CAP_ALWAYS_ON_CONTROL; + IVibrator::CAP_ALWAYS_ON_CONTROL | IVibrator::CAP_GET_RESONANT_FREQUENCY | + IVibrator::CAP_GET_Q_FACTOR; return ndk::ScopedAStatus::ok(); } @@ -201,6 +205,16 @@ ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id) { return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) { + *resonantFreqHz = kResonantFrequency; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Vibrator::getQFactor(float *qFactor) { + *qFactor = kQFactor; + return ndk::ScopedAStatus::ok(); +} + } // namespace vibrator } // namespace hardware } // namespace android diff --git a/vibrator/aidl/default/include/vibrator-impl/Vibrator.h b/vibrator/aidl/default/include/vibrator-impl/Vibrator.h index c3f3616876..a2af9637ed 100644 --- a/vibrator/aidl/default/include/vibrator-impl/Vibrator.h +++ b/vibrator/aidl/default/include/vibrator-impl/Vibrator.h @@ -44,6 +44,8 @@ class Vibrator : public BnVibrator { ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return) override; ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override; ndk::ScopedAStatus alwaysOnDisable(int32_t id) override; + ndk::ScopedAStatus getResonantFrequency(float *resonantFreqHz) override; + ndk::ScopedAStatus getQFactor(float *qFactor) override; }; } // namespace vibrator diff --git a/vibrator/aidl/vts/Android.bp b/vibrator/aidl/vts/Android.bp index b50b3f70be..3f328fa736 100644 --- a/vibrator/aidl/vts/Android.bp +++ b/vibrator/aidl/vts/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalVibratorTargetTest", defaults: [ diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp index adbb0cfeb3..2540d0b1d5 100644 --- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp +++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp @@ -538,6 +538,28 @@ TEST_P(VibratorAidl, AlwaysOn) { } } +TEST_P(VibratorAidl, GetResonantFrequency) { + float resonantFrequency; + Status status = vibrator->getResonantFrequency(&resonantFrequency); + if (capabilities & IVibrator::CAP_GET_RESONANT_FREQUENCY) { + ASSERT_NE(resonantFrequency, 0); + EXPECT_EQ(status.exceptionCode(), Status::EX_NONE); + } else { + EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION); + } +} + +TEST_P(VibratorAidl, GetQFactor) { + float qFactor; + Status status = vibrator->getQFactor(&qFactor); + if (capabilities & IVibrator::CAP_GET_Q_FACTOR) { + ASSERT_NE(qFactor, 0); + EXPECT_EQ(status.exceptionCode(), Status::EX_NONE); + } else { + EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION); + } +} + std::vector<std::tuple<int32_t, int32_t>> GenerateVibratorMapping() { std::vector<std::tuple<int32_t, int32_t>> tuples; auto managerAidlNames = android::getAidlHalInstanceNames(IVibratorManager::descriptor); diff --git a/vibrator/bench/Android.bp b/vibrator/bench/Android.bp index 3d7bdc5084..e4c9cfb33d 100644 --- a/vibrator/bench/Android.bp +++ b/vibrator/bench/Android.bp @@ -13,6 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_benchmark { name: "VibratorHalIntegrationBenchmark", defaults: ["hidl_defaults"], diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp index 769ee3b4a3..27d2ea8287 100644 --- a/vr/1.0/Android.bp +++ b/vr/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.vr@1.0", root: "android.hardware", diff --git a/vr/1.0/default/Android.bp b/vr/1.0/default/Android.bp index cfb28086b9..6e59bcf99a 100644 --- a/vr/1.0/default/Android.bp +++ b/vr/1.0/default/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_shared { name: "android.hardware.vr@1.0-impl", defaults: ["hidl_defaults"], diff --git a/vr/1.0/vts/functional/Android.bp b/vr/1.0/vts/functional/Android.bp index 6bfa05cad7..8e23f4f687 100644 --- a/vr/1.0/vts/functional/Android.bp +++ b/vr/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalVrV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/weaver/1.0/Android.bp b/weaver/1.0/Android.bp index 11fc68560a..f7d452af66 100644 --- a/weaver/1.0/Android.bp +++ b/weaver/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.weaver@1.0", root: "android.hardware", diff --git a/weaver/1.0/vts/functional/Android.bp b/weaver/1.0/vts/functional/Android.bp index b20f127647..cc1d28465d 100644 --- a/weaver/1.0/vts/functional/Android.bp +++ b/weaver/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWeaverV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/weaver/aidl/Android.bp b/weaver/aidl/Android.bp index 5637e0a248..60925ecb89 100644 --- a/weaver/aidl/Android.bp +++ b/weaver/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.weaver", vendor_available: true, diff --git a/weaver/aidl/default/Android.bp b/weaver/aidl/default/Android.bp index 8440670c27..37a9c947d5 100644 --- a/weaver/aidl/default/Android.bp +++ b/weaver/aidl/default/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "android.hardware.weaver-service.example", relative_install_path: "hw", diff --git a/weaver/aidl/vts/Android.bp b/weaver/aidl/vts/Android.bp index 7daad8d833..8dec4c17f0 100644 --- a/weaver/aidl/vts/Android.bp +++ b/weaver/aidl/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWeaverTargetTest", defaults: [ diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp index c41864f853..94f8462836 100644 --- a/wifi/1.0/Android.bp +++ b/wifi/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi@1.0", root: "android.hardware", diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp index 30512a9f1a..e4948b4cc2 100644 --- a/wifi/1.0/vts/functional/Android.bp +++ b/wifi/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiV1_0TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/1.1/Android.bp b/wifi/1.1/Android.bp index 4068b31fbb..7b4116a258 100644 --- a/wifi/1.1/Android.bp +++ b/wifi/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi@1.1", root: "android.hardware", diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp index 98931372e2..80486425c1 100644 --- a/wifi/1.1/vts/functional/Android.bp +++ b/wifi/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/1.2/Android.bp b/wifi/1.2/Android.bp index 5812b8268a..f0edb81976 100644 --- a/wifi/1.2/Android.bp +++ b/wifi/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi@1.2", root: "android.hardware", diff --git a/wifi/1.2/vts/functional/Android.bp b/wifi/1.2/vts/functional/Android.bp index 21d8388369..f43892bb32 100644 --- a/wifi/1.2/vts/functional/Android.bp +++ b/wifi/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/1.3/Android.bp b/wifi/1.3/Android.bp index f4e130a7a8..030d7f6eb6 100644 --- a/wifi/1.3/Android.bp +++ b/wifi/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi@1.3", root: "android.hardware", diff --git a/wifi/1.3/vts/functional/Android.bp b/wifi/1.3/vts/functional/Android.bp index 7ee69c9964..16f84ef495 100644 --- a/wifi/1.3/vts/functional/Android.bp +++ b/wifi/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/1.4/Android.bp b/wifi/1.4/Android.bp index 5620d03553..1523f79927 100644 --- a/wifi/1.4/Android.bp +++ b/wifi/1.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi@1.4", root: "android.hardware", diff --git a/wifi/1.4/vts/functional/Android.bp b/wifi/1.4/vts/functional/Android.bp index 0051d27d6b..14ebbe3bb8 100644 --- a/wifi/1.4/vts/functional/Android.bp +++ b/wifi/1.4/vts/functional/Android.bp @@ -15,6 +15,15 @@ // // SoftAP-specific tests, similar to VtsHalWifiApV1_0TargetTest. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiApV1_4TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/1.5/Android.bp b/wifi/1.5/Android.bp index e2c38cecc0..7c04c6967a 100644 --- a/wifi/1.5/Android.bp +++ b/wifi/1.5/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi@1.5", root: "android.hardware", diff --git a/wifi/1.5/default/Android.mk b/wifi/1.5/default/Android.mk index e851bfe5fb..7e48cb7143 100644 --- a/wifi/1.5/default/Android.mk +++ b/wifi/1.5/default/Android.mk @@ -18,6 +18,9 @@ LOCAL_PATH := $(call my-dir) ### include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.wifi@1.0-service-lib +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_PROPRIETARY_MODULE := true LOCAL_CPPFLAGS := -Wall -Werror -Wextra @@ -87,6 +90,9 @@ include $(BUILD_STATIC_LIBRARY) ### include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.wifi@1.0-service +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_VINTF_FRAGMENTS := android.hardware.wifi@1.0-service.xml LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_PROPRIETARY_MODULE := true @@ -124,6 +130,9 @@ include $(BUILD_EXECUTABLE) ### include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.wifi@1.0-service-lazy +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_VINTF_FRAGMENTS := android.hardware.wifi@1.0-service.xml LOCAL_OVERRIDES_MODULES := android.hardware.wifi@1.0-service LOCAL_CFLAGS := -DLAZY_SERVICE @@ -158,6 +167,9 @@ include $(BUILD_EXECUTABLE) ### include $(CLEAR_VARS) LOCAL_MODULE := android.hardware.wifi@1.0-service-tests +LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 +LOCAL_LICENSE_CONDITIONS := notice +LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE LOCAL_PROPRIETARY_MODULE := true LOCAL_CPPFLAGS := -Wall -Werror -Wextra LOCAL_SRC_FILES := \ diff --git a/wifi/1.5/default/hidl_struct_util.cpp b/wifi/1.5/default/hidl_struct_util.cpp index 50e1bb6cdd..2c57098528 100644 --- a/wifi/1.5/default/hidl_struct_util.cpp +++ b/wifi/1.5/default/hidl_struct_util.cpp @@ -1017,6 +1017,14 @@ bool convertLegacyLinkLayerStatsToHidl( legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; hidl_stats->iface.V1_0.wmeBePktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; + hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; + hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; + hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; + hidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; hidl_stats->iface.V1_0.wmeBkPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; hidl_stats->iface.V1_0.wmeBkPktStats.txMpdu = @@ -1025,6 +1033,14 @@ bool convertLegacyLinkLayerStatsToHidl( legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; hidl_stats->iface.V1_0.wmeBkPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; + hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; + hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; + hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; + hidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; hidl_stats->iface.V1_0.wmeViPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; hidl_stats->iface.V1_0.wmeViPktStats.txMpdu = @@ -1033,6 +1049,14 @@ bool convertLegacyLinkLayerStatsToHidl( legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; hidl_stats->iface.V1_0.wmeViPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; + hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; + hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; + hidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; + hidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; hidl_stats->iface.V1_0.wmeVoPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; hidl_stats->iface.V1_0.wmeVoPktStats.txMpdu = @@ -1041,6 +1065,14 @@ bool convertLegacyLinkLayerStatsToHidl( legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; hidl_stats->iface.V1_0.wmeVoPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; + hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; + hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; + hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; + hidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; hidl_stats->iface.timeSliceDutyCycleInPercent = legacy_stats.iface.info.time_slicing_duty_cycle_percent; // radio legacy_stats conversion. diff --git a/wifi/1.5/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.5/default/tests/hidl_struct_util_unit_tests.cpp index ea84c61f66..6391a6aec1 100644 --- a/wifi/1.5/default/tests/hidl_struct_util_unit_tests.cpp +++ b/wifi/1.5/default/tests/hidl_struct_util_unit_tests.cpp @@ -138,21 +138,41 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples = + rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples = + rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples = + rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples = + rand(); legacy_stats.iface.info.time_slicing_duty_cycle_percent = rand(); @@ -197,6 +217,15 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.iface.V1_0.wmeBePktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries, converted.iface.V1_0.wmeBePktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min, + converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max, + converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, + converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ( + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, + converted.iface.wmeBeContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, converted.iface.V1_0.wmeBkPktStats.rxMpdu); @@ -206,6 +235,15 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.iface.V1_0.wmeBkPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries, converted.iface.V1_0.wmeBkPktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min, + converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max, + converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, + converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ( + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, + converted.iface.wmeBkContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, converted.iface.V1_0.wmeViPktStats.rxMpdu); @@ -215,6 +253,15 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.iface.V1_0.wmeViPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries, converted.iface.V1_0.wmeViPktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min, + converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max, + converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, + converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ( + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, + converted.iface.wmeViContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, converted.iface.V1_0.wmeVoPktStats.rxMpdu); @@ -224,6 +271,15 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { converted.iface.V1_0.wmeVoPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries, converted.iface.V1_0.wmeVoPktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min, + converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max, + converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, + converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ( + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, + converted.iface.wmeVoContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.info.time_slicing_duty_cycle_percent, converted.iface.timeSliceDutyCycleInPercent); diff --git a/wifi/1.5/types.hal b/wifi/1.5/types.hal index 4dff77443e..e1c0d327e0 100644 --- a/wifi/1.5/types.hal +++ b/wifi/1.5/types.hal @@ -135,6 +135,33 @@ struct NanCapabilities { }; /** + * Contention time statistics for different traffic categories. + */ +struct StaLinkLayerIfaceContentionTimeStats { + /** + * Data packet min contention time (usec). It includes both the internal contention time + * among different access categories within the chipset and the contention time for the medium. + */ + uint32_t contentionTimeMinInUsec; + + /** + * Data packet max contention time (usec). It includes both the internal contention time + * among different access categories within the chipset and the contention time for the medium. + */ + uint32_t contentionTimeMaxInUsec; + /** + * Data packet average contention time (usec). It includes both the internal contention time + * among different access categories within the chipset and the contention time for the medium. + */ + uint32_t contentionTimeAvgInUsec; + + /** + * Number of data packets used for contention statistics. + */ + uint32_t contentionNumSamples; +}; + +/** * Iface statistics for the current connection. */ struct StaLinkLayerIfaceStats { @@ -150,6 +177,26 @@ struct StaLinkLayerIfaceStats { * If not using time slicing (i.e SCC or DBS), set to 100. */ uint8_t timeSliceDutyCycleInPercent; + + /** + * WME Best Effort (BE) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; + + /** + * WME Background (BK) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; + + /** + * WME Video (VI) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; + + /** + * WME Voice (VO) Access Category (AC) contention time statistics. + */ + StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; }; /** diff --git a/wifi/1.5/vts/functional/Android.bp b/wifi/1.5/vts/functional/Android.bp index 118822a35f..764d14da0a 100644 --- a/wifi/1.5/vts/functional/Android.bp +++ b/wifi/1.5/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiV1_5TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp index 5ac747de22..07f7f470fe 100644 --- a/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp +++ b/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp @@ -147,6 +147,7 @@ TEST_P(WifiChipHidlTest, setMultiStaUseCase) { * setCoexUnsafeChannels */ TEST_P(WifiChipHidlTest, setCoexUnsafeChannels) { + configureChipForIfaceType(IfaceType::STA, true); // Test with empty vector of CoexUnsafeChannels std::vector<IWifiChip::CoexUnsafeChannel> vec; const auto& statusEmpty = diff --git a/wifi/hostapd/1.0/Android.bp b/wifi/hostapd/1.0/Android.bp index b736167f24..afcd45cc0c 100644 --- a/wifi/hostapd/1.0/Android.bp +++ b/wifi/hostapd/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.hostapd@1.0", root: "android.hardware", diff --git a/wifi/hostapd/1.0/vts/functional/Android.bp b/wifi/hostapd/1.0/vts/functional/Android.bp index 2a35f15190..daf5b60bfc 100644 --- a/wifi/hostapd/1.0/vts/functional/Android.bp +++ b/wifi/hostapd/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiHostapdV1_0TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/hostapd/1.1/Android.bp b/wifi/hostapd/1.1/Android.bp index bba065df08..f5f2fbe93a 100644 --- a/wifi/hostapd/1.1/Android.bp +++ b/wifi/hostapd/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.hostapd@1.1", root: "android.hardware", diff --git a/wifi/hostapd/1.1/vts/functional/Android.bp b/wifi/hostapd/1.1/vts/functional/Android.bp index 61a8dfd813..999a6a7d32 100644 --- a/wifi/hostapd/1.1/vts/functional/Android.bp +++ b/wifi/hostapd/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiHostapdV1_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/hostapd/1.2/Android.bp b/wifi/hostapd/1.2/Android.bp index 9b26ece6b2..4ca41aa2a7 100644 --- a/wifi/hostapd/1.2/Android.bp +++ b/wifi/hostapd/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.hostapd@1.2", root: "android.hardware", diff --git a/wifi/hostapd/1.2/vts/functional/Android.bp b/wifi/hostapd/1.2/vts/functional/Android.bp index 577174b018..9609da5d41 100644 --- a/wifi/hostapd/1.2/vts/functional/Android.bp +++ b/wifi/hostapd/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiHostapdV1_2TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/hostapd/1.3/Android.bp b/wifi/hostapd/1.3/Android.bp index 31faa6a9a6..f75b5e25da 100644 --- a/wifi/hostapd/1.3/Android.bp +++ b/wifi/hostapd/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.hostapd@1.3", root: "android.hardware", diff --git a/wifi/hostapd/1.3/vts/functional/Android.bp b/wifi/hostapd/1.3/vts/functional/Android.bp index ed18bb69cd..6eceadf774 100644 --- a/wifi/hostapd/1.3/vts/functional/Android.bp +++ b/wifi/hostapd/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiHostapdV1_3TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/offload/1.0/Android.bp b/wifi/offload/1.0/Android.bp index 91ed476c62..8fd602de1f 100644 --- a/wifi/offload/1.0/Android.bp +++ b/wifi/offload/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.offload@1.0", root: "android.hardware", diff --git a/wifi/offload/1.0/vts/functional/Android.bp b/wifi/offload/1.0/vts/functional/Android.bp index abfefa8214..a0eb048c66 100644 --- a/wifi/offload/1.0/vts/functional/Android.bp +++ b/wifi/offload/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalWifiOffloadV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp index d46e463ac9..66e9353833 100644 --- a/wifi/supplicant/1.0/Android.bp +++ b/wifi/supplicant/1.0/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.supplicant@1.0", root: "android.hardware", diff --git a/wifi/supplicant/1.0/vts/functional/Android.bp b/wifi/supplicant/1.0/vts/functional/Android.bp index 42efde451e..121117c244 100644 --- a/wifi/supplicant/1.0/vts/functional/Android.bp +++ b/wifi/supplicant/1.0/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiSupplicantV1_0TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/supplicant/1.1/Android.bp b/wifi/supplicant/1.1/Android.bp index bc20dca6db..c62437455e 100644 --- a/wifi/supplicant/1.1/Android.bp +++ b/wifi/supplicant/1.1/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.supplicant@1.1", root: "android.hardware", diff --git a/wifi/supplicant/1.1/vts/functional/Android.bp b/wifi/supplicant/1.1/vts/functional/Android.bp index d9ae3e029c..68cda33d3e 100644 --- a/wifi/supplicant/1.1/vts/functional/Android.bp +++ b/wifi/supplicant/1.1/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiSupplicantV1_1TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/supplicant/1.2/Android.bp b/wifi/supplicant/1.2/Android.bp index aa2fa7be60..d5d937fac0 100644 --- a/wifi/supplicant/1.2/Android.bp +++ b/wifi/supplicant/1.2/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.supplicant@1.2", root: "android.hardware", diff --git a/wifi/supplicant/1.2/vts/functional/Android.bp b/wifi/supplicant/1.2/vts/functional/Android.bp index 2592a2b08c..ec3ca2210a 100644 --- a/wifi/supplicant/1.2/vts/functional/Android.bp +++ b/wifi/supplicant/1.2/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiSupplicantV1_2TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/supplicant/1.3/Android.bp b/wifi/supplicant/1.3/Android.bp index 4268490f6a..fbe7f75bf4 100644 --- a/wifi/supplicant/1.3/Android.bp +++ b/wifi/supplicant/1.3/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.supplicant@1.3", root: "android.hardware", diff --git a/wifi/supplicant/1.3/vts/functional/Android.bp b/wifi/supplicant/1.3/vts/functional/Android.bp index 1784fad60c..ec25de2a43 100644 --- a/wifi/supplicant/1.3/vts/functional/Android.bp +++ b/wifi/supplicant/1.3/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiSupplicantV1_3TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/supplicant/1.4/Android.bp b/wifi/supplicant/1.4/Android.bp index 2867629d4c..b486687d74 100644 --- a/wifi/supplicant/1.4/Android.bp +++ b/wifi/supplicant/1.4/Android.bp @@ -1,5 +1,14 @@ // This file is autogenerated by hidl-gen -Landroidbp. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + hidl_interface { name: "android.hardware.wifi.supplicant@1.4", root: "android.hardware", diff --git a/wifi/supplicant/1.4/ISupplicantStaNetwork.hal b/wifi/supplicant/1.4/ISupplicantStaNetwork.hal index 6bed5ab887..4f95213223 100644 --- a/wifi/supplicant/1.4/ISupplicantStaNetwork.hal +++ b/wifi/supplicant/1.4/ISupplicantStaNetwork.hal @@ -55,6 +55,24 @@ interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork { }; /** + * SAE Hash-to-Element mode. + */ + enum SaeH2eMode : uint8_t { + /** + * Hash-to-Element is disabled, only Hunting & Pecking is allowed. + */ + DISABLED, + /** + * Both Hash-to-Element and Hunting & Pecking are allowed. + */ + H2E_OPTIONAL, + /** + * Only Hash-to-Element is allowed. + */ + H2E_MANDATORY, + }; + + /** * Set group cipher mask for the network. * * @param groupCipherMask value to set. @@ -154,22 +172,16 @@ interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork { generates (SupplicantStatus status); /** - * Set whether to enable SAE H2E (Hash-to-Element) only mode. - * - * When enabled, only SAE H2E network is allowed; othewise - * H&P (Hunting and Pecking) and H2E are both allowed. - * H&P only mode is not supported. - * If this API is not called before connecting to a SAE - * network, the behavior is undefined. + * Set SAE H2E (Hash-to-Element) mode. * - * @param enable true to set, false otherwise. + * @param mode SAE H2E supporting mode. * @return status Status of the operation. * Possible status codes: * |SupplicantStatusCode.SUCCESS|, * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ - enableSaeH2eOnlyMode(bool enable) generates (SupplicantStatus status); + setSaeH2eMode(SaeH2eMode mode) generates (SupplicantStatus status); /** * Set whether to enable SAE PK (Public Key) only mode to enable public AP validation. diff --git a/wifi/supplicant/1.4/types.hal b/wifi/supplicant/1.4/types.hal index aec61c4121..c39de6ead6 100644 --- a/wifi/supplicant/1.4/types.hal +++ b/wifi/supplicant/1.4/types.hal @@ -104,6 +104,7 @@ struct SupplicantStatus { */ enum WpaDriverCapabilitiesMask : @1.3::WpaDriverCapabilitiesMask { /** + * WPA3 SAE Public-Key. */ SAE_PK = 1 << 2, }; diff --git a/wifi/supplicant/1.4/vts/functional/Android.bp b/wifi/supplicant/1.4/vts/functional/Android.bp index d6af0a03d2..8cbe04f686 100644 --- a/wifi/supplicant/1.4/vts/functional/Android.bp +++ b/wifi/supplicant/1.4/vts/functional/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_library_static { name: "VtsHalWifiSupplicantV1_4TargetTestUtil", defaults: ["VtsHalTargetTestDefaults"], diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp index 0e38c4b26b..e3fbaf36f1 100644 --- a/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp +++ b/wifi/supplicant/1.4/vts/functional/supplicant_sta_network_hidl_test.cpp @@ -42,6 +42,8 @@ using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; using ::android::hardware::wifi::supplicant::V1_4:: ISupplicantStaNetworkCallback; using ::android::hardware::wifi::V1_0::IWifi; +using ISupplicantStaNetworkV1_4 = + ::android::hardware::wifi::supplicant::V1_4::ISupplicantStaNetwork; using SupplicantStatusV1_4 = ::android::hardware::wifi::supplicant::V1_4::SupplicantStatus; using SupplicantStatusCodeV1_4 = @@ -110,15 +112,24 @@ TEST_P(SupplicantStaNetworkHidlTest, RegisterCallback_1_4) { } /* - * enable SAE H2E (Hash-to-Element) only mode + * set SAE H2E (Hash-to-Element) mode */ -TEST_P(SupplicantStaNetworkHidlTest, EnableSaeH2eOnlyMode) { - v1_4->enableSaeH2eOnlyMode(true, [&](const SupplicantStatusV1_4& status) { - EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, status.code); - }); - v1_4->enableSaeH2eOnlyMode(false, [&](const SupplicantStatusV1_4& status) { - EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, status.code); - }); +TEST_P(SupplicantStaNetworkHidlTest, SetSaeH2eMode) { + v1_4->setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode::DISABLED, + [&](const SupplicantStatusV1_4& status) { + EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, + status.code); + }); + v1_4->setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode::H2E_MANDATORY, + [&](const SupplicantStatusV1_4& status) { + EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, + status.code); + }); + v1_4->setSaeH2eMode(ISupplicantStaNetworkV1_4::SaeH2eMode::H2E_OPTIONAL, + [&](const SupplicantStatusV1_4& status) { + EXPECT_EQ(SupplicantStatusCodeV1_4::SUCCESS, + status.code); + }); } /* |