diff options
475 files changed, 14204 insertions, 3620 deletions
diff --git a/METADATA b/METADATA new file mode 100644 index 0000000000..d97975ca3b --- /dev/null +++ b/METADATA @@ -0,0 +1,3 @@ +third_party { + license_type: NOTICE +} diff --git a/atrace/1.0/Android.bp b/atrace/1.0/Android.bp index c7e8d04eeb..5290a9a486 100644 --- a/atrace/1.0/Android.bp +++ b/atrace/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.atrace@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAtraceDevice.hal", diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp index 02f8b4087c..35f6803e30 100644 --- a/audio/2.0/Android.bp +++ b/audio/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDevice.hal", diff --git a/audio/4.0/Android.bp b/audio/4.0/Android.bp index bc695c852f..4957a1470f 100644 --- a/audio/4.0/Android.bp +++ b/audio/4.0/Android.bp @@ -5,9 +5,6 @@ hidl_interface { root: "android.hardware", // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDevice.hal", diff --git a/audio/5.0/Android.bp b/audio/5.0/Android.bp index 9b28497472..365a654610 100644 --- a/audio/5.0/Android.bp +++ b/audio/5.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio@5.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDevice.hal", diff --git a/audio/6.0/Android.bp b/audio/6.0/Android.bp index 16abc521e2..d7880b631d 100644 --- a/audio/6.0/Android.bp +++ b/audio/6.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio@6.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDevice.hal", diff --git a/audio/common/4.0/Android.bp b/audio/common/4.0/Android.bp index e4676ec1f5..dc4bca4a92 100644 --- a/audio/common/4.0/Android.bp +++ b/audio/common/4.0/Android.bp @@ -5,9 +5,6 @@ hidl_interface { root: "android.hardware", // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/audio/common/5.0/Android.bp b/audio/common/5.0/Android.bp index 761c171c96..bf265a5511 100644 --- a/audio/common/5.0/Android.bp +++ b/audio/common/5.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio.common@5.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/audio/common/6.0/Android.bp b/audio/common/6.0/Android.bp index 94f1cf8926..caeee6f75b 100644 --- a/audio/common/6.0/Android.bp +++ b/audio/common/6.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio.common@6.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/audio/common/all-versions/default/service/Android.bp b/audio/common/all-versions/default/service/Android.bp index e5d47706c3..0d304c3a00 100644 --- a/audio/common/all-versions/default/service/Android.bp +++ b/audio/common/all-versions/default/service/Android.bp @@ -4,11 +4,11 @@ cc_binary { init_rc: ["android.hardware.audio.service.rc"], relative_install_path: "hw", vendor: true, - // Only support 32 bit as the binary must always be installed at the same + // Prefer 32 bit as the binary must always be installed at the same // location for init to start it and the build system does not support // having two binaries installable to the same location even if they are // not installed in the same build. - compile_multilib: "32", + compile_multilib: "prefer32", srcs: ["service.cpp"], cflags: [ diff --git a/audio/common/all-versions/default/service/android.hardware.audio.service.rc b/audio/common/all-versions/default/service/android.hardware.audio.service.rc index f7e1e244d5..45fef9a936 100644 --- a/audio/common/all-versions/default/service/android.hardware.audio.service.rc +++ b/audio/common/all-versions/default/service/android.hardware.audio.service.rc @@ -2,7 +2,7 @@ service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service class hal user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) - group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub capabilities BLOCK_SUSPEND ioprio rt 4 task_profiles ProcessCapacityHigh HighPerformance diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp index 0af81b2bd4..8fdb70d1a2 100644 --- a/audio/core/all-versions/default/Android.bp +++ b/audio/core/all-versions/default/Android.bp @@ -1,8 +1,5 @@ -cc_defaults { - name: "android.hardware.audio-impl_default", - relative_install_path: "hw", - proprietary: true, - vendor: true, +filegroup { + name: "android.hardware.audio-impl_srcs", srcs: [ "Conversions.cpp", "Device.cpp", @@ -13,10 +10,23 @@ cc_defaults { "StreamIn.cpp", "StreamOut.cpp", ], +} - defaults: ["hidl_defaults"], - +cc_library_headers { + name: "android.hardware.audio-impl_headers", + proprietary: true, + vendor: true, export_include_dirs: ["include"], +} + +cc_defaults { + name: "android.hardware.audio-impl_default", + relative_install_path: "hw", + proprietary: true, + vendor: true, + srcs: [":android.hardware.audio-impl_srcs"], + + defaults: ["hidl_defaults"], static_libs: [ "libaudiofoundation", @@ -35,12 +45,17 @@ cc_defaults { ], header_libs: [ + "android.hardware.audio-impl_headers", "android.hardware.audio.common.util@all-versions", "libaudioclient_headers", "libaudio_system_headers", "libhardware_headers", "libmedia_headers", ], + + export_header_lib_headers: [ + "android.hardware.audio-impl_headers", + ], } cc_library_shared { @@ -89,8 +104,8 @@ cc_library_shared { ], } -cc_library_shared { - name: "android.hardware.audio@6.0-impl", +cc_defaults { + name: "android.hardware.audio@6.0-impl_default", defaults: ["android.hardware.audio-impl_default"], shared_libs: [ "android.hardware.audio@6.0", @@ -103,3 +118,8 @@ cc_library_shared { "-include common/all-versions/VersionMacro.h", ], } + +cc_library_shared { + name: "android.hardware.audio@6.0-impl", + defaults: ["android.hardware.audio@6.0-impl_default"], +} diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index 729ee7ab4a..2d5e8a5c92 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -55,7 +55,7 @@ cc_test { data: [ ":audio_policy_configuration_V2_0", ], - // Use test_config for vts-core suite. + // Use test_config for vts suite. // TODO(b/146104851): Add auto-gen rules and remove it. test_config: "VtsHalAudioV2_0TargetTest.xml", } @@ -78,7 +78,7 @@ cc_test { data: [ ":audio_policy_configuration_V4_0", ], - // Use test_config for vts-core suite. + // Use test_config for vts suite. // TODO(b/146104851): Add auto-gen rules and remove it. test_config: "VtsHalAudioV4_0TargetTest.xml", } @@ -101,7 +101,7 @@ cc_test { data: [ ":audio_policy_configuration_V5_0", ], - // Use test_config for vts-core suite. + // Use test_config for vts suite. // TODO(b/146104851): Add auto-gen rules and remove it. test_config: "VtsHalAudioV5_0TargetTest.xml", } @@ -124,7 +124,7 @@ cc_test { data: [ ":audio_policy_configuration_V6_0", ], - // Use test_config for vts-core suite. + // Use test_config for vts suite. // TODO(b/146104851): Add auto-gen rules and remove it. test_config: "VtsHalAudioV6_0TargetTest.xml", } diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index d5af335f6a..10a114435e 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -331,6 +331,9 @@ TEST_P(AudioPolicyConfigTest, HasPrimaryModule) { INSTANTIATE_TEST_CASE_P(AudioHidl, AudioPolicyConfigTest, ::testing::ValuesIn(getDeviceParametersForFactoryTests()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioPolicyConfigTest); ////////////////////////////////////////////////////////////////////////////// ////////////////////// getService audio_devices_factory ////////////////////// @@ -366,6 +369,9 @@ TEST_P(AudioHidlTest, OpenDeviceInvalidParameter) { INSTANTIATE_TEST_CASE_P(AudioHidl, AudioHidlTest, ::testing::ValuesIn(getDeviceParametersForFactoryTests()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioHidlTest); ////////////////////////////////////////////////////////////////////////////// /////////////////////////////// openDevice /////////////////////////////////// @@ -391,6 +397,9 @@ TEST_P(AudioHidlDeviceTest, Init) { INSTANTIATE_TEST_CASE_P(AudioHidlDevice, AudioHidlDeviceTest, ::testing::ValuesIn(getDeviceParameters()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioHidlDeviceTest); ////////////////////////////////////////////////////////////////////////////// /////////////////////////////// openDevice primary /////////////////////////// @@ -418,6 +427,9 @@ TEST_P(AudioPrimaryHidlTest, OpenPrimaryDevice) { INSTANTIATE_TEST_CASE_P(AudioPrimaryHidl, AudioPrimaryHidlTest, ::testing::ValuesIn(getDeviceParametersForPrimaryDeviceTests()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioPrimaryHidlTest); ////////////////////////////////////////////////////////////////////////////// ///////////////////// {set,get}{Master,Mic}{Mute,Volume} ///////////////////// @@ -513,6 +525,10 @@ INSTANTIATE_TEST_CASE_P(BoolAccessorHidl, BoolAccessorHidlTest, INSTANTIATE_TEST_CASE_P(BoolAccessorPrimaryHidl, BoolAccessorPrimaryHidlTest, ::testing::ValuesIn(getDeviceParametersForPrimaryDeviceTests()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BoolAccessorHidlTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BoolAccessorPrimaryHidlTest); using FloatAccessorHidlTest = AccessorHidlTest<float>; TEST_P(FloatAccessorHidlTest, MasterVolumeTest) { @@ -525,6 +541,9 @@ TEST_P(FloatAccessorHidlTest, MasterVolumeTest) { INSTANTIATE_TEST_CASE_P(FloatAccessorHidl, FloatAccessorHidlTest, ::testing::ValuesIn(getDeviceParameters()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FloatAccessorHidlTest); ////////////////////////////////////////////////////////////////////////////// //////////////////////////////// AudioPatches //////////////////////////////// @@ -547,6 +566,9 @@ TEST_P(AudioPatchHidlTest, AudioPatches) { INSTANTIATE_TEST_CASE_P(AudioPatchHidl, AudioPatchHidlTest, ::testing::ValuesIn(getDeviceParameters()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// 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. @@ -717,11 +739,15 @@ INSTANTIATE_TEST_CASE_P( ::testing::ValuesIn(ConfigHelper::getRecommendedSupportCaptureAudioConfig()), ::testing::Values(AudioInputFlag::NONE)), &DeviceConfigParameterToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(OptionalInputBufferSizeTest); #elif MAJOR_VERSION >= 6 INSTANTIATE_TEST_CASE_P(SupportedInputBufferSize, RequiredInputBufferSizeTest, ::testing::ValuesIn(getInputDeviceConfigParameters()), &DeviceConfigParameterToString); #endif +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RequiredInputBufferSizeTest); ////////////////////////////////////////////////////////////////////////////// /////////////////////////////// setScreenState /////////////////////////////// @@ -960,6 +986,9 @@ INSTANTIATE_TEST_CASE_P(DeclaredOutputStreamConfigSupport, OutputStreamTest, ::testing::ValuesIn(getOutputDeviceConfigParameters()), &DeviceConfigParameterToString); #endif +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(OutputStreamTest); ////////////////////////////// openInputStream ////////////////////////////// @@ -1015,6 +1044,9 @@ INSTANTIATE_TEST_CASE_P(DeclaredInputStreamConfigSupport, InputStreamTest, ::testing::ValuesIn(getInputDeviceConfigParameters()), &DeviceConfigParameterToString); #endif +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InputStreamTest); ////////////////////////////////////////////////////////////////////////////// ////////////////////////////// IStream getters /////////////////////////////// @@ -1553,6 +1585,9 @@ TEST_P(TtyModeAccessorPrimaryHidlTest, setGetTtyMode) { INSTANTIATE_TEST_CASE_P(TtyModeAccessorPrimaryHidl, TtyModeAccessorPrimaryHidlTest, ::testing::ValuesIn(getDeviceParametersForPrimaryDeviceTests()), &DeviceParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TtyModeAccessorPrimaryHidlTest); TEST_P(BoolAccessorPrimaryHidlTest, setGetHac) { doc::test("Query and set the HAC state"); diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp index 7b37260a27..a5a8b3405f 100644 --- a/audio/effect/2.0/Android.bp +++ b/audio/effect/2.0/Android.bp @@ -5,9 +5,6 @@ hidl_interface { root: "android.hardware", // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAcousticEchoCancelerEffect.hal", diff --git a/audio/effect/4.0/Android.bp b/audio/effect/4.0/Android.bp index 2242d6d76e..31f94ae8b8 100644 --- a/audio/effect/4.0/Android.bp +++ b/audio/effect/4.0/Android.bp @@ -5,9 +5,6 @@ hidl_interface { root: "android.hardware", // TODO(b/153609531): remove when no longer needed. native_bridge_supported: true, - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAcousticEchoCancelerEffect.hal", diff --git a/audio/effect/5.0/Android.bp b/audio/effect/5.0/Android.bp index b7dad8d9ca..a3081c688c 100644 --- a/audio/effect/5.0/Android.bp +++ b/audio/effect/5.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio.effect@5.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAcousticEchoCancelerEffect.hal", diff --git a/audio/effect/6.0/Android.bp b/audio/effect/6.0/Android.bp index b6184f3a58..de4bde74b1 100644 --- a/audio/effect/6.0/Android.bp +++ b/audio/effect/6.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.audio.effect@6.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAcousticEchoCancelerEffect.hal", diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index 070242fc9d..4787c091b2 100644 --- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -845,3 +845,9 @@ INSTANTIATE_TEST_SUITE_P( IEffectsFactory::descriptor)), ::testing::Values(LOUDNESS_ENHANCER_EFFECT_TYPE)), EffectParameterToString); +// When the VTS test runs on a device lacking the corresponding HAL version the parameter +// list is empty, this isn't a problem. +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioEffectsFactoryHidlTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioEffectHidlTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EqualizerAudioEffectHidlTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(LoudnessEnhancerAudioEffectHidlTest); diff --git a/authsecret/1.0/Android.bp b/authsecret/1.0/Android.bp index 3b84c3b518..5c556d2926 100644 --- a/authsecret/1.0/Android.bp +++ b/authsecret/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.authsecret@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IAuthSecret.hal", ], diff --git a/automotive/audiocontrol/1.0/Android.bp b/automotive/audiocontrol/1.0/Android.bp index 7ef7909802..8835f51a29 100644 --- a/automotive/audiocontrol/1.0/Android.bp +++ b/automotive/audiocontrol/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.automotive.audiocontrol@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAudioControl.hal", diff --git a/automotive/audiocontrol/2.0/Android.bp b/automotive/audiocontrol/2.0/Android.bp index 2a9f8499e3..e9ce638bae 100644 --- a/automotive/audiocontrol/2.0/Android.bp +++ b/automotive/audiocontrol/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.automotive.audiocontrol@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAudioControl.hal", @@ -13,8 +10,9 @@ hidl_interface { "IFocusListener.hal", ], interfaces: [ - "android.hidl.base@1.0", "android.hardware.audio.common@6.0", + "android.hidl.base@1.0", + "android.hidl.safe_union@1.0", ], gen_java: true, } diff --git a/automotive/can/1.0/Android.bp b/automotive/can/1.0/Android.bp index 2221e6623e..2ddfaf93b8 100644 --- a/automotive/can/1.0/Android.bp +++ b/automotive/can/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.automotive.can@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICanBus.hal", diff --git a/automotive/can/1.0/default/libnetdevice/Android.bp b/automotive/can/1.0/default/libnetdevice/Android.bp index 31e5ad0376..d49b9abb17 100644 --- a/automotive/can/1.0/default/libnetdevice/Android.bp +++ b/automotive/can/1.0/default/libnetdevice/Android.bp @@ -20,11 +20,27 @@ cc_library_static { vendor_available: true, relative_install_path: "hw", srcs: [ + "protocols/common/Empty.cpp", + "protocols/common/Error.cpp", + "protocols/generic/Ctrl.cpp", + "protocols/generic/Generic.cpp", + "protocols/generic/GenericMessageBase.cpp", + "protocols/generic/Unknown.cpp", + "protocols/route/Link.cpp", + "protocols/route/Route.cpp", + "protocols/route/structs.cpp", + "protocols/MessageDefinition.cpp", + "protocols/NetlinkProtocol.cpp", + "protocols/all.cpp", "NetlinkRequest.cpp", "NetlinkSocket.cpp", "can.cpp", "common.cpp", + "ethtool.cpp", + "ifreqs.cpp", "libnetdevice.cpp", + "printer.cpp", + "vlan.cpp", ], export_include_dirs: ["include"], } diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp index 556debfc09..4c06f7cdb4 100644 --- a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp +++ b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "NetlinkRequest.h" +#include <libnetdevice/NetlinkRequest.h> #include <android-base/logging.h> diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp index 7817169876..91149c0160 100644 --- a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp +++ b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp @@ -14,13 +14,21 @@ * limitations under the License. */ -#include "NetlinkSocket.h" +#include <libnetdevice/NetlinkSocket.h> + +#include <libnetdevice/printer.h> #include <android-base/logging.h> namespace android::netdevice { -NetlinkSocket::NetlinkSocket(int protocol) { +/** + * Print all outbound/inbound Netlink messages. + */ +static constexpr bool kSuperVerbose = false; + +NetlinkSocket::NetlinkSocket(int protocol, unsigned int pid, uint32_t groups) + : mProtocol(protocol) { mFd.reset(socket(AF_NETLINK, SOCK_RAW, protocol)); if (!mFd.ok()) { PLOG(ERROR) << "Can't open Netlink socket"; @@ -28,29 +36,37 @@ NetlinkSocket::NetlinkSocket(int protocol) { return; } - struct sockaddr_nl sa = {}; + sockaddr_nl sa = {}; sa.nl_family = AF_NETLINK; + sa.nl_pid = pid; + sa.nl_groups = groups; - if (bind(mFd.get(), reinterpret_cast<struct sockaddr*>(&sa), sizeof(sa)) < 0) { + if (bind(mFd.get(), reinterpret_cast<sockaddr*>(&sa), sizeof(sa)) < 0) { PLOG(ERROR) << "Can't bind Netlink socket"; mFd.reset(); mFailed = true; } } -bool NetlinkSocket::send(struct nlmsghdr* nlmsg) { +bool NetlinkSocket::send(nlmsghdr* nlmsg, size_t totalLen) { + if constexpr (kSuperVerbose) { + nlmsg->nlmsg_seq = mSeq; + LOG(VERBOSE) << (mFailed ? "(not) " : "") + << "sending Netlink message: " << toString({nlmsg, totalLen}, mProtocol); + } + if (mFailed) return false; nlmsg->nlmsg_pid = 0; // kernel nlmsg->nlmsg_seq = mSeq++; nlmsg->nlmsg_flags |= NLM_F_ACK; - struct iovec iov = {nlmsg, nlmsg->nlmsg_len}; + iovec iov = {nlmsg, nlmsg->nlmsg_len}; - struct sockaddr_nl sa = {}; + sockaddr_nl sa = {}; sa.nl_family = AF_NETLINK; - struct msghdr msg = {}; + msghdr msg = {}; msg.msg_name = &sa; msg.msg_namelen = sizeof(sa); msg.msg_iov = &iov; @@ -63,15 +79,65 @@ bool NetlinkSocket::send(struct nlmsghdr* nlmsg) { return true; } +bool NetlinkSocket::send(const nlbuf<nlmsghdr>& msg, const sockaddr_nl& sa) { + if constexpr (kSuperVerbose) { + LOG(VERBOSE) << (mFailed ? "(not) " : "") + << "sending Netlink message: " << toString(msg, mProtocol); + } + + if (mFailed) return false; + const auto rawMsg = msg.getRaw(); + const auto bytesSent = sendto(mFd.get(), rawMsg.ptr(), rawMsg.len(), 0, + reinterpret_cast<const sockaddr*>(&sa), sizeof(sa)); + if (bytesSent < 0) { + PLOG(ERROR) << "Can't send Netlink message"; + return false; + } + return true; +} + +std::optional<nlbuf<nlmsghdr>> NetlinkSocket::receive(void* buf, size_t bufLen) { + sockaddr_nl sa = {}; + return receive(buf, bufLen, sa); +} + +std::optional<nlbuf<nlmsghdr>> NetlinkSocket::receive(void* buf, size_t bufLen, sockaddr_nl& sa) { + if (mFailed) return std::nullopt; + + socklen_t saLen = sizeof(sa); + if (bufLen == 0) { + LOG(ERROR) << "Receive buffer has zero size!"; + return std::nullopt; + } + const auto bytesReceived = + recvfrom(mFd.get(), buf, bufLen, MSG_TRUNC, reinterpret_cast<sockaddr*>(&sa), &saLen); + if (bytesReceived <= 0) { + PLOG(ERROR) << "Failed to receive Netlink message"; + return std::nullopt; + } else if (unsigned(bytesReceived) > bufLen) { + PLOG(ERROR) << "Received data larger than the receive buffer! " << bytesReceived << " > " + << bufLen; + return std::nullopt; + } + + nlbuf<nlmsghdr> msg(reinterpret_cast<nlmsghdr*>(buf), bytesReceived); + if constexpr (kSuperVerbose) { + LOG(VERBOSE) << "received " << toString(msg, mProtocol); + } + return msg; +} + +/* TODO(161389935): Migrate receiveAck to use nlmsg<> internally. Possibly reuse + * NetlinkSocket::receive(). */ bool NetlinkSocket::receiveAck() { if (mFailed) return false; char buf[8192]; - struct sockaddr_nl sa; - struct iovec iov = {buf, sizeof(buf)}; + sockaddr_nl sa; + iovec iov = {buf, sizeof(buf)}; - struct msghdr msg = {}; + msghdr msg = {}; msg.msg_name = &sa; msg.msg_namelen = sizeof(sa); msg.msg_iov = &iov; @@ -89,8 +155,13 @@ bool NetlinkSocket::receiveAck() { return false; } - for (auto nlmsg = reinterpret_cast<struct nlmsghdr*>(buf); NLMSG_OK(nlmsg, remainingLen); + for (auto nlmsg = reinterpret_cast<nlmsghdr*>(buf); NLMSG_OK(nlmsg, remainingLen); nlmsg = NLMSG_NEXT(nlmsg, remainingLen)) { + if constexpr (kSuperVerbose) { + LOG(VERBOSE) << "received Netlink response: " + << toString({nlmsg, nlmsg->nlmsg_len}, mProtocol); + } + // We're looking for error/ack message only, ignoring others. if (nlmsg->nlmsg_type != NLMSG_ERROR) { LOG(WARNING) << "Received unexpected Netlink message (ignored): " << nlmsg->nlmsg_type; @@ -98,9 +169,9 @@ bool NetlinkSocket::receiveAck() { } // Found error/ack message, return status. - auto nlerr = reinterpret_cast<struct nlmsgerr*>(NLMSG_DATA(nlmsg)); + const auto nlerr = reinterpret_cast<nlmsgerr*>(NLMSG_DATA(nlmsg)); if (nlerr->error != 0) { - LOG(ERROR) << "Received Netlink error message: " << nlerr->error; + LOG(ERROR) << "Received Netlink error message: " << strerror(-nlerr->error); return false; } return true; @@ -109,4 +180,14 @@ bool NetlinkSocket::receiveAck() { return false; } +std::optional<unsigned int> NetlinkSocket::getSocketPid() { + sockaddr_nl sa = {}; + socklen_t sasize = sizeof(sa); + if (getsockname(mFd.get(), reinterpret_cast<sockaddr*>(&sa), &sasize) < 0) { + PLOG(ERROR) << "Failed to getsockname() for netlink_fd!"; + return std::nullopt; + } + return sa.nl_pid; +} + } // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h deleted file mode 100644 index 2b40ea20c0..0000000000 --- a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "NetlinkRequest.h" - -#include <android-base/macros.h> -#include <android-base/unique_fd.h> - -#include <linux/netlink.h> - -namespace android::netdevice { - -/** - * A wrapper around AF_NETLINK sockets. - * - * This class is not thread safe to use a single instance between multiple threads, but it's fine to - * use multiple instances over multiple threads. - */ -struct NetlinkSocket { - NetlinkSocket(int protocol); - - /** - * Send Netlink message to Kernel. - * - * \param msg Message to send, nlmsg_seq will be set to next sequence number - * \return true, if succeeded - */ - template <class T, unsigned int BUFSIZE> - bool send(NetlinkRequest<T, BUFSIZE>& req) { - if (!req.isGood()) return false; - return send(req.header()); - } - - /** - * Receive Netlink ACK message from Kernel. - * - * \return true if received ACK message, false in case of error - */ - bool receiveAck(); - - private: - uint32_t mSeq = 0; - base::unique_fd mFd; - bool mFailed = false; - - bool send(struct nlmsghdr* msg); - - DISALLOW_COPY_AND_ASSIGN(NetlinkSocket); -}; - -} // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp index a2a85dcae8..b0a243244d 100644 --- a/automotive/can/1.0/default/libnetdevice/can.cpp +++ b/automotive/can/1.0/default/libnetdevice/can.cpp @@ -14,14 +14,14 @@ * limitations under the License. */ -#include <libnetdevice/libnetdevice.h> +#include <libnetdevice/can.h> -#include "NetlinkRequest.h" -#include "NetlinkSocket.h" #include "common.h" #include <android-base/logging.h> #include <android-base/unique_fd.h> +#include <libnetdevice/NetlinkRequest.h> +#include <libnetdevice/NetlinkSocket.h> #include <linux/can.h> #include <linux/can/error.h> diff --git a/automotive/can/1.0/default/libnetdevice/common.cpp b/automotive/can/1.0/default/libnetdevice/common.cpp index 5c624439cd..f2968fc6ec 100644 --- a/automotive/can/1.0/default/libnetdevice/common.cpp +++ b/automotive/can/1.0/default/libnetdevice/common.cpp @@ -26,11 +26,33 @@ unsigned int nametoindex(const std::string& ifname) { const auto ifidx = if_nametoindex(ifname.c_str()); if (ifidx != 0) return ifidx; - const auto err = errno; - if (err != ENODEV) { - LOG(ERROR) << "if_nametoindex(" << ifname << ") failed: " << err; + if (errno != ENODEV) { + PLOG(ERROR) << "if_nametoindex(" << ifname << ") failed"; } return 0; } +std::string sanitize(std::string str) { + str.erase(std::find(str.begin(), str.end(), '\0'), str.end()); + + const auto isInvalid = [](char c) { return !isprint(c); }; + std::replace_if(str.begin(), str.end(), isInvalid, '?'); + + return str; +} + +uint16_t crc16(const nlbuf<uint8_t> data, uint16_t crc) { + for (const auto byte : data.getRaw()) { + crc ^= byte; + for (unsigned i = 0; i < 8; i++) { + if (crc & 1) { + crc = (crc >> 1) ^ 0xA001; + } else { + crc >>= 1; + } + } + } + return crc; +} + } // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/common.h b/automotive/can/1.0/default/libnetdevice/common.h index 8097f374ad..1e0d5b7eed 100644 --- a/automotive/can/1.0/default/libnetdevice/common.h +++ b/automotive/can/1.0/default/libnetdevice/common.h @@ -16,6 +16,11 @@ #pragma once +#include <libnetdevice/nlbuf.h> + +#include <linux/can.h> +#include <net/if.h> + #include <string> namespace android::netdevice { @@ -31,4 +36,24 @@ namespace android::netdevice { */ unsigned int nametoindex(const std::string& ifname); +/** + * Sanitize a string of unknown contents. + * + * Trims the string to the first '\0' character and replaces all non-printable characters with '?'. + */ +std::string sanitize(std::string str); + +/** + * Calculates a (optionally running) CRC16 checksum. + * + * CRC16 isn't a strong checksum, but is good for quick comparison purposes. + * One benefit (and also a drawback too) is that all-zero payloads with any length will + * always have a checksum of 0x0000. + * + * \param data Buffer to calculate checksum for + * \param crc Previous CRC16 value to continue calculating running checksum + * \return CRC16 checksum + */ +uint16_t crc16(const nlbuf<uint8_t> data, uint16_t crc = 0); + } // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/ethtool.cpp b/automotive/can/1.0/default/libnetdevice/ethtool.cpp new file mode 100644 index 0000000000..762ef5cc88 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/ethtool.cpp @@ -0,0 +1,47 @@ +/* + * 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 <libnetdevice/ethtool.h> + +#include "ifreqs.h" + +#include <linux/ethtool.h> + +namespace android::netdevice::ethtool { + +std::optional<uint32_t> getValue(const std::string& ifname, uint32_t command) { + struct ethtool_value valueop = {}; + valueop.cmd = command; + + auto ifr = ifreqs::fromName(ifname); + ifr.ifr_data = &valueop; + + if (!ifreqs::send(SIOCETHTOOL, ifr)) return std::nullopt; + return valueop.data; +} + +bool setValue(const std::string& ifname, uint32_t command, uint32_t value) { + struct ethtool_value valueop = {}; + valueop.cmd = command; + valueop.data = value; + + auto ifr = ifreqs::fromName(ifname); + ifr.ifr_data = &valueop; + + return ifreqs::send(SIOCETHTOOL, ifr); +} + +} // namespace android::netdevice::ethtool diff --git a/automotive/can/1.0/default/libnetdevice/ifreqs.cpp b/automotive/can/1.0/default/libnetdevice/ifreqs.cpp new file mode 100644 index 0000000000..8df6434796 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/ifreqs.cpp @@ -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. + */ + +#include "ifreqs.h" + +#include "common.h" + +#include <android-base/logging.h> +#include <android-base/unique_fd.h> + +#include <map> + +namespace android::netdevice::ifreqs { + +static constexpr int defaultSocketDomain = AF_INET; +std::atomic_int socketDomain = defaultSocketDomain; + +struct SocketParams { + int domain; + int type; + int protocol; +}; + +static const std::map<int, SocketParams> socketParams = { + {AF_INET, {AF_INET, SOCK_DGRAM, 0}}, + {AF_CAN, {AF_CAN, SOCK_RAW, CAN_RAW}}, +}; + +static SocketParams getSocketParams(int domain) { + if (socketParams.count(domain)) return socketParams.find(domain)->second; + + auto params = socketParams.find(defaultSocketDomain)->second; + params.domain = domain; + return params; +} + +bool send(unsigned long request, struct ifreq& ifr) { + const auto sp = getSocketParams(socketDomain); + base::unique_fd sock(socket(sp.domain, sp.type, sp.protocol)); + if (!sock.ok()) { + LOG(ERROR) << "Can't create socket"; + return false; + } + + if (ioctl(sock.get(), request, &ifr) < 0) { + PLOG(ERROR) << "ioctl(" << std::hex << request << std::dec << ") failed"; + return false; + } + + return true; +} + +struct ifreq fromName(const std::string& ifname) { + struct ifreq ifr = {}; + strlcpy(ifr.ifr_name, ifname.c_str(), IF_NAMESIZE); + return ifr; +} + +} // namespace android::netdevice::ifreqs diff --git a/automotive/can/1.0/default/libnetdevice/ifreqs.h b/automotive/can/1.0/default/libnetdevice/ifreqs.h new file mode 100644 index 0000000000..74e58775b6 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/ifreqs.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <net/if.h> + +#include <string> + +namespace android::netdevice::ifreqs { + +/** + * \see useSocketDomain() + */ +extern std::atomic_int socketDomain; + +/** + * Sends ioctl interface request. + * + * \param request Request type (such as SIOCGIFFLAGS) + * \param ifr Request data (both input and output) + * \return true if the call succeeded, false otherwise + */ +bool send(unsigned long request, struct ifreq& ifr); + +/** + * Initializes interface request with interface name. + * + * \param ifname Interface to initialize request with + * \return Interface request with ifr_name field set to ifname + */ +struct ifreq fromName(const std::string& ifname); + +} // namespace android::netdevice::ifreqs diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/NetlinkRequest.h index 3e28d78485..c19d04d874 100644 --- a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/NetlinkRequest.h @@ -17,18 +17,18 @@ #pragma once #include <android-base/macros.h> +#include <libnetdevice/types.h> + #include <linux/rtnetlink.h> #include <string> namespace android::netdevice { -typedef unsigned short rtattrtype_t; // as in rtnetlink.h -typedef __u16 nlmsgtype_t; // as in netlink.h - /** Implementation details, do not use outside NetlinkRequest template. */ namespace impl { +// TODO(twasilczyk): use nlattr instead of rtattr struct rtattr* addattr_l(struct nlmsghdr* n, size_t maxLen, rtattrtype_t type, const void* data, size_t dataLen); struct rtattr* addattr_nest(struct nlmsghdr* n, size_t maxLen, rtattrtype_t type); @@ -36,6 +36,7 @@ void addattr_nest_end(struct nlmsghdr* n, struct rtattr* nest); } // namespace impl +// TODO(twasilczyk): rename to NetlinkMessage /** * Wrapper around NETLINK_ROUTE messages, to build them in C++ style. * @@ -44,6 +45,14 @@ void addattr_nest_end(struct nlmsghdr* n, struct rtattr* nest); */ template <class T, unsigned int BUFSIZE = 128> struct NetlinkRequest { + struct RequestData { + struct nlmsghdr nlmsg; + T data; + char buf[BUFSIZE]; + }; + + static constexpr size_t totalLength = sizeof(RequestData); + /** * Create empty message. * @@ -131,12 +140,7 @@ struct NetlinkRequest { private: bool mIsGood = true; - - struct { - struct nlmsghdr nlmsg; - T data; - char buf[BUFSIZE]; - } mRequest = {}; + RequestData mRequest = {}; struct rtattr* nestStart(rtattrtype_t type) { if (!mIsGood) return nullptr; diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/NetlinkSocket.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/NetlinkSocket.h new file mode 100644 index 0000000000..826b6b88de --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/NetlinkSocket.h @@ -0,0 +1,116 @@ +/* + * 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. + */ + +#pragma once + +#include <android-base/macros.h> +#include <android-base/unique_fd.h> +#include <libnetdevice/NetlinkRequest.h> +#include <libnetdevice/nlbuf.h> + +#include <linux/netlink.h> + +#include <optional> + +namespace android::netdevice { + +/** + * A wrapper around AF_NETLINK sockets. + * + * This class is not thread safe to use a single instance between multiple threads, but it's fine to + * use multiple instances over multiple threads. + */ +struct NetlinkSocket { + /** + * NetlinkSocket constructor. + * + * \param protocol the Netlink protocol to use. + * \param pid port id. Default value of 0 allows the kernel to assign us a unique pid. (NOTE: + * this is NOT the same as process id!) + * \param groups Netlink multicast groups to listen to. This is a 32-bit bitfield, where each + * bit is a different group. Default value of 0 means no groups are selected. See man netlink.7 + * for more details. + */ + NetlinkSocket(int protocol, unsigned int pid = 0, uint32_t groups = 0); + + /** + * Send Netlink message to Kernel. The sequence number will be automatically incremented, and + * the NLM_F_ACK (request ACK) flag will be set. + * + * \param msg Message to send. + * \return true, if succeeded + */ + template <class T, unsigned int BUFSIZE> + bool send(NetlinkRequest<T, BUFSIZE>& req) { + if (!req.isGood()) return false; + return send(req.header(), req.totalLength); + } + + /** + * Send Netlink message. The message will be sent as is, without any modification. + * + * \param msg Message to send. + * \param sa Destination address. + * \return true, if succeeded + */ + bool send(const nlbuf<nlmsghdr>& msg, const sockaddr_nl& sa); + + /** + * Receive Netlink data. + * + * \param buf buffer to hold message data. + * \param bufLen length of buf. + * \return nlbuf with message data, std::nullopt on error. + */ + std::optional<nlbuf<nlmsghdr>> receive(void* buf, size_t bufLen); + + /** + * Receive Netlink data with address info. + * + * \param buf buffer to hold message data. + * \param bufLen length of buf. + * \param sa Blank struct that recvfrom will populate with address info. + * \return nlbuf with message data, std::nullopt on error. + */ + std::optional<nlbuf<nlmsghdr>> receive(void* buf, size_t bufLen, sockaddr_nl& sa); + + /** + * Receive Netlink ACK message from Kernel. + * + * \return true if received ACK message, false in case of error + */ + bool receiveAck(); + + /** + * Gets the PID assigned to mFd. + * + * \return pid that mSocket is bound to. + */ + std::optional<unsigned int> getSocketPid(); + + private: + const int mProtocol; + + uint32_t mSeq = 0; + base::unique_fd mFd; + bool mFailed = false; + + bool send(nlmsghdr* msg, size_t totalLen); + + DISALLOW_COPY_AND_ASSIGN(NetlinkSocket); +}; + +} // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/ethtool.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/ethtool.h new file mode 100644 index 0000000000..26bfdce00c --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/ethtool.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <optional> +#include <string> + +namespace android::netdevice::ethtool { + +/** + * Fetch a single value with ethtool_value. + * + * \see linux/ethtool.h + * \param ifname Interface to fetch data for + * \param command Fetch command (ETHTOOL_G*) + * \return value, or nullopt if fetch failed + */ +std::optional<uint32_t> getValue(const std::string& ifname, uint32_t command); + +/** + * Set a single value with ethtool_value. + * + * \see linux/ethtool.h + * \param ifname Interface to set data for + * \param command Set command (ETHTOOL_S*) + * \param value New value + * \return true if succeeded, false otherwise + */ +bool setValue(const std::string& ifname, uint32_t command, uint32_t value); + +} // namespace android::netdevice::ethtool diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h index 3818a31c4c..9a26ff17be 100644 --- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h @@ -16,11 +16,26 @@ #pragma once +#include <linux/if_ether.h> + +#include <array> #include <optional> #include <string> namespace android::netdevice { +typedef std::array<uint8_t, ETH_ALEN> hwaddr_t; + +/** + * Configures libnetdevice to use other socket domain than AF_INET, + * what requires less permissive SEPolicy rules for a given process. + * + * In such case, the process would only be able to control interfaces of a given kind. + + * \param domain Socket domain to use (e.g. AF_CAN), see socket(2) for details + */ +void useSocketDomain(int domain); + /** * Checks, if the network interface exists. * @@ -38,6 +53,16 @@ bool exists(std::string ifname); std::optional<bool> isUp(std::string ifname); /** + * Checks, if the network interface exists and is up. + * + * This is a convenience function to call both exists() and isUp(). + * + * \param ifname Interface to check + * \return true if the interface is up, false otherwise + */ +bool existsAndIsUp(const std::string& ifname); + +/** * Brings network interface up. * * \param ifname Interface to bring up @@ -70,4 +95,22 @@ bool add(std::string dev, std::string type); */ bool del(std::string dev); +/** + * Fetches interface's hardware address. + * + * \param ifname Interface name + * \return Hardware address (MAC address) or nullopt if the lookup failed + */ +std::optional<hwaddr_t> getHwAddr(const std::string& ifname); + +/** + * Changes interface's hardware address. + * + * \param ifname Interface name + * \param hwaddr New hardware address to set + */ +bool setHwAddr(const std::string& ifname, hwaddr_t hwaddr); + } // namespace android::netdevice + +bool operator==(const android::netdevice::hwaddr_t lhs, const unsigned char rhs[ETH_ALEN]); diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/nlbuf.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/nlbuf.h new file mode 100644 index 0000000000..601ab942af --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/nlbuf.h @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <android-base/logging.h> + +#include <linux/netlink.h> + +#include <optional> + +namespace android::netdevice { + +/** + * Buffer containing netlink structure (e.g. struct nlmsghdr, struct nlattr). + * + * This is a C++-style, memory safe(r) and generic implementation of linux/netlink.h macros. + * + * While netlink structures contain information about their total length (with payload), they can + * not be trusted - the value may either be larger than the buffer message is allocated in or + * smaller than the header itself (so it couldn't even fit itself). + * + * As a solution, nlbuf<> keeps track of two lengths (both attribute for header with payload): + * - buffer length - how much memory was allocated to a given structure + * - declared length - what nlmsg_len or nla_len says how long the structure is + * + * In most cases buffer length would be larger than declared length (or equal - modulo alignment - + * for continuous data). If that's not the case, there is a potential of ouf-of-bounds read which + * this template attempts to protect against. + */ +template <typename T> +class nlbuf { + // The following definitions are C++ equivalents of NLMSG_* macros from linux/netlink.h + + static constexpr size_t alignto = NLMSG_ALIGNTO; + static_assert(NLMSG_ALIGNTO == NLA_ALIGNTO); + + static constexpr size_t align(size_t ptr) { return (ptr + alignto - 1) & ~(alignto - 1); } + + static constexpr size_t hdrlen = align(sizeof(T)); + + public: + /** + * Constructor for nlbuf. + * + * \param data A pointer to the data the nlbuf wraps. + * \param bufferLen Length of buffer. + */ + nlbuf(const T* data, size_t bufferLen) : mData(data), mBufferEnd(pointerAdd(data, bufferLen)) {} + + const T* operator->() const { + CHECK(firstOk()) << "buffer can't fit the first element's header"; + return mData; + } + + std::pair<bool, const T&> getFirst() const { + if (!ok()) { + static const T dummy = {}; + return {false, dummy}; + } + return {true, *mData}; + } + + /** + * Copy the first element of the buffer. + * + * This is a memory-safe cast operation, useful for reading e.g. uint32_t values + * from 1-byte buffer. + */ + T copyFirst() const { + T val = {}; + memcpy(&val, mData, std::min(sizeof(val), remainingLength())); + return val; + } + + bool firstOk() const { return sizeof(T) <= remainingLength(); } + + template <typename D> + const nlbuf<D> data(size_t offset = 0) const { + // Equivalent to NLMSG_DATA(hdr) + NLMSG_ALIGN(offset) + const D* dptr = reinterpret_cast<const D*>(uintptr_t(mData) + hdrlen + align(offset)); + return {dptr, dataEnd()}; + } + + class iterator { + public: + iterator() : mCurrent(nullptr, size_t(0)) { + CHECK(!mCurrent.ok()) << "end() iterator should indicate it's beyond end"; + } + iterator(const nlbuf<T>& buf) : mCurrent(buf) {} + + iterator operator++() { + // mBufferEnd stays the same + mCurrent.mData = reinterpret_cast<const T*>( // + uintptr_t(mCurrent.mData) + align(mCurrent.declaredLength())); + + return *this; + } + + bool operator==(const iterator& other) const { + // all iterators beyond end are the same + if (!mCurrent.ok() && !other.mCurrent.ok()) return true; + + return uintptr_t(other.mCurrent.mData) == uintptr_t(mCurrent.mData); + } + + const nlbuf<T>& operator*() const { return mCurrent; } + + protected: + nlbuf<T> mCurrent; + }; + iterator begin() const { return {*this}; } + iterator end() const { return {}; } + + class raw_iterator : public iterator { + public: + iterator operator++() { + this->mCurrent.mData++; // ignore alignment + return *this; + } + const T& operator*() const { return *this->mCurrent.mData; } + }; + + class raw_view { + public: + raw_view(const nlbuf<T>& buffer) : mBuffer(buffer) {} + raw_iterator begin() const { return {mBuffer}; } + raw_iterator end() const { return {}; } + + const T* ptr() const { return mBuffer.mData; } + size_t len() const { return mBuffer.remainingLength(); } + + private: + const nlbuf<T> mBuffer; + }; + + raw_view getRaw() const { return {*this}; } + + private: + const T* mData; + const void* mBufferEnd; + + nlbuf(const T* data, const void* bufferEnd) : mData(data), mBufferEnd(bufferEnd) {} + + bool ok() const { return declaredLength() <= remainingLength(); } + + // to be specialized individually for each T with payload after a header + inline size_t declaredLengthImpl() const { return sizeof(T); } + + size_t declaredLength() const { + // We can't even fit a header, so let's return some absurd high value to trip off + // buffer overflow checks. + static constexpr size_t badHeaderLength = std::numeric_limits<size_t>::max() / 2; + + if (sizeof(T) > remainingLength()) return badHeaderLength; + const auto len = declaredLengthImpl(); + if (sizeof(T) > len) return badHeaderLength; + return len; + } + + size_t remainingLength() const { + auto len = intptr_t(mBufferEnd) - intptr_t(mData); + return (len >= 0) ? len : 0; + } + + const void* dataEnd() const { + auto declaredEnd = pointerAdd(mData, declaredLength()); + return std::min(declaredEnd, mBufferEnd); + } + + static const void* pointerAdd(const void* ptr, size_t len) { + return reinterpret_cast<const void*>(uintptr_t(ptr) + len); + } + + template <typename D> + friend class nlbuf; // calling private constructor of data buffers +}; + +template <> +inline size_t nlbuf<nlmsghdr>::declaredLengthImpl() const { + return mData->nlmsg_len; +} + +template <> +inline size_t nlbuf<nlattr>::declaredLengthImpl() const { + return mData->nla_len; +} + +} // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/printer.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/printer.h new file mode 100644 index 0000000000..071fa63612 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/printer.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <libnetdevice/nlbuf.h> + +#include <linux/netlink.h> + +#include <string> + +namespace android::netdevice { + +/** + * Stringify a Netlink message. + * + * \param hdr Pointer to the message(s) to print. + * \param protocol Which Netlink protocol hdr uses. + * \param printPayload True will stringify message data, false will only stringify the header(s). + * \return Stringified message. + */ +std::string toString(const nlbuf<nlmsghdr> hdr, int protocol, bool printPayload = false); + +} // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/types.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/types.h new file mode 100644 index 0000000000..9d90c8a7ac --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/types.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <linux/types.h> + +namespace android::netdevice { + +typedef __u16 nlmsgtype_t; // nlmsghdr::nlmsg_type +typedef __u16 nlattrtype_t; // nlattr::nla_type +typedef unsigned short rtattrtype_t; // rtattr::rta_type + +} // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/vlan.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/vlan.h new file mode 100644 index 0000000000..3e1b736ebd --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/vlan.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <string> + +namespace android::netdevice::vlan { + +bool add(const std::string& eth, const std::string& vlan, uint16_t id); + +} // namespace android::netdevice::vlan diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp index b05144209e..4293cad0db 100644 --- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp +++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp @@ -16,62 +16,48 @@ #include <libnetdevice/libnetdevice.h> -#include "NetlinkRequest.h" -#include "NetlinkSocket.h" #include "common.h" +#include "ifreqs.h" #include <android-base/logging.h> +#include <libnetdevice/NetlinkRequest.h> +#include <libnetdevice/NetlinkSocket.h> #include <linux/can.h> #include <net/if.h> namespace android::netdevice { -bool exists(std::string ifname) { - return nametoindex(ifname) != 0; +void useSocketDomain(int domain) { + ifreqs::socketDomain = domain; } -static bool sendIfreq(unsigned long request, struct ifreq& ifr) { - /* For general interfaces it would be socket(AF_INET, SOCK_DGRAM, 0), - * but SEPolicy forces us to limit our flexibility here. */ - base::unique_fd sock(socket(PF_CAN, SOCK_RAW, CAN_RAW)); - if (!sock.ok()) { - LOG(ERROR) << "Can't create socket"; - return false; - } - - if (ioctl(sock.get(), request, &ifr) < 0) { - PLOG(ERROR) << "ioctl(" << std::hex << request << std::dec << ") failed"; - return false; - } - - return true; -} - -static struct ifreq ifreqFromName(const std::string& ifname) { - struct ifreq ifr = {}; - strlcpy(ifr.ifr_name, ifname.c_str(), IF_NAMESIZE); - return ifr; +bool exists(std::string ifname) { + return nametoindex(ifname) != 0; } std::optional<bool> isUp(std::string ifname) { - struct ifreq ifr = ifreqFromName(ifname); - if (!sendIfreq(SIOCGIFFLAGS, ifr)) return std::nullopt; + auto ifr = ifreqs::fromName(ifname); + if (!ifreqs::send(SIOCGIFFLAGS, ifr)) return std::nullopt; return ifr.ifr_flags & IFF_UP; } +bool existsAndIsUp(const std::string& ifname) { + return exists(ifname) && isUp(ifname).value_or(false); +} + bool up(std::string ifname) { - struct ifreq ifr = ifreqFromName(ifname); - if (!sendIfreq(SIOCGIFFLAGS, ifr)) return false; + auto ifr = ifreqs::fromName(ifname); + if (!ifreqs::send(SIOCGIFFLAGS, ifr)) return false; ifr.ifr_flags |= IFF_UP; - return sendIfreq(SIOCSIFFLAGS, ifr); + return ifreqs::send(SIOCSIFFLAGS, ifr); } bool down(std::string ifname) { - struct ifreq ifr = ifreqFromName(ifname); - if (!sendIfreq(SIOCGIFFLAGS, ifr)) return false; + auto ifr = ifreqs::fromName(ifname); + if (!ifreqs::send(SIOCGIFFLAGS, ifr)) return false; ifr.ifr_flags &= ~IFF_UP; - return sendIfreq(SIOCSIFFLAGS, ifr); + return ifreqs::send(SIOCSIFFLAGS, ifr); } bool add(std::string dev, std::string type) { @@ -95,4 +81,28 @@ bool del(std::string dev) { return sock.send(req) && sock.receiveAck(); } +std::optional<hwaddr_t> getHwAddr(const std::string& ifname) { + auto ifr = ifreqs::fromName(ifname); + if (!ifreqs::send(SIOCGIFHWADDR, ifr)) return std::nullopt; + + hwaddr_t hwaddr; + memcpy(hwaddr.data(), ifr.ifr_hwaddr.sa_data, hwaddr.size()); + return hwaddr; +} + +bool setHwAddr(const std::string& ifname, hwaddr_t hwaddr) { + auto ifr = ifreqs::fromName(ifname); + + // fetch sa_family + if (!ifreqs::send(SIOCGIFHWADDR, ifr)) return false; + + memcpy(ifr.ifr_hwaddr.sa_data, hwaddr.data(), hwaddr.size()); + return ifreqs::send(SIOCSIFHWADDR, ifr); +} + } // namespace android::netdevice + +bool operator==(const android::netdevice::hwaddr_t lhs, const unsigned char rhs[ETH_ALEN]) { + static_assert(lhs.size() == ETH_ALEN); + return 0 == memcmp(lhs.data(), rhs, lhs.size()); +} diff --git a/automotive/can/1.0/default/libnetdevice/printer.cpp b/automotive/can/1.0/default/libnetdevice/printer.cpp new file mode 100644 index 0000000000..179d501264 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/printer.cpp @@ -0,0 +1,177 @@ +/* + * 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 <libnetdevice/printer.h> + +#include "common.h" +#include "protocols/all.h" + +#include <android-base/logging.h> +#include <libnetdevice/nlbuf.h> + +#include <algorithm> +#include <iomanip> +#include <sstream> + +namespace android::netdevice { + +static void flagsToStream(std::stringstream& ss, __u16 nlmsg_flags) { + bool first = true; + auto printFlag = [&ss, &first, &nlmsg_flags](__u16 flag, const std::string& name) { + if (!(nlmsg_flags & flag)) return; + nlmsg_flags &= ~flag; + + if (first) { + first = false; + } else { + ss << '|'; + } + + ss << name; + }; + printFlag(NLM_F_REQUEST, "REQUEST"); + printFlag(NLM_F_MULTI, "MULTI"); + printFlag(NLM_F_ACK, "ACK"); + printFlag(NLM_F_ECHO, "ECHO"); + printFlag(NLM_F_DUMP_INTR, "DUMP_INTR"); + printFlag(NLM_F_DUMP_FILTERED, "DUMP_FILTERED"); + + // TODO(twasilczyk): print flags depending on request type + printFlag(NLM_F_ROOT, "ROOT-REPLACE"); + printFlag(NLM_F_MATCH, "MATCH-EXCL"); + printFlag(NLM_F_ATOMIC, "ATOMIC-CREATE"); + printFlag(NLM_F_APPEND, "APPEND"); + + if (nlmsg_flags != 0) { + if (!first) ss << '|'; + ss << std::hex << nlmsg_flags << std::dec; + } +} + +static void toStream(std::stringstream& ss, const nlbuf<uint8_t> data) { + const auto rawData = data.getRaw(); + const auto dataLen = rawData.len(); + ss << std::hex; + int i = 0; + for (const auto byte : rawData) { + if (i % 16 == 0 && dataLen > 16) { + ss << std::endl << ' ' << std::dec << std::setw(4) << i << std::hex; + } + if (i++ > 0 || dataLen > 16) ss << ' '; + ss << std::setw(2) << unsigned(byte); + } + ss << std::dec; + if (dataLen > 16) ss << std::endl; +} + +static void toStream(std::stringstream& ss, const nlbuf<nlattr> attr, + const protocols::AttributeMap& attrMap) { + using DataType = protocols::AttributeDefinition::DataType; + const auto attrtype = attrMap[attr->nla_type]; + + ss << attrtype.name << ": "; + switch (attrtype.dataType) { + case DataType::Raw: + toStream(ss, attr.data<uint8_t>()); + break; + case DataType::Nested: { + ss << '{'; + bool first = true; + for (const auto childattr : attr.data<nlattr>()) { + if (!first) ss << ", "; + first = false; + toStream(ss, childattr, std::get<protocols::AttributeMap>(attrtype.ops)); + } + ss << '}'; + break; + } + case DataType::String: { + const auto str = attr.data<char>().getRaw(); + ss << '"' << sanitize({str.ptr(), str.len()}) << '"'; + break; + } + case DataType::Uint: + ss << attr.data<uint32_t>().copyFirst(); + break; + case DataType::Struct: { + const auto structToStream = + std::get<protocols::AttributeDefinition::ToStream>(attrtype.ops); + structToStream(ss, attr); + break; + } + } +} + +std::string toString(const nlbuf<nlmsghdr> hdr, int protocol, bool printPayload) { + if (!hdr.firstOk()) return "nlmsg{buffer overflow}"; + + std::stringstream ss; + ss << std::setfill('0'); + + auto protocolMaybe = protocols::get(protocol); + if (!protocolMaybe.has_value()) { + ss << "nlmsg{protocol=" << protocol << "}"; + return ss.str(); + } + protocols::NetlinkProtocol& protocolDescr = *protocolMaybe; + + auto msgDescMaybe = protocolDescr.getMessageDescriptor(hdr->nlmsg_type); + const auto msgTypeName = msgDescMaybe.has_value() + ? msgDescMaybe->get().getMessageName(hdr->nlmsg_type) + : std::to_string(hdr->nlmsg_type); + + ss << "nlmsg{" << protocolDescr.getName() << " "; + + ss << "hdr={"; + ss << "type=" << msgTypeName; + if (hdr->nlmsg_flags != 0) { + ss << ", flags="; + flagsToStream(ss, hdr->nlmsg_flags); + } + if (hdr->nlmsg_seq != 0) ss << ", seq=" << hdr->nlmsg_seq; + if (hdr->nlmsg_pid != 0) ss << ", pid=" << hdr->nlmsg_pid; + ss << ", len=" << hdr->nlmsg_len; + + ss << ", crc=" << std::hex << std::setw(4) << crc16(hdr.data<uint8_t>()) << std::dec; + ss << "} "; + + if (!printPayload) return ss.str(); + + if (!msgDescMaybe.has_value()) { + toStream(ss, hdr.data<uint8_t>()); + } else { + const protocols::MessageDescriptor& msgDesc = *msgDescMaybe; + msgDesc.dataToStream(ss, hdr); + + bool first = true; + for (auto attr : hdr.data<nlattr>(msgDesc.getContentsSize())) { + if (first) { + ss << " attributes: {"; + first = false; + } else { + ss << ", "; + } + toStream(ss, attr, msgDesc.getAttributeMap()); + } + if (!first) ss << '}'; + } + + ss << "}"; + + return ss.str(); +} + +} // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnetdevice/protocols/MessageDefinition.cpp b/automotive/can/1.0/default/libnetdevice/protocols/MessageDefinition.cpp new file mode 100644 index 0000000000..cb42896c67 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/MessageDefinition.cpp @@ -0,0 +1,62 @@ +/* + * 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 "MessageDefinition.h" + +namespace android::netdevice::protocols { + +AttributeMap::AttributeMap(const std::initializer_list<value_type> attrTypes) + : std::map<std::optional<nlattrtype_t>, AttributeDefinition>(attrTypes) {} + +const AttributeDefinition AttributeMap::operator[](nlattrtype_t nla_type) const { + if (count(nla_type) == 0) { + if (count(std::nullopt) == 0) return {std::to_string(nla_type)}; + + auto definition = find(std::nullopt)->second; + definition.name += std::to_string(nla_type); + return definition; + } + return find(nla_type)->second; +} + +MessageDescriptor::MessageDescriptor(const std::string& name, const MessageTypeMap&& messageTypes, + const AttributeMap&& attrTypes, size_t contentsSize) + : mName(name), + mContentsSize(contentsSize), + mMessageTypes(messageTypes), + mAttributeMap(attrTypes) {} + +MessageDescriptor::~MessageDescriptor() {} + +size_t MessageDescriptor::getContentsSize() const { + return mContentsSize; +} + +const MessageDescriptor::MessageTypeMap& MessageDescriptor::getMessageTypeMap() const { + return mMessageTypes; +} + +const AttributeMap& MessageDescriptor::getAttributeMap() const { + return mAttributeMap; +} + +const std::string MessageDescriptor::getMessageName(nlmsgtype_t msgtype) const { + const auto it = mMessageTypes.find(msgtype); + if (it == mMessageTypes.end()) return "?"; + return it->second; +} + +} // namespace android::netdevice::protocols diff --git a/automotive/can/1.0/default/libnetdevice/protocols/MessageDefinition.h b/automotive/can/1.0/default/libnetdevice/protocols/MessageDefinition.h new file mode 100644 index 0000000000..3a8b2b55d0 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/MessageDefinition.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <libnetdevice/nlbuf.h> +#include <libnetdevice/types.h> + +#include <map> +#include <sstream> +#include <variant> + +namespace android::netdevice::protocols { + +struct AttributeDefinition; + +/** + * Mapping between nlattrtype_t identifier and attribute definition. + * + * The map contains values for all nlattrtype_t identifiers - if some is missing, a generic + * definition with a identifier as its name will be generated. + * + * It's possible to define a default attribute to return instead of to_string of its identifier + * (useful for nested attribute lists). In such case, an entry with id=std::nullopt needs to be + * present in the map. + */ +class AttributeMap : private std::map<std::optional<nlattrtype_t>, AttributeDefinition> { + public: + using std::map<std::optional<nlattrtype_t>, AttributeDefinition>::value_type; + + AttributeMap(const std::initializer_list<value_type> attrTypes); + + const AttributeDefinition operator[](nlattrtype_t nla_type) const; +}; + +/** + * Attribute definition. + * + * Describes the name and type (optionally sub types, in case of Nested attribute) + * for a given message attribute. + */ +struct AttributeDefinition { + enum class DataType : uint8_t { + Raw, + Nested, + String, + Uint, + Struct, + }; + using ToStream = std::function<void(std::stringstream& ss, const nlbuf<nlattr> attr)>; + + std::string name; + DataType dataType = DataType::Raw; + std::variant<AttributeMap, ToStream> ops = AttributeMap{}; +}; + +/** + * Message family descriptor. + * + * Describes the structure of all message types with the same header and attributes. + */ +class MessageDescriptor { + protected: + typedef std::map<nlmsgtype_t, std::string> MessageTypeMap; + + MessageDescriptor(const std::string& name, const MessageTypeMap&& messageTypes, + const AttributeMap&& attrTypes, size_t contentsSize); + + public: + virtual ~MessageDescriptor(); + + size_t getContentsSize() const; + const MessageTypeMap& getMessageTypeMap() const; + const AttributeMap& getAttributeMap() const; + const std::string getMessageName(nlmsgtype_t msgtype) const; + virtual void dataToStream(std::stringstream& ss, const nlbuf<nlmsghdr> hdr) const = 0; + + private: + const std::string mName; + const size_t mContentsSize; + const MessageTypeMap mMessageTypes; + const AttributeMap mAttributeMap; +}; + +/** + * Message definition template. + * + * A convenience initialization helper of a message descriptor. + */ +template <typename T> +class MessageDefinition : public MessageDescriptor { + public: + MessageDefinition( + const std::string& name, + const std::initializer_list<MessageDescriptor::MessageTypeMap::value_type> messageTypes, + const std::initializer_list<AttributeMap::value_type> attrTypes = {}) + : MessageDescriptor(name, messageTypes, attrTypes, sizeof(T)) {} + + void dataToStream(std::stringstream& ss, const nlbuf<nlmsghdr> hdr) const override { + const auto& [ok, msg] = hdr.data<T>().getFirst(); + if (!ok) { + ss << "{incomplete payload}"; + return; + } + + toStream(ss, msg); + } + + protected: + virtual void toStream(std::stringstream& ss, const T& data) const = 0; +}; + +} // namespace android::netdevice::protocols diff --git a/automotive/can/1.0/default/libnetdevice/protocols/NetlinkProtocol.cpp b/automotive/can/1.0/default/libnetdevice/protocols/NetlinkProtocol.cpp new file mode 100644 index 0000000000..4b6cefb8be --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/NetlinkProtocol.cpp @@ -0,0 +1,64 @@ +/* + * 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 "NetlinkProtocol.h" + +namespace android::netdevice::protocols { + +NetlinkProtocol::NetlinkProtocol(int protocol, const std::string name, + const MessageDescriptorList&& messageDescrs) + : mProtocol(protocol), mName(name), mMessageDescrs(toMap(messageDescrs, protocol)) {} + +NetlinkProtocol::~NetlinkProtocol() {} + +int NetlinkProtocol::getProtocol() const { + return mProtocol; +} + +const std::string& NetlinkProtocol::getName() const { + return mName; +} + +const std::optional<std::reference_wrapper<const MessageDescriptor>> +NetlinkProtocol::getMessageDescriptor(nlmsgtype_t nlmsg_type) { + if (mMessageDescrs.count(nlmsg_type) == 0) return std::nullopt; + return *mMessageDescrs.find(nlmsg_type)->second; +} + +NetlinkProtocol::MessageDescriptorMap NetlinkProtocol::toMap( + const NetlinkProtocol::MessageDescriptorList& descrs, int protocol) { + MessageDescriptorMap map; + for (const auto& descr : descrs) { + for (const auto& [mtype, mname] : descr->getMessageTypeMap()) { + map.emplace(mtype, descr); + } + } + + const MessageDescriptorList baseDescriptors = { + std::make_shared<base::Empty>(), + std::make_shared<base::Error>(protocol), + }; + + for (const auto& descr : baseDescriptors) { + for (const auto& [mtype, mname] : descr->getMessageTypeMap()) { + map.emplace(mtype, descr); + } + } + + return map; +} + +} // namespace android::netdevice::protocols diff --git a/automotive/can/1.0/default/libnetdevice/protocols/NetlinkProtocol.h b/automotive/can/1.0/default/libnetdevice/protocols/NetlinkProtocol.h new file mode 100644 index 0000000000..7b12efaa2c --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/NetlinkProtocol.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "MessageDefinition.h" +#include "common/Empty.h" +#include "common/Error.h" + +#include <libnetdevice/types.h> + +#include <string> +#include <vector> + +namespace android::netdevice::protocols { + +/** + * Netlink-based protocol definition. + * + * Usually it's just an id/name and a list of supported messages. + */ +class NetlinkProtocol { + public: + virtual ~NetlinkProtocol(); + + int getProtocol() const; + + const std::string& getName() const; + + virtual const std::optional<std::reference_wrapper<const MessageDescriptor>> + getMessageDescriptor(nlmsgtype_t nlmsg_type); + + protected: + typedef std::vector<std::shared_ptr<const MessageDescriptor>> MessageDescriptorList; + + NetlinkProtocol(int protocol, const std::string name, + const MessageDescriptorList&& messageDescrs); + + private: + typedef std::map<nlmsgtype_t, std::shared_ptr<const MessageDescriptor>> MessageDescriptorMap; + + const int mProtocol; + const std::string mName; + const MessageDescriptorMap mMessageDescrs; + + static MessageDescriptorMap toMap(const MessageDescriptorList& descrs, int protocol); +}; + +} // namespace android::netdevice::protocols diff --git a/automotive/can/1.0/default/libnetdevice/protocols/README b/automotive/can/1.0/default/libnetdevice/protocols/README new file mode 100644 index 0000000000..45c95c40ea --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/README @@ -0,0 +1,8 @@ +This folder contains message definitions for various protocols based on Netlink. + +The structure is as follows: +protocols/*.(cpp|h) - base definition classes and protocol definition lookup +protocols/common/ - common message types that apply to all protocols +protocols/<proto>/<proto>.(cpp|h) - protocol definition (usually just a list of message types) +protocols/<proto>/*.(cpp|h) - message definition that covers all message types with the same + header (T type in MessageDefinition template) and attributes diff --git a/automotive/can/1.0/default/libnetdevice/protocols/all.cpp b/automotive/can/1.0/default/libnetdevice/protocols/all.cpp new file mode 100644 index 0000000000..980e3d0f16 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/all.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 "all.h" + +#include "generic/Generic.h" +#include "route/Route.h" + +#include <map> + +namespace android::netdevice::protocols { + +// This should be a map of unique_ptr, but it's not trivial to uniformly initialize such a map +static std::map<int, std::shared_ptr<NetlinkProtocol>> toMap( + std::initializer_list<std::shared_ptr<NetlinkProtocol>> l) { + std::map<int, std::shared_ptr<NetlinkProtocol>> map; + for (auto p : l) { + map[p->getProtocol()] = p; + } + return map; +} + +static auto all = toMap({ + std::make_unique<generic::Generic>(), + std::make_unique<route::Route>(), +}); + +std::optional<std::reference_wrapper<NetlinkProtocol>> get(int protocol) { + if (all.count(protocol) == 0) return std::nullopt; + return *all.find(protocol)->second.get(); +} + +} // namespace android::netdevice::protocols diff --git a/automotive/can/1.0/default/libnetdevice/protocols/all.h b/automotive/can/1.0/default/libnetdevice/protocols/all.h new file mode 100644 index 0000000000..2180ebb017 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/all.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "NetlinkProtocol.h" + +namespace android::netdevice::protocols { + +/** + * Protocol definition lookup. + * + * \param protocol Protocol identifier from linux/netlink.h + * \return Protocol definition or nullopt if it's not implemented + */ +std::optional<std::reference_wrapper<NetlinkProtocol>> get(int protocol); + +} // namespace android::netdevice::protocols diff --git a/automotive/can/1.0/default/libnetdevice/protocols/common/Empty.cpp b/automotive/can/1.0/default/libnetdevice/protocols/common/Empty.cpp new file mode 100644 index 0000000000..9f252039da --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/common/Empty.cpp @@ -0,0 +1,31 @@ +/* + * 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 "Empty.h" + +namespace android::netdevice::protocols::base { + +// clang-format off +Empty::Empty() : MessageDefinition<char>("nlmsg", { + {NLMSG_NOOP, "NOOP"}, + {NLMSG_DONE, "DONE"}, + {NLMSG_OVERRUN, "OVERRUN"}, +}) {} +// clang-format on + +void Empty::toStream(std::stringstream&, const char&) const {} + +} // namespace android::netdevice::protocols::base diff --git a/automotive/can/1.0/default/libnetdevice/protocols/common/Empty.h b/automotive/can/1.0/default/libnetdevice/protocols/common/Empty.h new file mode 100644 index 0000000000..b5b317f436 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/common/Empty.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "../MessageDefinition.h" + +#include <libnetdevice/printer.h> + +namespace android::netdevice::protocols::base { + +// no-payload (like NLMSG_NOOP) messages can't be defined with T=void, so let's use char +class Empty : public MessageDefinition<char> { + public: + Empty(); + void toStream(std::stringstream&, const char&) const override; +}; + +} // namespace android::netdevice::protocols::base diff --git a/automotive/can/1.0/default/libnetdevice/protocols/common/Error.cpp b/automotive/can/1.0/default/libnetdevice/protocols/common/Error.cpp new file mode 100644 index 0000000000..25ae680227 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/common/Error.cpp @@ -0,0 +1,36 @@ +/* + * 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 "Error.h" + +#include "../MessageDefinition.h" + +#include <libnetdevice/printer.h> + +namespace android::netdevice::protocols::base { + +// clang-format off +Error::Error(int protocol) : MessageDefinition<nlmsgerr>("nlmsg", { + {NLMSG_ERROR, "ERROR"}, +}), mProtocol(protocol) {} +// clang-format on + +void Error::toStream(std::stringstream& ss, const nlmsgerr& data) const { + ss << "nlmsgerr{error=" << data.error + << ", msg=" << toString({&data.msg, sizeof(data.msg)}, mProtocol) << "}"; +} + +} // namespace android::netdevice::protocols::base diff --git a/automotive/can/1.0/default/libnetdevice/protocols/common/Error.h b/automotive/can/1.0/default/libnetdevice/protocols/common/Error.h new file mode 100644 index 0000000000..1f3c1dd694 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/common/Error.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "../MessageDefinition.h" + +namespace android::netdevice::protocols::base { + +class Error : public MessageDefinition<nlmsgerr> { + public: + Error(int protocol); + void toStream(std::stringstream& ss, const nlmsgerr& data) const override; + + private: + const int mProtocol; +}; + +} // namespace android::netdevice::protocols::base diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/Ctrl.cpp b/automotive/can/1.0/default/libnetdevice/protocols/generic/Ctrl.cpp new file mode 100644 index 0000000000..4120008519 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/Ctrl.cpp @@ -0,0 +1,55 @@ +/* + * 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 "Ctrl.h" + +namespace android::netdevice::protocols::generic { + +using DataType = AttributeDefinition::DataType; + +// clang-format off +Ctrl::Ctrl() : GenericMessageBase(GENL_ID_CTRL, "ID_CTRL", { + {CTRL_CMD_NEWFAMILY, "NEWFAMILY"}, + {CTRL_CMD_DELFAMILY, "DELFAMILY"}, + {CTRL_CMD_GETFAMILY, "GETFAMILY"}, + {CTRL_CMD_NEWOPS, "NEWOPS"}, + {CTRL_CMD_DELOPS, "DELOPS"}, + {CTRL_CMD_GETOPS, "GETOPS"}, + {CTRL_CMD_NEWMCAST_GRP, "NEWMCAST_GRP"}, + {CTRL_CMD_DELMCAST_GRP, "DELMCAST_GRP"}, + {CTRL_CMD_GETMCAST_GRP, "GETMCAST_GRP"}, +}, { + {CTRL_ATTR_FAMILY_ID, {"FAMILY_ID", DataType::Uint}}, + {CTRL_ATTR_FAMILY_NAME, {"FAMILY_NAME", DataType::String}}, + {CTRL_ATTR_VERSION, {"VERSION", DataType::Uint}}, + {CTRL_ATTR_HDRSIZE, {"HDRSIZE", DataType::Uint}}, + {CTRL_ATTR_MAXATTR, {"MAXATTR", DataType::Uint}}, + {CTRL_ATTR_OPS, {"OPS", DataType::Nested, AttributeMap{ + {std::nullopt, {"OP", DataType::Nested, AttributeMap{ + {CTRL_ATTR_OP_ID, {"ID", DataType::Uint}}, + {CTRL_ATTR_OP_FLAGS, {"FLAGS", DataType::Uint}}, + }}}, + }}}, + {CTRL_ATTR_MCAST_GROUPS, {"MCAST_GROUPS", DataType::Nested, AttributeMap{ + {std::nullopt, {"GRP", DataType::Nested, AttributeMap{ + {CTRL_ATTR_MCAST_GRP_NAME, {"NAME", DataType::String}}, + {CTRL_ATTR_MCAST_GRP_ID, {"ID", DataType::Uint}}, + }}}, + }}}, +}) {} +// clang-format on + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/Ctrl.h b/automotive/can/1.0/default/libnetdevice/protocols/generic/Ctrl.h new file mode 100644 index 0000000000..804ed2cf9a --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/Ctrl.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "GenericMessageBase.h" + +namespace android::netdevice::protocols::generic { + +class Ctrl : public GenericMessageBase { + public: + Ctrl(); +}; + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/Generic.cpp b/automotive/can/1.0/default/libnetdevice/protocols/generic/Generic.cpp new file mode 100644 index 0000000000..633ef3cbbe --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/Generic.cpp @@ -0,0 +1,36 @@ +/* + * 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 "Generic.h" + +#include "Ctrl.h" +#include "Unknown.h" + +namespace android::netdevice::protocols::generic { + +Generic::Generic() : NetlinkProtocol(NETLINK_GENERIC, "GENERIC", {std::make_shared<Ctrl>()}) {} + +const std::optional<std::reference_wrapper<const MessageDescriptor>> Generic::getMessageDescriptor( + nlmsgtype_t nlmsg_type) { + const auto desc = NetlinkProtocol::getMessageDescriptor(nlmsg_type); + if (desc.has_value()) return desc; + + auto it = mFamilyRegister.find(nlmsg_type); + if (it != mFamilyRegister.end()) return *it->second; + return *(mFamilyRegister[nlmsg_type] = std::make_shared<Unknown>(nlmsg_type)); +} + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/Generic.h b/automotive/can/1.0/default/libnetdevice/protocols/generic/Generic.h new file mode 100644 index 0000000000..b4352f6193 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/Generic.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "../NetlinkProtocol.h" + +namespace android::netdevice::protocols::generic { + +/** + * Definition of NETLINK_GENERIC protocol. + */ +class Generic : public NetlinkProtocol { + public: + Generic(); + + const std::optional<std::reference_wrapper<const MessageDescriptor>> getMessageDescriptor( + nlmsgtype_t nlmsg_type); + + private: + std::map<nlmsgtype_t, std::shared_ptr<const MessageDescriptor>> mFamilyRegister; +}; + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/GenericMessageBase.cpp b/automotive/can/1.0/default/libnetdevice/protocols/generic/GenericMessageBase.cpp new file mode 100644 index 0000000000..c9f08131fc --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/GenericMessageBase.cpp @@ -0,0 +1,40 @@ +/* + * 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 "GenericMessageBase.h" + +namespace android::netdevice::protocols::generic { + +GenericMessageBase::GenericMessageBase( + nlmsgtype_t msgtype, std::string msgname, + const std::initializer_list<GenericCommandNameMap::value_type> commandNames, + const std::initializer_list<AttributeMap::value_type> attrTypes) + : MessageDefinition<struct genlmsghdr>(msgname, {{msgtype, msgname}}, attrTypes), + mCommandNames(commandNames) {} + +void GenericMessageBase::toStream(std::stringstream& ss, const struct genlmsghdr& data) const { + ss << "genlmsghdr{"; + if (mCommandNames.count(data.cmd) == 0) { + ss << "cmd=" << unsigned(data.cmd); + } else { + ss << "cmd=" << mCommandNames.find(data.cmd)->second; + } + ss << ", version=" << unsigned(data.version); + if (data.reserved != 0) ss << ", reserved=" << data.reserved; + ss << "}"; +} + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/GenericMessageBase.h b/automotive/can/1.0/default/libnetdevice/protocols/generic/GenericMessageBase.h new file mode 100644 index 0000000000..2a19034dda --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/GenericMessageBase.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "../MessageDefinition.h" + +#include <linux/genetlink.h> + +namespace android::netdevice::protocols::generic { + +class GenericMessageBase : public MessageDefinition<struct genlmsghdr> { + public: + typedef std::map<uint8_t, std::string> GenericCommandNameMap; + + GenericMessageBase( + nlmsgtype_t msgtype, std::string msgname, + const std::initializer_list<GenericCommandNameMap::value_type> commandNames = {}, + const std::initializer_list<AttributeMap::value_type> attrTypes = {}); + + void toStream(std::stringstream& ss, const struct genlmsghdr& data) const override; + + private: + const GenericCommandNameMap mCommandNames; +}; + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/Unknown.cpp b/automotive/can/1.0/default/libnetdevice/protocols/generic/Unknown.cpp new file mode 100644 index 0000000000..9a71d897c3 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/Unknown.cpp @@ -0,0 +1,24 @@ +/* + * 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 "Unknown.h" + +namespace android::netdevice::protocols::generic { + +Unknown::Unknown(nlmsgtype_t msgtype) + : GenericMessageBase(msgtype, "Unknown(" + std::to_string(msgtype) + ")") {} + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/generic/Unknown.h b/automotive/can/1.0/default/libnetdevice/protocols/generic/Unknown.h new file mode 100644 index 0000000000..82a5501830 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/generic/Unknown.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "GenericMessageBase.h" + +namespace android::netdevice::protocols::generic { + +class Unknown : public GenericMessageBase { + public: + Unknown(nlmsgtype_t msgtype); +}; + +} // namespace android::netdevice::protocols::generic diff --git a/automotive/can/1.0/default/libnetdevice/protocols/route/Link.cpp b/automotive/can/1.0/default/libnetdevice/protocols/route/Link.cpp new file mode 100644 index 0000000000..53e1700219 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/route/Link.cpp @@ -0,0 +1,117 @@ +/* + * 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 "Link.h" + +#include "structs.h" + +#include <net/if.h> + +namespace android::netdevice::protocols::route { + +using DataType = AttributeDefinition::DataType; + +// clang-format off +Link::Link() : MessageDefinition<struct ifinfomsg>("link", { + {RTM_NEWLINK, "NEWLINK"}, + {RTM_DELLINK, "DELLINK"}, + {RTM_GETLINK, "GETLINK"}, +}, { + {IFLA_ADDRESS, {"ADDRESS"}}, + {IFLA_BROADCAST, {"BROADCAST"}}, + {IFLA_IFNAME, {"IFNAME", DataType::String}}, + {IFLA_MTU, {"MTU", DataType::Uint}}, + {IFLA_LINK, {"LINK", DataType::Uint}}, + {IFLA_QDISC, {"QDISC", DataType::String}}, + {IFLA_STATS, {"STATS", DataType::Struct, statsToStream<rtnl_link_stats>}}, + {IFLA_COST, {"COST"}}, + {IFLA_PRIORITY, {"PRIORITY"}}, + {IFLA_MASTER, {"MASTER", DataType::Uint}}, + {IFLA_WIRELESS, {"WIRELESS"}}, + {IFLA_PROTINFO, {"PROTINFO"}}, + {IFLA_TXQLEN, {"TXQLEN", DataType::Uint}}, + {IFLA_MAP, {"MAP", DataType::Struct, mapToStream}}, + {IFLA_WEIGHT, {"WEIGHT", DataType::Uint}}, + {IFLA_OPERSTATE, {"OPERSTATE", DataType::Uint}}, + {IFLA_LINKMODE, {"LINKMODE", DataType::Uint}}, + {IFLA_LINKINFO, {"LINKINFO", DataType::Nested, AttributeMap{ + {IFLA_INFO_KIND, {"INFO_KIND", DataType::String}}, + {IFLA_INFO_DATA, {"INFO_DATA", DataType::Nested}}, + {IFLA_INFO_XSTATS, {"INFO_XSTATS"}}, + {IFLA_INFO_SLAVE_KIND, {"INFO_SLAVE_KIND", DataType::String}}, + {IFLA_INFO_SLAVE_DATA, {"INFO_SLAVE_DATA"}}, + }}}, + {IFLA_NET_NS_PID, {"NET_NS_PID", DataType::Uint}}, + {IFLA_IFALIAS, {"IFALIAS", DataType::String}}, + {IFLA_NUM_VF, {"NUM_VF", DataType::Uint}}, + {IFLA_VFINFO_LIST, {"VFINFO_LIST"}}, + {IFLA_STATS64, {"STATS64", DataType::Struct, statsToStream<rtnl_link_stats64>}}, + {IFLA_VF_PORTS, {"VF_PORTS"}}, + {IFLA_PORT_SELF, {"PORT_SELF"}}, + {IFLA_AF_SPEC, {"AF_SPEC", DataType::Nested, AttributeMap{ + {AF_INET, {"AF_INET", DataType::Nested, AttributeMap{ + {IFLA_INET_CONF, {"INET_CONF", DataType::Struct, arrayToStream<int32_t>}}, + }}}, + {AF_INET6, {"AF_INET6", DataType::Nested, AttributeMap{ + {IFLA_INET6_FLAGS, {"INET6_FLAGS", DataType::Uint}}, + {IFLA_INET6_CONF, {"INET6_CONF", DataType::Struct, arrayToStream<int32_t>}}, + {IFLA_INET6_STATS, {"INET6_STATS", DataType::Struct, arrayToStream<uint64_t>}}, + {IFLA_INET6_MCAST, {"INET6_MCAST"}}, + {IFLA_INET6_CACHEINFO, {"INET6_CACHEINFO", DataType::Struct, ifla_cacheinfoToStream}}, + {IFLA_INET6_ICMP6STATS, {"INET6_ICMP6STATS", DataType::Struct, arrayToStream<uint64_t>}}, + {IFLA_INET6_TOKEN, {"INET6_TOKEN"}}, + {IFLA_INET6_ADDR_GEN_MODE, {"INET6_ADDR_GEN_MODE", DataType::Uint}}, + }}}, + }}}, + {IFLA_GROUP, {"GROUP", DataType::Uint}}, + {IFLA_NET_NS_FD, {"NET_NS_FD", DataType::Uint}}, + {IFLA_EXT_MASK, {"EXT_MASK", DataType::Uint}}, + {IFLA_PROMISCUITY, {"PROMISCUITY", DataType::Uint}}, + {IFLA_NUM_TX_QUEUES, {"NUM_TX_QUEUES", DataType::Uint}}, + {IFLA_NUM_RX_QUEUES, {"NUM_RX_QUEUES", DataType::Uint}}, + {IFLA_CARRIER, {"CARRIER", DataType::Uint}}, + {IFLA_PHYS_PORT_ID, {"PHYS_PORT_ID"}}, + {IFLA_CARRIER_CHANGES, {"CARRIER_CHANGES", DataType::Uint}}, + {IFLA_PHYS_SWITCH_ID, {"PHYS_SWITCH_ID"}}, + {IFLA_LINK_NETNSID, {"LINK_NETNSID"}}, // NLA_S32 + {IFLA_PHYS_PORT_NAME, {"PHYS_PORT_NAME", DataType::String}}, + {IFLA_PROTO_DOWN, {"PROTO_DOWN", DataType::Uint}}, + {IFLA_GSO_MAX_SEGS, {"GSO_MAX_SEGS", DataType::Uint}}, + {IFLA_GSO_MAX_SIZE, {"GSO_MAX_SIZE", DataType::Uint}}, + {IFLA_PAD, {"PAD"}}, + {IFLA_XDP, {"XDP"}}, + {IFLA_EVENT, {"EVENT", DataType::Uint}}, + {IFLA_NEW_NETNSID, {"NEW_NETNSID"}}, // NLA_S32 + {IFLA_TARGET_NETNSID, {"TARGET_NETNSID"}}, // NLA_S32 + {IFLA_CARRIER_UP_COUNT, {"CARRIER_UP_COUNT", DataType::Uint}}, + {IFLA_CARRIER_DOWN_COUNT, {"CARRIER_DOWN_COUNT", DataType::Uint}}, + {IFLA_NEW_IFINDEX, {"NEW_IFINDEX"}}, // NLA_S32 + {IFLA_MIN_MTU, {"MIN_MTU", DataType::Uint}}, + {IFLA_MAX_MTU, {"MAX_MTU", DataType::Uint}}, + {IFLA_PROP_LIST, {"PROP_LIST"}}, + {IFLA_ALT_IFNAME, {"ALT_IFNAME", DataType::String}}, + {IFLA_PERM_ADDRESS, {"PERM_ADDRESS"}}, +}) {} +// clang-format off + +void Link::toStream(std::stringstream& ss, const struct ifinfomsg& data) const { + ss << "ifinfomsg{" + << "family=" << unsigned(data.ifi_family) << ", type=" << data.ifi_type + << ", index=" << data.ifi_index << ", flags=" << data.ifi_flags + << ", change=" << data.ifi_change << "}"; +} + +} // namespace android::netdevice::protocols::route diff --git a/automotive/can/1.0/default/libnetdevice/protocols/route/Link.h b/automotive/can/1.0/default/libnetdevice/protocols/route/Link.h new file mode 100644 index 0000000000..bcfce19795 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/route/Link.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "../MessageDefinition.h" + +#include <linux/rtnetlink.h> + +namespace android::netdevice::protocols::route { + +class Link : public MessageDefinition<struct ifinfomsg> { + public: + Link(); + void toStream(std::stringstream& ss, const struct ifinfomsg& data) const override; +}; + +} // namespace android::netdevice::protocols::route diff --git a/automotive/can/1.0/default/libnetdevice/protocols/route/Route.cpp b/automotive/can/1.0/default/libnetdevice/protocols/route/Route.cpp new file mode 100644 index 0000000000..456072b84a --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/route/Route.cpp @@ -0,0 +1,25 @@ +/* + * 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 "Route.h" + +#include "Link.h" + +namespace android::netdevice::protocols::route { + +Route::Route() : NetlinkProtocol(NETLINK_ROUTE, "ROUTE", {std::make_shared<Link>()}) {} + +} // namespace android::netdevice::protocols::route diff --git a/automotive/can/1.0/default/libnetdevice/protocols/route/Route.h b/automotive/can/1.0/default/libnetdevice/protocols/route/Route.h new file mode 100644 index 0000000000..3051cf93b4 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/route/Route.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "../NetlinkProtocol.h" + +namespace android::netdevice::protocols::route { + +/** + * Definition of NETLINK_ROUTE protocol. + */ +class Route : public NetlinkProtocol { + public: + Route(); +}; + +} // namespace android::netdevice::protocols::route diff --git a/automotive/can/1.0/default/libnetdevice/protocols/route/structs.cpp b/automotive/can/1.0/default/libnetdevice/protocols/route/structs.cpp new file mode 100644 index 0000000000..48d64f0a4a --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/route/structs.cpp @@ -0,0 +1,49 @@ +/* + * 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 "structs.h" + +namespace android::netdevice::protocols::route { + +void mapToStream(std::stringstream& ss, const nlbuf<nlattr> attr) { + const auto& [ok, data] = attr.data<rtnl_link_ifmap>().getFirst(); + if (!ok) { + ss << "invalid structure"; + return; + } + ss << '{' // + << data.mem_start << ',' // + << data.mem_end << ',' // + << data.base_addr << ',' // + << data.irq << ',' // + << unsigned(data.dma) << ',' // + << unsigned(data.port) << '}'; +} + +void ifla_cacheinfoToStream(std::stringstream& ss, const nlbuf<nlattr> attr) { + const auto& [ok, data] = attr.data<ifla_cacheinfo>().getFirst(); + if (!ok) { + ss << "invalid structure"; + return; + } + ss << '{' // + << data.max_reasm_len << ',' // + << data.tstamp << ',' // + << data.reachable_time << ',' // + << data.retrans_time << '}'; +} + +} // namespace android::netdevice::protocols::route diff --git a/automotive/can/1.0/default/libnetdevice/protocols/route/structs.h b/automotive/can/1.0/default/libnetdevice/protocols/route/structs.h new file mode 100644 index 0000000000..e53270439c --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/protocols/route/structs.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <libnetdevice/nlbuf.h> + +#include <linux/rtnetlink.h> + +#include <sstream> + +namespace android::netdevice::protocols::route { + +// rtnl_link_ifmap +void mapToStream(std::stringstream& ss, const nlbuf<nlattr> attr); + +// ifla_cacheinfo +void ifla_cacheinfoToStream(std::stringstream& ss, const nlbuf<nlattr> attr); + +template <typename T> +void arrayToStream(std::stringstream& ss, const nlbuf<nlattr> attr) { + ss << '{'; + for (const auto it : attr.data<T>().getRaw()) { + ss << it << ','; + } + ss.seekp(-1, std::ios_base::cur); + ss << '}'; +} + +// rtnl_link_stats or rtnl_link_stats64 +template <typename T> +void statsToStream(std::stringstream& ss, const nlbuf<nlattr> attr) { + const auto& [ok, data] = attr.data<T>().getFirst(); + if (!ok) { + ss << "invalid structure"; + return; + } + ss << '{' // + << data.rx_packets << ',' // + << data.tx_packets << ',' // + << data.rx_bytes << ',' // + << data.tx_bytes << ',' // + << data.rx_errors << ',' // + << data.tx_errors << ',' // + << data.rx_dropped << ',' // + << data.tx_dropped << ',' // + << data.multicast << ',' // + << data.collisions << ',' // + << data.rx_length_errors << ',' // + << data.rx_over_errors << ',' // + << data.rx_crc_errors << ',' // + << data.rx_frame_errors << ',' // + << data.rx_fifo_errors << ',' // + << data.rx_missed_errors << ',' // + << data.tx_aborted_errors << ',' // + << data.tx_carrier_errors << ',' // + << data.tx_fifo_errors << ',' // + << data.tx_heartbeat_errors << ',' // + << data.tx_window_errors << ',' // + << data.rx_compressed << ',' // + << data.tx_compressed << ',' // + << data.rx_nohandler << '}'; +} + +} // namespace android::netdevice::protocols::route diff --git a/automotive/can/1.0/default/libnetdevice/vlan.cpp b/automotive/can/1.0/default/libnetdevice/vlan.cpp new file mode 100644 index 0000000000..f0caacdb75 --- /dev/null +++ b/automotive/can/1.0/default/libnetdevice/vlan.cpp @@ -0,0 +1,52 @@ +/* + * 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 <libnetdevice/vlan.h> + +#include "common.h" + +#include <android-base/logging.h> +#include <libnetdevice/NetlinkRequest.h> +#include <libnetdevice/NetlinkSocket.h> + +namespace android::netdevice::vlan { + +bool add(const std::string& eth, const std::string& vlan, uint16_t id) { + const auto ethidx = nametoindex(eth); + if (ethidx == 0) { + LOG(ERROR) << "Ethernet interface " << eth << " doesn't exist"; + return false; + } + + NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL); + req.addattr(IFLA_IFNAME, vlan); + req.addattr<uint32_t>(IFLA_LINK, ethidx); + + { + auto linkinfo = req.nest(IFLA_LINKINFO); + req.addattr(IFLA_INFO_KIND, "vlan"); + + { + auto linkinfo = req.nest(IFLA_INFO_DATA); + req.addattr(IFLA_VLAN_ID, id); + } + } + + NetlinkSocket sock(NETLINK_ROUTE); + return sock.send(req) && sock.receiveAck(); +} + +} // namespace android::netdevice::vlan diff --git a/automotive/can/1.0/default/service.cpp b/automotive/can/1.0/default/service.cpp index b52a54a5b7..9a9d3226f0 100644 --- a/automotive/can/1.0/default/service.cpp +++ b/automotive/can/1.0/default/service.cpp @@ -18,6 +18,7 @@ #include <android-base/logging.h> #include <hidl/HidlTransportSupport.h> +#include <libnetdevice/libnetdevice.h> namespace android::hardware::automotive::can::V1_0::implementation { @@ -27,6 +28,8 @@ static void canControllerService() { configureRpcThreadpool(16, true); LOG(DEBUG) << "CAN controller service starting..."; + netdevice::useSocketDomain(AF_CAN); + sp<CanController> canController(new CanController); if (canController->registerAsService("socketcan") != OK) { LOG(FATAL) << "Failed to register CAN controller"; diff --git a/automotive/evs/1.0/Android.bp b/automotive/evs/1.0/Android.bp index 51f8e208b1..279c09aca0 100644 --- a/automotive/evs/1.0/Android.bp +++ b/automotive/evs/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.automotive.evs@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IEvsCamera.hal", diff --git a/automotive/evs/1.1/Android.bp b/automotive/evs/1.1/Android.bp index f9bccef5fe..443422e5aa 100644 --- a/automotive/evs/1.1/Android.bp +++ b/automotive/evs/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.automotive.evs@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IEvsCamera.hal", diff --git a/automotive/sv/1.0/Android.bp b/automotive/sv/1.0/Android.bp index 769bdc62d8..3a39148aa0 100644 --- a/automotive/sv/1.0/Android.bp +++ b/automotive/sv/1.0/Android.bp @@ -3,22 +3,19 @@ hidl_interface { name: "android.hardware.automotive.sv@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", - "ISurroundViewStream.hal", - "ISurroundViewSession.hal", "ISurroundView2dSession.hal", "ISurroundView3dSession.hal", "ISurroundViewService.hal", + "ISurroundViewSession.hal", + "ISurroundViewStream.hal", ], interfaces: [ - "android.hidl.base@1.0", "android.hardware.graphics.common@1.0", "android.hardware.graphics.common@1.1", "android.hardware.graphics.common@1.2", + "android.hidl.base@1.0", ], gen_java: true, } diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp index 0e73d856d9..4fa8773270 100644 --- a/automotive/vehicle/2.0/Android.bp +++ b/automotive/vehicle/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.automotive.vehicle@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IVehicle.hal", diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp index ea38cb3941..a5c2930a96 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp @@ -65,7 +65,7 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetP case USER_IDENTIFICATION_ASSOCIATION: return onSetUserIdentificationAssociation(value); default: - return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG)) + return android::base::Error((int)StatusCode::INVALID_ARG) << "Unsupported property: " << toString(value); } } @@ -113,7 +113,7 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetInitialUserInfoResponse(const VehiclePropValue& value) { if (value.value.int32Values.size() == 0) { ALOGE("set(INITIAL_USER_INFO): no int32values, ignoring it: %s", toString(value).c_str()); - return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG)) + return android::base::Error((int)StatusCode::INVALID_ARG) << "no int32values on " << toString(value); } @@ -150,11 +150,20 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetS const VehiclePropValue& value) { if (value.value.int32Values.size() == 0) { ALOGE("set(SWITCH_USER): no int32values, ignoring it: %s", toString(value).c_str()); - return android::base::Error(static_cast<int>(StatusCode::INVALID_ARG)) + return android::base::Error((int)StatusCode::INVALID_ARG) << "no int32values on " << toString(value); } if (value.areaId != 0) { + if (value.value.int32Values.size() >= 2 && + static_cast<SwitchUserMessageType>(value.value.int32Values[1]) == + SwitchUserMessageType::VEHICLE_REQUEST) { + // User HAL can also request a user switch, so we need to check it first + ALOGD("set(SWITCH_USER) called from lshal to emulate a vehicle request: %s", + toString(value).c_str()); + return std::unique_ptr<VehiclePropValue>(new VehiclePropValue(value)); + } + // Otherwise, we store it ALOGD("set(SWITCH_USER) called from lshal; storing it: %s", toString(value).c_str()); mSwitchUserResponseFromCmd.reset(new VehiclePropValue(value)); return {}; @@ -284,12 +293,12 @@ android::base::Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::sendUs case 3: ALOGD("not generating a property change event because of lshal prop: %s", toString(*response).c_str()); - return android::base::Error(static_cast<int>(StatusCode::NOT_AVAILABLE)) + return android::base::Error((int)StatusCode::NOT_AVAILABLE) << "not generating a property change event because of lshal prop: " << toString(*response); default: ALOGE("invalid action on lshal response: %s", toString(*response).c_str()); - return android::base::Error(static_cast<int>(StatusCode::INTERNAL_ERROR)) + return android::base::Error((int)StatusCode::INTERNAL_ERROR) << "invalid action on lshal response: " << toString(*response); } diff --git a/biometrics/face/1.0/Android.bp b/biometrics/face/1.0/Android.bp index ebb8668938..dd406f99c3 100644 --- a/biometrics/face/1.0/Android.bp +++ b/biometrics/face/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.biometrics.face@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBiometricsFace.hal", diff --git a/biometrics/face/1.1/Android.bp b/biometrics/face/1.1/Android.bp new file mode 100644 index 0000000000..14a86f14b8 --- /dev/null +++ b/biometrics/face/1.1/Android.bp @@ -0,0 +1,14 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.biometrics.face@1.1", + root: "android.hardware", + srcs: [ + "IBiometricsFace.hal", + ], + interfaces: [ + "android.hardware.biometrics.face@1.0", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/biometrics/face/1.1/IBiometricsFace.hal b/biometrics/face/1.1/IBiometricsFace.hal new file mode 100644 index 0000000000..84e7443c9c --- /dev/null +++ b/biometrics/face/1.1/IBiometricsFace.hal @@ -0,0 +1,117 @@ +/* + * 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. + */ + +package android.hardware.biometrics.face@1.1; + +import @1.0::IBiometricsFace; +import @1.0::Status; +import @1.0::Feature; + +/** + * The HAL interface for biometric face authentication. + */ +interface IBiometricsFace extends @1.0::IBiometricsFace { + /** + * Enrolls a user's face for a remote client, for example Android Auto. + * + * The HAL implementation is responsible for creating a secure communication + * channel and receiving the enrollment images from a mobile device with + * face authentication hardware. + * + * Note that the Hardware Authentication Token must be valid for the + * duration of enrollment and thus should be explicitly invalidated by a + * call to revokeChallenge() when enrollment is complete, to reduce the + * window of opportunity to re-use the challenge and HAT. For example, + * Settings calls generateChallenge() once to allow the user to enroll one + * or more faces or toggle secure settings without having to re-enter the + * PIN/pattern/password. Once the user completes the operation, Settings + * invokes revokeChallenge() to close the transaction. If the HAT is expired, + * the implementation must invoke onError with UNABLE_TO_PROCESS. + * + * Requirements for using this API: + * - Mobile devices MUST NOT delegate enrollment to another device by calling + * this API. This feature is intended only to allow enrollment on devices + * where it is impossible to enroll locally on the device. + * - The path MUST be protected by a secret key with rollback protection. + * - Synchronizing between devices MUST be accomplished by having both + * devices agree on a secret PIN entered by the user (similar to BT + * pairing procedure) and use a salted version of that PIN plus other secret + * to encrypt traffic. + * - All communication to/from the remote device MUST be encrypted and signed + * to prevent image injection and other man-in-the-middle type attacks. + * - generateChallenge() and revokeChallenge() MUST be implemented on both + * remote and local host (e.g. hash the result of the remote host with a + * local secret before responding to the API call) and any transmission of + * the challenge between hosts MUST be signed to prevent man-in-the-middle + * attacks. + * - In the event of a lost connection, the result of the last + * generateChallenge() MUST be invalidated and the process started over. + * - Both the remote and local host MUST honor the timeout and invalidate the + * challenge. + * + * This method triggers the IBiometricsFaceClientCallback#onEnrollResult() + * method. + * + * @param hat A valid Hardware Authentication Token, generated as a result + * of a generateChallenge() challenge being wrapped by the gatekeeper + * after a successful strong authentication request. + * @param timeoutSec A timeout in seconds, after which this enroll + * attempt is cancelled. Note that the framework can continue + * enrollment by calling this again with a valid HAT. This timeout is + * expected to be used to limit power usage if the device becomes idle + * during enrollment. The implementation is expected to send + * ERROR_TIMEOUT if this happens. + * @param disabledFeatures A list of features to be disabled during + * enrollment. Note that all features are enabled by default. + * @return status The status of this method call. + */ + enrollRemotely(vec<uint8_t> hat, uint32_t timeoutSec, vec<Feature> disabledFeatures) + generates (Status status); + + /** + * Enrolls a user's face. + * + * Note that the Hardware Authentication Token must be valid for the + * duration of enrollment and thus should be explicitly invalidated by a + * call to revokeChallenge() when enrollment is complete, to reduce the + * window of opportunity to re-use the challenge and HAT. For example, + * Settings calls generateChallenge() once to allow the user to enroll one + * or more faces or toggle secure settings without having to re-enter the + * PIN/pattern/password. Once the user completes the operation, Settings + * invokes revokeChallenge() to close the transaction. If the HAT is expired, + * the implementation must invoke onError with UNABLE_TO_PROCESS. + * + * This method triggers the IBiometricsFaceClientCallback#onEnrollResult() + * method. + * + * @param hat A valid Hardware Authentication Token, generated as a result + * of a generateChallenge() challenge being wrapped by the gatekeeper + * after a successful strong authentication request. + * @param timeoutSec A timeout in seconds, after which this enroll + * attempt is cancelled. Note that the framework can continue + * enrollment by calling this again with a valid HAT. This timeout is + * expected to be used to limit power usage if the device becomes idle + * during enrollment. The implementation is expected to send + * ERROR_TIMEOUT if this happens. + * @param disabledFeatures A list of features to be disabled during + * enrollment. Note that all features are enabled by default. + * @param windowId optional ID of a camera preview window for a + * single-camera device. Must be null if not used. + * @return status The status of this method call. + */ + enroll_1_1(vec<uint8_t> hat, uint32_t timeoutSec, vec<Feature> disabledFeatures, + handle windowId) generates (Status status); +}; diff --git a/biometrics/face/1.0/default/Android.bp b/biometrics/face/1.1/default/Android.bp index d6ff087ee6..360071f3dd 100644 --- a/biometrics/face/1.0/default/Android.bp +++ b/biometrics/face/1.1/default/Android.bp @@ -15,10 +15,10 @@ */ cc_binary { - name: "android.hardware.biometrics.face@1.0-service.example", + name: "android.hardware.biometrics.face@1.1-service.example", defaults: ["hidl_defaults"], vendor: true, - init_rc: ["android.hardware.biometrics.face@1.0-service.rc"], + init_rc: ["android.hardware.biometrics.face@1.1-service.rc"], vintf_fragments: ["manifest_face_default.xml"], relative_install_path: "hw", proprietary: true, @@ -31,5 +31,6 @@ cc_binary { "libutils", "liblog", "android.hardware.biometrics.face@1.0", + "android.hardware.biometrics.face@1.1", ], } diff --git a/biometrics/face/1.0/default/BiometricsFace.cpp b/biometrics/face/1.1/default/BiometricsFace.cpp index 2dd64764bb..2143880514 100644 --- a/biometrics/face/1.0/default/BiometricsFace.cpp +++ b/biometrics/face/1.1/default/BiometricsFace.cpp @@ -110,4 +110,20 @@ Return<Status> BiometricsFace::resetLockout(const hidl_vec<uint8_t>& /* hat */) return Status::OK; } +// Methods from ::android::hardware::biometrics::face::V1_1::IBiometricsFace follow. +Return<Status> BiometricsFace::enroll_1_1(const hidl_vec<uint8_t>& /* hat */, + uint32_t /* timeoutSec */, + const hidl_vec<Feature>& /* disabledFeatures */, + const hidl_handle& /* windowId */) { + mClientCallback->onError(kDeviceId, mUserId, FaceError::UNABLE_TO_PROCESS, 0 /* vendorCode */); + return Status::OK; +} + +Return<Status> BiometricsFace::enrollRemotely(const hidl_vec<uint8_t>& /* hat */, + uint32_t /* timeoutSec */, + const hidl_vec<Feature>& /* disabledFeatures */) { + mClientCallback->onError(kDeviceId, mUserId, FaceError::UNABLE_TO_PROCESS, 0 /* vendorCode */); + return Status::OK; +} + } // namespace android::hardware::biometrics::face::implementation diff --git a/biometrics/face/1.0/default/BiometricsFace.h b/biometrics/face/1.1/default/BiometricsFace.h index 1d99ed26bc..5ce5771eae 100644 --- a/biometrics/face/1.0/default/BiometricsFace.h +++ b/biometrics/face/1.1/default/BiometricsFace.h @@ -16,7 +16,7 @@ #pragma once -#include <android/hardware/biometrics/face/1.0/IBiometricsFace.h> +#include <android/hardware/biometrics/face/1.1/IBiometricsFace.h> #include <hidl/MQDescriptor.h> #include <hidl/Status.h> #include <random> @@ -34,7 +34,7 @@ using ::android::hardware::biometrics::face::V1_0::Feature; using ::android::hardware::biometrics::face::V1_0::IBiometricsFaceClientCallback; using ::android::hardware::biometrics::face::V1_0::Status; -class BiometricsFace : public V1_0::IBiometricsFace { +class BiometricsFace : public V1_1::IBiometricsFace { public: BiometricsFace(); @@ -71,6 +71,14 @@ class BiometricsFace : public V1_0::IBiometricsFace { Return<Status> resetLockout(const hidl_vec<uint8_t>& hat) override; + // Methods from ::android::hardware::biometrics::face::V1_1::IBiometricsFace follow. + Return<Status> enroll_1_1(const hidl_vec<uint8_t>& hat, uint32_t timeoutSec, + const hidl_vec<Feature>& disabledFeatures, + const hidl_handle& windowId) override; + + Return<Status> enrollRemotely(const hidl_vec<uint8_t>& hat, uint32_t timeoutSec, + const hidl_vec<Feature>& disabledFeatures) override; + private: std::mt19937 mRandom; int32_t mUserId; diff --git a/biometrics/face/1.0/default/android.hardware.biometrics.face@1.0-service.rc b/biometrics/face/1.1/default/android.hardware.biometrics.face@1.1-service.rc index 6c7362f2bb..687e2d8c86 100644 --- a/biometrics/face/1.0/default/android.hardware.biometrics.face@1.0-service.rc +++ b/biometrics/face/1.1/default/android.hardware.biometrics.face@1.1-service.rc @@ -1,4 +1,4 @@ -service vendor.face-hal-1-0-default /vendor/bin/hw/android.hardware.biometrics.face@1.0-service.example +service vendor.face-hal-1-1-default /vendor/bin/hw/android.hardware.biometrics.face@1.1-service.example # "class hal" causes a race condition on some devices due to files created # in /data. As a workaround, postpone startup until later in boot once # /data is mounted. diff --git a/biometrics/face/1.0/default/manifest_face_default.xml b/biometrics/face/1.1/default/manifest_face_default.xml index 380ae49e93..ec71d9c92b 100644 --- a/biometrics/face/1.0/default/manifest_face_default.xml +++ b/biometrics/face/1.1/default/manifest_face_default.xml @@ -2,7 +2,7 @@ <hal format="hidl"> <name>android.hardware.biometrics.face</name> <transport>hwbinder</transport> - <version>1.0</version> + <version>1.1</version> <interface> <name>IBiometricsFace</name> <instance>default</instance> diff --git a/biometrics/face/1.0/default/service.cpp b/biometrics/face/1.1/default/service.cpp index 9818c959d6..344bdb99b4 100644 --- a/biometrics/face/1.0/default/service.cpp +++ b/biometrics/face/1.1/default/service.cpp @@ -14,10 +14,10 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.biometrics.face@1.0-service" +#define LOG_TAG "android.hardware.biometrics.face@1.1-service" #include <android/hardware/biometrics/face/1.0/types.h> -#include <android/hardware/biometrics/face/1.0/IBiometricsFace.h> +#include <android/hardware/biometrics/face/1.1/IBiometricsFace.h> #include <android/log.h> #include <hidl/HidlSupport.h> #include <hidl/HidlTransportSupport.h> @@ -27,7 +27,7 @@ using android::sp; using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; using android::hardware::biometrics::face::implementation::BiometricsFace; -using android::hardware::biometrics::face::V1_0::IBiometricsFace; +using android::hardware::biometrics::face::V1_1::IBiometricsFace; int main() { ALOGI("BiometricsFace HAL is being started."); diff --git a/biometrics/face/1.1/vts/functional/Android.bp b/biometrics/face/1.1/vts/functional/Android.bp new file mode 100644 index 0000000000..aa0b1fa082 --- /dev/null +++ b/biometrics/face/1.1/vts/functional/Android.bp @@ -0,0 +1,29 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +cc_test { + name: "VtsHalBiometricsFaceV1_1TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: ["VtsHalBiometricsFaceV1_1TargetTest.cpp"], + static_libs: [ + "android.hardware.biometrics.face@1.0", + "android.hardware.biometrics.face@1.1", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/biometrics/face/1.1/vts/functional/VtsHalBiometricsFaceV1_1TargetTest.cpp b/biometrics/face/1.1/vts/functional/VtsHalBiometricsFaceV1_1TargetTest.cpp new file mode 100644 index 0000000000..a105d8f8fd --- /dev/null +++ b/biometrics/face/1.1/vts/functional/VtsHalBiometricsFaceV1_1TargetTest.cpp @@ -0,0 +1,205 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "biometrics_face_hidl_hal_test" + +#include <android/hardware/biometrics/face/1.0/IBiometricsFaceClientCallback.h> +#include <android/hardware/biometrics/face/1.1/IBiometricsFace.h> + +#include <VtsHalHidlTargetCallbackBase.h> +#include <android-base/logging.h> +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> + +#include <chrono> +#include <cstdint> +#include <random> + +using android::sp; +using android::hardware::hidl_handle; +using android::hardware::hidl_vec; +using android::hardware::Return; +using android::hardware::Void; +using android::hardware::biometrics::face::V1_0::FaceAcquiredInfo; +using android::hardware::biometrics::face::V1_0::FaceError; +using android::hardware::biometrics::face::V1_0::IBiometricsFaceClientCallback; +using android::hardware::biometrics::face::V1_0::OptionalUint64; +using android::hardware::biometrics::face::V1_0::Status; +using android::hardware::biometrics::face::V1_1::IBiometricsFace; + +namespace { + +// Arbitrary, nonexistent userId +constexpr uint32_t kUserId = 9; +constexpr uint32_t kTimeoutSec = 3; +constexpr auto kTimeout = std::chrono::seconds(kTimeoutSec); +constexpr char kFacedataDir[] = "/data/vendor_de/0/facedata"; +constexpr char kCallbackNameOnError[] = "onError"; + +// Callback arguments that need to be captured for the tests. +struct FaceCallbackArgs { + // The error passed to the last onError() callback. + FaceError error; + + // The userId passed to the last callback. + int32_t userId; +}; + +// Test callback class for the BiometricsFace HAL. +// The HAL will call these callback methods to notify about completed operations +// or encountered errors. +class FaceCallback : public ::testing::VtsHalHidlTargetCallbackBase<FaceCallbackArgs>, + public IBiometricsFaceClientCallback { + public: + Return<void> onEnrollResult(uint64_t, uint32_t, int32_t, uint32_t) override { return Void(); } + + Return<void> onAuthenticated(uint64_t, uint32_t, int32_t, const hidl_vec<uint8_t>&) override { + return Void(); + } + + Return<void> onAcquired(uint64_t, int32_t, FaceAcquiredInfo, int32_t) override { + return Void(); + } + + Return<void> onError(uint64_t, int32_t userId, FaceError error, int32_t) override { + FaceCallbackArgs args = {}; + args.error = error; + args.userId = userId; + NotifyFromCallback(kCallbackNameOnError, args); + return Void(); + } + + Return<void> onRemoved(uint64_t, const hidl_vec<uint32_t>&, int32_t) override { return Void(); } + + Return<void> onEnumerate(uint64_t, const hidl_vec<uint32_t>&, int32_t) override { + return Void(); + } + + Return<void> onLockoutChanged(uint64_t) override { return Void(); } +}; + +// Test class for the BiometricsFace HAL. +class FaceHidlTest : public ::testing::TestWithParam<std::string> { + public: + void SetUp() override { + mService = IBiometricsFace::getService(GetParam()); + ASSERT_NE(mService, nullptr); + mCallback = new FaceCallback(); + mCallback->SetWaitTimeoutDefault(kTimeout); + Return<void> ret1 = mService->setCallback(mCallback, [](const OptionalUint64& res) { + ASSERT_EQ(Status::OK, res.status); + // Makes sure the "deviceId" represented by "res.value" is not 0. + // 0 would mean the HIDL is not available. + ASSERT_NE(0UL, res.value); + }); + ASSERT_TRUE(ret1.isOk()); + Return<Status> ret2 = mService->setActiveUser(kUserId, kFacedataDir); + ASSERT_EQ(Status::OK, static_cast<Status>(ret2)); + } + + void TearDown() override {} + + sp<IBiometricsFace> mService; + sp<FaceCallback> mCallback; +}; + +// enroll with an invalid (all zeroes) HAT should fail. +TEST_P(FaceHidlTest, Enroll1_1ZeroHatTest) { + // Filling HAT with zeros + hidl_vec<uint8_t> token(69); + for (size_t i = 0; i < 69; i++) { + token[i] = 0; + } + + hidl_handle windowId = nullptr; + Return<Status> ret = mService->enroll_1_1(token, kTimeoutSec, {}, windowId); + ASSERT_EQ(Status::OK, static_cast<Status>(ret)); + + // onError should be called with a meaningful (nonzero) error. + auto res = mCallback->WaitForCallback(kCallbackNameOnError); + EXPECT_TRUE(res.no_timeout); + EXPECT_EQ(kUserId, res.args->userId); + EXPECT_EQ(FaceError::UNABLE_TO_PROCESS, res.args->error); +} + +// enroll with an invalid HAT should fail. +TEST_P(FaceHidlTest, Enroll1_1GarbageHatTest) { + // Filling HAT with pseudorandom invalid data. + // Using default seed to make the test reproducible. + std::mt19937 gen(std::mt19937::default_seed); + std::uniform_int_distribution<uint8_t> dist; + hidl_vec<uint8_t> token(69); + for (size_t i = 0; i < 69; ++i) { + token[i] = dist(gen); + } + + hidl_handle windowId = nullptr; + Return<Status> ret = mService->enroll_1_1(token, kTimeoutSec, {}, windowId); + ASSERT_EQ(Status::OK, static_cast<Status>(ret)); + + // onError should be called with a meaningful (nonzero) error. + auto res = mCallback->WaitForCallback(kCallbackNameOnError); + EXPECT_TRUE(res.no_timeout); + EXPECT_EQ(kUserId, res.args->userId); + EXPECT_EQ(FaceError::UNABLE_TO_PROCESS, res.args->error); +} + +// enroll with an invalid (all zeroes) HAT should fail. +TEST_P(FaceHidlTest, EnrollRemotelyZeroHatTest) { + // Filling HAT with zeros + hidl_vec<uint8_t> token(69); + for (size_t i = 0; i < 69; i++) { + token[i] = 0; + } + + Return<Status> ret = mService->enrollRemotely(token, kTimeoutSec, {}); + ASSERT_EQ(Status::OK, static_cast<Status>(ret)); + + // onError should be called with a meaningful (nonzero) error. + auto res = mCallback->WaitForCallback(kCallbackNameOnError); + EXPECT_TRUE(res.no_timeout); + EXPECT_EQ(kUserId, res.args->userId); + EXPECT_EQ(FaceError::UNABLE_TO_PROCESS, res.args->error); +} + +// enroll with an invalid HAT should fail. +TEST_P(FaceHidlTest, EnrollRemotelyGarbageHatTest) { + // Filling HAT with pseudorandom invalid data. + // Using default seed to make the test reproducible. + std::mt19937 gen(std::mt19937::default_seed); + std::uniform_int_distribution<uint8_t> dist; + hidl_vec<uint8_t> token(69); + for (size_t i = 0; i < 69; ++i) { + token[i] = dist(gen); + } + + Return<Status> ret = mService->enrollRemotely(token, kTimeoutSec, {}); + ASSERT_EQ(Status::OK, static_cast<Status>(ret)); + + // onError should be called with a meaningful (nonzero) error. + auto res = mCallback->WaitForCallback(kCallbackNameOnError); + EXPECT_TRUE(res.no_timeout); + EXPECT_EQ(kUserId, res.args->userId); + EXPECT_EQ(FaceError::UNABLE_TO_PROCESS, res.args->error); +} + +} // anonymous namespace + +INSTANTIATE_TEST_SUITE_P( + PerInstance, FaceHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames(IBiometricsFace::descriptor)), + android::hardware::PrintInstanceNameToString); diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp index c8cc0f17bb..25bd48db70 100644 --- a/biometrics/fingerprint/2.1/Android.bp +++ b/biometrics/fingerprint/2.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.biometrics.fingerprint@2.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBiometricsFingerprint.hal", diff --git a/biometrics/fingerprint/2.2/Android.bp b/biometrics/fingerprint/2.2/Android.bp index 6c769ac22e..a8f202c2c0 100644 --- a/biometrics/fingerprint/2.2/Android.bp +++ b/biometrics/fingerprint/2.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.biometrics.fingerprint@2.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBiometricsFingerprint.hal", diff --git a/biometrics/fingerprint/2.3/Android.bp b/biometrics/fingerprint/2.3/Android.bp new file mode 100644 index 0000000000..cf635029f1 --- /dev/null +++ b/biometrics/fingerprint/2.3/Android.bp @@ -0,0 +1,15 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.biometrics.fingerprint@2.3", + root: "android.hardware", + srcs: [ + "IBiometricsFingerprint.hal", + ], + interfaces: [ + "android.hardware.biometrics.fingerprint@2.1", + "android.hardware.biometrics.fingerprint@2.2", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/biometrics/fingerprint/2.3/IBiometricsFingerprint.hal b/biometrics/fingerprint/2.3/IBiometricsFingerprint.hal new file mode 100644 index 0000000000..13f03c5eea --- /dev/null +++ b/biometrics/fingerprint/2.3/IBiometricsFingerprint.hal @@ -0,0 +1,66 @@ +/* + * Copyright 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.biometrics.fingerprint@2.3; + +import @2.2::IBiometricsFingerprint; + +/** + * The interface for biometric fingerprint authentication. + */ +interface IBiometricsFingerprint extends @2.2::IBiometricsFingerprint { + /** + * Returns whether the fingerprint sensor is an under-display fingerprint + * sensor. + * @param sensorId the unique sensor ID for which the operation should be + * performed. + * @return isUdfps indicating whether the specified sensor is an + * under-display fingerprint sensor. + */ + isUdfps(uint32_t sensorId) generates (bool isUdfps); + + /** + * Notifies about a touch occurring within the under-display fingerprint + * sensor area. + * + * It it assumed that the device can only have one active under-display + * fingerprint sensor at a time. + * + * If multiple fingers are detected within the sensor area, only the + * chronologically first event will be reported. + * + * @param x The screen x-coordinate of the center of the touch contact area, in + * display pixels. + * @param y The screen y-coordinate of the center of the touch contact area, in + * display pixels. + * @param minor The length of the minor axis of an ellipse that describes the + * touch area, in display pixels. + * @param major The length of the major axis of an ellipse that describes the + * touch area, in display pixels. + */ + onFingerDown(uint32_t x, uint32_t y, float minor, float major); + + /** + * Notifies about a finger leaving the under-display fingerprint sensor area. + * + * It it assumed that the device can only have one active under-display + * fingerprint sensor at a time. + * + * If multiple fingers have left the sensor area, only the finger which + * previously caused a "finger down" event will be reported. + */ + onFingerUp(); +}; diff --git a/biometrics/fingerprint/2.3/vts/functional/Android.bp b/biometrics/fingerprint/2.3/vts/functional/Android.bp new file mode 100644 index 0000000000..521c0f41fd --- /dev/null +++ b/biometrics/fingerprint/2.3/vts/functional/Android.bp @@ -0,0 +1,30 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +cc_test { + name: "VtsHalBiometricsFingerprintV2_3TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: ["VtsHalBiometricsFingerprintV2_3TargetTest.cpp"], + static_libs: [ + "android.hardware.biometrics.fingerprint@2.1", + "android.hardware.biometrics.fingerprint@2.2", + "android.hardware.biometrics.fingerprint@2.3", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp b/biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp new file mode 100644 index 0000000000..72420162f0 --- /dev/null +++ b/biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#define ASSERT_OK(v) ASSERT_TRUE(v.isOk()) + +#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h> +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/HidlSupport.h> +#include <hidl/ServiceManagement.h> + +namespace { + +namespace hidl_interface_2_3 = android::hardware::biometrics::fingerprint::V2_3; + +using hidl_interface_2_3::IBiometricsFingerprint; + +using android::sp; + +// Callback arguments that need to be captured for the tests. +struct FingerprintCallbackArgs {}; + +class FingerprintHidlTest : public ::testing::TestWithParam<std::string> { + public: + void SetUp() override { + mService = IBiometricsFingerprint::getService(GetParam()); + ASSERT_NE(mService, nullptr); + } + + sp<IBiometricsFingerprint> mService; +}; + +// This method returns true or false depending on the implementation. +TEST_P(FingerprintHidlTest, isUdfpsTest) { + // Arbitrary ID + uint32_t sensorId = 1234; + ASSERT_OK(mService->isUdfps(sensorId)); +} + +// This method that doesn't return anything. +TEST_P(FingerprintHidlTest, onFingerDownTest) { + ASSERT_OK(mService->onFingerDown(1, 2, 3.0f, 4.0f)); +} + +// This method that doesn't return anything. +TEST_P(FingerprintHidlTest, onFingerUp) { + ASSERT_OK(mService->onFingerUp()); +} + +} // anonymous namespace + +INSTANTIATE_TEST_SUITE_P(PerInstance, FingerprintHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + IBiometricsFingerprint::descriptor)), + android::hardware::PrintInstanceNameToString); diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp index 7036d6e78a..1cac820427 100644 --- a/bluetooth/1.0/Android.bp +++ b/bluetooth/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.bluetooth@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBluetoothHci.hal", diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp index f66c25e976..6e39d541fb 100644 --- a/bluetooth/1.0/default/Android.bp +++ b/bluetooth/1.0/default/Android.bp @@ -102,13 +102,13 @@ cc_test_host { srcs: [ "bluetooth_address.cc", "test/bluetooth_address_test.cc", - "test/properties.cc", ], local_include_dirs: [ "test", ], shared_libs: [ "libbase", + "libcutils", "liblog", ], } diff --git a/bluetooth/1.0/default/test/bluetooth_address_test.cc b/bluetooth/1.0/default/test/bluetooth_address_test.cc index 2c8dbe5b5d..ee52d3364f 100644 --- a/bluetooth/1.0/default/test/bluetooth_address_test.cc +++ b/bluetooth/1.0/default/test/bluetooth_address_test.cc @@ -120,95 +120,6 @@ TEST_F(BluetoothAddressTest, bytes_to_string) { EXPECT_FALSE(memcmp(addrA, addrB, BluetoothAddress::kStringLength) == 0); } -TEST_F(BluetoothAddressTest, property_set) { - // Set the properties to empty strings. - property_set(PERSIST_BDADDR_PROPERTY, ""); - property_set(PROPERTY_BT_BDADDR_PATH, ""); - property_set(FACTORY_BDADDR_PROPERTY, ""); - - // Get returns 0. - char prop[PROP_VALUE_MAX] = ""; - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) == 0); - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) == 0); - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) == 0); - - // Set the properties to known strings. - property_set(PERSIST_BDADDR_PROPERTY, "1"); - property_set(PROPERTY_BT_BDADDR_PATH, "22"); - property_set(FACTORY_BDADDR_PROPERTY, "333"); - - // Get returns the correct length. - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) == 1); - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) == 2); - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) == 3); - - // Set the properties to empty strings again. - property_set(PERSIST_BDADDR_PROPERTY, ""); - property_set(PROPERTY_BT_BDADDR_PATH, ""); - property_set(FACTORY_BDADDR_PROPERTY, ""); - - // Get returns 0. - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) == 0); - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) == 0); - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) == 0); -} - -TEST_F(BluetoothAddressTest, property_get) { - // Set the properties to known strings. - property_set(PERSIST_BDADDR_PROPERTY, PERSIST_BDADDR_PROPERTY); - property_set(PROPERTY_BT_BDADDR_PATH, PROPERTY_BT_BDADDR_PATH); - property_set(FACTORY_BDADDR_PROPERTY, FACTORY_BDADDR_PROPERTY); - - // Get returns the same strings. - char prop[PROP_VALUE_MAX] = ""; - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(PERSIST_BDADDR_PROPERTY, prop) == 0); - - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0); - EXPECT_TRUE(strcmp(PROPERTY_BT_BDADDR_PATH, prop) == 0); - - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(FACTORY_BDADDR_PROPERTY, prop) == 0); - - // Set a property to a different known string. - char prop2[PROP_VALUE_MAX] = "Erased"; - property_set(PERSIST_BDADDR_PROPERTY, prop2); - - // Get returns the correct strings. - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(prop2, prop) == 0); - - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0); - EXPECT_TRUE(strcmp(PROPERTY_BT_BDADDR_PATH, prop) == 0); - - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(FACTORY_BDADDR_PROPERTY, prop) == 0); - - // Set another property to prop2. - property_set(PROPERTY_BT_BDADDR_PATH, prop2); - - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(prop2, prop) == 0); - - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0); - EXPECT_TRUE(strcmp(prop2, prop) == 0); - - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(FACTORY_BDADDR_PROPERTY, prop) == 0); - - // Set the third property to prop2. - property_set(FACTORY_BDADDR_PROPERTY, prop2); - - EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(prop2, prop) == 0); - - EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0); - EXPECT_TRUE(strcmp(prop2, prop) == 0); - - EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0); - EXPECT_TRUE(strcmp(prop2, prop) == 0); -} - TEST_F(BluetoothAddressTest, get_local_address) { EXPECT_TRUE(property_set(PERSIST_BDADDR_PROPERTY, "") == 0); EXPECT_TRUE(property_set(FACTORY_BDADDR_PROPERTY, "") == 0); diff --git a/bluetooth/1.0/default/test/properties.cc b/bluetooth/1.0/default/test/properties.cc deleted file mode 100644 index 70de01e06d..0000000000 --- a/bluetooth/1.0/default/test/properties.cc +++ /dev/null @@ -1,79 +0,0 @@ -// -// Copyright 2016 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. -// - -#define LOG_TAG "properties" - -#include <ctype.h> -#include <stdbool.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <cutils/properties.h> -#include <log/log.h> - -static const int MAX_PROPERTIES = 5; - -struct property { - char key[PROP_KEY_MAX + 2]; - char value[PROP_VALUE_MAX + 2]; -}; - -int num_properties = 0; -struct property properties[MAX_PROPERTIES]; - -// Find the correct entry. -static int property_find(const char* key) { - for (int i = 0; i < num_properties; i++) { - if (strncmp(properties[i].key, key, PROP_KEY_MAX) == 0) { - return i; - } - } - return MAX_PROPERTIES; -} - -int property_set(const char* key, const char* value) { - if (strnlen(value, PROP_VALUE_MAX) > PROP_VALUE_MAX) return -1; - - // Check to see if the property exists. - int prop_index = property_find(key); - - if (prop_index == MAX_PROPERTIES) { - if (num_properties >= MAX_PROPERTIES) return -1; - prop_index = num_properties; - num_properties += 1; - } - - // This is test code. Be nice and don't push the boundary cases! - strncpy(properties[prop_index].key, key, PROP_KEY_MAX + 1); - strncpy(properties[prop_index].value, value, PROP_VALUE_MAX + 1); - return 0; -} - -int property_get(const char* key, char* value, const char* default_value) { - // This doesn't mock the behavior of default value - if (default_value != NULL) ALOGE("%s: default_value is ignored!", __func__); - - // Check to see if the property exists. - int prop_index = property_find(key); - - if (prop_index == MAX_PROPERTIES) return 0; - - int len = strlen(properties[prop_index].value); - memcpy(value, properties[prop_index].value, len); - value[len] = '\0'; - return len; -} diff --git a/bluetooth/1.0/default/test/sys/system_properties.h b/bluetooth/1.0/default/test/sys/system_properties.h deleted file mode 100644 index b477a6baba..0000000000 --- a/bluetooth/1.0/default/test/sys/system_properties.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright 2016 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. -// - -// Mock sys/system_properties.h for testing - -#define PROP_VALUE_MAX 50 -#define PROP_KEY_MAX 50 diff --git a/bluetooth/1.1/Android.bp b/bluetooth/1.1/Android.bp index 4204aed7dc..c3967f028f 100644 --- a/bluetooth/1.1/Android.bp +++ b/bluetooth/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.bluetooth@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IBluetoothHci.hal", "IBluetoothHciCallbacks.hal", diff --git a/bluetooth/a2dp/1.0/Android.bp b/bluetooth/a2dp/1.0/Android.bp index 02f224acff..d9ec982da8 100644 --- a/bluetooth/a2dp/1.0/Android.bp +++ b/bluetooth/a2dp/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.bluetooth.a2dp@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBluetoothAudioHost.hal", diff --git a/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp b/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp index 44b138a894..f7fdf3113d 100644 --- a/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp +++ b/bluetooth/a2dp/1.0/vts/functional/VtsHalBluetoothA2dpV1_0TargetTest.cpp @@ -107,4 +107,6 @@ INSTANTIATE_TEST_SUITE_P( PerInstance, BluetoothA2dpHidlTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames( IBluetoothAudioOffload::descriptor)), - android::hardware::PrintInstanceNameToString);
\ No newline at end of file + android::hardware::PrintInstanceNameToString); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BluetoothA2dpHidlTest); diff --git a/bluetooth/audio/2.0/Android.bp b/bluetooth/audio/2.0/Android.bp index 6bf0070851..3fbd51f631 100644 --- a/bluetooth/audio/2.0/Android.bp +++ b/bluetooth/audio/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.bluetooth.audio@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBluetoothAudioPort.hal", diff --git a/bluetooth/audio/2.0/default/session/BluetoothAudioSession.cpp b/bluetooth/audio/2.0/default/session/BluetoothAudioSession.cpp index d60e7324f3..50119bf399 100644 --- a/bluetooth/audio/2.0/default/session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/2.0/default/session/BluetoothAudioSession.cpp @@ -90,14 +90,16 @@ void BluetoothAudioSession::OnSessionStarted( // bluetooth_audio outputs void BluetoothAudioSession::OnSessionEnded() { std::lock_guard<std::recursive_mutex> guard(mutex_); - if (IsSessionReady()) { - ReportSessionStatus(); - } + bool toggled = IsSessionReady(); + LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); audio_config_ = (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH ? kInvalidOffloadAudioConfiguration : kInvalidSoftwareAudioConfiguration); stack_iface_ = nullptr; UpdateDataPath(nullptr); + if (toggled) { + ReportSessionStatus(); + } } // invoking the registered session_changed_cb_ diff --git a/bluetooth/audio/2.0/default/session/BluetoothAudioSupportedCodecsDB.cpp b/bluetooth/audio/2.0/default/session/BluetoothAudioSupportedCodecsDB.cpp index 6ea61e1f18..c368197467 100644 --- a/bluetooth/audio/2.0/default/session/BluetoothAudioSupportedCodecsDB.cpp +++ b/bluetooth/audio/2.0/default/session/BluetoothAudioSupportedCodecsDB.cpp @@ -74,7 +74,7 @@ static const AacParameters kDefaultOffloadAacCapability = { .objectType = AacObjectType::MPEG2_LC, .sampleRate = SampleRate::RATE_44100, .channelMode = ChannelMode::STEREO, - .variableBitRateEnabled = AacVariableBitRate::DISABLED, + .variableBitRateEnabled = AacVariableBitRate::ENABLED, .bitsPerSample = BitsPerSample::BITS_16}; // LDAC: mSampleRate:(44100|48000|88200|96000), mBitsPerSample:(16|24|32), diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp index 55684360bf..844cf9b26b 100644 --- a/boot/1.0/Android.bp +++ b/boot/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.boot@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBootControl.hal", diff --git a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp index 613c528a0a..2f6b23ee5c 100644 --- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp +++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp @@ -80,7 +80,6 @@ TEST_P(BootHidlTest, MarkBootSuccessful) { } } -// Sanity check Boot::setActiveBootSlot() on good and bad inputs. TEST_P(BootHidlTest, SetActiveBootSlot) { Slot curSlot = boot->getCurrentSlot(); Slot otherSlot = curSlot ? 0 : 1; @@ -117,7 +116,6 @@ TEST_P(BootHidlTest, SetActiveBootSlot) { } } -// Sanity check Boot::setSlotAsUnbootable() on good and bad inputs. TEST_P(BootHidlTest, SetSlotAsUnbootable) { Slot curSlot = boot->getCurrentSlot(); Slot otherSlot = curSlot ? 0 : 1; diff --git a/boot/1.1/Android.bp b/boot/1.1/Android.bp index 6a8d57aa8c..3f505e659e 100644 --- a/boot/1.1/Android.bp +++ b/boot/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.boot@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBootControl.hal", diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp index 8239d748fb..5fc120d3b9 100644 --- a/broadcastradio/1.0/Android.bp +++ b/broadcastradio/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.broadcastradio@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBroadcastRadio.hal", diff --git a/broadcastradio/1.1/Android.bp b/broadcastradio/1.1/Android.bp index 1cc9b62ee6..5efa3d4599 100644 --- a/broadcastradio/1.1/Android.bp +++ b/broadcastradio/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.broadcastradio@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBroadcastRadio.hal", diff --git a/broadcastradio/2.0/Android.bp b/broadcastradio/2.0/Android.bp index 1040ba1968..0ef635eb5e 100644 --- a/broadcastradio/2.0/Android.bp +++ b/broadcastradio/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.broadcastradio@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAnnouncementListener.hal", diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp index d170a6d469..694d52a094 100644 --- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp +++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp @@ -116,7 +116,10 @@ class BroadcastRadioHalTest : public ::testing::TestWithParam<std::string> { }; static void printSkipped(std::string msg) { - std::cout << "[ SKIPPED ] " << msg << std::endl; + const auto testInfo = testing::UnitTest::GetInstance()->current_test_info(); + std::cout << "[ SKIPPED ] " << testInfo->test_case_name() << "." << testInfo->name() + << std::endl; + std::cout << msg << std::endl; } MATCHER_P(InfoHasId, id, @@ -428,8 +431,9 @@ TEST_P(BroadcastRadioHalTest, FmTune) { ProgramInfo infoCb = {}; EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, InfoHasId(utils::make_identifier(IdentifierType::AMFM_FREQUENCY, freq))) - .Times(AnyNumber()) - .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void())))); + .Times(AnyNumber()) + .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void())))) + .WillRepeatedly(testing::InvokeWithoutArgs([] { return Void(); })); auto result = mSession->tune(sel); // expect a failure if it's not supported diff --git a/camera/common/1.0/Android.bp b/camera/common/1.0/Android.bp index ed64060067..bd00dbbd37 100644 --- a/camera/common/1.0/Android.bp +++ b/camera/common/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.common@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/camera/device/1.0/Android.bp b/camera/device/1.0/Android.bp index 668884d8c8..f2125af005 100644 --- a/camera/device/1.0/Android.bp +++ b/camera/device/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.device@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraDevice.hal", diff --git a/camera/device/1.0/default/CameraDevice.cpp b/camera/device/1.0/default/CameraDevice.cpp index 9b6e4b91f3..622660685f 100644 --- a/camera/device/1.0/default/CameraDevice.cpp +++ b/camera/device/1.0/default/CameraDevice.cpp @@ -15,6 +15,9 @@ */ #define LOG_TAG "CamDev@1.0-impl" + +#include <fcntl.h> + #include <hardware/camera.h> #include <hardware/gralloc1.h> #include <hidlmemory/mapping.h> diff --git a/camera/device/3.2/Android.bp b/camera/device/3.2/Android.bp index 2e5349f054..93d1e75a36 100644 --- a/camera/device/3.2/Android.bp +++ b/camera/device/3.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.device@3.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraDevice.hal", diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp index 8d3bf0285c..896c35843a 100644 --- a/camera/device/3.2/default/CameraDeviceSession.cpp +++ b/camera/device/3.2/default/CameraDeviceSession.cpp @@ -790,8 +790,9 @@ void CameraDeviceSession::ResultBatcher::processCaptureResult(CaptureResult& res auto it = batch->mBatchBufs.find(buffer.streamId); if (it != batch->mBatchBufs.end()) { InflightBatch::BufferBatch& bb = it->second; + auto id = buffer.streamId; pushStreamBuffer(std::move(buffer), bb.mBuffers); - filledStreams.push_back(buffer.streamId); + filledStreams.push_back(id); } else { pushStreamBuffer(std::move(buffer), nonBatchedBuffers); } diff --git a/camera/device/3.3/Android.bp b/camera/device/3.3/Android.bp index 679fad698e..0f8502b80c 100644 --- a/camera/device/3.3/Android.bp +++ b/camera/device/3.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.device@3.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraDeviceSession.hal", diff --git a/camera/device/3.4/Android.bp b/camera/device/3.4/Android.bp index e6f42d6e1a..5575366155 100644 --- a/camera/device/3.4/Android.bp +++ b/camera/device/3.4/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.device@3.4", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraDeviceCallback.hal", diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp index b4ebe22701..3f088a3d94 100644 --- a/camera/device/3.4/default/CameraDeviceSession.cpp +++ b/camera/device/3.4/default/CameraDeviceSession.cpp @@ -656,8 +656,9 @@ void CameraDeviceSession::ResultBatcher_3_4::processCaptureResult_3_4(CaptureRes auto it = batch->mBatchBufs.find(buffer.streamId); if (it != batch->mBatchBufs.end()) { InflightBatch::BufferBatch& bb = it->second; + auto id = buffer.streamId; pushStreamBuffer(std::move(buffer), bb.mBuffers); - filledStreams.push_back(buffer.streamId); + filledStreams.push_back(id); } else { pushStreamBuffer(std::move(buffer), nonBatchedBuffers); } diff --git a/camera/device/3.5/Android.bp b/camera/device/3.5/Android.bp index 362a5e6894..94962169d9 100644 --- a/camera/device/3.5/Android.bp +++ b/camera/device/3.5/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.device@3.5", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraDevice.hal", diff --git a/camera/device/3.6/Android.bp b/camera/device/3.6/Android.bp index 19adb3472d..e6f458ca5f 100644 --- a/camera/device/3.6/Android.bp +++ b/camera/device/3.6/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.device@3.6", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraDevice.hal", diff --git a/camera/metadata/3.2/Android.bp b/camera/metadata/3.2/Android.bp index f58fb289e6..6e55139241 100644 --- a/camera/metadata/3.2/Android.bp +++ b/camera/metadata/3.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.metadata@3.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/camera/metadata/3.3/Android.bp b/camera/metadata/3.3/Android.bp index 885f4f9b16..f11fe2bd2f 100644 --- a/camera/metadata/3.3/Android.bp +++ b/camera/metadata/3.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.metadata@3.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/camera/metadata/3.4/Android.bp b/camera/metadata/3.4/Android.bp index 6a924580fd..31218be61e 100644 --- a/camera/metadata/3.4/Android.bp +++ b/camera/metadata/3.4/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.metadata@3.4", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/camera/metadata/3.5/Android.bp b/camera/metadata/3.5/Android.bp index 224c36976a..a28ba430a5 100644 --- a/camera/metadata/3.5/Android.bp +++ b/camera/metadata/3.5/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.metadata@3.5", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/camera/provider/2.4/Android.bp b/camera/provider/2.4/Android.bp index 876814d8f7..8b67f3fc13 100644 --- a/camera/provider/2.4/Android.bp +++ b/camera/provider/2.4/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.provider@2.4", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ICameraProvider.hal", "ICameraProviderCallback.hal", diff --git a/camera/provider/2.5/Android.bp b/camera/provider/2.5/Android.bp index 4ca1efbfc3..be71806206 100644 --- a/camera/provider/2.5/Android.bp +++ b/camera/provider/2.5/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.provider@2.5", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraProvider.hal", diff --git a/camera/provider/2.6/Android.bp b/camera/provider/2.6/Android.bp index e69819c863..6934c175e0 100644 --- a/camera/provider/2.6/Android.bp +++ b/camera/provider/2.6/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.camera.provider@2.6", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICameraProvider.hal", diff --git a/cas/1.0/Android.bp b/cas/1.0/Android.bp index 4982e20b35..9f289a1dcc 100644 --- a/cas/1.0/Android.bp +++ b/cas/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.cas@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICas.hal", diff --git a/cas/1.0/default/DescramblerImpl.cpp b/cas/1.0/default/DescramblerImpl.cpp index 9b09751d72..f79b32db44 100644 --- a/cas/1.0/default/DescramblerImpl.cpp +++ b/cas/1.0/default/DescramblerImpl.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "android.hardware.cas@1.0-DescramblerImpl" #include <hidlmemory/mapping.h> +#include <inttypes.h> #include <media/cas/DescramblerAPI.h> #include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/AString.h> @@ -101,7 +102,7 @@ Return<void> DescramblerImpl::descramble( // size in size_t. If size is over SIZE_MAX, mapMemory mapMemory could succeed // but the mapped memory's actual size will be smaller than the reported size. if (srcBuffer.heapBase.size() > SIZE_MAX) { - ALOGE("Invalid hidl_memory size: %llu", srcBuffer.heapBase.size()); + ALOGE("Invalid hidl_memory size: %" PRIu64 "", srcBuffer.heapBase.size()); android_errorWriteLog(0x534e4554, "79376389"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -118,8 +119,8 @@ Return<void> DescramblerImpl::descramble( } if (!validateRangeForSize( srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize())) { - ALOGE("Invalid src buffer range: offset %llu, size %llu, srcMem size %llu", - srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize()); + ALOGE("Invalid src buffer range: offset %" PRIu64 ", size %" PRIu64 ", srcMem" + "size %" PRIu64 "", srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize()); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -135,8 +136,8 @@ Return<void> DescramblerImpl::descramble( // is consistent with the source shared buffer size. if (!validateRangeForSize(srcOffset, totalBytesInSubSamples, srcBuffer.size)) { ALOGE("Invalid srcOffset and subsample size: " - "srcOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu", - srcOffset, totalBytesInSubSamples, srcBuffer.size); + "srcOffset %" PRIu64 ", totalBytesInSubSamples %" PRIu64 ", srcBuffer" + "size %" PRIu64 "", srcOffset, totalBytesInSubSamples, srcBuffer.size); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -153,8 +154,8 @@ Return<void> DescramblerImpl::descramble( // dstOffset against the buffer size too. if (!validateRangeForSize(dstOffset, totalBytesInSubSamples, srcBuffer.size)) { ALOGE("Invalid dstOffset and subsample size: " - "dstOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu", - dstOffset, totalBytesInSubSamples, srcBuffer.size); + "dstOffset %" PRIu64 ", totalBytesInSubSamples %" PRIu64 ", srcBuffer" + "size %" PRIu64 "", dstOffset, totalBytesInSubSamples, srcBuffer.size); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); diff --git a/cas/1.1/Android.bp b/cas/1.1/Android.bp index 13217b6439..e20298b374 100644 --- a/cas/1.1/Android.bp +++ b/cas/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.cas@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ICas.hal", "ICasListener.hal", diff --git a/cas/1.1/default/DescramblerImpl.cpp b/cas/1.1/default/DescramblerImpl.cpp index 36dc1a51d0..309cd3c007 100644 --- a/cas/1.1/default/DescramblerImpl.cpp +++ b/cas/1.1/default/DescramblerImpl.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "android.hardware.cas@1.1-DescramblerImpl" #include <hidlmemory/mapping.h> +#include <inttypes.h> #include <media/cas/DescramblerAPI.h> #include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/AUtils.h> @@ -92,7 +93,7 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, // size in size_t. If size is over SIZE_MAX, mapMemory mapMemory could succeed // but the mapped memory's actual size will be smaller than the reported size. if (srcBuffer.heapBase.size() > SIZE_MAX) { - ALOGE("Invalid hidl_memory size: %llu", srcBuffer.heapBase.size()); + ALOGE("Invalid hidl_memory size: %" PRIu64 "", srcBuffer.heapBase.size()); android_errorWriteLog(0x534e4554, "79376389"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -108,8 +109,8 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, return Void(); } if (!validateRangeForSize(srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize())) { - ALOGE("Invalid src buffer range: offset %llu, size %llu, srcMem size %llu", - srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize()); + ALOGE("Invalid src buffer range: offset %" PRIu64 ", size %" PRIu64 ", srcMem" + "size %" PRIu64 "", srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize()); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -125,8 +126,8 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, // is consistent with the source shared buffer size. if (!validateRangeForSize(srcOffset, totalBytesInSubSamples, srcBuffer.size)) { ALOGE("Invalid srcOffset and subsample size: " - "srcOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu", - srcOffset, totalBytesInSubSamples, srcBuffer.size); + "srcOffset %" PRIu64 ", totalBytesInSubSamples %" PRIu64 ", srcBuffer" + "size %" PRIu64 "", srcOffset, totalBytesInSubSamples, srcBuffer.size); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -143,8 +144,8 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, // dstOffset against the buffer size too. if (!validateRangeForSize(dstOffset, totalBytesInSubSamples, srcBuffer.size)) { ALOGE("Invalid dstOffset and subsample size: " - "dstOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu", - dstOffset, totalBytesInSubSamples, srcBuffer.size); + "dstOffset %" PRIu64 ", totalBytesInSubSamples %" PRIu64 ", srcBuffer" + "size %" PRIu64 "", dstOffset, totalBytesInSubSamples, srcBuffer.size); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); diff --git a/cas/1.2/Android.bp b/cas/1.2/Android.bp index fbb38b0bb8..f03b6b7db1 100644 --- a/cas/1.2/Android.bp +++ b/cas/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.cas@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICas.hal", diff --git a/cas/1.2/default/DescramblerImpl.cpp b/cas/1.2/default/DescramblerImpl.cpp index 36dc1a51d0..309cd3c007 100644 --- a/cas/1.2/default/DescramblerImpl.cpp +++ b/cas/1.2/default/DescramblerImpl.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "android.hardware.cas@1.1-DescramblerImpl" #include <hidlmemory/mapping.h> +#include <inttypes.h> #include <media/cas/DescramblerAPI.h> #include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/AUtils.h> @@ -92,7 +93,7 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, // size in size_t. If size is over SIZE_MAX, mapMemory mapMemory could succeed // but the mapped memory's actual size will be smaller than the reported size. if (srcBuffer.heapBase.size() > SIZE_MAX) { - ALOGE("Invalid hidl_memory size: %llu", srcBuffer.heapBase.size()); + ALOGE("Invalid hidl_memory size: %" PRIu64 "", srcBuffer.heapBase.size()); android_errorWriteLog(0x534e4554, "79376389"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -108,8 +109,8 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, return Void(); } if (!validateRangeForSize(srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize())) { - ALOGE("Invalid src buffer range: offset %llu, size %llu, srcMem size %llu", - srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize()); + ALOGE("Invalid src buffer range: offset %" PRIu64 ", size %" PRIu64 ", srcMem" + "size %" PRIu64 "", srcBuffer.offset, srcBuffer.size, (uint64_t)srcMem->getSize()); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -125,8 +126,8 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, // is consistent with the source shared buffer size. if (!validateRangeForSize(srcOffset, totalBytesInSubSamples, srcBuffer.size)) { ALOGE("Invalid srcOffset and subsample size: " - "srcOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu", - srcOffset, totalBytesInSubSamples, srcBuffer.size); + "srcOffset %" PRIu64 ", totalBytesInSubSamples %" PRIu64 ", srcBuffer" + "size %" PRIu64 "", srcOffset, totalBytesInSubSamples, srcBuffer.size); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); @@ -143,8 +144,8 @@ Return<void> DescramblerImpl::descramble(ScramblingControl scramblingControl, // dstOffset against the buffer size too. if (!validateRangeForSize(dstOffset, totalBytesInSubSamples, srcBuffer.size)) { ALOGE("Invalid dstOffset and subsample size: " - "dstOffset %llu, totalBytesInSubSamples %llu, srcBuffer size %llu", - dstOffset, totalBytesInSubSamples, srcBuffer.size); + "dstOffset %" PRIu64 ", totalBytesInSubSamples %" PRIu64 ", srcBuffer" + "size %" PRIu64 "", dstOffset, totalBytesInSubSamples, srcBuffer.size); android_errorWriteLog(0x534e4554, "67962232"); _hidl_cb(toStatus(BAD_VALUE), 0, NULL); return Void(); diff --git a/cas/native/1.0/Android.bp b/cas/native/1.0/Android.bp index 633ceb9306..6aa420414b 100644 --- a/cas/native/1.0/Android.bp +++ b/cas/native/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.cas.native@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDescrambler.hal", diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp index ba56832bdd..9d4e55cce0 100644 --- a/compatibility_matrices/Android.bp +++ b/compatibility_matrices/Android.bp @@ -90,3 +90,16 @@ vintf_compatibility_matrix { "kernel_config_r_5.4", ], } + +vintf_compatibility_matrix { + name: "framework_compatibility_matrix.current.xml", + stem: "compatibility_matrix.current.xml", + srcs: [ + "compatibility_matrix.current.xml", + ], + kernel_configs: [ + "kernel_config_current_4.14", + "kernel_config_current_4.19", + "kernel_config_current_5.4", + ], +} diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index e69fc8dbca..96191c8997 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -98,6 +98,7 @@ my_system_matrix_deps := \ framework_compatibility_matrix.3.xml \ framework_compatibility_matrix.4.xml \ framework_compatibility_matrix.5.xml \ + framework_compatibility_matrix.current.xml \ framework_compatibility_matrix.device.xml \ my_framework_matrix_deps += \ diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml new file mode 100644 index 0000000000..946392458e --- /dev/null +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -0,0 +1,554 @@ +<compatibility-matrix version="1.0" type="framework" level="6"> + <hal format="hidl" optional="true"> + <name>android.hardware.atrace</name> + <version>1.0</version> + <interface> + <name>IAtraceDevice</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.audio</name> + <version>6.0</version> + <interface> + <name>IDevicesFactory</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.audio.effect</name> + <version>6.0</version> + <interface> + <name>IEffectsFactory</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.authsecret</name> + <version>1.0</version> + <interface> + <name>IAuthSecret</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.automotive.audiocontrol</name> + <version>1.0</version> + <version>2.0</version> + <interface> + <name>IAudioControl</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.automotive.can</name> + <version>1.0</version> + <interface> + <name>ICanBus</name> + <regex-instance>.*</regex-instance> + </interface> + <interface> + <name>ICanController</name> + <regex-instance>.*</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.automotive.evs</name> + <version>1.0-1</version> + <interface> + <name>IEvsEnumerator</name> + <instance>default</instance> + <regex-instance>[a-z]+/[0-9]+</regex-instance> + </interface> + </hal> + <hal format="aidl" optional="true"> + <name>android.hardware.automotive.occupant_awareness</name> + <interface> + <name>IOccupantAwareness</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.automotive.sv</name> + <version>1.0</version> + <interface> + <name>ISurroundView</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.automotive.vehicle</name> + <version>2.0</version> + <interface> + <name>IVehicle</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.biometrics.face</name> + <version>1.0-1</version> + <interface> + <name>IBiometricsFace</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.biometrics.fingerprint</name> + <version>2.1-2</version> + <interface> + <name>IBiometricsFingerprint</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.bluetooth</name> + <version>1.0-1</version> + <interface> + <name>IBluetoothHci</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.bluetooth.audio</name> + <version>2.0</version> + <interface> + <name>IBluetoothAudioProvidersFactory</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.boot</name> + <version>1.1</version> + <interface> + <name>IBootControl</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.broadcastradio</name> + <version>1.0-1</version> + <interface> + <name>IBroadcastRadioFactory</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.broadcastradio</name> + <version>2.0</version> + <interface> + <name>IBroadcastRadio</name> + <regex-instance>.*</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.camera.provider</name> + <version>2.4-6</version> + <interface> + <name>ICameraProvider</name> + <regex-instance>[^/]+/[0-9]+</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.cas</name> + <version>1.1-2</version> + <interface> + <name>IMediaCasService</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.confirmationui</name> + <version>1.0</version> + <interface> + <name>IConfirmationUI</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.contexthub</name> + <version>1.0-1</version> + <interface> + <name>IContexthub</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.drm</name> + <version>1.3</version> + <interface> + <name>ICryptoFactory</name> + <regex-instance>.*</regex-instance> + </interface> + <interface> + <name>IDrmFactory</name> + <regex-instance>.*</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.dumpstate</name> + <version>1.1</version> + <interface> + <name>IDumpstateDevice</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.gatekeeper</name> + <version>1.0</version> + <interface> + <name>IGatekeeper</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.gnss</name> + <version>2.0-1</version> + <version>3.0</version> + <interface> + <name>IGnss</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.graphics.allocator</name> + <!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test --> + <version>2.0</version> + <version>3.0</version> + <version>4.0</version> + <interface> + <name>IAllocator</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.graphics.composer</name> + <version>2.1-4</version> + <interface> + <name>IComposer</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.graphics.mapper</name> + <!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test --> + <version>2.1</version> + <version>3.0</version> + <version>4.0</version> + <interface> + <name>IMapper</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.health</name> + <version>2.1</version> + <interface> + <name>IHealth</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.health.storage</name> + <version>1.0</version> + <interface> + <name>IStorage</name> + <instance>default</instance> + </interface> + </hal> + <hal format="aidl" optional="true"> + <name>android.hardware.identity</name> + <interface> + <name>IIdentityCredentialStore</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.ir</name> + <version>1.0</version> + <interface> + <name>IConsumerIr</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.input.classifier</name> + <version>1.0</version> + <interface> + <name>IInputClassifier</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="false"> + <name>android.hardware.keymaster</name> + <version>3.0</version> + <version>4.0-1</version> + <interface> + <name>IKeymasterDevice</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.keymaster</name> + <version>4.0-1</version> + <interface> + <name>IKeymasterDevice</name> + <instance>strongbox</instance> + </interface> + </hal> + <hal format="aidl" optional="true"> + <name>android.hardware.light</name> + <interface> + <name>ILights</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.media.c2</name> + <version>1.0-1</version> + <interface> + <name>IComponentStore</name> + <regex-instance>default[0-9]*</regex-instance> + <regex-instance>vendor[0-9]*_software</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.media.omx</name> + <version>1.0</version> + <interface> + <name>IOmx</name> + <instance>default</instance> + </interface> + <interface> + <name>IOmxStore</name> + <instance>default</instance> + </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> + <name>IDevice</name> + <regex-instance>.*</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.nfc</name> + <version>1.2</version> + <interface> + <name>INfc</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.oemlock</name> + <version>1.0</version> + <interface> + <name>IOemLock</name> + <instance>default</instance> + </interface> + </hal> + <hal format="aidl" optional="false"> + <name>android.hardware.power</name> + <interface> + <name>IPower</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.power.stats</name> + <version>1.0</version> + <interface> + <name>IPowerStats</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.radio</name> + <version>1.6</version> + <interface> + <name>IRadio</name> + <instance>slot1</instance> + <instance>slot2</instance> + <instance>slot3</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.radio</name> + <version>1.2</version> + <interface> + <name>ISap</name> + <instance>slot1</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.radio.config</name> + <!-- + See compatibility_matrix.4.xml on versioning of radio config HAL. + --> + <version>1.1</version> + <interface> + <name>IRadioConfig</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.renderscript</name> + <version>1.0</version> + <interface> + <name>IDevice</name> + <instance>default</instance> + </interface> + </hal> + <hal format="aidl" optional="true"> + <name>android.hardware.rebootescrow</name> + <interface> + <name>IRebootEscrow</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.secure_element</name> + <version>1.0-2</version> + <interface> + <name>ISecureElement</name> + <regex-instance>eSE[1-9][0-9]*</regex-instance> + <regex-instance>SIM[1-9][0-9]*</regex-instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.sensors</name> + <version>1.0</version> + <version>2.0-1</version> + <interface> + <name>ISensors</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.soundtrigger</name> + <version>2.0-3</version> + <interface> + <name>ISoundTriggerHw</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.tetheroffload.config</name> + <version>1.0</version> + <interface> + <name>IOffloadConfig</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.tetheroffload.control</name> + <version>1.0</version> + <interface> + <name>IOffloadControl</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.thermal</name> + <version>2.0</version> + <interface> + <name>IThermal</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.tv.cec</name> + <version>1.0</version> + <interface> + <name>IHdmiCec</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.tv.input</name> + <version>1.0</version> + <interface> + <name>ITvInput</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.tv.tuner</name> + <version>1.0-1</version> + <interface> + <name>ITuner</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.usb</name> + <version>1.0-2</version> + <interface> + <name>IUsb</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.usb.gadget</name> + <version>1.0-1</version> + <interface> + <name>IUsbGadget</name> + <instance>default</instance> + </interface> + </hal> + <hal format="aidl" optional="true"> + <name>android.hardware.vibrator</name> + <interface> + <name>IVibrator</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.vr</name> + <version>1.0</version> + <interface> + <name>IVr</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.weaver</name> + <version>1.0</version> + <interface> + <name>IWeaver</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.wifi</name> + <version>1.0-5</version> + <interface> + <name>IWifi</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.wifi.hostapd</name> + <version>1.0-2</version> + <interface> + <name>IHostapd</name> + <instance>default</instance> + </interface> + </hal> + <hal format="hidl" optional="true"> + <name>android.hardware.wifi.supplicant</name> + <version>1.0-3</version> + <interface> + <name>ISupplicant</name> + <instance>default</instance> + </interface> + </hal> +</compatibility-matrix> diff --git a/confirmationui/1.0/Android.bp b/confirmationui/1.0/Android.bp index a22067a167..15c4f18c99 100644 --- a/confirmationui/1.0/Android.bp +++ b/confirmationui/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.confirmationui@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IConfirmationResultCallback.hal", diff --git a/contexthub/1.0/Android.bp b/contexthub/1.0/Android.bp index 71dd9787a3..be30d61a11 100644 --- a/contexthub/1.0/Android.bp +++ b/contexthub/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.contexthub@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IContexthub.hal", diff --git a/contexthub/1.1/Android.bp b/contexthub/1.1/Android.bp index 649f1db4c7..9ee8e765e5 100644 --- a/contexthub/1.1/Android.bp +++ b/contexthub/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.contexthub@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IContexthub.hal", diff --git a/current.txt b/current.txt index 669651625d..6f5e55916c 100644 --- a/current.txt +++ b/current.txt @@ -765,3 +765,14 @@ a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardwar 2ce1f7fb52e49f80b13a9b153d491bce530552f02357ea729acae922a8659f93 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback 77531c8d048f8f8ae532babd0ca86332a865ec9aace1b051226ef2b21123e645 android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork 98592d193a717066facf91428426e5abe211e3bd718bc372e29fb944ddbe6e7c android.hardware.wifi.supplicant@1.3::types + +# ABI preserving changes to HALs during Android S +cd84ab19c590e0e73dd2307b591a3093ee18147ef95e6d5418644463a6620076 android.hardware.neuralnetworks@1.2::IDevice +9625e85f56515ad2cf87b6a1847906db669f746ea4ab02cd3d4ca25abc9b0109 android.hardware.neuralnetworks@1.2::types +9e758e208d14f7256e0885d6d8ad0b61121b21d8c313864f981727ae55bffd16 android.hardware.neuralnetworks@1.3::types +38d65fb20c60a5b823298560fc0825457ecdc49603a4b4e94bf81511790737da android.hardware.radio@1.4::types +954c334efd80e8869b66d1ce5fe2755712d96ba4b3c38d415739c330af5fb4cb android.hardware.radio@1.5::types + +# HALs released in Android S +# NOTE: waiting to freeze HALs until later in the release +# NOTE: new HALs are recommended to be in AIDL diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp index 9049af2882..44fb83777f 100644 --- a/drm/1.0/Android.bp +++ b/drm/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.drm@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICryptoFactory.hal", diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp index 8fd258a163..0545c70606 100644 --- a/drm/1.0/vts/functional/Android.bp +++ b/drm/1.0/vts/functional/Android.bp @@ -43,12 +43,12 @@ cc_library_static { "android.hardware.drm@1.0", "android.hidl.allocator@1.0", "android.hidl.memory@1.0", + "libcrypto", "libhidlmemory", "libnativehelper", ], static_libs: [ "android.hardware.drm@1.0-helper", - "libcrypto_static", "libdrmvtshelper", ], export_shared_lib_headers: [ @@ -76,12 +76,12 @@ cc_test { "android.hardware.drm@1.0", "android.hidl.allocator@1.0", "android.hidl.memory@1.0", + "libcrypto", "libhidlmemory", "libnativehelper", ], static_libs: [ "android.hardware.drm@1.0-helper", - "libcrypto_static", "libdrmvtshelper", ], arch: { diff --git a/drm/1.1/Android.bp b/drm/1.1/Android.bp index 16010a656d..0af4cf4cdf 100644 --- a/drm/1.1/Android.bp +++ b/drm/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.drm@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICryptoFactory.hal", diff --git a/drm/1.2/Android.bp b/drm/1.2/Android.bp index 9104aa9ce8..f1c60de482 100644 --- a/drm/1.2/Android.bp +++ b/drm/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.drm@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ICryptoFactory.hal", diff --git a/drm/1.2/vts/functional/Android.bp b/drm/1.2/vts/functional/Android.bp index 9aed4eea9f..271cc043d0 100644 --- a/drm/1.2/vts/functional/Android.bp +++ b/drm/1.2/vts/functional/Android.bp @@ -31,12 +31,12 @@ cc_library_static { "android.hardware.drm@1.2", "android.hidl.allocator@1.0", "android.hidl.memory@1.0", + "libcrypto", "libhidlmemory", "libnativehelper", ], static_libs: [ "android.hardware.drm@1.0-helper", - "libcrypto_static", "libdrmvtshelper", ], export_shared_lib_headers: [ @@ -63,11 +63,11 @@ cc_test { "android.hardware.drm@1.0", "android.hardware.drm@1.2", "android.hidl.allocator@1.0", + "libcrypto", "libhidlmemory", ], static_libs: [ "android.hardware.drm@1.0-helper", - "libcrypto_static", "libdrmvtshelper", ], arch: { diff --git a/drm/1.3/Android.bp b/drm/1.3/Android.bp index b0ffcb92a5..9a2b9e12aa 100644 --- a/drm/1.3/Android.bp +++ b/drm/1.3/Android.bp @@ -3,12 +3,9 @@ hidl_interface { name: "android.hardware.drm@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ - "IDrmFactory.hal", "ICryptoFactory.hal", + "IDrmFactory.hal", ], interfaces: [ "android.hardware.drm@1.0", diff --git a/dumpstate/1.0/Android.bp b/dumpstate/1.0/Android.bp index 3d47550607..5d9eefcdf3 100644 --- a/dumpstate/1.0/Android.bp +++ b/dumpstate/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.dumpstate@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IDumpstateDevice.hal", ], diff --git a/dumpstate/1.1/Android.bp b/dumpstate/1.1/Android.bp index 2aa8c82dc7..75805dfb51 100644 --- a/dumpstate/1.1/Android.bp +++ b/dumpstate/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.dumpstate@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDumpstateDevice.hal", diff --git a/dumpstate/1.1/default/main.cpp b/dumpstate/1.1/default/main.cpp index 3c17e18f43..4510f63647 100644 --- a/dumpstate/1.1/default/main.cpp +++ b/dumpstate/1.1/default/main.cpp @@ -116,7 +116,7 @@ int main(int, char**) { configureRpcThreadpool(1, true); - sp<DumpstateDevice> dumpstate(new DumpstateDevice); + auto dumpstate = sp<DumpstateDevice>::make(); auto serviceRegistrar = LazyServiceRegistrar::getInstance(); if (serviceRegistrar.registerService(dumpstate) != ::android::OK) { diff --git a/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp b/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp index cbdd87bc78..1bef66358a 100644 --- a/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp +++ b/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp @@ -20,6 +20,7 @@ #include <unistd.h> #include <functional> +#include <tuple> #include <vector> #include <android/hardware/dumpstate/1.1/IDumpstateDevice.h> @@ -27,6 +28,7 @@ #include <cutils/native_handle.h> #include <gtest/gtest.h> #include <hidl/GtestPrinter.h> +#include <hidl/HidlSupport.h> #include <hidl/ServiceManagement.h> #include <log/log.h> @@ -39,13 +41,18 @@ using ::android::hardware::dumpstate::V1_1::DumpstateStatus; using ::android::hardware::dumpstate::V1_1::IDumpstateDevice; using ::android::hardware::dumpstate::V1_1::toString; -class DumpstateHidl1_1Test : public ::testing::TestWithParam<std::string> { +// Base class common to all dumpstate HAL v1.1 tests. +template <typename T> +class DumpstateHidl1_1TestBase : public ::testing::TestWithParam<T> { protected: virtual void SetUp() override { GetService(); } + virtual std::string GetInstanceName() = 0; + void GetService() { - dumpstate = IDumpstateDevice::getService(GetParam()); - ASSERT_NE(dumpstate, nullptr) << "Could not get HIDL instance"; + const std::string instance_name = GetInstanceName(); + dumpstate = IDumpstateDevice::getService(instance_name); + ASSERT_NE(dumpstate, nullptr) << "Could not get HIDL instance " << instance_name; } void ToggleVerboseLogging(bool enable) { @@ -78,77 +85,76 @@ class DumpstateHidl1_1Test : public ::testing::TestWithParam<std::string> { sp<IDumpstateDevice> dumpstate; }; -#define TEST_FOR_DUMPSTATE_MODE(name, body, mode) \ - TEST_P(DumpstateHidl1_1Test, name##_##mode) { body(DumpstateMode::mode); } - -// We use a macro to define individual test cases instead of hidl_enum_range<> because some HAL -// implementations are lazy and may call exit() at the end of dumpstateBoard(), which would cause -// DEAD_OBJECT errors after the first iteration. Separate cases re-get the service each time as part -// of SetUp(), and also provide better separation of concerns when specific modes are problematic. -#define TEST_FOR_ALL_DUMPSTATE_MODES(name, body) \ - TEST_FOR_DUMPSTATE_MODE(name, body, FULL); \ - TEST_FOR_DUMPSTATE_MODE(name, body, INTERACTIVE); \ - TEST_FOR_DUMPSTATE_MODE(name, body, REMOTE); \ - TEST_FOR_DUMPSTATE_MODE(name, body, WEAR); \ - TEST_FOR_DUMPSTATE_MODE(name, body, CONNECTIVITY); \ - TEST_FOR_DUMPSTATE_MODE(name, body, WIFI); \ - TEST_FOR_DUMPSTATE_MODE(name, body, DEFAULT); \ - TEST_FOR_DUMPSTATE_MODE(name, body, PROTO); - -constexpr uint64_t kDefaultTimeoutMillis = 30 * 1000; // 30 seconds +// Tests that don't need to iterate every single DumpstateMode value for dumpstateBoard_1_1. +class DumpstateHidl1_1GeneralTest : public DumpstateHidl1_1TestBase<std::string> { + protected: + virtual std::string GetInstanceName() override { return GetParam(); } +}; -// Will only execute additional_assertions when status == expected. -void AssertStatusForMode(const DumpstateMode mode, const Return<DumpstateStatus>& status, - const DumpstateStatus expected, - std::function<void()> additional_assertions = nullptr) { - ASSERT_TRUE(status.isOk()) << "Status should be ok and return a more specific DumpstateStatus: " - << status.description(); - if (mode == DumpstateMode::DEFAULT) { - ASSERT_EQ(expected, status) << "Required mode (DumpstateMode::" << toString(mode) - << "): status should be DumpstateStatus::" << toString(expected) - << ", but got DumpstateStatus::" << toString(status); - } else { - // The rest of the modes are optional to support, but they MUST return either the expected - // value or UNSUPPORTED_MODE. - ASSERT_TRUE(status == expected || status == DumpstateStatus::UNSUPPORTED_MODE) - << "Optional mode (DumpstateMode::" << toString(mode) - << "): status should be DumpstateStatus::" << toString(expected) - << " or DumpstateStatus::UNSUPPORTED_MODE, but got DumpstateStatus::" - << toString(status); - } - if (status == expected && additional_assertions != nullptr) { - additional_assertions(); +// Tests that iterate every single DumpstateMode value for dumpstateBoard_1_1. +class DumpstateHidl1_1PerModeTest + : public DumpstateHidl1_1TestBase<std::tuple<std::string, DumpstateMode>> { + protected: + virtual std::string GetInstanceName() override { return std::get<0>(GetParam()); } + + DumpstateMode GetMode() { return std::get<1>(GetParam()); } + + // Will only execute additional_assertions when status == expected. + void AssertStatusForMode(const Return<DumpstateStatus>& status, const DumpstateStatus expected, + std::function<void()> additional_assertions = nullptr) { + ASSERT_TRUE(status.isOk()) + << "Status should be ok and return a more specific DumpstateStatus: " + << status.description(); + if (GetMode() == DumpstateMode::DEFAULT) { + ASSERT_EQ(expected, status) + << "Required mode (DumpstateMode::" << toString(GetMode()) + << "): status should be DumpstateStatus::" << toString(expected) + << ", but got DumpstateStatus::" << toString(status); + } else { + // The rest of the modes are optional to support, but they MUST return either the + // expected value or UNSUPPORTED_MODE. + ASSERT_TRUE(status == expected || status == DumpstateStatus::UNSUPPORTED_MODE) + << "Optional mode (DumpstateMode::" << toString(GetMode()) + << "): status should be DumpstateStatus::" << toString(expected) + << " or DumpstateStatus::UNSUPPORTED_MODE, but got DumpstateStatus::" + << toString(status); + } + if (status == expected && additional_assertions != nullptr) { + additional_assertions(); + } } -} +}; + +constexpr uint64_t kDefaultTimeoutMillis = 30 * 1000; // 30 seconds // Negative test: make sure dumpstateBoard() doesn't crash when passed a null pointer. -TEST_FOR_ALL_DUMPSTATE_MODES(TestNullHandle, [this](DumpstateMode mode) { +TEST_P(DumpstateHidl1_1PerModeTest, TestNullHandle) { EnableVerboseLogging(); Return<DumpstateStatus> status = - dumpstate->dumpstateBoard_1_1(nullptr, mode, kDefaultTimeoutMillis); + dumpstate->dumpstateBoard_1_1(nullptr, GetMode(), kDefaultTimeoutMillis); - AssertStatusForMode(mode, status, DumpstateStatus::ILLEGAL_ARGUMENT); -}); + AssertStatusForMode(status, DumpstateStatus::ILLEGAL_ARGUMENT); +} // Negative test: make sure dumpstateBoard() ignores a handle with no FD. -TEST_FOR_ALL_DUMPSTATE_MODES(TestHandleWithNoFd, [this](DumpstateMode mode) { +TEST_P(DumpstateHidl1_1PerModeTest, TestHandleWithNoFd) { EnableVerboseLogging(); native_handle_t* handle = native_handle_create(0, 0); ASSERT_NE(handle, nullptr) << "Could not create native_handle"; Return<DumpstateStatus> status = - dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis); + dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis); - AssertStatusForMode(mode, status, DumpstateStatus::ILLEGAL_ARGUMENT); + AssertStatusForMode(status, DumpstateStatus::ILLEGAL_ARGUMENT); native_handle_close(handle); native_handle_delete(handle); -}); +} // Positive test: make sure dumpstateBoard() writes something to the FD. -TEST_FOR_ALL_DUMPSTATE_MODES(TestOk, [this](DumpstateMode mode) { +TEST_P(DumpstateHidl1_1PerModeTest, TestOk) { EnableVerboseLogging(); // Index 0 corresponds to the read end of the pipe; 1 to the write end. @@ -160,9 +166,9 @@ TEST_FOR_ALL_DUMPSTATE_MODES(TestOk, [this](DumpstateMode mode) { handle->data[0] = fds[1]; Return<DumpstateStatus> status = - dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis); + dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis); - AssertStatusForMode(mode, status, DumpstateStatus::OK, [&fds]() { + AssertStatusForMode(status, DumpstateStatus::OK, [&fds]() { // Check that at least one byte was written. char buff; ASSERT_EQ(1, read(fds[0], &buff, 1)) << "Dumped nothing"; @@ -170,10 +176,10 @@ TEST_FOR_ALL_DUMPSTATE_MODES(TestOk, [this](DumpstateMode mode) { native_handle_close(handle); native_handle_delete(handle); -}); +} // Positive test: make sure dumpstateBoard() doesn't crash with two FDs. -TEST_FOR_ALL_DUMPSTATE_MODES(TestHandleWithTwoFds, [this](DumpstateMode mode) { +TEST_P(DumpstateHidl1_1PerModeTest, TestHandleWithTwoFds) { EnableVerboseLogging(); int fds1[2]; @@ -187,9 +193,9 @@ TEST_FOR_ALL_DUMPSTATE_MODES(TestHandleWithTwoFds, [this](DumpstateMode mode) { handle->data[1] = fds2[1]; Return<DumpstateStatus> status = - dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis); + dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis); - AssertStatusForMode(mode, status, DumpstateStatus::OK, [&fds1, &fds2]() { + AssertStatusForMode(status, DumpstateStatus::OK, [&fds1, &fds2]() { // Check that at least one byte was written to one of the FDs. char buff; size_t read1 = read(fds1[0], &buff, 1); @@ -200,10 +206,10 @@ TEST_FOR_ALL_DUMPSTATE_MODES(TestHandleWithTwoFds, [this](DumpstateMode mode) { native_handle_close(handle); native_handle_delete(handle); -}); +} // Make sure dumpstateBoard_1_1 actually validates its arguments. -TEST_P(DumpstateHidl1_1Test, TestInvalidModeArgument_Negative) { +TEST_P(DumpstateHidl1_1GeneralTest, TestInvalidModeArgument_Negative) { EnableVerboseLogging(); int fds[2]; @@ -225,7 +231,7 @@ TEST_P(DumpstateHidl1_1Test, TestInvalidModeArgument_Negative) { native_handle_delete(handle); } -TEST_P(DumpstateHidl1_1Test, TestInvalidModeArgument_Undefined) { +TEST_P(DumpstateHidl1_1GeneralTest, TestInvalidModeArgument_Undefined) { EnableVerboseLogging(); int fds[2]; @@ -248,7 +254,7 @@ TEST_P(DumpstateHidl1_1Test, TestInvalidModeArgument_Undefined) { } // Positive test: make sure dumpstateBoard() from 1.0 doesn't fail. -TEST_P(DumpstateHidl1_1Test, Test1_0MethodOk) { +TEST_P(DumpstateHidl1_1GeneralTest, Test1_0MethodOk) { EnableVerboseLogging(); int fds[2]; @@ -272,7 +278,7 @@ TEST_P(DumpstateHidl1_1Test, Test1_0MethodOk) { // Make sure disabling verbose logging behaves correctly. Some info is still allowed to be emitted, // but it can't have privacy/storage/battery impacts. -TEST_FOR_ALL_DUMPSTATE_MODES(TestVerboseLoggingDisabled, [this](DumpstateMode mode) { +TEST_P(DumpstateHidl1_1PerModeTest, TestDeviceLoggingDisabled) { DisableVerboseLogging(); // Index 0 corresponds to the read end of the pipe; 1 to the write end. @@ -284,31 +290,31 @@ TEST_FOR_ALL_DUMPSTATE_MODES(TestVerboseLoggingDisabled, [this](DumpstateMode mo handle->data[0] = fds[1]; Return<DumpstateStatus> status = - dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis); + dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis); // We don't include additional assertions here about the file passed in. If verbose logging is // disabled, the OEM may choose to include nothing at all, but it is allowed to include some // essential information based on the mode as long as it isn't private user information. - AssertStatusForMode(mode, status, DumpstateStatus::OK); + AssertStatusForMode(status, DumpstateStatus::OK); native_handle_close(handle); native_handle_delete(handle); -}); +} // Double-enable is perfectly valid, but the second call shouldn't do anything. -TEST_P(DumpstateHidl1_1Test, TestRepeatedEnable) { +TEST_P(DumpstateHidl1_1GeneralTest, TestRepeatedEnable) { EnableVerboseLogging(); EnableVerboseLogging(); } // Double-disable is perfectly valid, but the second call shouldn't do anything. -TEST_P(DumpstateHidl1_1Test, TestRepeatedDisable) { +TEST_P(DumpstateHidl1_1GeneralTest, TestRepeatedDisable) { DisableVerboseLogging(); DisableVerboseLogging(); } // Toggling in short order is perfectly valid. -TEST_P(DumpstateHidl1_1Test, TestRepeatedToggle) { +TEST_P(DumpstateHidl1_1GeneralTest, TestRepeatedToggle) { EnableVerboseLogging(); DisableVerboseLogging(); EnableVerboseLogging(); @@ -316,8 +322,23 @@ TEST_P(DumpstateHidl1_1Test, TestRepeatedToggle) { } INSTANTIATE_TEST_SUITE_P( - PerInstance, DumpstateHidl1_1Test, + PerInstance, DumpstateHidl1_1GeneralTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames(IDumpstateDevice::descriptor)), android::hardware::PrintInstanceNameToString); +// Includes the mode's name as part of the description string. +static inline std::string PrintInstanceNameToStringWithMode( + const testing::TestParamInfo<std::tuple<std::string, DumpstateMode>>& info) { + return android::hardware::PrintInstanceNameToString( + testing::TestParamInfo(std::get<0>(info.param), info.index)) + + "_" + toString(std::get<1>(info.param)); +} + +INSTANTIATE_TEST_SUITE_P( + PerInstanceAndMode, DumpstateHidl1_1PerModeTest, + testing::Combine(testing::ValuesIn(android::hardware::getAllHalInstanceNames( + IDumpstateDevice::descriptor)), + testing::ValuesIn(android::hardware::hidl_enum_range<DumpstateMode>())), + PrintInstanceNameToStringWithMode); + } // namespace diff --git a/fastboot/1.0/Android.bp b/fastboot/1.0/Android.bp index ec447b80fc..60dfb2d9f5 100644 --- a/fastboot/1.0/Android.bp +++ b/fastboot/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.fastboot@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IFastboot.hal", diff --git a/gatekeeper/1.0/Android.bp b/gatekeeper/1.0/Android.bp index 5d63eaf0e9..28fd5b689a 100644 --- a/gatekeeper/1.0/Android.bp +++ b/gatekeeper/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.gatekeeper@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IGatekeeper.hal", diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp index d97588c195..22f47e8aba 100644 --- a/gnss/1.0/Android.bp +++ b/gnss/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.gnss@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAGnss.hal", diff --git a/gnss/1.1/Android.bp b/gnss/1.1/Android.bp index 5294a6b107..1c38e97c44 100644 --- a/gnss/1.1/Android.bp +++ b/gnss/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.gnss@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IGnss.hal", "IGnssCallback.hal", diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp index db5075f862..b7a98b7af2 100644 --- a/gnss/2.0/Android.bp +++ b/gnss/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.gnss@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAGnss.hal", diff --git a/gnss/2.1/Android.bp b/gnss/2.1/Android.bp index 21223997b3..affbeae66d 100644 --- a/gnss/2.1/Android.bp +++ b/gnss/2.1/Android.bp @@ -3,22 +3,19 @@ hidl_interface { name: "android.hardware.gnss@2.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IGnss.hal", "IGnssAntennaInfo.hal", "IGnssAntennaInfoCallback.hal", "IGnssCallback.hal", + "IGnssConfiguration.hal", "IGnssMeasurement.hal", "IGnssMeasurementCallback.hal", - "IGnssConfiguration.hal", ], interfaces: [ - "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", + "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.visibility_control@1.0", "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", @@ -26,4 +23,5 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + gen_java_constants: true, } diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp index c4dc8fd55d..7739f908a7 100644 --- a/gnss/2.1/default/Android.bp +++ b/gnss/2.1/default/Android.bp @@ -21,12 +21,6 @@ cc_binary { vendor: true, vintf_fragments: ["android.hardware.gnss@2.1-service.xml"], srcs: [ - "Gnss.cpp", - "GnssAntennaInfo.cpp", - "GnssDebug.cpp", - "GnssMeasurement.cpp", - "GnssMeasurementCorrections.cpp", - "GnssConfiguration.cpp", "service.cpp", ], shared_libs: [ diff --git a/gnss/2.1/default/Gnss.cpp b/gnss/2.1/default/Gnss.cpp deleted file mode 100644 index 2b327a9916..0000000000 --- a/gnss/2.1/default/Gnss.cpp +++ /dev/null @@ -1,439 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "Gnss" - -#include "Gnss.h" -#include "GnssAntennaInfo.h" -#include "GnssDebug.h" -#include "GnssMeasurement.h" -#include "GnssMeasurementCorrections.h" -#include "Utils.h" - -#include <log/log.h> - -using ::android::hardware::gnss::common::Utils; -using ::android::hardware::gnss::measurement_corrections::V1_1::implementation:: - GnssMeasurementCorrections; - -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { -namespace implementation { - -sp<V2_1::IGnssCallback> Gnss::sGnssCallback_2_1 = nullptr; -sp<V2_0::IGnssCallback> Gnss::sGnssCallback_2_0 = nullptr; -sp<V1_1::IGnssCallback> Gnss::sGnssCallback_1_1 = nullptr; -sp<V1_0::IGnssCallback> Gnss::sGnssCallback_1_0 = nullptr; - -Gnss::Gnss() : mMinIntervalMs(1000), mGnssConfiguration{new GnssConfiguration()} {} - -Gnss::~Gnss() { - stop(); -} - -Return<bool> Gnss::start() { - ALOGD("start"); - if (mIsActive) { - ALOGW("Gnss has started. Restarting..."); - stop(); - } - - mIsActive = true; - mThread = std::thread([this]() { - while (mIsActive == true) { - auto svStatus = filterBlacklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1()); - this->reportSvStatus(svStatus); - - if (sGnssCallback_2_1 != nullptr || sGnssCallback_2_0 != nullptr) { - const auto location = Utils::getMockLocationV2_0(); - this->reportLocation(location); - } else { - const auto location = Utils::getMockLocationV1_0(); - this->reportLocation(location); - } - - std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs)); - } - }); - return true; -} - -hidl_vec<GnssSvInfo> Gnss::filterBlacklistedSatellitesV2_1(hidl_vec<GnssSvInfo> gnssSvInfoList) { - for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) { - if (mGnssConfiguration->isBlacklistedV2_1(gnssSvInfoList[i])) { - gnssSvInfoList[i].v2_0.v1_0.svFlag &= - ~static_cast<uint8_t>(V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX); - } - } - return gnssSvInfoList; -} - -Return<bool> Gnss::stop() { - ALOGD("stop"); - mIsActive = false; - if (mThread.joinable()) { - mThread.join(); - } - return true; -} - -// Methods from V1_0::IGnss follow. -Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) { - if (callback == nullptr) { - ALOGE("%s: Null callback ignored", __func__); - return false; - } - - sGnssCallback_1_0 = callback; - - uint32_t capabilities = 0x0 | V1_0::IGnssCallback::Capabilities::MEASUREMENTS | - V1_0::IGnssCallback::Capabilities::SCHEDULING; - auto ret = sGnssCallback_1_0->gnssSetCapabilitesCb(capabilities); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2018}; - - ret = sGnssCallback_1_0->gnssSetSystemInfoCb(gnssInfo); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - return true; -} - -Return<void> Gnss::cleanup() { - sGnssCallback_2_1 = nullptr; - sGnssCallback_2_0 = nullptr; - return Void(); -} - -Return<bool> Gnss::injectTime(int64_t, int64_t, int32_t) { - return true; -} - -Return<bool> Gnss::injectLocation(double, double, float) { - return true; -} - -Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData) { - // TODO implement - return Void(); -} - -Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode, - V1_0::IGnss::GnssPositionRecurrence, uint32_t minIntervalMs, - uint32_t, uint32_t) { - mMinIntervalMs = minIntervalMs; - return true; -} - -Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() { - // TODO implement - return ::android::sp<V1_0::IAGnssRil>{}; -} - -Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() { - // TODO implement - return ::android::sp<V1_0::IGnssGeofencing>{}; -} - -Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() { - // TODO implement - return ::android::sp<V1_0::IAGnss>{}; -} - -Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() { - // TODO implement - return ::android::sp<V1_0::IGnssNi>{}; -} - -Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() { - ALOGD("Gnss::getExtensionGnssMeasurement"); - return new GnssMeasurement(); -} - -Return<sp<V1_0::IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() { - // TODO implement - return ::android::sp<V1_0::IGnssNavigationMessage>{}; -} - -Return<sp<V1_0::IGnssXtra>> Gnss::getExtensionXtra() { - // TODO implement - return ::android::sp<V1_0::IGnssXtra>{}; -} - -Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() { - // TODO implement - return ::android::sp<V1_0::IGnssConfiguration>{}; -} - -Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() { - return new V1_1::implementation::GnssDebug(); -} - -Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() { - // TODO implement - return ::android::sp<V1_0::IGnssBatching>{}; -} - -// Methods from V1_1::IGnss follow. -Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) { - if (callback == nullptr) { - ALOGE("%s: Null callback ignored", __func__); - return false; - } - - sGnssCallback_1_1 = callback; - - uint32_t capabilities = 0x0; - auto ret = sGnssCallback_1_1->gnssSetCapabilitesCb(capabilities); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2018}; - - ret = sGnssCallback_1_1->gnssSetSystemInfoCb(gnssInfo); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - auto gnssName = "Google Mock GNSS Implementation v2.1"; - ret = sGnssCallback_1_1->gnssNameCb(gnssName); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - return true; -} - -Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode, - V1_0::IGnss::GnssPositionRecurrence, uint32_t minIntervalMs, - uint32_t, uint32_t, bool) { - mMinIntervalMs = minIntervalMs; - return true; -} - -Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() { - // TODO implement - return ::android::sp<V1_1::IGnssConfiguration>{}; -} - -Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() { - // TODO implement - return ::android::sp<V1_1::IGnssMeasurement>{}; -} - -Return<bool> Gnss::injectBestLocation(const V1_0::GnssLocation&) { - return true; -} - -// Methods from V2_0::IGnss follow. -Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) { - ALOGD("Gnss::setCallback_2_0"); - if (callback == nullptr) { - ALOGE("%s: Null callback ignored", __func__); - return false; - } - - sGnssCallback_2_0 = callback; - - using Capabilities = V2_0::IGnssCallback::Capabilities; - const auto capabilities = Capabilities::MEASUREMENTS | Capabilities::MEASUREMENT_CORRECTIONS | - Capabilities::LOW_POWER_MODE | Capabilities::SATELLITE_BLACKLIST; - auto ret = sGnssCallback_2_0->gnssSetCapabilitiesCb_2_0(capabilities); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019}; - - ret = sGnssCallback_2_0->gnssSetSystemInfoCb(gnssInfo); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - auto gnssName = "Google Mock GNSS Implementation v2.1"; - ret = sGnssCallback_2_0->gnssNameCb(gnssName); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - return true; -} - -Return<sp<V2_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_0() { - ALOGD("Gnss::getExtensionGnssConfiguration_2_0"); - return mGnssConfiguration; -} - -Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() { - // TODO implement - return ::android::sp<V2_0::IGnssDebug>{}; -} - -Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() { - // TODO implement - return ::android::sp<V2_0::IAGnss>{}; -} - -Return<sp<V2_0::IAGnssRil>> Gnss::getExtensionAGnssRil_2_0() { - // TODO implement - return ::android::sp<V2_0::IAGnssRil>{}; -} - -Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() { - ALOGD("Gnss::getExtensionGnssMeasurement_2_0"); - return new GnssMeasurement(); -} - -Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>> -Gnss::getExtensionMeasurementCorrections() { - ALOGD("Gnss::getExtensionMeasurementCorrections()"); - return new GnssMeasurementCorrections(); -} - -Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> Gnss::getExtensionVisibilityControl() { - // TODO implement - return ::android::sp<visibility_control::V1_0::IGnssVisibilityControl>{}; -} - -Return<sp<V2_0::IGnssBatching>> Gnss::getExtensionGnssBatching_2_0() { - // TODO implement - return ::android::sp<V2_0::IGnssBatching>{}; -} - -Return<bool> Gnss::injectBestLocation_2_0(const V2_0::GnssLocation&) { - // TODO(b/124012850): Implement function. - return bool{}; -} - -// Methods from V2_1::IGnss follow. -Return<bool> Gnss::setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) { - ALOGD("Gnss::setCallback_2_1"); - if (callback == nullptr) { - ALOGE("%s: Null callback ignored", __func__); - return false; - } - - sGnssCallback_2_1 = callback; - - using Capabilities = V2_1::IGnssCallback::Capabilities; - const auto capabilities = Capabilities::MEASUREMENTS | Capabilities::MEASUREMENT_CORRECTIONS | - Capabilities::LOW_POWER_MODE | Capabilities::SATELLITE_BLACKLIST | - Capabilities::ANTENNA_INFO; - auto ret = sGnssCallback_2_1->gnssSetCapabilitiesCb_2_1(capabilities); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2020}; - - ret = sGnssCallback_2_1->gnssSetSystemInfoCb(gnssInfo); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - auto gnssName = "Android Mock GNSS Implementation v2.1"; - ret = sGnssCallback_2_1->gnssNameCb(gnssName); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } - - return true; -} - -Return<sp<V2_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_1() { - ALOGD("Gnss::getExtensionGnssMeasurement_2_1"); - return new GnssMeasurement(); -} - -Return<sp<V2_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_2_1() { - ALOGD("Gnss::getExtensionGnssConfiguration_2_1"); - return mGnssConfiguration; -} - -Return<sp<measurement_corrections::V1_1::IMeasurementCorrections>> -Gnss::getExtensionMeasurementCorrections_1_1() { - ALOGD("Gnss::getExtensionMeasurementCorrections_1_1()"); - return new GnssMeasurementCorrections(); -} - -Return<sp<V2_1::IGnssAntennaInfo>> Gnss::getExtensionGnssAntennaInfo() { - ALOGD("Gnss::getExtensionGnssAntennaInfo"); - return new GnssAntennaInfo(); -} - -void Gnss::reportSvStatus(const hidl_vec<GnssSvInfo>& svInfoList) const { - std::unique_lock<std::mutex> lock(mMutex); - // TODO(skz): update this to call 2_0 callback if non-null - if (sGnssCallback_2_1 == nullptr) { - ALOGE("%s: sGnssCallback v2.1 is null.", __func__); - return; - } - auto ret = sGnssCallback_2_1->gnssSvStatusCb_2_1(svInfoList); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback", __func__); - } -} - -void Gnss::reportLocation(const V1_0::GnssLocation& location) const { - std::unique_lock<std::mutex> lock(mMutex); - if (sGnssCallback_1_1 != nullptr) { - auto ret = sGnssCallback_1_1->gnssLocationCb(location); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback v1.1", __func__); - } - return; - } - if (sGnssCallback_1_0 == nullptr) { - ALOGE("%s: No non-null callback", __func__); - return; - } - auto ret = sGnssCallback_1_0->gnssLocationCb(location); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback v1.0", __func__); - } -} - -void Gnss::reportLocation(const V2_0::GnssLocation& location) const { - std::unique_lock<std::mutex> lock(mMutex); - if (sGnssCallback_2_1 != nullptr) { - auto ret = sGnssCallback_2_1->gnssLocationCb_2_0(location); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback v2.1", __func__); - } - return; - } - if (sGnssCallback_2_0 == nullptr) { - ALOGE("%s: No non-null callback", __func__); - return; - } - auto ret = sGnssCallback_2_0->gnssLocationCb_2_0(location); - if (!ret.isOk()) { - ALOGE("%s: Unable to invoke callback v2.0", __func__); - } -} - -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android diff --git a/gnss/2.1/default/Gnss.h b/gnss/2.1/default/Gnss.h deleted file mode 100644 index bd5e6e852c..0000000000 --- a/gnss/2.1/default/Gnss.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <android/hardware/gnss/2.1/IGnss.h> -#include <hidl/MQDescriptor.h> -#include <hidl/Status.h> -#include <atomic> -#include <mutex> -#include <thread> -#include "GnssAntennaInfo.h" -#include "GnssConfiguration.h" - -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { - -using GnssSvInfo = IGnssCallback::GnssSvInfo; - -namespace implementation { - -struct Gnss : public IGnss { - Gnss(); - ~Gnss(); - // Methods from V1_0::IGnss follow. - Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override; - Return<bool> start() override; - Return<bool> stop() override; - Return<void> cleanup() override; - Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs, - int32_t uncertaintyMs) override; - Return<bool> injectLocation(double latitudeDegrees, double longitudeDegrees, - float accuracyMeters) override; - Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override; - Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode, - V1_0::IGnss::GnssPositionRecurrence recurrence, - uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, - uint32_t preferredTimeMs) override; - Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override; - Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override; - Return<sp<V1_0::IAGnss>> getExtensionAGnss() override; - Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override; - Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override; - Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override; - Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override; - Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override; - Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override; - Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override; - - // Methods from V1_1::IGnss follow. - Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override; - Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode, - V1_0::IGnss::GnssPositionRecurrence recurrence, - uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, - uint32_t preferredTimeMs, bool lowPowerMode) override; - Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override; - Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override; - Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override; - - // Methods from V2_0::IGnss follow. - Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override; - Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override; - Return<sp<V2_0::IGnssDebug>> getExtensionGnssDebug_2_0() override; - Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override; - Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override; - Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override; - Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>> - getExtensionMeasurementCorrections() override; - Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> getExtensionVisibilityControl() - override; - Return<sp<V2_0::IGnssBatching>> getExtensionGnssBatching_2_0() override; - Return<bool> injectBestLocation_2_0(const V2_0::GnssLocation& location) override; - - // Methods from V2_1::IGnss follow. - Return<bool> setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) override; - Return<sp<V2_1::IGnssMeasurement>> getExtensionGnssMeasurement_2_1() override; - Return<sp<V2_1::IGnssConfiguration>> getExtensionGnssConfiguration_2_1() override; - Return<sp<measurement_corrections::V1_1::IMeasurementCorrections>> - getExtensionMeasurementCorrections_1_1() override; - Return<sp<V2_1::IGnssAntennaInfo>> getExtensionGnssAntennaInfo() override; - - private: - void reportLocation(const V2_0::GnssLocation&) const; - void reportLocation(const V1_0::GnssLocation&) const; - void reportSvStatus(const hidl_vec<GnssSvInfo>&) const; - - static sp<V2_1::IGnssCallback> sGnssCallback_2_1; - static sp<V2_0::IGnssCallback> sGnssCallback_2_0; - static sp<V1_1::IGnssCallback> sGnssCallback_1_1; - static sp<V1_0::IGnssCallback> sGnssCallback_1_0; - std::atomic<long> mMinIntervalMs; - sp<GnssConfiguration> mGnssConfiguration; - std::atomic<bool> mIsActive; - std::thread mThread; - mutable std::mutex mMutex; - hidl_vec<GnssSvInfo> filterBlacklistedSatellitesV2_1(hidl_vec<GnssSvInfo> gnssSvInfoList); -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android diff --git a/gnss/2.1/default/service.cpp b/gnss/2.1/default/service.cpp index 5e004d5697..4f282cfdaf 100644 --- a/gnss/2.1/default/service.cpp +++ b/gnss/2.1/default/service.cpp @@ -18,17 +18,17 @@ #include <hidl/HidlSupport.h> #include <hidl/HidlTransportSupport.h> -#include "Gnss.h" +#include "v2_1/GnssTemplate.h" using ::android::OK; using ::android::sp; using ::android::hardware::configureRpcThreadpool; using ::android::hardware::joinRpcThreadpool; +using ::android::hardware::gnss::common::implementation::GnssTemplate; using ::android::hardware::gnss::V2_1::IGnss; -using ::android::hardware::gnss::V2_1::implementation::Gnss; int main(int /* argc */, char* /* argv */[]) { - sp<IGnss> gnss = new Gnss(); + sp<IGnss> gnss = new GnssTemplate<IGnss>(); configureRpcThreadpool(1, true /* will join */); if (gnss->registerAsService() != OK) { ALOGE("Could not register gnss 2.1 service."); diff --git a/gnss/2.1/vts/functional/Android.bp b/gnss/2.1/vts/functional/Android.bp index b3051d4b48..175bc75481 100644 --- a/gnss/2.1/vts/functional/Android.bp +++ b/gnss/2.1/vts/functional/Android.bp @@ -18,7 +18,6 @@ cc_test { name: "VtsHalGnssV2_1TargetTest", defaults: ["VtsHalTargetTestDefaults"], srcs: [ - "gnss_hal_test.cpp", "gnss_hal_test_cases.cpp", "VtsHalGnssV2_1TargetTest.cpp", ], diff --git a/gnss/2.1/vts/functional/gnss_hal_test.cpp b/gnss/2.1/vts/functional/gnss_hal_test.cpp deleted file mode 100644 index da7a62b4bd..0000000000 --- a/gnss/2.1/vts/functional/gnss_hal_test.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "GnssHalTest" - -#include <gnss_hal_test.h> -#include <chrono> -#include "Utils.h" - -#include <gtest/gtest.h> - -using ::android::hardware::gnss::common::Utils; - -// Implementations for the main test class for GNSS HAL -void GnssHalTest::SetUp() { - gnss_hal_ = IGnss::getService(GetParam()); - ASSERT_NE(gnss_hal_, nullptr); - - SetUpGnssCallback(); -} - -void GnssHalTest::TearDown() { - if (gnss_hal_ != nullptr) { - gnss_hal_->cleanup(); - gnss_hal_ = nullptr; - } - - // Set to nullptr to destruct the callback event queues and warn of any unprocessed events. - gnss_cb_ = nullptr; -} - -void GnssHalTest::SetUpGnssCallback() { - gnss_cb_ = new GnssCallback(); - ASSERT_NE(gnss_cb_, nullptr); - - auto result = gnss_hal_->setCallback_2_1(gnss_cb_); - if (!result.isOk()) { - ALOGE("result of failed setCallback %s", result.description().c_str()); - } - - ASSERT_TRUE(result.isOk()); - ASSERT_TRUE(result); - - /* - * All capabilities, name and systemInfo callbacks should trigger - */ - EXPECT_TRUE(gnss_cb_->capabilities_cbq_.retrieve(gnss_cb_->last_capabilities_, TIMEOUT_SEC)); - EXPECT_TRUE(gnss_cb_->info_cbq_.retrieve(gnss_cb_->last_info_, TIMEOUT_SEC)); - EXPECT_TRUE(gnss_cb_->name_cbq_.retrieve(gnss_cb_->last_name_, TIMEOUT_SEC)); - - EXPECT_EQ(gnss_cb_->capabilities_cbq_.calledCount(), 1); - EXPECT_EQ(gnss_cb_->info_cbq_.calledCount(), 1); - EXPECT_EQ(gnss_cb_->name_cbq_.calledCount(), 1); -} - -void GnssHalTest::StopAndClearLocations() { - const auto result = gnss_hal_->stop(); - - EXPECT_TRUE(result.isOk()); - EXPECT_TRUE(result); - - /* - * Clear notify/waiting counter, allowing up till the timeout after - * the last reply for final startup messages to arrive (esp. system - * info.) - */ - while (gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, TIMEOUT_SEC)) { - } - gnss_cb_->location_cbq_.reset(); -} - -void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) { - const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider) - const int kPreferredTimeMsec = 0; // Ideally immediate - - const auto result = gnss_hal_->setPositionMode_1_1( - IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC, - min_interval_msec, kPreferredAccuracy, kPreferredTimeMsec, low_power_mode); - - ASSERT_TRUE(result.isOk()); - EXPECT_TRUE(result); -} - -bool GnssHalTest::StartAndCheckFirstLocation() { - const auto result = gnss_hal_->start(); - - EXPECT_TRUE(result.isOk()); - EXPECT_TRUE(result); - - /* - * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, - * so allow time to demodulate ephemeris over the air. - */ - const int kFirstGnssLocationTimeoutSeconds = 75; - - EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, - kFirstGnssLocationTimeoutSeconds)); - int locationCalledCount = gnss_cb_->location_cbq_.calledCount(); - EXPECT_EQ(locationCalledCount, 1); - - if (locationCalledCount > 0) { - // don't require speed on first fix - CheckLocation(gnss_cb_->last_location_, false); - return true; - } - return false; -} - -void GnssHalTest::CheckLocation(const GnssLocation_2_0& location, bool check_speed) { - const bool check_more_accuracies = - (gnss_cb_->info_cbq_.calledCount() > 0 && gnss_cb_->last_info_.yearOfHw >= 2017); - - Utils::checkLocation(location.v1_0, check_speed, check_more_accuracies); -} - -void GnssHalTest::StartAndCheckLocations(int count) { - const int kMinIntervalMsec = 500; - const int kLocationTimeoutSubsequentSec = 2; - const bool kLowPowerMode = false; - - SetPositionMode(kMinIntervalMsec, kLowPowerMode); - - EXPECT_TRUE(StartAndCheckFirstLocation()); - - for (int i = 1; i < count; i++) { - EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, - kLocationTimeoutSubsequentSec)); - int locationCalledCount = gnss_cb_->location_cbq_.calledCount(); - EXPECT_EQ(locationCalledCount, i + 1); - // Don't cause confusion by checking details if no location yet - if (locationCalledCount > 0) { - // Should be more than 1 location by now, but if not, still don't check first fix speed - CheckLocation(gnss_cb_->last_location_, locationCalledCount > 1); - } - } -} - -GnssConstellationType GnssHalTest::startLocationAndGetNonGpsConstellation( - const int locations_to_await, const int gnss_sv_info_list_timeout) { - gnss_cb_->location_cbq_.reset(); - StartAndCheckLocations(locations_to_await); - const int location_called_count = gnss_cb_->location_cbq_.calledCount(); - - // Tolerate 1 less sv status to handle edge cases in reporting. - int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); - EXPECT_GE(sv_info_list_cbq_size + 1, locations_to_await); - ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)", - sv_info_list_cbq_size, locations_to_await, location_called_count); - - // Find first non-GPS constellation to blacklist - GnssConstellationType constellation_to_blacklist = GnssConstellationType::UNKNOWN; - for (int i = 0; i < sv_info_list_cbq_size; ++i) { - hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec; - gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, gnss_sv_info_list_timeout); - for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { - const auto& gnss_sv = sv_info_vec[iSv]; - if ((gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX) && - (gnss_sv.v2_0.constellation != GnssConstellationType::UNKNOWN) && - (gnss_sv.v2_0.constellation != GnssConstellationType::GPS)) { - // found a non-GPS constellation - constellation_to_blacklist = gnss_sv.v2_0.constellation; - break; - } - } - if (constellation_to_blacklist != GnssConstellationType::UNKNOWN) { - break; - } - } - - if (constellation_to_blacklist == GnssConstellationType::UNKNOWN) { - ALOGI("No non-GPS constellations found, constellation blacklist test less effective."); - // Proceed functionally to blacklist something. - constellation_to_blacklist = GnssConstellationType::GLONASS; - } - - return constellation_to_blacklist; -} - -GnssHalTest::GnssCallback::GnssCallback() - : info_cbq_("system_info"), - name_cbq_("name"), - capabilities_cbq_("capabilities"), - location_cbq_("location"), - sv_info_list_cbq_("sv_info") {} - -Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb( - const IGnssCallback_1_0::GnssSystemInfo& info) { - ALOGI("Info received, year %d", info.yearOfHw); - info_cbq_.store(info); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) { - ALOGI("Capabilities received %d", capabilities); - capabilities_cbq_.store(capabilities); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitiesCb_2_0(uint32_t capabilities) { - ALOGI("Capabilities (v2.0) received %d", capabilities); - capabilities_cbq_.store(capabilities); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitiesCb_2_1(uint32_t capabilities) { - ALOGI("Capabilities (v2.1) received %d", capabilities); - capabilities_cbq_.store(capabilities); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) { - ALOGI("Name received: %s", name.c_str()); - name_cbq_.store(name); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssLocationCb(const GnssLocation_1_0& location) { - ALOGI("Location received"); - GnssLocation_2_0 location_v2_0; - location_v2_0.v1_0 = location; - return gnssLocationCbImpl(location_v2_0); -} - -Return<void> GnssHalTest::GnssCallback::gnssLocationCb_2_0(const GnssLocation_2_0& location) { - ALOGI("Location (v2.0) received"); - return gnssLocationCbImpl(location); -} - -Return<void> GnssHalTest::GnssCallback::gnssLocationCbImpl(const GnssLocation_2_0& location) { - location_cbq_.store(location); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb(const IGnssCallback_1_0::GnssSvStatus&) { - ALOGI("gnssSvStatusCb"); - return Void(); -} - -Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb_2_1( - const hidl_vec<IGnssCallback_2_1::GnssSvInfo>& svInfoList) { - ALOGI("gnssSvStatusCb_2_1. Size = %d", (int)svInfoList.size()); - sv_info_list_cbq_.store(svInfoList); - return Void(); -} - -Return<void> GnssHalTest::GnssMeasurementCallback::gnssMeasurementCb_2_1( - const IGnssMeasurementCallback_2_1::GnssData& data) { - ALOGD("GnssMeasurement v2.1 received. Size = %d", (int)data.measurements.size()); - measurement_cbq_.store(data); - return Void(); -} - -Return<void> GnssHalTest::GnssMeasurementCorrectionsCallback::setCapabilitiesCb( - uint32_t capabilities) { - ALOGI("GnssMeasurementCorrectionsCallback capabilities received %d", capabilities); - capabilities_cbq_.store(capabilities); - return Void(); -} - -Return<void> GnssHalTest::GnssAntennaInfoCallback::gnssAntennaInfoCb( - const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos) { - ALOGD("GnssAntennaInfo v2.1 received. Size = %d", (int)gnssAntennaInfos.size()); - antenna_info_cbq_.store(gnssAntennaInfos); - return Void(); -}
\ No newline at end of file diff --git a/gnss/2.1/vts/functional/gnss_hal_test.h b/gnss/2.1/vts/functional/gnss_hal_test.h index 9e6e162a13..c28e2480f7 100644 --- a/gnss/2.1/vts/functional/gnss_hal_test.h +++ b/gnss/2.1/vts/functional/gnss_hal_test.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,221 +14,12 @@ * limitations under the License. */ -#ifndef GNSS_HAL_TEST_H_ -#define GNSS_HAL_TEST_H_ +#pragma once #include <android/hardware/gnss/2.1/IGnss.h> -#include "GnssCallbackEventQueue.h" +#include "v2_1/gnss_hal_test_template.h" -#include <gtest/gtest.h> - -using android::hardware::hidl_vec; -using android::hardware::Return; -using android::hardware::Void; - -using android::hardware::gnss::common::GnssCallbackEventQueue; -using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback; -using android::hardware::gnss::V1_0::GnssLocationFlags; -using android::hardware::gnss::V2_0::GnssConstellationType; using android::hardware::gnss::V2_1::IGnss; -using android::hardware::gnss::V2_1::IGnssAntennaInfo; -using android::hardware::gnss::V2_1::IGnssAntennaInfoCallback; - -using GnssLocation_1_0 = android::hardware::gnss::V1_0::GnssLocation; -using GnssLocation_2_0 = android::hardware::gnss::V2_0::GnssLocation; - -using IGnssCallback_1_0 = android::hardware::gnss::V1_0::IGnssCallback; -using IGnssCallback_2_0 = android::hardware::gnss::V2_0::IGnssCallback; -using IGnssCallback_2_1 = android::hardware::gnss::V2_1::IGnssCallback; - -using IGnssMeasurementCallback_1_0 = android::hardware::gnss::V1_0::IGnssMeasurementCallback; -using IGnssMeasurementCallback_1_1 = android::hardware::gnss::V1_1::IGnssMeasurementCallback; -using IGnssMeasurementCallback_2_0 = android::hardware::gnss::V2_0::IGnssMeasurementCallback; -using IGnssMeasurementCallback_2_1 = android::hardware::gnss::V2_1::IGnssMeasurementCallback; - -using android::sp; - -#define TIMEOUT_SEC 2 // for basic commands/responses // The main test class for GNSS HAL. -class GnssHalTest : public testing::TestWithParam<std::string> { - public: - virtual void SetUp() override; - - virtual void TearDown() override; - - /* Callback class for data & Event. */ - class GnssCallback : public IGnssCallback_2_1 { - public: - IGnssCallback_1_0::GnssSystemInfo last_info_; - android::hardware::hidl_string last_name_; - uint32_t last_capabilities_; - GnssLocation_2_0 last_location_; - - GnssCallbackEventQueue<IGnssCallback_1_0::GnssSystemInfo> info_cbq_; - GnssCallbackEventQueue<android::hardware::hidl_string> name_cbq_; - GnssCallbackEventQueue<uint32_t> capabilities_cbq_; - GnssCallbackEventQueue<GnssLocation_2_0> location_cbq_; - GnssCallbackEventQueue<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_list_cbq_; - - GnssCallback(); - virtual ~GnssCallback() = default; - - // Dummy callback handlers - Return<void> gnssStatusCb(const IGnssCallback_1_0::GnssStatusValue /* status */) override { - return Void(); - } - Return<void> gnssNmeaCb(int64_t /* timestamp */, - const android::hardware::hidl_string& /* nmea */) override { - return Void(); - } - Return<void> gnssAcquireWakelockCb() override { return Void(); } - Return<void> gnssReleaseWakelockCb() override { return Void(); } - Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override { - return Void(); - } - Return<void> gnssRequestTimeCb() override { return Void(); } - // Actual (test) callback handlers - Return<void> gnssNameCb(const android::hardware::hidl_string& name) override; - Return<void> gnssLocationCb(const GnssLocation_1_0& location) override; - Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override; - Return<void> gnssSetSystemInfoCb(const IGnssCallback_1_0::GnssSystemInfo& info) override; - Return<void> gnssSvStatusCb(const IGnssCallback_1_0::GnssSvStatus& svStatus) override; - - // New in v2.0 - Return<void> gnssLocationCb_2_0(const GnssLocation_2_0& location) override; - Return<void> gnssRequestLocationCb_2_0(bool /* independentFromGnss */, - bool /* isUserEmergency */) override { - return Void(); - } - Return<void> gnssSetCapabilitiesCb_2_0(uint32_t capabilities) override; - Return<void> gnssSvStatusCb_2_0(const hidl_vec<IGnssCallback_2_0::GnssSvInfo>&) override { - return Void(); - } - - // New in v2.1 - Return<void> gnssSvStatusCb_2_1( - const hidl_vec<IGnssCallback_2_1::GnssSvInfo>& svInfoList) override; - Return<void> gnssSetCapabilitiesCb_2_1(uint32_t capabilities) override; - - private: - Return<void> gnssLocationCbImpl(const GnssLocation_2_0& location); - }; - - /* Callback class for GnssMeasurement. */ - class GnssMeasurementCallback : public IGnssMeasurementCallback_2_1 { - public: - GnssCallbackEventQueue<IGnssMeasurementCallback_2_1::GnssData> measurement_cbq_; - - GnssMeasurementCallback() : measurement_cbq_("measurement"){}; - virtual ~GnssMeasurementCallback() = default; - - // Methods from V1_0::IGnssMeasurementCallback follow. - Return<void> GnssMeasurementCb(const IGnssMeasurementCallback_1_0::GnssData&) override { - return Void(); - } - - // Methods from V1_1::IGnssMeasurementCallback follow. - Return<void> gnssMeasurementCb(const IGnssMeasurementCallback_1_1::GnssData&) override { - return Void(); - } - - // Methods from V2_0::IGnssMeasurementCallback follow. - Return<void> gnssMeasurementCb_2_0(const IGnssMeasurementCallback_2_0::GnssData&) override { - return Void(); - } - - // Methods from V2_1::IGnssMeasurementCallback follow. - Return<void> gnssMeasurementCb_2_1(const IGnssMeasurementCallback_2_1::GnssData&) override; - }; - - /* Callback class for GnssMeasurementCorrections. */ - class GnssMeasurementCorrectionsCallback : public IMeasurementCorrectionsCallback { - public: - uint32_t last_capabilities_; - GnssCallbackEventQueue<uint32_t> capabilities_cbq_; - - GnssMeasurementCorrectionsCallback() : capabilities_cbq_("capabilities"){}; - virtual ~GnssMeasurementCorrectionsCallback() = default; - - // Methods from V1_0::IMeasurementCorrectionsCallback follow. - Return<void> setCapabilitiesCb(uint32_t capabilities) override; - }; - - /* Callback class for GnssAntennaInfo. */ - class GnssAntennaInfoCallback : public IGnssAntennaInfoCallback { - public: - GnssCallbackEventQueue<hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>> - antenna_info_cbq_; - - GnssAntennaInfoCallback() : antenna_info_cbq_("info"){}; - virtual ~GnssAntennaInfoCallback() = default; - - // Methods from V2_1::GnssAntennaInfoCallback follow. - Return<void> gnssAntennaInfoCb( - const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos); - }; - - /* - * SetUpGnssCallback: - * Set GnssCallback and verify the result. - */ - void SetUpGnssCallback(); - - /* - * StartAndCheckFirstLocation: - * Helper function to start location, and check the first one. - * - * <p> Note this leaves the Location request active, to enable Stop call vs. other call - * reordering tests. - * - * returns true if a location was successfully generated - */ - bool StartAndCheckFirstLocation(); - - /* - * CheckLocation: - * Helper function to vet Location fields - * - * check_speed: true if speed related fields are also verified. - */ - void CheckLocation(const GnssLocation_2_0& location, const bool check_speed); - - /* - * StartAndCheckLocations: - * Helper function to collect, and check a number of - * normal ~1Hz locations. - * - * Note this leaves the Location request active, to enable Stop call vs. other call - * reordering tests. - */ - void StartAndCheckLocations(int count); - - /* - * StopAndClearLocations: - * Helper function to stop locations, and clear any remaining notifications - */ - void StopAndClearLocations(); - - /* - * SetPositionMode: - * Helper function to set positioning mode and verify output - */ - void SetPositionMode(const int min_interval_msec, const bool low_power_mode); - - /* - * startLocationAndGetNonGpsConstellation: - * 1. Start location - * 2. Find and return first non-GPS constellation - * - * Note that location is not stopped in this method. The client should call - * StopAndClearLocations() after the call. - */ - GnssConstellationType startLocationAndGetNonGpsConstellation( - const int locations_to_await, const int gnss_sv_info_list_timeout); - - sp<IGnss> gnss_hal_; // GNSS HAL to call into - sp<GnssCallback> gnss_cb_; // Primary callback interface -}; - -#endif // GNSS_HAL_TEST_H_ +class GnssHalTest : public GnssHalTestTemplate<IGnss> {}; diff --git a/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp index 33feb5e5f0..a3d2956199 100644 --- a/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp +++ b/gnss/2.1/vts/functional/gnss_hal_test_cases.cpp @@ -247,8 +247,10 @@ TEST_P(GnssHalTest, TestGnssSvInfoFields) { ALOGD("Observed %d GnssSvStatus, while awaiting one location (%d received)", sv_info_list_cbq_size, location_called_count); - hidl_vec<IGnssCallback_2_1::GnssSvInfo> last_sv_info_list; - ASSERT_TRUE(gnss_cb_->sv_info_list_cbq_.retrieve(last_sv_info_list, 1)); + // Get the last sv_info_list + std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_vec_list; + gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec_list, sv_info_list_cbq_size, 1); + hidl_vec<IGnssCallback_2_1::GnssSvInfo> last_sv_info_list = sv_info_vec_list.back(); bool nonZeroCn0Found = false; for (auto sv_info : last_sv_info_list) { @@ -673,4 +675,4 @@ TEST_P(GnssHalTest, TestGnssMeasurementCorrections) { iMeasurementCorrections->setCorrections_1_1(Utils::getMockMeasurementCorrections_1_1()); ASSERT_TRUE(result.isOk()); EXPECT_TRUE(result); -}
\ No newline at end of file +} diff --git a/gnss/3.0/Android.bp b/gnss/3.0/Android.bp new file mode 100644 index 0000000000..dada17ced7 --- /dev/null +++ b/gnss/3.0/Android.bp @@ -0,0 +1,22 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.gnss@3.0", + root: "android.hardware", + srcs: [ + "IGnss.hal", + "IGnssPsds.hal", + "IGnssPsdsCallback.hal", + ], + interfaces: [ + "android.hardware.gnss.measurement_corrections@1.0", + "android.hardware.gnss.measurement_corrections@1.1", + "android.hardware.gnss.visibility_control@1.0", + "android.hardware.gnss@1.0", + "android.hardware.gnss@1.1", + "android.hardware.gnss@2.0", + "android.hardware.gnss@2.1", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/gnss/3.0/IGnss.hal b/gnss/3.0/IGnss.hal new file mode 100644 index 0000000000..18e5a9dee3 --- /dev/null +++ b/gnss/3.0/IGnss.hal @@ -0,0 +1,32 @@ +/* + * 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.gnss@3.0; + +import @2.1::IGnss; +import IGnssPsds; + +/** + * Represents the standard GNSS (Global Navigation Satellite System) interface. + */ +interface IGnss extends @2.1::IGnss { + /** + * This method returns the IGnssPsds interface. + * + * @return psdsIface Handle to the IGnssPsds interface. + */ + getExtensionPsds() generates (IGnssPsds psdsIface); +}; diff --git a/gnss/3.0/IGnssPsds.hal b/gnss/3.0/IGnssPsds.hal new file mode 100644 index 0000000000..5004570574 --- /dev/null +++ b/gnss/3.0/IGnssPsds.hal @@ -0,0 +1,48 @@ +/* + * 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.gnss@3.0; + +import @1.0::IGnssXtra; +import IGnssPsdsCallback; + +/** + * This interface is used by the GNSS HAL to request the framework to download Predicted Satellite + * Data Service data. + */ +interface IGnssPsds extends @1.0::IGnssXtra { + /** + * Opens the PSDS interface and provides the callback routines to the implementation of this + * interface. + * + * @param callback Handle to the IGnssPsdsCallback interface. + * + * @return success True if the operation is successful. + */ + setCallback_3_0(IGnssPsdsCallback callback) generates (bool success); + + /** + * Inject the downloaded PSDS data into the GNSS receiver. + * + * @param psdsType Type of PSDS as defined in IGnssPsdsCallback.hal + * @param psdsData GNSS PSDS data. Framework must not parse the data since the data format is + * opaque to framework. + * + * @return success True if the operation is successful. + */ + injectPsdsData_3_0(int32_t psdsType, string psdsData) generates (bool success); +}; + diff --git a/gnss/3.0/IGnssPsdsCallback.hal b/gnss/3.0/IGnssPsdsCallback.hal new file mode 100644 index 0000000000..d91385f814 --- /dev/null +++ b/gnss/3.0/IGnssPsdsCallback.hal @@ -0,0 +1,41 @@ +/* + * 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.gnss@3.0; + +import @1.0::IGnssXtraCallback; + +/** + * This interface is used by the GNSS HAL to request download data from Predicted Satellite Data + * Service (PSDS). + */ +interface IGnssPsdsCallback extends @1.0::IGnssXtraCallback { + /** + * Callback to request the client to download PSDS data. The client should + * download PSDS data and inject it by calling injectPsdsData(). + * + * psdsType represents the type of PSDS data requested. + * - Value 1 represents the Long-Term type PSDS data, which lasts for many hours to several days + * and often provides satellite orbit and clock accuracy of 2 - 20 meters. + * - Value 2 represents the Normal type PSDS data, which is similar to broadcast ephemeris in + * longevity - lasting for hours and providings satellite orbit and clock accuracy of 1 - 2 + * meters. + * - Value 3 represents the Real-Time type PSDS data, which lasts for minutes and provides brief + * satellite status information such as temporary malfunction, but does not include satellite + * orbit or clock information. + */ + downloadRequestCb_3_0(int32_t psdsType); +}; diff --git a/gnss/3.0/default/Android.bp b/gnss/3.0/default/Android.bp new file mode 100644 index 0000000000..2b33b32058 --- /dev/null +++ b/gnss/3.0/default/Android.bp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +cc_binary { + name: "android.hardware.gnss@3.0-service", + init_rc: ["android.hardware.gnss@3.0-service.rc"], + relative_install_path: "hw", + vendor: true, + vintf_fragments: ["android.hardware.gnss@3.0-service.xml"], + srcs: [ + "Gnss.cpp", + "GnssPsds.cpp", + "service.cpp", + ], + shared_libs: [ + "libhidlbase", + "libutils", + "liblog", + "android.hardware.gnss@1.0", + "android.hardware.gnss@1.1", + "android.hardware.gnss@2.0", + "android.hardware.gnss@2.1", + "android.hardware.gnss@3.0", + "android.hardware.gnss.measurement_corrections@1.1", + "android.hardware.gnss.measurement_corrections@1.0", + ], + static_libs: [ + "android.hardware.gnss@common-default-lib", + ], +} diff --git a/gnss/3.0/default/Gnss.cpp b/gnss/3.0/default/Gnss.cpp new file mode 100644 index 0000000000..5f2ca4f522 --- /dev/null +++ b/gnss/3.0/default/Gnss.cpp @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#define LOG_TAG "Gnss" + +#include "Gnss.h" +#include <log/log.h> +#include "GnssPsds.h" +#include "Utils.h" + +namespace android::hardware::gnss::V3_0::implementation { + +// Methods from V3_0::IGnss follow. +Return<sp<V3_0::IGnssPsds>> Gnss::getExtensionPsds() { + ALOGD("Gnss::getExtensionPsds"); + return new GnssPsds(); +} + +} // namespace android::hardware::gnss::V3_0::implementation diff --git a/gnss/3.0/default/Gnss.h b/gnss/3.0/default/Gnss.h new file mode 100644 index 0000000000..7ae562ade3 --- /dev/null +++ b/gnss/3.0/default/Gnss.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <android/hardware/gnss/3.0/IGnss.h> +#include <hidl/MQDescriptor.h> +#include <hidl/Status.h> +#include <atomic> +#include <mutex> +#include <thread> +#include "v2_1/GnssTemplate.h" + +namespace android::hardware::gnss::V3_0::implementation { + +using ::android::sp; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::hardware::gnss::common::implementation::GnssTemplate; + +struct Gnss : public GnssTemplate<IGnss> { + Gnss(){}; + ~Gnss(){}; + + // Methods from V3_0::IGnss follow. + Return<sp<V3_0::IGnssPsds>> getExtensionPsds() override; +}; + +} // namespace android::hardware::gnss::V3_0::implementation diff --git a/gnss/3.0/default/GnssPsds.cpp b/gnss/3.0/default/GnssPsds.cpp new file mode 100644 index 0000000000..44e096ebd3 --- /dev/null +++ b/gnss/3.0/default/GnssPsds.cpp @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#define LOG_TAG "GnssPsds" + +#include "GnssPsds.h" + +#include <log/log.h> + +namespace android::hardware::gnss::V3_0::implementation { + +sp<V3_0::IGnssPsdsCallback> GnssPsds::sCallback_3_0 = nullptr; + +// Methods from V1_0::IGnssXtra follow. +Return<bool> GnssPsds::setCallback(const sp<V1_0::IGnssXtraCallback>&) { + // TODO implement + return bool{}; +} + +Return<bool> GnssPsds::injectXtraData(const hidl_string&) { + // TODO implement + return bool{}; +} + +// Methods from V3_0::IGnssPsds follow. +Return<bool> GnssPsds::setCallback_3_0(const sp<V3_0::IGnssPsdsCallback>& callback) { + ALOGD("setCallback_3_0"); + std::unique_lock<std::mutex> lock(mMutex); + sCallback_3_0 = callback; + return true; +} + +Return<bool> GnssPsds::injectPsdsData_3_0(int32_t psdsType, const hidl_string& psdsData) { + ALOGD("injectPsdsData_3_0. psdsType: %d, psdsData: %s", psdsType, psdsData.c_str()); + return true; +} +} // namespace android::hardware::gnss::V3_0::implementation diff --git a/gnss/3.0/default/GnssPsds.h b/gnss/3.0/default/GnssPsds.h new file mode 100644 index 0000000000..4053bf17c8 --- /dev/null +++ b/gnss/3.0/default/GnssPsds.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <android/hardware/gnss/3.0/IGnssPsds.h> +#include <hidl/MQDescriptor.h> +#include <hidl/Status.h> + +namespace android::hardware::gnss::V3_0::implementation { + +using ::android::sp; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +struct GnssPsds : public V3_0::IGnssPsds { + // Methods from V1_0::IGnssXtra follow. + Return<bool> setCallback(const sp<V1_0::IGnssXtraCallback>& callback) override; + Return<bool> injectXtraData(const hidl_string& xtraData) override; + + // Methods from V3_0::IGnssPsds follow. + Return<bool> setCallback_3_0(const sp<V3_0::IGnssPsdsCallback>& callback) override; + Return<bool> injectPsdsData_3_0(int32_t psdsType, const hidl_string& psdsData) override; + + private: + // Guarded by mMutex + static sp<V3_0::IGnssPsdsCallback> sCallback_3_0; + + // Synchronization lock for sCallback_3_0 + mutable std::mutex mMutex; +}; + +} // namespace android::hardware::gnss::V3_0::implementation diff --git a/gnss/3.0/default/OWNERS b/gnss/3.0/default/OWNERS new file mode 100644 index 0000000000..b7b4a2e902 --- /dev/null +++ b/gnss/3.0/default/OWNERS @@ -0,0 +1,4 @@ +gomo@google.com +smalkos@google.com +wyattriley@google.com +yuhany@google.com diff --git a/gnss/3.0/default/android.hardware.gnss@3.0-service.rc b/gnss/3.0/default/android.hardware.gnss@3.0-service.rc new file mode 100644 index 0000000000..c2bfb91e22 --- /dev/null +++ b/gnss/3.0/default/android.hardware.gnss@3.0-service.rc @@ -0,0 +1,4 @@ +service vendor.gnss-3-0 /vendor/bin/hw/android.hardware.gnss@3.0-service + class hal + user system + group system diff --git a/gnss/3.0/default/android.hardware.gnss@3.0-service.xml b/gnss/3.0/default/android.hardware.gnss@3.0-service.xml new file mode 100644 index 0000000000..6709e0c3b5 --- /dev/null +++ b/gnss/3.0/default/android.hardware.gnss@3.0-service.xml @@ -0,0 +1,13 @@ +<manifest version="1.0" type="device"> + <hal format="hidl"> + <name>android.hardware.gnss</name> + <transport>hwbinder</transport> + <version>3.0</version> + <version>2.1</version> + <version>1.1</version> + <interface> + <name>IGnss</name> + <instance>default</instance> + </interface> + </hal> +</manifest> diff --git a/gnss/3.0/default/service.cpp b/gnss/3.0/default/service.cpp new file mode 100644 index 0000000000..87b458070b --- /dev/null +++ b/gnss/3.0/default/service.cpp @@ -0,0 +1,41 @@ +/* + * 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. + */ + +#define LOG_TAG "android.hardware.gnss@3.0-service" + +#include <hidl/HidlSupport.h> +#include <hidl/HidlTransportSupport.h> +#include "Gnss.h" + +using ::android::OK; +using ::android::sp; +using ::android::hardware::configureRpcThreadpool; +using ::android::hardware::joinRpcThreadpool; +using ::android::hardware::gnss::V3_0::IGnss; +using ::android::hardware::gnss::V3_0::implementation::Gnss; + +int main(int /* argc */, char* /* argv */[]) { + sp<IGnss> gnss = new Gnss(); + configureRpcThreadpool(1, true /* will join */); + if (gnss->registerAsService() != OK) { + ALOGE("Could not register gnss 3.0 service."); + return 1; + } + joinRpcThreadpool(); + + ALOGE("Service exited!"); + return 1; +}
\ No newline at end of file diff --git a/gnss/3.0/vts/OWNERS b/gnss/3.0/vts/OWNERS new file mode 100644 index 0000000000..b7b4a2e902 --- /dev/null +++ b/gnss/3.0/vts/OWNERS @@ -0,0 +1,4 @@ +gomo@google.com +smalkos@google.com +wyattriley@google.com +yuhany@google.com diff --git a/gnss/3.0/vts/functional/Android.bp b/gnss/3.0/vts/functional/Android.bp new file mode 100644 index 0000000000..584424ccc4 --- /dev/null +++ b/gnss/3.0/vts/functional/Android.bp @@ -0,0 +1,39 @@ +// +// Copyright (C) 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_test { + name: "VtsHalGnssV3_0TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "gnss_hal_test_cases.cpp", + "VtsHalGnssV3_0TargetTest.cpp", + ], + static_libs: [ + "android.hardware.gnss.measurement_corrections@1.0", + "android.hardware.gnss.measurement_corrections@1.1", + "android.hardware.gnss.visibility_control@1.0", + "android.hardware.gnss@1.0", + "android.hardware.gnss@1.1", + "android.hardware.gnss@2.0", + "android.hardware.gnss@2.1", + "android.hardware.gnss@3.0", + "android.hardware.gnss@common-vts-lib", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/gnss/3.0/vts/functional/VtsHalGnssV3_0TargetTest.cpp b/gnss/3.0/vts/functional/VtsHalGnssV3_0TargetTest.cpp new file mode 100644 index 0000000000..9eca7b0620 --- /dev/null +++ b/gnss/3.0/vts/functional/VtsHalGnssV3_0TargetTest.cpp @@ -0,0 +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. + */ +#define LOG_TAG "VtsHalGnssV3_0TargetTest" + +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> + +#include "gnss_hal_test.h" + +using android::hardware::gnss::V3_0::IGnss; + +INSTANTIATE_TEST_SUITE_P( + PerInstance, GnssHalTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames(IGnss::descriptor)), + android::hardware::PrintInstanceNameToString);
\ No newline at end of file diff --git a/gnss/3.0/vts/functional/gnss_hal_test.h b/gnss/3.0/vts/functional/gnss_hal_test.h new file mode 100644 index 0000000000..387214eba2 --- /dev/null +++ b/gnss/3.0/vts/functional/gnss_hal_test.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <android/hardware/gnss/3.0/IGnss.h> +#include "v2_1/gnss_hal_test_template.h" + +using android::hardware::gnss::V3_0::IGnss; + +// The main test class for GNSS HAL. +class GnssHalTest : public GnssHalTestTemplate<IGnss> {};
\ No newline at end of file diff --git a/gnss/3.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/3.0/vts/functional/gnss_hal_test_cases.cpp new file mode 100644 index 0000000000..cc5341c181 --- /dev/null +++ b/gnss/3.0/vts/functional/gnss_hal_test_cases.cpp @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#define LOG_TAG "GnssHalTestCases" + +#include <gnss_hal_test.h> +#include <cmath> +#include "Utils.h" + +#include <gtest/gtest.h> + +using android::hardware::hidl_string; +using android::hardware::hidl_vec; + +using android::hardware::gnss::common::Utils; + +using android::hardware::gnss::V3_0::IGnssPsds; + +/* + * SetupTeardownCreateCleanup: + * Requests the gnss HAL then calls cleanup + * + * Empty test fixture to verify basic Setup & Teardown + */ +TEST_P(GnssHalTest, SetupTeardownCreateCleanup) {} + +/* + * TestPsdsExtension: + * Gets the PsdsExtension and verifies that it returns a non-null extension. + */ +TEST_P(GnssHalTest, TestPsdsExtension) { + auto psds = gnss_hal_->getExtensionPsds(); + ASSERT_TRUE(psds.isOk()); + sp<IGnssPsds> iPsds = psds; + ASSERT_TRUE(iPsds != nullptr); +} diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp index 577f6ae5e3..8d9d4d46aa 100644 --- a/gnss/common/utils/default/Android.bp +++ b/gnss/common/utils/default/Android.bp @@ -24,7 +24,13 @@ cc_library_static { "-Werror", ], srcs: [ + "v2_1/GnssAntennaInfo.cpp", + "v2_1/GnssConfiguration.cpp", + "v2_1/GnssDebug.cpp", + "v2_1/GnssMeasurement.cpp", + "v2_1/GnssMeasurementCorrections.cpp", "Utils.cpp", + "NmeaFixInfo.cpp", ], export_include_dirs: ["include"], shared_libs: [ @@ -33,5 +39,7 @@ cc_library_static { "android.hardware.gnss@1.0", "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", + "android.hardware.gnss.measurement_corrections@1.1", + "android.hardware.gnss.measurement_corrections@1.0", ], } diff --git a/gnss/common/utils/default/NmeaFixInfo.cpp b/gnss/common/utils/default/NmeaFixInfo.cpp new file mode 100644 index 0000000000..43e008bb72 --- /dev/null +++ b/gnss/common/utils/default/NmeaFixInfo.cpp @@ -0,0 +1,266 @@ +/* + * 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. + */ + +#define LOG_TAG "NmeaFixInfo" + +#include <Constants.h> +#include <NmeaFixInfo.h> +#include <Utils.h> +#include <log/log.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <utils/SystemClock.h> +#include <limits> +#include <sstream> +#include <string> +#include <vector> + +namespace android { +namespace hardware { +namespace gnss { +namespace common { + +NmeaFixInfo::NmeaFixInfo() : hasGMCRecord(false), hasGGARecord(false) {} + +float NmeaFixInfo::getAltitudeMeters() const { + return altitudeMeters; +} + +float NmeaFixInfo::checkAndConvertToFloat(const std::string& sentence) { + if (sentence.empty()) { + return std::numeric_limits<float>::quiet_NaN(); + } + return std::stof(sentence); +} + +float NmeaFixInfo::getBearingAccuracyDegrees() const { + // Current NMEA doesn't contains beaing accuracy inforamtion + return kMockBearingAccuracyDegrees; +} +float NmeaFixInfo::getBearingDegrees() const { + return bearingDegrees; +} + +float NmeaFixInfo::getHorizontalAccuracyMeters() const { + // Current NMEA doesn't contains horizontal accuracy inforamtion + return kMockHorizontalAccuracyMeters; +} + +float NmeaFixInfo::getLatDeg() const { + return latDeg; +} + +float NmeaFixInfo::getLngDeg() const { + return lngDeg; +} + +float NmeaFixInfo::getSpeedAccuracyMetersPerSecond() const { + // Current NMEA doesn't contains speed accuracy inforamtion + return kMockSpeedAccuracyMetersPerSecond; +} + +float NmeaFixInfo::getSpeedMetersPerSec() const { + return speedMetersPerSec; +} + +int64_t NmeaFixInfo::getTimestamp() const { + return timestamp; +} + +float NmeaFixInfo::getVerticalAccuracyMeters() const { + // Current NMEA doesn't contains vertical accuracy inforamtion + return kMockVerticalAccuracyMeters; +} + +int64_t NmeaFixInfo::nmeaPartsToTimestamp(const std::string& timeStr, const std::string& dateStr) { + /** + * In NMEA format, the full time can only get from the $GPRMC record, see + * the following example: + * $GPRMC,213204.00,A,3725.371240,N,12205.589239,W,000.0,000.0,290819,,,A*49 + * the datetime is stored in two parts, 213204 and 290819, which means + * 2019/08/29 21:32:04, however for in unix the year starts from 1900, we + * need to add the offset. + */ + struct tm tm; + const int32_t unixYearOffset = 100; + tm.tm_mday = std::stoi(dateStr.substr(0, 2).c_str()); + tm.tm_mon = std::stoi(dateStr.substr(2, 2).c_str()) - 1; + tm.tm_year = std::stoi(dateStr.substr(4, 2).c_str()) + unixYearOffset; + tm.tm_hour = std::stoi(timeStr.substr(0, 2).c_str()); + tm.tm_min = std::stoi(timeStr.substr(2, 2).c_str()); + tm.tm_sec = std::stoi(timeStr.substr(4, 2).c_str()); + return static_cast<int64_t>(mktime(&tm) - timezone); +} + +bool NmeaFixInfo::isValidFix() const { + return hasGMCRecord && hasGGARecord; +} + +void NmeaFixInfo::parseGGALine(const std::vector<std::string>& sentenceValues) { + if (sentenceValues.size() == 0 || sentenceValues[0].compare(GPGA_RECORD_TAG) != 0) { + return; + } + // LatDeg, need covert to degree, if it is 'N', should be negative value + this->latDeg = std::stof(sentenceValues[2].substr(0, 2)) + + (std::stof(sentenceValues[2].substr(2)) / 60.0); + if (sentenceValues[3].compare("N") != 0) { + this->latDeg *= -1; + } + + // LngDeg, need covert to degree, if it is 'E', should be negative value + this->lngDeg = std::stof(sentenceValues[4].substr(0, 3)) + + std::stof(sentenceValues[4].substr(3)) / 60.0; + if (sentenceValues[5].compare("E") != 0) { + this->lngDeg *= -1; + } + + this->altitudeMeters = std::stof(sentenceValues[9]); + + this->hDop = sentenceValues[8].empty() ? std::numeric_limits<float>::quiet_NaN() + : std::stof(sentenceValues[8]); + this->hasGGARecord = true; +} + +void NmeaFixInfo::parseRMCLine(const std::vector<std::string>& sentenceValues) { + if (sentenceValues.size() == 0 || sentenceValues[0].compare(GPRMC_RECORD_TAG) != 0) { + return; + } + this->speedMetersPerSec = checkAndConvertToFloat(sentenceValues[7]); + this->bearingDegrees = checkAndConvertToFloat(sentenceValues[8]); + this->timestamp = nmeaPartsToTimestamp(sentenceValues[1], sentenceValues[9]); + this->hasGMCRecord = true; +} + +/** invalid the current NmeaFixInfo */ +void NmeaFixInfo::reset() { + this->altitudeMeters = 0; + this->bearingDegrees = 0; + this->fixId = 0; + this->hasGMCRecord = false; + this->hasGGARecord = false; + this->latDeg = 0; + this->lngDeg = 0; + this->hDop = 0; + this->vDop = 0; + this->satelliteCount = 0; + this->speedMetersPerSec = 0; + this->timestamp = 0; +} + +void NmeaFixInfo::splitStr(const std::string& line, const char& delimiter, + std::vector<std::string>& out) { + std::istringstream iss(line); + std::string item; + while (std::getline(iss, item, delimiter)) { + out.push_back(item); + } +} + +NmeaFixInfo& NmeaFixInfo::operator=(const NmeaFixInfo& rhs) { + if (this == &rhs) return *this; + this->altitudeMeters = rhs.altitudeMeters; + this->bearingDegrees = rhs.bearingDegrees; + this->fixId = rhs.fixId; + this->hasGMCRecord = rhs.hasGMCRecord; + this->hasGGARecord = rhs.hasGGARecord; + this->hDop = rhs.hDop; + this->vDop = rhs.vDop; + this->latDeg = rhs.latDeg; + this->lngDeg = rhs.lngDeg; + this->satelliteCount = rhs.satelliteCount; + this->speedMetersPerSec = rhs.speedMetersPerSec; + this->timestamp = rhs.timestamp; + + return *this; +} + +/** + * Parses the input string in NMEA format and convert to GnssLocation. + * Currently version only cares about $GPGGA and $GPRMC records. but we + * can easily extend to other types supported by NMEA if needed. + */ +std::unique_ptr<V2_0::GnssLocation> NmeaFixInfo::getLocationFromInputStr( + const std::string& inputStr) { + std::vector<std::string> nmeaRecords; + splitStr(inputStr, LINE_SEPARATOR, nmeaRecords); + NmeaFixInfo nmeaFixInfo; + NmeaFixInfo candidateFixInfo; + uint32_t fixId = 0; + double lastTimeStamp = 0; + for (const auto& line : nmeaRecords) { + std::vector<std::string> sentenceValues; + splitStr(line, COMMA_SEPARATOR, sentenceValues); + double currentTimeStamp = std::stof(sentenceValues[1]); + // If see a new timestamp, report correct location. + if ((currentTimeStamp - lastTimeStamp) > TIMESTAMP_EPSILON && + candidateFixInfo.isValidFix()) { + nmeaFixInfo = candidateFixInfo; + candidateFixInfo.reset(); + fixId++; + } + if (line.compare(0, strlen(GPGA_RECORD_TAG), GPGA_RECORD_TAG) == 0) { + candidateFixInfo.fixId = fixId; + candidateFixInfo.parseGGALine(sentenceValues); + } else if (line.compare(0, strlen(GPRMC_RECORD_TAG), GPRMC_RECORD_TAG) == 0) { + candidateFixInfo.parseRMCLine(sentenceValues); + } + } + if (candidateFixInfo.isValidFix()) { + nmeaFixInfo = candidateFixInfo; + candidateFixInfo.reset(); + } + if (!nmeaFixInfo.isValidFix()) { + return nullptr; + } + return nmeaFixInfo.toGnssLocation(); +} + +/** + * Parses the input string in NMEA format and convert to GnssLocation. + */ +std::unique_ptr<V2_0::GnssLocation> NmeaFixInfo::toGnssLocation() const { + const V2_0::ElapsedRealtime currentOsTimestamp = { + .flags = V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS | + V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS, + .timestampNs = static_cast<uint64_t>(::android::elapsedRealtimeNano()), + // This is an hardcoded value indicating a 1ms of uncertainty between the two clocks. + // In an actual implementation provide an estimate of the synchronization uncertainty + // or don't set the field. + .timeUncertaintyNs = 1000000}; + + V1_0::GnssLocation locationV1 = { + .gnssLocationFlags = 0xFF, + .latitudeDegrees = this->getLatDeg(), + .longitudeDegrees = this->getLngDeg(), + .altitudeMeters = this->getAltitudeMeters(), + .speedMetersPerSec = this->getSpeedMetersPerSec(), + .bearingDegrees = this->getBearingDegrees(), + .horizontalAccuracyMeters = this->getHorizontalAccuracyMeters(), + .verticalAccuracyMeters = this->getVerticalAccuracyMeters(), + .speedAccuracyMetersPerSecond = this->getSpeedAccuracyMetersPerSecond(), + .bearingAccuracyDegrees = this->getBearingAccuracyDegrees(), + .timestamp = this->getTimestamp()}; + + V2_0::GnssLocation locationV2 = {.v1_0 = locationV1, .elapsedRealtime = currentOsTimestamp}; + + return std::make_unique<V2_0::GnssLocation>(locationV2); +} + +} // namespace common +} // namespace gnss +} // namespace hardware +} // namespace android
\ No newline at end of file diff --git a/gnss/common/utils/default/include/NmeaFixInfo.h b/gnss/common/utils/default/include/NmeaFixInfo.h new file mode 100644 index 0000000000..fb2c1a4491 --- /dev/null +++ b/gnss/common/utils/default/include/NmeaFixInfo.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <Constants.h> +#include <android/hardware/gnss/1.0/IGnss.h> +#include <android/hardware/gnss/2.0/IGnss.h> +#include <hidl/Status.h> +#include <ctime> +#include <string> +namespace android { +namespace hardware { +namespace gnss { +namespace common { +using ::android::sp; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +constexpr char GPGA_RECORD_TAG[] = "$GPGGA"; +constexpr char GPRMC_RECORD_TAG[] = "$GPRMC"; +constexpr char LINE_SEPARATOR = '\n'; +constexpr char COMMA_SEPARATOR = ','; +constexpr double TIMESTAMP_EPSILON = 0.001; + +/** Helper class to parse and store the GNSS fix details information. */ +class NmeaFixInfo { + private: + float altitudeMeters; + float bearingDegrees; + uint32_t fixId; + bool hasGMCRecord; + bool hasGGARecord; + float hDop; + float vDop; + float latDeg; + float lngDeg; + uint32_t satelliteCount; + float speedMetersPerSec; + int64_t timestamp; + + public: + static std::unique_ptr<V2_0::GnssLocation> getLocationFromInputStr(const std::string& inputStr); + + private: + static void splitStr(const std::string& line, const char& delimiter, + std::vector<std::string>& out); + static float checkAndConvertToFloat(const std::string& sentence); + static int64_t nmeaPartsToTimestamp(const std::string& timeStr, const std::string& dateStr); + + NmeaFixInfo(); + void parseGGALine(const std::vector<std::string>& sentenceValues); + void parseRMCLine(const std::vector<std::string>& sentenceValues); + std::unique_ptr<V2_0::GnssLocation> toGnssLocation() const; + + // Getters + float getAltitudeMeters() const; + float getBearingAccuracyDegrees() const; + float getBearingDegrees() const; + uint32_t getFixId() const; + float getHorizontalAccuracyMeters() const; + float getLatDeg() const; + float getLngDeg() const; + float getSpeedAccuracyMetersPerSecond() const; + float getSpeedMetersPerSec() const; + int64_t getTimestamp() const; + float getVerticalAccuracyMeters() const; + + bool isValidFix() const; + void reset(); + NmeaFixInfo& operator=(const NmeaFixInfo& rhs); +}; + +} // namespace common +} // namespace gnss +} // namespace hardware +} // namespace android
\ No newline at end of file diff --git a/gnss/2.1/default/GnssAntennaInfo.h b/gnss/common/utils/default/include/v2_1/GnssAntennaInfo.h index 94b2111d06..e74ff54839 100644 --- a/gnss/2.1/default/GnssAntennaInfo.h +++ b/gnss/common/utils/default/include/v2_1/GnssAntennaInfo.h @@ -14,23 +14,20 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H -#define ANDROID_HARDWARE_GNSS_V2_1_GNSSANTENNAINFO_H +#pragma once #include <android/hardware/gnss/2.1/IGnssAntennaInfo.h> #include <mutex> #include <thread> -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { -namespace implementation { +namespace android::hardware::gnss::V2_1::implementation { using ::android::sp; using ::android::hardware::Return; using ::android::hardware::Void; +using IGnssAntennaInfo = ::android::hardware::gnss::V2_1::IGnssAntennaInfo; +using IGnssAntennaInfoCallback = ::android::hardware::gnss::V2_1::IGnssAntennaInfoCallback; struct GnssAntennaInfo : public IGnssAntennaInfo { GnssAntennaInfo(); @@ -58,10 +55,4 @@ struct GnssAntennaInfo : public IGnssAntennaInfo { mutable std::mutex mMutex; }; -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H +} // namespace android::hardware::gnss::V2_1::implementation diff --git a/gnss/2.1/default/GnssConfiguration.h b/gnss/common/utils/default/include/v2_1/GnssConfiguration.h index 662d61d038..8463a5caa2 100644 --- a/gnss/2.1/default/GnssConfiguration.h +++ b/gnss/common/utils/default/include/v2_1/GnssConfiguration.h @@ -14,8 +14,7 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H -#define ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H +#pragma once #include <android/hardware/gnss/2.1/IGnssCallback.h> #include <android/hardware/gnss/2.1/IGnssConfiguration.h> @@ -24,11 +23,7 @@ #include <mutex> #include <unordered_set> -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { -namespace implementation { +namespace android::hardware::gnss::V2_1::implementation { using ::android::sp; using ::android::hardware::hidl_array; @@ -92,10 +87,4 @@ struct GnssConfiguration : public IGnssConfiguration { BlacklistedConstellationSetV2_1 mBlacklistedConstellationSet; }; -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSCONFIGURATION_H
\ No newline at end of file +} // namespace android::hardware::gnss::V2_1::implementation diff --git a/gnss/2.1/default/GnssDebug.h b/gnss/common/utils/default/include/v2_1/GnssDebug.h index 969d337524..8580989c6a 100644 --- a/gnss/2.1/default/GnssDebug.h +++ b/gnss/common/utils/default/include/v2_1/GnssDebug.h @@ -14,17 +14,12 @@ * limitations under the License. */ -#ifndef android_hardware_gnss_V1_1_GnssDebug_H_ -#define android_hardware_gnss_V1_1_GnssDebug_H_ +#pragma once #include <android/hardware/gnss/1.0/IGnssDebug.h> #include <hidl/Status.h> -namespace android { -namespace hardware { -namespace gnss { -namespace V1_1 { -namespace implementation { +namespace android::hardware::gnss::V1_1::implementation { using ::android::sp; using ::android::hardware::hidl_string; @@ -42,10 +37,4 @@ struct GnssDebug : public IGnssDebug { Return<void> getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb) override; }; -} // namespace implementation -} // namespace V1_1 -} // namespace gnss -} // namespace hardware -} // namespace android - -#endif // android_hardware_gnss_V1_1_GnssDebug_H_ +} // namespace android::hardware::gnss::V1_1::implementation diff --git a/gnss/2.1/default/GnssMeasurement.h b/gnss/common/utils/default/include/v2_1/GnssMeasurement.h index d44641978f..1d1fc9d712 100644 --- a/gnss/2.1/default/GnssMeasurement.h +++ b/gnss/common/utils/default/include/v2_1/GnssMeasurement.h @@ -23,11 +23,7 @@ #include <mutex> #include <thread> -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { -namespace implementation { +namespace android::hardware::gnss::V2_1::implementation { using GnssDataV2_1 = V2_1::IGnssMeasurementCallback::GnssData; using GnssDataV2_0 = V2_0::IGnssMeasurementCallback::GnssData; @@ -80,8 +76,4 @@ struct GnssMeasurement : public IGnssMeasurement { mutable std::mutex mMutex; }; -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android +} // namespace android::hardware::gnss::V2_1::implementation diff --git a/gnss/2.1/default/GnssMeasurementCorrections.h b/gnss/common/utils/default/include/v2_1/GnssMeasurementCorrections.h index 036e855586..eaa7659c6b 100644 --- a/gnss/2.1/default/GnssMeasurementCorrections.h +++ b/gnss/common/utils/default/include/v2_1/GnssMeasurementCorrections.h @@ -20,22 +20,15 @@ #include <hidl/MQDescriptor.h> #include <hidl/Status.h> -namespace android { -namespace hardware { -namespace gnss { -namespace measurement_corrections { -namespace V1_1 { -namespace implementation { +namespace android::hardware::gnss::measurement_corrections::V1_1::implementation { using ::android::sp; -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; using ::android::hardware::Return; -using ::android::hardware::Void; struct GnssMeasurementCorrections : public IMeasurementCorrections { + GnssMeasurementCorrections(); + ~GnssMeasurementCorrections(); + // Methods from V1_0::IMeasurementCorrections follow. Return<bool> setCorrections(const V1_0::MeasurementCorrections& corrections) override; Return<bool> setCallback(const sp<V1_0::IMeasurementCorrectionsCallback>& callback) override; @@ -44,9 +37,4 @@ struct GnssMeasurementCorrections : public IMeasurementCorrections { Return<bool> setCorrections_1_1(const V1_1::MeasurementCorrections& corrections) override; }; -} // namespace implementation -} // namespace V1_1 -} // namespace measurement_corrections -} // namespace gnss -} // namespace hardware -} // namespace android +} // namespace android::hardware::gnss::measurement_corrections::V1_1::implementation diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h new file mode 100644 index 0000000000..d16a67bffe --- /dev/null +++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h @@ -0,0 +1,641 @@ +/* + * 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. + */ + +#pragma once + +#include <android/hardware/gnss/2.1/IGnss.h> +#include <fcntl.h> +#include <hidl/MQDescriptor.h> +#include <hidl/Status.h> +#include <log/log.h> +#include <sys/epoll.h> +#include <atomic> +#include <mutex> +#include <string> +#include <thread> + +#include "GnssAntennaInfo.h" +#include "GnssConfiguration.h" +#include "GnssDebug.h" +#include "GnssMeasurement.h" +#include "GnssMeasurementCorrections.h" +#include "NmeaFixInfo.h" +#include "Utils.h" + +namespace android::hardware::gnss::common::implementation { + +using GnssSvInfo = V2_1::IGnssCallback::GnssSvInfo; + +using common::NmeaFixInfo; +using common::Utils; +using measurement_corrections::V1_1::implementation::GnssMeasurementCorrections; + +using V2_1::implementation::GnssAntennaInfo; +using V2_1::implementation::GnssConfiguration; +using V2_1::implementation::GnssMeasurement; + +constexpr int INPUT_BUFFER_SIZE = 128; +constexpr char CMD_GET_LOCATION[] = "CMD_GET_LOCATION"; +constexpr char GNSS_PATH[] = "/dev/gnss0"; + +template <class T_IGnss> +struct GnssTemplate : public T_IGnss { + GnssTemplate(); + ~GnssTemplate(); + // Methods from V1_0::IGnss follow. + Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override; + Return<bool> start() override; + Return<bool> stop() override; + Return<void> cleanup() override; + Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs, + int32_t uncertaintyMs) override; + Return<bool> injectLocation(double latitudeDegrees, double longitudeDegrees, + float accuracyMeters) override; + Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override; + Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode, + V1_0::IGnss::GnssPositionRecurrence recurrence, + uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, + uint32_t preferredTimeMs) override; + Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override; + Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override; + Return<sp<V1_0::IAGnss>> getExtensionAGnss() override; + Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override; + Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override; + Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override; + Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override; + Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override; + Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override; + Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override; + + // Methods from V1_1::IGnss follow. + Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override; + Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode, + V1_0::IGnss::GnssPositionRecurrence recurrence, + uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, + uint32_t preferredTimeMs, bool lowPowerMode) override; + Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override; + Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override; + Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override; + + // Methods from V2_0::IGnss follow. + Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override; + Return<sp<V2_0::IGnssConfiguration>> getExtensionGnssConfiguration_2_0() override; + Return<sp<V2_0::IGnssDebug>> getExtensionGnssDebug_2_0() override; + Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override; + Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override; + Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override; + Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>> + getExtensionMeasurementCorrections() override; + Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> getExtensionVisibilityControl() + override; + Return<sp<V2_0::IGnssBatching>> getExtensionGnssBatching_2_0() override; + Return<bool> injectBestLocation_2_0(const V2_0::GnssLocation& location) override; + + // Methods from V2_1::IGnss follow. + Return<bool> setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) override; + Return<sp<V2_1::IGnssMeasurement>> getExtensionGnssMeasurement_2_1() override; + Return<sp<V2_1::IGnssConfiguration>> getExtensionGnssConfiguration_2_1() override; + Return<sp<measurement_corrections::V1_1::IMeasurementCorrections>> + getExtensionMeasurementCorrections_1_1() override; + Return<sp<V2_1::IGnssAntennaInfo>> getExtensionGnssAntennaInfo() override; + + private: + std::unique_ptr<V2_0::GnssLocation> getLocationFromHW(); + void reportLocation(const V2_0::GnssLocation&) const; + void reportLocation(const V1_0::GnssLocation&) const; + void reportSvStatus(const hidl_vec<GnssSvInfo>&) const; + + static sp<V2_1::IGnssCallback> sGnssCallback_2_1; + static sp<V2_0::IGnssCallback> sGnssCallback_2_0; + static sp<V1_1::IGnssCallback> sGnssCallback_1_1; + static sp<V1_0::IGnssCallback> sGnssCallback_1_0; + + std::atomic<long> mMinIntervalMs; + sp<GnssConfiguration> mGnssConfiguration; + std::atomic<bool> mIsActive; + std::atomic<bool> mHardwareModeOn; + std::atomic<int> mGnssFd; + std::thread mThread; + + mutable std::mutex mMutex; + hidl_vec<GnssSvInfo> filterBlacklistedSatellitesV2_1(hidl_vec<GnssSvInfo> gnssSvInfoList); +}; + +template <class T_IGnss> +sp<V2_1::IGnssCallback> GnssTemplate<T_IGnss>::sGnssCallback_2_1 = nullptr; +template <class T_IGnss> +sp<V2_0::IGnssCallback> GnssTemplate<T_IGnss>::sGnssCallback_2_0 = nullptr; +template <class T_IGnss> +sp<V1_1::IGnssCallback> GnssTemplate<T_IGnss>::sGnssCallback_1_1 = nullptr; +template <class T_IGnss> +sp<V1_0::IGnssCallback> GnssTemplate<T_IGnss>::sGnssCallback_1_0 = nullptr; + +template <class T_IGnss> +GnssTemplate<T_IGnss>::GnssTemplate() + : mMinIntervalMs(1000), + mGnssConfiguration{new GnssConfiguration()}, + mHardwareModeOn(false), + mGnssFd(-1) {} + +template <class T_IGnss> +GnssTemplate<T_IGnss>::~GnssTemplate() { + stop(); +} + +template <class T_IGnss> +std::unique_ptr<V2_0::GnssLocation> GnssTemplate<T_IGnss>::getLocationFromHW() { + char inputBuffer[INPUT_BUFFER_SIZE]; + mHardwareModeOn = false; + if (mGnssFd == -1) { + mGnssFd = open(GNSS_PATH, O_RDWR | O_NONBLOCK); + } + if (mGnssFd == -1) { + return nullptr; + } + // Send control message to device + int bytes_write = write(mGnssFd, CMD_GET_LOCATION, strlen(CMD_GET_LOCATION)); + if (bytes_write <= 0) { + return nullptr; + } + + struct epoll_event ev, events[1]; + ev.data.fd = mGnssFd; + ev.events = EPOLLIN; + int epoll_fd = epoll_create1(0); + epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev); + int bytes_read = -1; + std::string inputStr = ""; + int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs); + // Indicates it is a hardwareMode, don't need to wait outside. + mHardwareModeOn = true; + if (epoll_ret == -1) { + return nullptr; + } + while (true) { + bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE); + if (bytes_read <= 0) { + break; + } + inputStr += std::string(inputBuffer, bytes_read); + } + return NmeaFixInfo::getLocationFromInputStr(inputStr); +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::start() { + if (mIsActive) { + ALOGW("Gnss has started. Restarting..."); + stop(); + } + + mIsActive = true; + mThread = std::thread([this]() { + while (mIsActive == true) { + auto svStatus = filterBlacklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1()); + this->reportSvStatus(svStatus); + + auto currentLocation = getLocationFromHW(); + if (currentLocation != nullptr) { + this->reportLocation(*currentLocation); + } else { + if (sGnssCallback_2_1 != nullptr || sGnssCallback_2_0 != nullptr) { + const auto location = Utils::getMockLocationV2_0(); + this->reportLocation(location); + } else { + const auto location = Utils::getMockLocationV1_0(); + this->reportLocation(location); + } + + // Only need do the sleep in the static location mode, which mocks the "wait + // for" hardware behavior. + if (!mHardwareModeOn) { + std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs)); + } + } + } + }); + return true; +} + +template <class T_IGnss> +hidl_vec<GnssSvInfo> GnssTemplate<T_IGnss>::filterBlacklistedSatellitesV2_1( + hidl_vec<GnssSvInfo> gnssSvInfoList) { + for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) { + if (mGnssConfiguration->isBlacklistedV2_1(gnssSvInfoList[i])) { + gnssSvInfoList[i].v2_0.v1_0.svFlag &= + ~static_cast<uint8_t>(V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX); + } + } + return gnssSvInfoList; +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::stop() { + ALOGD("stop"); + mIsActive = false; + if (mThread.joinable()) { + mThread.join(); + } + if (mGnssFd != -1) { + close(mGnssFd); + mGnssFd = -1; + } + return true; +} + +// Methods from V1_0::IGnss follow. +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::setCallback(const sp<V1_0::IGnssCallback>& callback) { + if (callback == nullptr) { + ALOGE("%s: Null callback ignored", __func__); + return false; + } + + sGnssCallback_1_0 = callback; + + uint32_t capabilities = 0x0 | V1_0::IGnssCallback::Capabilities::MEASUREMENTS | + V1_0::IGnssCallback::Capabilities::SCHEDULING; + auto ret = sGnssCallback_1_0->gnssSetCapabilitesCb(capabilities); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + V2_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2018}; + + ret = sGnssCallback_1_0->gnssSetSystemInfoCb(gnssInfo); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + return true; +} + +template <class T_IGnss> +Return<void> GnssTemplate<T_IGnss>::cleanup() { + sGnssCallback_2_1 = nullptr; + sGnssCallback_2_0 = nullptr; + return Void(); +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::injectTime(int64_t, int64_t, int32_t) { + return true; +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::injectLocation(double, double, float) { + return true; +} + +template <class T_IGnss> +Return<void> GnssTemplate<T_IGnss>::deleteAidingData(V1_0::IGnss::GnssAidingData) { + // TODO implement + return Void(); +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::setPositionMode(V1_0::IGnss::GnssPositionMode, + V1_0::IGnss::GnssPositionRecurrence, + uint32_t minIntervalMs, uint32_t, uint32_t) { + mMinIntervalMs = minIntervalMs; + return true; +} + +template <class T_IGnss> +Return<sp<V1_0::IAGnssRil>> GnssTemplate<T_IGnss>::getExtensionAGnssRil() { + // TODO implement + return ::android::sp<V1_0::IAGnssRil>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssGeofencing>> GnssTemplate<T_IGnss>::getExtensionGnssGeofencing() { + // TODO implement + return ::android::sp<V1_0::IGnssGeofencing>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IAGnss>> GnssTemplate<T_IGnss>::getExtensionAGnss() { + // TODO implement + return ::android::sp<V1_0::IAGnss>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssNi>> GnssTemplate<T_IGnss>::getExtensionGnssNi() { + // TODO implement + return ::android::sp<V1_0::IGnssNi>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement() { + ALOGD("Gnss::getExtensionGnssMeasurement"); + return new GnssMeasurement(); +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssNavigationMessage>> +GnssTemplate<T_IGnss>::getExtensionGnssNavigationMessage() { + // TODO implement + return ::android::sp<V1_0::IGnssNavigationMessage>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssXtra>> GnssTemplate<T_IGnss>::getExtensionXtra() { + // TODO implement + return ::android::sp<V1_0::IGnssXtra>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssConfiguration>> GnssTemplate<T_IGnss>::getExtensionGnssConfiguration() { + // TODO implement + return ::android::sp<V1_0::IGnssConfiguration>{}; +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssDebug>> GnssTemplate<T_IGnss>::getExtensionGnssDebug() { + return new V1_1::implementation::GnssDebug(); +} + +template <class T_IGnss> +Return<sp<V1_0::IGnssBatching>> GnssTemplate<T_IGnss>::getExtensionGnssBatching() { + // TODO implement + return ::android::sp<V1_0::IGnssBatching>{}; +} + +// Methods from V1_1::IGnss follow. +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) { + if (callback == nullptr) { + ALOGE("%s: Null callback ignored", __func__); + return false; + } + + sGnssCallback_1_1 = callback; + + uint32_t capabilities = 0x0; + auto ret = sGnssCallback_1_1->gnssSetCapabilitesCb(capabilities); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + V2_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2018}; + + ret = sGnssCallback_1_1->gnssSetSystemInfoCb(gnssInfo); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + auto gnssName = "Google Mock GNSS Implementation v2.1"; + ret = sGnssCallback_1_1->gnssNameCb(gnssName); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + return true; +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode, + V1_0::IGnss::GnssPositionRecurrence, + uint32_t minIntervalMs, uint32_t, uint32_t, + bool) { + mMinIntervalMs = minIntervalMs; + return true; +} + +template <class T_IGnss> +Return<sp<V1_1::IGnssConfiguration>> GnssTemplate<T_IGnss>::getExtensionGnssConfiguration_1_1() { + // TODO implement + return ::android::sp<V1_1::IGnssConfiguration>{}; +} + +template <class T_IGnss> +Return<sp<V1_1::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement_1_1() { + // TODO implement + return ::android::sp<V1_1::IGnssMeasurement>{}; +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::injectBestLocation(const V1_0::GnssLocation&) { + return true; +} + +// Methods from V2_0::IGnss follow. +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) { + ALOGD("Gnss::setCallback_2_0"); + if (callback == nullptr) { + ALOGE("%s: Null callback ignored", __func__); + return false; + } + + sGnssCallback_2_0 = callback; + + using Capabilities = V2_0::IGnssCallback::Capabilities; + const auto capabilities = Capabilities::MEASUREMENTS | Capabilities::MEASUREMENT_CORRECTIONS | + Capabilities::LOW_POWER_MODE | Capabilities::SATELLITE_BLACKLIST; + auto ret = sGnssCallback_2_0->gnssSetCapabilitiesCb_2_0(capabilities); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019}; + + ret = sGnssCallback_2_0->gnssSetSystemInfoCb(gnssInfo); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + auto gnssName = "Google Mock GNSS Implementation v2.1"; + ret = sGnssCallback_2_0->gnssNameCb(gnssName); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + return true; +} + +template <class T_IGnss> +Return<sp<V2_0::IGnssConfiguration>> GnssTemplate<T_IGnss>::getExtensionGnssConfiguration_2_0() { + ALOGD("Gnss::getExtensionGnssConfiguration_2_0"); + return mGnssConfiguration; +} + +template <class T_IGnss> +Return<sp<V2_0::IGnssDebug>> GnssTemplate<T_IGnss>::getExtensionGnssDebug_2_0() { + // TODO implement + return ::android::sp<V2_0::IGnssDebug>{}; +} + +template <class T_IGnss> +Return<sp<V2_0::IAGnss>> GnssTemplate<T_IGnss>::getExtensionAGnss_2_0() { + // TODO implement + return ::android::sp<V2_0::IAGnss>{}; +} + +template <class T_IGnss> +Return<sp<V2_0::IAGnssRil>> GnssTemplate<T_IGnss>::getExtensionAGnssRil_2_0() { + // TODO implement + return ::android::sp<V2_0::IAGnssRil>{}; +} + +template <class T_IGnss> +Return<sp<V2_0::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement_2_0() { + ALOGD("Gnss::getExtensionGnssMeasurement_2_0"); + return new GnssMeasurement(); +} + +template <class T_IGnss> +Return<sp<measurement_corrections::V1_0::IMeasurementCorrections>> +GnssTemplate<T_IGnss>::getExtensionMeasurementCorrections() { + ALOGD("Gnss::getExtensionMeasurementCorrections()"); + return new GnssMeasurementCorrections(); +} + +template <class T_IGnss> +Return<sp<visibility_control::V1_0::IGnssVisibilityControl>> +GnssTemplate<T_IGnss>::getExtensionVisibilityControl() { + // TODO implement + return ::android::sp<visibility_control::V1_0::IGnssVisibilityControl>{}; +} + +template <class T_IGnss> +Return<sp<V2_0::IGnssBatching>> GnssTemplate<T_IGnss>::getExtensionGnssBatching_2_0() { + // TODO implement + return ::android::sp<V2_0::IGnssBatching>{}; +} + +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::injectBestLocation_2_0(const V2_0::GnssLocation&) { + // TODO(b/124012850): Implement function. + return bool{}; +} + +// Methods from V2_1::IGnss follow. +template <class T_IGnss> +Return<bool> GnssTemplate<T_IGnss>::setCallback_2_1(const sp<V2_1::IGnssCallback>& callback) { + ALOGD("Gnss::setCallback_2_1"); + if (callback == nullptr) { + ALOGE("%s: Null callback ignored", __func__); + return false; + } + + sGnssCallback_2_1 = callback; + + using Capabilities = V2_1::IGnssCallback::Capabilities; + const auto capabilities = Capabilities::MEASUREMENTS | Capabilities::MEASUREMENT_CORRECTIONS | + Capabilities::LOW_POWER_MODE | Capabilities::SATELLITE_BLACKLIST | + Capabilities::ANTENNA_INFO; + auto ret = sGnssCallback_2_1->gnssSetCapabilitiesCb_2_1(capabilities); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2020}; + + ret = sGnssCallback_2_1->gnssSetSystemInfoCb(gnssInfo); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + auto gnssName = "Android Mock GNSS Implementation v2.1"; + ret = sGnssCallback_2_1->gnssNameCb(gnssName); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + + return true; +} + +template <class T_IGnss> +Return<sp<V2_1::IGnssMeasurement>> GnssTemplate<T_IGnss>::getExtensionGnssMeasurement_2_1() { + ALOGD("Gnss::getExtensionGnssMeasurement_2_1"); + return new GnssMeasurement(); +} + +template <class T_IGnss> +Return<sp<V2_1::IGnssConfiguration>> GnssTemplate<T_IGnss>::getExtensionGnssConfiguration_2_1() { + ALOGD("Gnss::getExtensionGnssConfiguration_2_1"); + return mGnssConfiguration; +} + +template <class T_IGnss> +Return<sp<measurement_corrections::V1_1::IMeasurementCorrections>> +GnssTemplate<T_IGnss>::getExtensionMeasurementCorrections_1_1() { + ALOGD("Gnss::getExtensionMeasurementCorrections_1_1()"); + return new GnssMeasurementCorrections(); +} + +template <class T_IGnss> +Return<sp<V2_1::IGnssAntennaInfo>> GnssTemplate<T_IGnss>::getExtensionGnssAntennaInfo() { + ALOGD("Gnss::getExtensionGnssAntennaInfo"); + return new GnssAntennaInfo(); +} + +template <class T_IGnss> +void GnssTemplate<T_IGnss>::reportSvStatus(const hidl_vec<GnssSvInfo>& svInfoList) const { + std::unique_lock<std::mutex> lock(mMutex); + // TODO(skz): update this to call 2_0 callback if non-null + if (sGnssCallback_2_1 == nullptr) { + ALOGE("%s: sGnssCallback v2.1 is null.", __func__); + return; + } + auto ret = sGnssCallback_2_1->gnssSvStatusCb_2_1(svInfoList); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } +} + +template <class T_IGnss> +void GnssTemplate<T_IGnss>::reportLocation(const V1_0::GnssLocation& location) const { + std::unique_lock<std::mutex> lock(mMutex); + if (sGnssCallback_1_1 != nullptr) { + auto ret = sGnssCallback_1_1->gnssLocationCb(location); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback v1.1", __func__); + } + return; + } + if (sGnssCallback_1_0 == nullptr) { + ALOGE("%s: No non-null callback", __func__); + return; + } + auto ret = sGnssCallback_1_0->gnssLocationCb(location); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback v1.0", __func__); + } +} + +template <class T_IGnss> +void GnssTemplate<T_IGnss>::reportLocation(const V2_0::GnssLocation& location) const { + std::unique_lock<std::mutex> lock(mMutex); + if (sGnssCallback_2_1 != nullptr) { + auto ret = sGnssCallback_2_1->gnssLocationCb_2_0(location); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback v2.1", __func__); + } + return; + } + if (sGnssCallback_2_0 == nullptr) { + ALOGE("%s: No non-null callback", __func__); + return; + } + auto ret = sGnssCallback_2_0->gnssLocationCb_2_0(location); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback v2.0", __func__); + } +} + +} // namespace android::hardware::gnss::common::implementation diff --git a/gnss/2.1/default/GnssAntennaInfo.cpp b/gnss/common/utils/default/v2_1/GnssAntennaInfo.cpp index ed183a9383..962451c0dd 100644 --- a/gnss/2.1/default/GnssAntennaInfo.cpp +++ b/gnss/common/utils/default/v2_1/GnssAntennaInfo.cpp @@ -16,18 +16,14 @@ #define LOG_TAG "GnssAntennaInfo" -#include "GnssAntennaInfo.h" +#include "v2_1/GnssAntennaInfo.h" #include "Utils.h" #include <log/log.h> using ::android::hardware::gnss::common::Utils; -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { -namespace implementation { +namespace android::hardware::gnss::V2_1::implementation { sp<IGnssAntennaInfoCallback> GnssAntennaInfo::sCallback = nullptr; @@ -102,8 +98,4 @@ void GnssAntennaInfo::reportAntennaInfo( } } -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android
\ No newline at end of file +} // namespace android::hardware::gnss::V2_1::implementation diff --git a/gnss/2.1/default/GnssConfiguration.cpp b/gnss/common/utils/default/v2_1/GnssConfiguration.cpp index cd8f07fcc4..8b30701ea1 100644 --- a/gnss/2.1/default/GnssConfiguration.cpp +++ b/gnss/common/utils/default/v2_1/GnssConfiguration.cpp @@ -16,14 +16,10 @@ #define LOG_TAG "GnssConfiguration" -#include "GnssConfiguration.h" +#include "v2_1/GnssConfiguration.h" #include <log/log.h> -namespace android { -namespace hardware { -namespace gnss { -namespace V2_1 { -namespace implementation { +namespace android::hardware::gnss::V2_1::implementation { // Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow. Return<bool> GnssConfiguration::setSuplEs(bool enable) { @@ -99,8 +95,4 @@ Return<bool> GnssConfiguration::isBlacklistedV2_1(const GnssSvInfoV2_1& gnssSvIn return (mBlacklistedSourceSet.find(source) != mBlacklistedSourceSet.end()); } -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android
\ No newline at end of file +} // namespace android::hardware::gnss::V2_1::implementation diff --git a/gnss/2.1/default/GnssDebug.cpp b/gnss/common/utils/default/v2_1/GnssDebug.cpp index a9f7ded2a7..492b970b59 100644 --- a/gnss/2.1/default/GnssDebug.cpp +++ b/gnss/common/utils/default/v2_1/GnssDebug.cpp @@ -19,15 +19,11 @@ #include <log/log.h> #include "Constants.h" -#include "GnssDebug.h" +#include "v2_1/GnssDebug.h" using namespace ::android::hardware::gnss::common; -namespace android { -namespace hardware { -namespace gnss { -namespace V1_1 { -namespace implementation { +namespace android::hardware::gnss::V1_1::implementation { // Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow. Return<void> GnssDebug::getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb) { @@ -55,8 +51,4 @@ Return<void> GnssDebug::getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb) return Void(); } -} // namespace implementation -} // namespace V1_1 -} // namespace gnss -} // namespace hardware -} // namespace android +} // namespace android::hardware::gnss::V1_1::implementation diff --git a/gnss/2.1/default/GnssMeasurement.cpp b/gnss/common/utils/default/v2_1/GnssMeasurement.cpp index 63bbc0a399..7d3a002ea7 100644 --- a/gnss/2.1/default/GnssMeasurement.cpp +++ b/gnss/common/utils/default/v2_1/GnssMeasurement.cpp @@ -16,19 +16,14 @@ #define LOG_TAG "GnssMeasurement" -#include "GnssMeasurement.h" +#include "v2_1/GnssMeasurement.h" #include <log/log.h> #include "Utils.h" -namespace android { -namespace hardware { -namespace gnss { +namespace android::hardware::gnss::V2_1::implementation { using common::Utils; -namespace V2_1 { -namespace implementation { - sp<V2_1::IGnssMeasurementCallback> GnssMeasurement::sCallback_2_1 = nullptr; sp<V2_0::IGnssMeasurementCallback> GnssMeasurement::sCallback_2_0 = nullptr; @@ -145,8 +140,4 @@ void GnssMeasurement::reportMeasurement(const GnssDataV2_1& data) { } } -} // namespace implementation -} // namespace V2_1 -} // namespace gnss -} // namespace hardware -} // namespace android +} // namespace android::hardware::gnss::V2_1::implementation diff --git a/gnss/2.1/default/GnssMeasurementCorrections.cpp b/gnss/common/utils/default/v2_1/GnssMeasurementCorrections.cpp index accf62b733..9be7e2350f 100644 --- a/gnss/2.1/default/GnssMeasurementCorrections.cpp +++ b/gnss/common/utils/default/v2_1/GnssMeasurementCorrections.cpp @@ -16,15 +16,14 @@ #define LOG_TAG "GnssMeasurementCorrections" -#include "GnssMeasurementCorrections.h" +#include "v2_1/GnssMeasurementCorrections.h" #include <log/log.h> -namespace android { -namespace hardware { -namespace gnss { -namespace measurement_corrections { -namespace V1_1 { -namespace implementation { +namespace android::hardware::gnss::measurement_corrections::V1_1::implementation { + +GnssMeasurementCorrections::GnssMeasurementCorrections() {} + +GnssMeasurementCorrections::~GnssMeasurementCorrections() {} // Methods from V1_0::IMeasurementCorrections follow. Return<bool> GnssMeasurementCorrections::setCorrections( @@ -101,9 +100,4 @@ Return<bool> GnssMeasurementCorrections::setCorrections_1_1( return true; } -} // namespace implementation -} // namespace V1_1 -} // namespace measurement_corrections -} // namespace gnss -} // namespace hardware -} // namespace android +} // namespace android::hardware::gnss::measurement_corrections::V1_1::implementation diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp index 4c6d4439bc..e36b656171 100644 --- a/gnss/common/utils/vts/Android.bp +++ b/gnss/common/utils/vts/Android.bp @@ -25,11 +25,14 @@ cc_library_static { ], srcs: [ "Utils.cpp", + "v2_1/GnssCallback.cpp", ], export_include_dirs: ["include"], shared_libs: [ "android.hardware.gnss@1.0", + "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", + "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.measurement_corrections@1.1", ], diff --git a/gnss/common/utils/vts/include/v2_1/GnssCallback.h b/gnss/common/utils/vts/include/v2_1/GnssCallback.h new file mode 100644 index 0000000000..ab1375d3a5 --- /dev/null +++ b/gnss/common/utils/vts/include/v2_1/GnssCallback.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <android/hardware/gnss/2.1/IGnss.h> +#include "GnssCallbackEventQueue.h" + +#include <gtest/gtest.h> + +using android::hardware::hidl_vec; +using android::hardware::Return; +using android::hardware::Void; + +using android::hardware::gnss::common::GnssCallbackEventQueue; +using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback; +using android::hardware::gnss::V1_0::GnssLocationFlags; +using android::hardware::gnss::V2_0::GnssConstellationType; + +using GnssLocation_1_0 = android::hardware::gnss::V1_0::GnssLocation; +using GnssLocation_2_0 = android::hardware::gnss::V2_0::GnssLocation; + +using IGnssCallback_1_0 = android::hardware::gnss::V1_0::IGnssCallback; +using IGnssCallback_2_0 = android::hardware::gnss::V2_0::IGnssCallback; +using IGnssCallback_2_1 = android::hardware::gnss::V2_1::IGnssCallback; + +using IGnssMeasurementCallback_1_0 = android::hardware::gnss::V1_0::IGnssMeasurementCallback; +using IGnssMeasurementCallback_1_1 = android::hardware::gnss::V1_1::IGnssMeasurementCallback; +using IGnssMeasurementCallback_2_0 = android::hardware::gnss::V2_0::IGnssMeasurementCallback; +using IGnssMeasurementCallback_2_1 = android::hardware::gnss::V2_1::IGnssMeasurementCallback; + +using android::sp; + +#define TIMEOUT_SEC 2 // for basic commands/responses + +namespace android::hardware::gnss::common { + +/* Callback class for data & Event. */ +class GnssCallback : public IGnssCallback_2_1 { + public: + IGnssCallback_1_0::GnssSystemInfo last_info_; + android::hardware::hidl_string last_name_; + uint32_t last_capabilities_; + GnssLocation_2_0 last_location_; + + GnssCallbackEventQueue<IGnssCallback_1_0::GnssSystemInfo> info_cbq_; + GnssCallbackEventQueue<android::hardware::hidl_string> name_cbq_; + GnssCallbackEventQueue<uint32_t> capabilities_cbq_; + GnssCallbackEventQueue<GnssLocation_2_0> location_cbq_; + GnssCallbackEventQueue<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_list_cbq_; + + GnssCallback(); + virtual ~GnssCallback() = default; + + // Dummy callback handlers + Return<void> gnssStatusCb(const IGnssCallback_1_0::GnssStatusValue /* status */) override { + return Void(); + } + Return<void> gnssNmeaCb(int64_t /* timestamp */, + const android::hardware::hidl_string& /* nmea */) override { + return Void(); + } + Return<void> gnssAcquireWakelockCb() override { return Void(); } + Return<void> gnssReleaseWakelockCb() override { return Void(); } + Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override { return Void(); } + Return<void> gnssRequestTimeCb() override { return Void(); } + // Actual (test) callback handlers + Return<void> gnssNameCb(const android::hardware::hidl_string& name) override; + Return<void> gnssLocationCb(const GnssLocation_1_0& location) override; + Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override; + Return<void> gnssSetSystemInfoCb(const IGnssCallback_1_0::GnssSystemInfo& info) override; + Return<void> gnssSvStatusCb(const IGnssCallback_1_0::GnssSvStatus& svStatus) override; + + // New in v2.0 + Return<void> gnssLocationCb_2_0(const GnssLocation_2_0& location) override; + Return<void> gnssRequestLocationCb_2_0(bool /* independentFromGnss */, + bool /* isUserEmergency */) override { + return Void(); + } + Return<void> gnssSetCapabilitiesCb_2_0(uint32_t capabilities) override; + Return<void> gnssSvStatusCb_2_0(const hidl_vec<IGnssCallback_2_0::GnssSvInfo>&) override { + return Void(); + } + + // New in v2.1 + Return<void> gnssSvStatusCb_2_1( + const hidl_vec<IGnssCallback_2_1::GnssSvInfo>& svInfoList) override; + Return<void> gnssSetCapabilitiesCb_2_1(uint32_t capabilities) override; + + private: + Return<void> gnssLocationCbImpl(const GnssLocation_2_0& location); +}; + +} // namespace android::hardware::gnss::common diff --git a/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h b/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h new file mode 100644 index 0000000000..d057c617be --- /dev/null +++ b/gnss/common/utils/vts/include/v2_1/gnss_hal_test_template.h @@ -0,0 +1,381 @@ +/* + * 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. + */ + +#pragma once + +#include "GnssCallbackEventQueue.h" +#include "Utils.h" +#include "v2_1/GnssCallback.h" + +#include <gtest/gtest.h> +#include <chrono> + +using ::android::hardware::gnss::common::Utils; + +using android::hardware::hidl_vec; +using android::hardware::Return; +using android::hardware::Void; + +using android::hardware::gnss::common::GnssCallback; +using android::hardware::gnss::common::GnssCallbackEventQueue; +using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback; +using android::hardware::gnss::V1_0::GnssLocationFlags; +using android::hardware::gnss::V2_0::GnssConstellationType; +using android::hardware::gnss::V2_1::IGnssAntennaInfo; +using android::hardware::gnss::V2_1::IGnssAntennaInfoCallback; + +using GnssLocation_1_0 = android::hardware::gnss::V1_0::GnssLocation; +using GnssLocation_2_0 = android::hardware::gnss::V2_0::GnssLocation; + +using IGnssCallback_1_0 = android::hardware::gnss::V1_0::IGnssCallback; +using IGnssCallback_2_0 = android::hardware::gnss::V2_0::IGnssCallback; +using IGnssCallback_2_1 = android::hardware::gnss::V2_1::IGnssCallback; + +using IGnssMeasurementCallback_1_0 = android::hardware::gnss::V1_0::IGnssMeasurementCallback; +using IGnssMeasurementCallback_1_1 = android::hardware::gnss::V1_1::IGnssMeasurementCallback; +using IGnssMeasurementCallback_2_0 = android::hardware::gnss::V2_0::IGnssMeasurementCallback; +using IGnssMeasurementCallback_2_1 = android::hardware::gnss::V2_1::IGnssMeasurementCallback; + +using android::sp; + +#define TIMEOUT_SEC 2 // for basic commands/responses + +// The main test class for GNSS HAL. +template <class T_IGnss> +class GnssHalTestTemplate : public testing::TestWithParam<std::string> { + public: + virtual void SetUp() override; + + virtual void TearDown() override; + + /* Callback class for GnssMeasurement. */ + class GnssMeasurementCallback : public IGnssMeasurementCallback_2_1 { + public: + GnssCallbackEventQueue<IGnssMeasurementCallback_2_1::GnssData> measurement_cbq_; + + GnssMeasurementCallback() : measurement_cbq_("measurement"){}; + virtual ~GnssMeasurementCallback() = default; + + // Methods from V1_0::IGnssMeasurementCallback follow. + Return<void> GnssMeasurementCb(const IGnssMeasurementCallback_1_0::GnssData&) override { + return Void(); + } + + // Methods from V1_1::IGnssMeasurementCallback follow. + Return<void> gnssMeasurementCb(const IGnssMeasurementCallback_1_1::GnssData&) override { + return Void(); + } + + // Methods from V2_0::IGnssMeasurementCallback follow. + Return<void> gnssMeasurementCb_2_0(const IGnssMeasurementCallback_2_0::GnssData&) override { + return Void(); + } + + // Methods from V2_1::IGnssMeasurementCallback follow. + Return<void> gnssMeasurementCb_2_1(const IGnssMeasurementCallback_2_1::GnssData&) override; + }; + + /* Callback class for GnssMeasurementCorrections. */ + class GnssMeasurementCorrectionsCallback : public IMeasurementCorrectionsCallback { + public: + uint32_t last_capabilities_; + GnssCallbackEventQueue<uint32_t> capabilities_cbq_; + + GnssMeasurementCorrectionsCallback() : capabilities_cbq_("capabilities"){}; + virtual ~GnssMeasurementCorrectionsCallback() = default; + + // Methods from V1_0::IMeasurementCorrectionsCallback follow. + Return<void> setCapabilitiesCb(uint32_t capabilities) override; + }; + + /* Callback class for GnssAntennaInfo. */ + class GnssAntennaInfoCallback : public IGnssAntennaInfoCallback { + public: + GnssCallbackEventQueue<hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>> + antenna_info_cbq_; + + GnssAntennaInfoCallback() : antenna_info_cbq_("info"){}; + virtual ~GnssAntennaInfoCallback() = default; + + // Methods from V2_1::GnssAntennaInfoCallback follow. + Return<void> gnssAntennaInfoCb( + const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos); + }; + + /* + * SetUpGnssCallback: + * Set GnssCallback and verify the result. + */ + void SetUpGnssCallback(); + + /* + * StartAndCheckFirstLocation: + * Helper function to start location, and check the first one. + * + * <p> Note this leaves the Location request active, to enable Stop call vs. other call + * reordering tests. + * + * returns true if a location was successfully generated + */ + bool StartAndCheckFirstLocation(); + + /* + * CheckLocation: + * Helper function to vet Location fields + * + * check_speed: true if speed related fields are also verified. + */ + void CheckLocation(const GnssLocation_2_0& location, const bool check_speed); + + /* + * StartAndCheckLocations: + * Helper function to collect, and check a number of + * normal ~1Hz locations. + * + * Note this leaves the Location request active, to enable Stop call vs. other call + * reordering tests. + */ + void StartAndCheckLocations(int count); + + /* + * StopAndClearLocations: + * Helper function to stop locations, and clear any remaining notifications + */ + void StopAndClearLocations(); + + /* + * SetPositionMode: + * Helper function to set positioning mode and verify output + */ + void SetPositionMode(const int min_interval_msec, const bool low_power_mode); + + /* + * startLocationAndGetNonGpsConstellation: + * 1. Start location + * 2. Find and return first non-GPS constellation + * + * Note that location is not stopped in this method. The client should call + * StopAndClearLocations() after the call. + */ + GnssConstellationType startLocationAndGetNonGpsConstellation( + const int locations_to_await, const int gnss_sv_info_list_timeout); + + sp<T_IGnss> gnss_hal_; // GNSS HAL to call into + sp<GnssCallback> gnss_cb_; // Primary callback interface +}; + +using ::android::hardware::gnss::common::Utils; + +// Implementations for the main test class for GNSS HAL +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::SetUp() { + gnss_hal_ = T_IGnss::getService(GetParam()); + ASSERT_NE(gnss_hal_, nullptr); + + SetUpGnssCallback(); +} + +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::TearDown() { + if (gnss_hal_ != nullptr) { + gnss_hal_->cleanup(); + gnss_hal_ = nullptr; + } + + // Set to nullptr to destruct the callback event queues and warn of any unprocessed events. + gnss_cb_ = nullptr; +} + +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::SetUpGnssCallback() { + gnss_cb_ = new GnssCallback(); + ASSERT_NE(gnss_cb_, nullptr); + + auto result = gnss_hal_->setCallback_2_1(gnss_cb_); + if (!result.isOk()) { + ALOGE("result of failed setCallback %s", result.description().c_str()); + } + + ASSERT_TRUE(result.isOk()); + ASSERT_TRUE(result); + + /* + * All capabilities, name and systemInfo callbacks should trigger + */ + EXPECT_TRUE(gnss_cb_->capabilities_cbq_.retrieve(gnss_cb_->last_capabilities_, TIMEOUT_SEC)); + EXPECT_TRUE(gnss_cb_->info_cbq_.retrieve(gnss_cb_->last_info_, TIMEOUT_SEC)); + EXPECT_TRUE(gnss_cb_->name_cbq_.retrieve(gnss_cb_->last_name_, TIMEOUT_SEC)); + + EXPECT_EQ(gnss_cb_->capabilities_cbq_.calledCount(), 1); + EXPECT_EQ(gnss_cb_->info_cbq_.calledCount(), 1); + EXPECT_EQ(gnss_cb_->name_cbq_.calledCount(), 1); +} + +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::StopAndClearLocations() { + const auto result = gnss_hal_->stop(); + + EXPECT_TRUE(result.isOk()); + EXPECT_TRUE(result); + + /* + * Clear notify/waiting counter, allowing up till the timeout after + * the last reply for final startup messages to arrive (esp. system + * info.) + */ + while (gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, TIMEOUT_SEC)) { + } + gnss_cb_->location_cbq_.reset(); +} + +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::SetPositionMode(const int min_interval_msec, + const bool low_power_mode) { + const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider) + const int kPreferredTimeMsec = 0; // Ideally immediate + + const auto result = gnss_hal_->setPositionMode_1_1( + T_IGnss::GnssPositionMode::MS_BASED, + T_IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC, min_interval_msec, + kPreferredAccuracy, kPreferredTimeMsec, low_power_mode); + + ASSERT_TRUE(result.isOk()); + EXPECT_TRUE(result); +} + +template <class T_IGnss> +bool GnssHalTestTemplate<T_IGnss>::StartAndCheckFirstLocation() { + const auto result = gnss_hal_->start(); + + EXPECT_TRUE(result.isOk()); + EXPECT_TRUE(result); + + /* + * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, + * so allow time to demodulate ephemeris over the air. + */ + const int kFirstGnssLocationTimeoutSeconds = 75; + + EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, + kFirstGnssLocationTimeoutSeconds)); + int locationCalledCount = gnss_cb_->location_cbq_.calledCount(); + EXPECT_EQ(locationCalledCount, 1); + + if (locationCalledCount > 0) { + // don't require speed on first fix + CheckLocation(gnss_cb_->last_location_, false); + return true; + } + return false; +} + +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::CheckLocation(const GnssLocation_2_0& location, + bool check_speed) { + const bool check_more_accuracies = + (gnss_cb_->info_cbq_.calledCount() > 0 && gnss_cb_->last_info_.yearOfHw >= 2017); + + Utils::checkLocation(location.v1_0, check_speed, check_more_accuracies); +} + +template <class T_IGnss> +void GnssHalTestTemplate<T_IGnss>::StartAndCheckLocations(int count) { + const int kMinIntervalMsec = 500; + const int kLocationTimeoutSubsequentSec = 2; + const bool kLowPowerMode = false; + + SetPositionMode(kMinIntervalMsec, kLowPowerMode); + + EXPECT_TRUE(StartAndCheckFirstLocation()); + + for (int i = 1; i < count; i++) { + EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_, + kLocationTimeoutSubsequentSec)); + int locationCalledCount = gnss_cb_->location_cbq_.calledCount(); + EXPECT_EQ(locationCalledCount, i + 1); + // Don't cause confusion by checking details if no location yet + if (locationCalledCount > 0) { + // Should be more than 1 location by now, but if not, still don't check first fix speed + CheckLocation(gnss_cb_->last_location_, locationCalledCount > 1); + } + } +} + +template <class T_IGnss> +GnssConstellationType GnssHalTestTemplate<T_IGnss>::startLocationAndGetNonGpsConstellation( + const int locations_to_await, const int gnss_sv_info_list_timeout) { + gnss_cb_->location_cbq_.reset(); + StartAndCheckLocations(locations_to_await); + const int location_called_count = gnss_cb_->location_cbq_.calledCount(); + + // Tolerate 1 less sv status to handle edge cases in reporting. + int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); + EXPECT_GE(sv_info_list_cbq_size + 1, locations_to_await); + ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)", + sv_info_list_cbq_size, locations_to_await, location_called_count); + + // Find first non-GPS constellation to blacklist + GnssConstellationType constellation_to_blacklist = GnssConstellationType::UNKNOWN; + for (int i = 0; i < sv_info_list_cbq_size; ++i) { + hidl_vec<IGnssCallback_2_1::GnssSvInfo> sv_info_vec; + gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, gnss_sv_info_list_timeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + const auto& gnss_sv = sv_info_vec[iSv]; + if ((gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX) && + (gnss_sv.v2_0.constellation != GnssConstellationType::UNKNOWN) && + (gnss_sv.v2_0.constellation != GnssConstellationType::GPS)) { + // found a non-GPS constellation + constellation_to_blacklist = gnss_sv.v2_0.constellation; + break; + } + } + if (constellation_to_blacklist != GnssConstellationType::UNKNOWN) { + break; + } + } + + if (constellation_to_blacklist == GnssConstellationType::UNKNOWN) { + ALOGI("No non-GPS constellations found, constellation blacklist test less effective."); + // Proceed functionally to blacklist something. + constellation_to_blacklist = GnssConstellationType::GLONASS; + } + + return constellation_to_blacklist; +} + +template <class T_IGnss> +Return<void> GnssHalTestTemplate<T_IGnss>::GnssMeasurementCallback::gnssMeasurementCb_2_1( + const IGnssMeasurementCallback_2_1::GnssData& data) { + ALOGD("GnssMeasurement v2.1 received. Size = %d", (int)data.measurements.size()); + measurement_cbq_.store(data); + return Void(); +} + +template <class T_IGnss> +Return<void> GnssHalTestTemplate<T_IGnss>::GnssMeasurementCorrectionsCallback::setCapabilitiesCb( + uint32_t capabilities) { + ALOGI("GnssMeasurementCorrectionsCallback capabilities received %d", capabilities); + capabilities_cbq_.store(capabilities); + return Void(); +} + +template <class T_IGnss> +Return<void> GnssHalTestTemplate<T_IGnss>::GnssAntennaInfoCallback::gnssAntennaInfoCb( + const hidl_vec<IGnssAntennaInfoCallback::GnssAntennaInfo>& gnssAntennaInfos) { + ALOGD("GnssAntennaInfo v2.1 received. Size = %d", (int)gnssAntennaInfos.size()); + antenna_info_cbq_.store(gnssAntennaInfos); + return Void(); +} diff --git a/gnss/common/utils/vts/v2_1/GnssCallback.cpp b/gnss/common/utils/vts/v2_1/GnssCallback.cpp new file mode 100644 index 0000000000..3b96fb834b --- /dev/null +++ b/gnss/common/utils/vts/v2_1/GnssCallback.cpp @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#define LOG_TAG "GnssCallback" + +#include "v2_1/GnssCallback.h" +#include <chrono> +#include "Utils.h" + +#include <gtest/gtest.h> + +using ::android::hardware::gnss::common::Utils; + +namespace android::hardware::gnss::common { + +GnssCallback::GnssCallback() + : info_cbq_("system_info"), + name_cbq_("name"), + capabilities_cbq_("capabilities"), + location_cbq_("location"), + sv_info_list_cbq_("sv_info") {} + +Return<void> GnssCallback::gnssSetSystemInfoCb(const IGnssCallback_1_0::GnssSystemInfo& info) { + ALOGI("Info received, year %d", info.yearOfHw); + info_cbq_.store(info); + return Void(); +} + +Return<void> GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) { + ALOGI("Capabilities received %d", capabilities); + capabilities_cbq_.store(capabilities); + return Void(); +} + +Return<void> GnssCallback::gnssSetCapabilitiesCb_2_0(uint32_t capabilities) { + ALOGI("Capabilities (v2.0) received %d", capabilities); + capabilities_cbq_.store(capabilities); + return Void(); +} + +Return<void> GnssCallback::gnssSetCapabilitiesCb_2_1(uint32_t capabilities) { + ALOGI("Capabilities (v2.1) received %d", capabilities); + capabilities_cbq_.store(capabilities); + return Void(); +} + +Return<void> GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) { + ALOGI("Name received: %s", name.c_str()); + name_cbq_.store(name); + return Void(); +} + +Return<void> GnssCallback::gnssLocationCb(const GnssLocation_1_0& location) { + ALOGI("Location received"); + GnssLocation_2_0 location_v2_0; + location_v2_0.v1_0 = location; + return gnssLocationCbImpl(location_v2_0); +} + +Return<void> GnssCallback::gnssLocationCb_2_0(const GnssLocation_2_0& location) { + ALOGI("Location (v2.0) received"); + return gnssLocationCbImpl(location); +} + +Return<void> GnssCallback::gnssLocationCbImpl(const GnssLocation_2_0& location) { + location_cbq_.store(location); + return Void(); +} + +Return<void> GnssCallback::gnssSvStatusCb(const IGnssCallback_1_0::GnssSvStatus&) { + ALOGI("gnssSvStatusCb"); + return Void(); +} + +Return<void> GnssCallback::gnssSvStatusCb_2_1( + const hidl_vec<IGnssCallback::GnssSvInfo>& svInfoList) { + ALOGI("gnssSvStatusCb_2_1. Size = %d", (int)svInfoList.size()); + sv_info_list_cbq_.store(svInfoList); + return Void(); +} + +} // namespace android::hardware::gnss::common diff --git a/gnss/measurement_corrections/1.0/Android.bp b/gnss/measurement_corrections/1.0/Android.bp index 837cc7abca..a140674338 100644 --- a/gnss/measurement_corrections/1.0/Android.bp +++ b/gnss/measurement_corrections/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.gnss.measurement_corrections@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IMeasurementCorrections.hal", diff --git a/gnss/measurement_corrections/1.1/Android.bp b/gnss/measurement_corrections/1.1/Android.bp index d279af6cd2..93638489b0 100644 --- a/gnss/measurement_corrections/1.1/Android.bp +++ b/gnss/measurement_corrections/1.1/Android.bp @@ -3,17 +3,14 @@ hidl_interface { name: "android.hardware.gnss.measurement_corrections@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IMeasurementCorrections.hal", ], interfaces: [ "android.hardware.gnss.measurement_corrections@1.0", - "android.hardware.gnss@2.0", "android.hardware.gnss@1.0", + "android.hardware.gnss@2.0", "android.hidl.base@1.0", ], gen_java: true, diff --git a/gnss/visibility_control/1.0/Android.bp b/gnss/visibility_control/1.0/Android.bp index e58e9327cb..975da785e9 100644 --- a/gnss/visibility_control/1.0/Android.bp +++ b/gnss/visibility_control/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.gnss.visibility_control@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IGnssVisibilityControl.hal", "IGnssVisibilityControlCallback.hal", diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp index 4e4b81ce97..2358a8fbf3 100644 --- a/graphics/composer/2.1/Android.bp +++ b/graphics/composer/2.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.graphics.composer@2.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IComposer.hal", diff --git a/graphics/composer/2.2/Android.bp b/graphics/composer/2.2/Android.bp index 930cadc01d..234b9ac6bf 100644 --- a/graphics/composer/2.2/Android.bp +++ b/graphics/composer/2.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.graphics.composer@2.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IComposer.hal", "IComposerClient.hal", diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp index c78c358857..3becacea91 100644 --- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp +++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp @@ -69,9 +69,8 @@ void TestRenderEngine::drawLayers() { [](renderengine::LayerSettings& settings) -> renderengine::LayerSettings* { return &settings; }); - mRenderEngine->drawLayers(mDisplaySettings, compositionLayerPointers, - mGraphicBuffer->getNativeBuffer(), true, std::move(bufferFence), - &readyFence); + mRenderEngine->drawLayers(mDisplaySettings, compositionLayerPointers, mGraphicBuffer, true, + std::move(bufferFence), &readyFence); int fd = readyFence.release(); if (fd != -1) { ASSERT_EQ(0, sync_wait(fd, -1)); diff --git a/graphics/composer/2.3/Android.bp b/graphics/composer/2.3/Android.bp index a777556aee..96f301c807 100644 --- a/graphics/composer/2.3/Android.bp +++ b/graphics/composer/2.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.graphics.composer@2.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IComposer.hal", "IComposerClient.hal", diff --git a/graphics/composer/2.4/Android.bp b/graphics/composer/2.4/Android.bp index 5f700bed9b..2bbe751402 100644 --- a/graphics/composer/2.4/Android.bp +++ b/graphics/composer/2.4/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.graphics.composer@2.4", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IComposer.hal", diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp index ea6b0c8161..7845871d6d 100644 --- a/health/1.0/Android.bp +++ b/health/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.health@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHealth.hal", diff --git a/health/1.0/default/convert.cpp b/health/1.0/default/convert.cpp index 7f1e3c4c11..3680d4d000 100644 --- a/health/1.0/default/convert.cpp +++ b/health/1.0/default/convert.cpp @@ -79,7 +79,7 @@ void convertFromHealthConfig(const HealthConfig& c, struct healthd_config *hc) { hc->batteryCurrentAvgPath = android::String8(c.batteryCurrentAvgPath.c_str(), - c.batteryCurrentNowPath.size()); + c.batteryCurrentAvgPath.size()); hc->batteryChargeCounterPath = android::String8(c.batteryChargeCounterPath.c_str(), diff --git a/health/2.0/Android.bp b/health/2.0/Android.bp index b8323b62fe..420586e2e2 100644 --- a/health/2.0/Android.bp +++ b/health/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.health@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHealth.hal", diff --git a/health/2.1/Android.bp b/health/2.1/Android.bp index 254bfc0d30..80a6501664 100644 --- a/health/2.1/Android.bp +++ b/health/2.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.health@2.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHealth.hal", diff --git a/health/storage/1.0/Android.bp b/health/storage/1.0/Android.bp index e4620f8ee7..b9d892db43 100644 --- a/health/storage/1.0/Android.bp +++ b/health/storage/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.health.storage@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IGarbageCollectCallback.hal", diff --git a/identity/aidl/default/IdentityCredential.cpp b/identity/aidl/default/IdentityCredential.cpp index 10f9aa5886..87d9a935de 100644 --- a/identity/aidl/default/IdentityCredential.cpp +++ b/identity/aidl/default/IdentityCredential.cpp @@ -108,7 +108,7 @@ int IdentityCredential::initialize() { } ndk::ScopedAStatus IdentityCredential::deleteCredential( - vector<int8_t>* outProofOfDeletionSignature) { + vector<uint8_t>* outProofOfDeletionSignature) { cppbor::Array array = {"ProofOfDeletion", docType_, testCredential_}; vector<uint8_t> proofOfDeletion = array.encode(); @@ -121,11 +121,11 @@ ndk::ScopedAStatus IdentityCredential::deleteCredential( IIdentityCredentialStore::STATUS_FAILED, "Error signing data")); } - *outProofOfDeletionSignature = byteStringToSigned(signature.value()); + *outProofOfDeletionSignature = signature.value(); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus IdentityCredential::createEphemeralKeyPair(vector<int8_t>* outKeyPair) { +ndk::ScopedAStatus IdentityCredential::createEphemeralKeyPair(vector<uint8_t>* outKeyPair) { optional<vector<uint8_t>> kp = support::createEcKeyPair(); if (!kp) { return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( @@ -141,13 +141,13 @@ ndk::ScopedAStatus IdentityCredential::createEphemeralKeyPair(vector<int8_t>* ou } ephemeralPublicKey_ = publicKey.value(); - *outKeyPair = byteStringToSigned(kp.value()); + *outKeyPair = kp.value(); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus IdentityCredential::setReaderEphemeralPublicKey( - const vector<int8_t>& publicKey) { - readerPublicKey_ = byteStringToUnsigned(publicKey); + const vector<uint8_t>& publicKey) { + readerPublicKey_ = publicKey; return ndk::ScopedAStatus::ok(); } @@ -176,8 +176,8 @@ ndk::ScopedAStatus IdentityCredential::createAuthChallenge(int64_t* outChallenge // ahead of time. bool checkReaderAuthentication(const SecureAccessControlProfile& profile, const vector<uint8_t>& readerCertificateChain) { - optional<vector<uint8_t>> acpPubKey = support::certificateChainGetTopMostKey( - byteStringToUnsigned(profile.readerCertificate.encodedCertificate)); + optional<vector<uint8_t>> acpPubKey = + support::certificateChainGetTopMostKey(profile.readerCertificate.encodedCertificate); if (!acpPubKey) { LOG(ERROR) << "Error extracting public key from readerCertificate in profile"; return false; @@ -269,13 +269,9 @@ ndk::ScopedAStatus IdentityCredential::setVerificationToken( ndk::ScopedAStatus IdentityCredential::startRetrieval( const vector<SecureAccessControlProfile>& accessControlProfiles, - const HardwareAuthToken& authToken, const vector<int8_t>& itemsRequestS, - const vector<int8_t>& signingKeyBlobS, const vector<int8_t>& sessionTranscriptS, - const vector<int8_t>& readerSignatureS, const vector<int32_t>& requestCounts) { - auto sessionTranscript = byteStringToUnsigned(sessionTranscriptS); - auto itemsRequest = byteStringToUnsigned(itemsRequestS); - auto readerSignature = byteStringToUnsigned(readerSignatureS); - + const HardwareAuthToken& authToken, const vector<uint8_t>& itemsRequest, + const vector<uint8_t>& signingKeyBlob, const vector<uint8_t>& sessionTranscript, + const vector<uint8_t>& readerSignature, const vector<int32_t>& requestCounts) { if (sessionTranscript.size() > 0) { auto [item, _, message] = cppbor::parse(sessionTranscript); if (item == nullptr) { @@ -497,7 +493,7 @@ ndk::ScopedAStatus IdentityCredential::startRetrieval( currentNameSpace_ = ""; itemsRequest_ = itemsRequest; - signingKeyBlob_ = byteStringToUnsigned(signingKeyBlobS); + signingKeyBlob_ = signingKeyBlob; // Finally, calculate the size of DeviceNameSpaces. We need to know it ahead of time. expectedDeviceNameSpacesSize_ = calcDeviceNameSpacesSize(); @@ -712,9 +708,8 @@ ndk::ScopedAStatus IdentityCredential::startRetrieveEntryValue( return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus IdentityCredential::retrieveEntryValue(const vector<int8_t>& encryptedContentS, - vector<int8_t>* outContent) { - auto encryptedContent = byteStringToUnsigned(encryptedContentS); +ndk::ScopedAStatus IdentityCredential::retrieveEntryValue(const vector<uint8_t>& encryptedContent, + vector<uint8_t>* outContent) { optional<vector<uint8_t>> content = support::decryptAes128Gcm(storageKey_, encryptedContent, entryAdditionalData_); if (!content) { @@ -753,12 +748,12 @@ ndk::ScopedAStatus IdentityCredential::retrieveEntryValue(const vector<int8_t>& currentNameSpaceDeviceNameSpacesMap_.add(currentName_, std::move(entryValueItem)); } - *outContent = byteStringToSigned(content.value()); + *outContent = content.value(); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus IdentityCredential::finishRetrieval(vector<int8_t>* outMac, - vector<int8_t>* outDeviceNameSpaces) { +ndk::ScopedAStatus IdentityCredential::finishRetrieval(vector<uint8_t>* outMac, + vector<uint8_t>* outDeviceNameSpaces) { if (currentNameSpaceDeviceNameSpacesMap_.size() > 0) { deviceNameSpacesMap_.add(currentNameSpace_, std::move(currentNameSpaceDeviceNameSpacesMap_)); @@ -828,13 +823,13 @@ ndk::ScopedAStatus IdentityCredential::finishRetrieval(vector<int8_t>* outMac, } } - *outMac = byteStringToSigned(mac.value_or(vector<uint8_t>({}))); - *outDeviceNameSpaces = byteStringToSigned(encodedDeviceNameSpaces); + *outMac = mac.value_or(vector<uint8_t>({})); + *outDeviceNameSpaces = encodedDeviceNameSpaces; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus IdentityCredential::generateSigningKeyPair( - vector<int8_t>* outSigningKeyBlob, Certificate* outSigningKeyCertificate) { + vector<uint8_t>* outSigningKeyBlob, Certificate* outSigningKeyCertificate) { string serialDecimal = "0"; // TODO: set serial to something unique string issuer = "Android Open Source Project"; string subject = "Android IdentityCredential Reference Implementation"; @@ -882,9 +877,9 @@ ndk::ScopedAStatus IdentityCredential::generateSigningKeyPair( return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( IIdentityCredentialStore::STATUS_FAILED, "Error encrypting signingKey")); } - *outSigningKeyBlob = byteStringToSigned(encryptedSigningKey.value()); + *outSigningKeyBlob = encryptedSigningKey.value(); *outSigningKeyCertificate = Certificate(); - outSigningKeyCertificate->encodedCertificate = byteStringToSigned(certificate.value()); + outSigningKeyCertificate->encodedCertificate = certificate.value(); return ndk::ScopedAStatus::ok(); } diff --git a/identity/aidl/default/IdentityCredential.h b/identity/aidl/default/IdentityCredential.h index 40070c0074..a82531dd4b 100644 --- a/identity/aidl/default/IdentityCredential.h +++ b/identity/aidl/default/IdentityCredential.h @@ -51,26 +51,26 @@ class IdentityCredential : public BnIdentityCredential { int initialize(); // Methods from IIdentityCredential follow. - ndk::ScopedAStatus deleteCredential(vector<int8_t>* outProofOfDeletionSignature) override; - ndk::ScopedAStatus createEphemeralKeyPair(vector<int8_t>* outKeyPair) override; - ndk::ScopedAStatus setReaderEphemeralPublicKey(const vector<int8_t>& publicKey) override; + ndk::ScopedAStatus deleteCredential(vector<uint8_t>* outProofOfDeletionSignature) override; + ndk::ScopedAStatus createEphemeralKeyPair(vector<uint8_t>* outKeyPair) override; + ndk::ScopedAStatus setReaderEphemeralPublicKey(const vector<uint8_t>& publicKey) override; ndk::ScopedAStatus createAuthChallenge(int64_t* outChallenge) override; ndk::ScopedAStatus setRequestedNamespaces( const vector<RequestNamespace>& requestNamespaces) override; ndk::ScopedAStatus setVerificationToken(const VerificationToken& verificationToken) override; ndk::ScopedAStatus startRetrieval( const vector<SecureAccessControlProfile>& accessControlProfiles, - const HardwareAuthToken& authToken, const vector<int8_t>& itemsRequest, - const vector<int8_t>& signingKeyBlob, const vector<int8_t>& sessionTranscript, - const vector<int8_t>& readerSignature, const vector<int32_t>& requestCounts) override; + const HardwareAuthToken& authToken, const vector<uint8_t>& itemsRequest, + const vector<uint8_t>& signingKeyBlob, const vector<uint8_t>& sessionTranscript, + const vector<uint8_t>& readerSignature, const vector<int32_t>& requestCounts) override; ndk::ScopedAStatus startRetrieveEntryValue( const string& nameSpace, const string& name, int32_t entrySize, const vector<int32_t>& accessControlProfileIds) override; - ndk::ScopedAStatus retrieveEntryValue(const vector<int8_t>& encryptedContent, - vector<int8_t>* outContent) override; - ndk::ScopedAStatus finishRetrieval(vector<int8_t>* outMac, - vector<int8_t>* outDeviceNameSpaces) override; - ndk::ScopedAStatus generateSigningKeyPair(vector<int8_t>* outSigningKeyBlob, + ndk::ScopedAStatus retrieveEntryValue(const vector<uint8_t>& encryptedContent, + vector<uint8_t>* outContent) override; + ndk::ScopedAStatus finishRetrieval(vector<uint8_t>* outMac, + vector<uint8_t>* outDeviceNameSpaces) override; + ndk::ScopedAStatus generateSigningKeyPair(vector<uint8_t>* outSigningKeyBlob, Certificate* outSigningKeyCertificate) override; private: diff --git a/identity/aidl/default/IdentityCredentialStore.cpp b/identity/aidl/default/IdentityCredentialStore.cpp index 1efb4b4937..30dc6f330b 100644 --- a/identity/aidl/default/IdentityCredentialStore.cpp +++ b/identity/aidl/default/IdentityCredentialStore.cpp @@ -51,7 +51,7 @@ ndk::ScopedAStatus IdentityCredentialStore::createCredential( } ndk::ScopedAStatus IdentityCredentialStore::getCredential( - CipherSuite cipherSuite, const vector<int8_t>& credentialData, + CipherSuite cipherSuite, const vector<uint8_t>& credentialData, shared_ptr<IIdentityCredential>* outCredential) { // We only support CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256 right now. if (cipherSuite != CipherSuite::CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256) { @@ -60,8 +60,8 @@ ndk::ScopedAStatus IdentityCredentialStore::getCredential( "Unsupported cipher suite")); } - vector<uint8_t> data = vector<uint8_t>(credentialData.begin(), credentialData.end()); - shared_ptr<IdentityCredential> credential = ndk::SharedRefBase::make<IdentityCredential>(data); + shared_ptr<IdentityCredential> credential = + ndk::SharedRefBase::make<IdentityCredential>(credentialData); auto ret = credential->initialize(); if (ret != IIdentityCredentialStore::STATUS_OK) { return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( diff --git a/identity/aidl/default/IdentityCredentialStore.h b/identity/aidl/default/IdentityCredentialStore.h index a2051130b0..4f3a42139f 100644 --- a/identity/aidl/default/IdentityCredentialStore.h +++ b/identity/aidl/default/IdentityCredentialStore.h @@ -39,7 +39,7 @@ class IdentityCredentialStore : public BnIdentityCredentialStore { const string& docType, bool testCredential, shared_ptr<IWritableIdentityCredential>* outWritableCredential) override; - ndk::ScopedAStatus getCredential(CipherSuite cipherSuite, const vector<int8_t>& credentialData, + ndk::ScopedAStatus getCredential(CipherSuite cipherSuite, const vector<uint8_t>& credentialData, shared_ptr<IIdentityCredential>* outCredential) override; }; diff --git a/identity/aidl/default/Util.cpp b/identity/aidl/default/Util.cpp index a0f86bedcd..66b9f13d89 100644 --- a/identity/aidl/default/Util.cpp +++ b/identity/aidl/default/Util.cpp @@ -39,21 +39,12 @@ const vector<uint8_t>& getHardwareBoundKey() { return hardwareBoundKey; } -vector<uint8_t> byteStringToUnsigned(const vector<int8_t>& value) { - return vector<uint8_t>(value.begin(), value.end()); -} - -vector<int8_t> byteStringToSigned(const vector<uint8_t>& value) { - return vector<int8_t>(value.begin(), value.end()); -} - vector<uint8_t> secureAccessControlProfileEncodeCbor(const SecureAccessControlProfile& profile) { cppbor::Map map; map.add("id", profile.id); if (profile.readerCertificate.encodedCertificate.size() > 0) { - map.add("readerCertificate", - cppbor::Bstr(byteStringToUnsigned(profile.readerCertificate.encodedCertificate))); + map.add("readerCertificate", cppbor::Bstr(profile.readerCertificate.encodedCertificate)); } if (profile.userAuthenticationRequired) { @@ -94,7 +85,7 @@ bool secureAccessControlProfileCheckMac(const SecureAccessControlProfile& profil if (!mac) { return false; } - if (mac.value() != byteStringToUnsigned(profile.mac)) { + if (mac.value() != profile.mac) { return false; } return true; diff --git a/identity/aidl/default/Util.h b/identity/aidl/default/Util.h index ee41ad1aac..9fccba2c72 100644 --- a/identity/aidl/default/Util.h +++ b/identity/aidl/default/Util.h @@ -49,10 +49,6 @@ bool secureAccessControlProfileCheckMac(const SecureAccessControlProfile& profil vector<uint8_t> entryCreateAdditionalData(const string& nameSpace, const string& name, const vector<int32_t> accessControlProfileIds); -vector<uint8_t> byteStringToUnsigned(const vector<int8_t>& value); - -vector<int8_t> byteStringToSigned(const vector<uint8_t>& value); - } // namespace aidl::android::hardware::identity #endif // ANDROID_HARDWARE_IDENTITY_UTIL_H diff --git a/identity/aidl/default/WritableIdentityCredential.cpp b/identity/aidl/default/WritableIdentityCredential.cpp index c218866ace..fea289b9ef 100644 --- a/identity/aidl/default/WritableIdentityCredential.cpp +++ b/identity/aidl/default/WritableIdentityCredential.cpp @@ -57,8 +57,8 @@ bool WritableIdentityCredential::initialize() { // attestation certificate with current time and expires one year from now. The // certificate shall contain all values as specified in hal. ndk::ScopedAStatus WritableIdentityCredential::getAttestationCertificate( - const vector<int8_t>& attestationApplicationId, // - const vector<int8_t>& attestationChallenge, // + const vector<uint8_t>& attestationApplicationId, // + const vector<uint8_t>& attestationChallenge, // vector<Certificate>* outCertificateChain) { if (!credentialPrivKey_.empty() || !credentialPubKey_.empty() || !certificateChain_.empty()) { return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( @@ -105,7 +105,7 @@ ndk::ScopedAStatus WritableIdentityCredential::getAttestationCertificate( *outCertificateChain = vector<Certificate>(); for (const vector<uint8_t>& cert : certificateChain_) { Certificate c = Certificate(); - c.encodedCertificate = byteStringToSigned(cert); + c.encodedCertificate = cert; outCertificateChain->push_back(std::move(c)); } return ndk::ScopedAStatus::ok(); @@ -186,14 +186,13 @@ ndk::ScopedAStatus WritableIdentityCredential::addAccessControlProfile( return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( IIdentityCredentialStore::STATUS_FAILED, "Error calculating MAC for profile")); } - profile.mac = byteStringToSigned(mac.value()); + profile.mac = mac.value(); cppbor::Map profileMap; profileMap.add("id", profile.id); if (profile.readerCertificate.encodedCertificate.size() > 0) { - profileMap.add( - "readerCertificate", - cppbor::Bstr(byteStringToUnsigned(profile.readerCertificate.encodedCertificate))); + profileMap.add("readerCertificate", + cppbor::Bstr(profile.readerCertificate.encodedCertificate)); } if (profile.userAuthenticationRequired) { profileMap.add("userAuthenticationRequired", profile.userAuthenticationRequired); @@ -273,9 +272,8 @@ ndk::ScopedAStatus WritableIdentityCredential::beginAddEntry( return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus WritableIdentityCredential::addEntryValue(const vector<int8_t>& contentS, - vector<int8_t>* outEncryptedContentS) { - auto content = byteStringToUnsigned(contentS); +ndk::ScopedAStatus WritableIdentityCredential::addEntryValue(const vector<uint8_t>& content, + vector<uint8_t>* outEncryptedContent) { size_t contentSize = content.size(); if (contentSize > IdentityCredentialStore::kGcmChunkSize) { @@ -330,7 +328,7 @@ ndk::ScopedAStatus WritableIdentityCredential::addEntryValue(const vector<int8_t signedDataCurrentNamespace_.add(std::move(entryMap)); } - *outEncryptedContentS = byteStringToSigned(encryptedContent.value()); + *outEncryptedContent = encryptedContent.value(); return ndk::ScopedAStatus::ok(); } @@ -379,7 +377,7 @@ bool generateCredentialData(const vector<uint8_t>& hardwareBoundKey, const strin } ndk::ScopedAStatus WritableIdentityCredential::finishAddingEntries( - vector<int8_t>* outCredentialData, vector<int8_t>* outProofOfProvisioningSignature) { + vector<uint8_t>* outCredentialData, vector<uint8_t>* outProofOfProvisioningSignature) { if (numAccessControlProfileRemaining_ != 0) { return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage( IIdentityCredentialStore::STATUS_INVALID_DATA, @@ -436,8 +434,8 @@ ndk::ScopedAStatus WritableIdentityCredential::finishAddingEntries( IIdentityCredentialStore::STATUS_FAILED, "Error generating CredentialData")); } - *outCredentialData = byteStringToSigned(credentialData); - *outProofOfProvisioningSignature = byteStringToSigned(signature.value()); + *outCredentialData = credentialData; + *outProofOfProvisioningSignature = signature.value(); return ndk::ScopedAStatus::ok(); } diff --git a/identity/aidl/default/WritableIdentityCredential.h b/identity/aidl/default/WritableIdentityCredential.h index 05104d7016..56458520c1 100644 --- a/identity/aidl/default/WritableIdentityCredential.h +++ b/identity/aidl/default/WritableIdentityCredential.h @@ -39,8 +39,8 @@ class WritableIdentityCredential : public BnWritableIdentityCredential { bool initialize(); // Methods from IWritableIdentityCredential follow. - ndk::ScopedAStatus getAttestationCertificate(const vector<int8_t>& attestationApplicationId, - const vector<int8_t>& attestationChallenge, + ndk::ScopedAStatus getAttestationCertificate(const vector<uint8_t>& attestationApplicationId, + const vector<uint8_t>& attestationChallenge, vector<Certificate>* outCertificateChain) override; ndk::ScopedAStatus setExpectedProofOfProvisioningSize( @@ -58,12 +58,12 @@ class WritableIdentityCredential : public BnWritableIdentityCredential { const string& nameSpace, const string& name, int32_t entrySize) override; - ndk::ScopedAStatus addEntryValue(const vector<int8_t>& content, - vector<int8_t>* outEncryptedContent) override; + ndk::ScopedAStatus addEntryValue(const vector<uint8_t>& content, + vector<uint8_t>* outEncryptedContent) override; ndk::ScopedAStatus finishAddingEntries( - vector<int8_t>* outCredentialData, - vector<int8_t>* outProofOfProvisioningSignature) override; + vector<uint8_t>* outCredentialData, + vector<uint8_t>* outProofOfProvisioningSignature) override; private: string docType_; diff --git a/input/classifier/1.0/Android.bp b/input/classifier/1.0/Android.bp index 11e0f52dd0..b6e54ca56a 100644 --- a/input/classifier/1.0/Android.bp +++ b/input/classifier/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.input.classifier@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IInputClassifier.hal", ], diff --git a/input/classifier/1.0/vts/functional/Android.bp b/input/classifier/1.0/vts/functional/Android.bp index 4d6c9c367e..fc1f5857b2 100644 --- a/input/classifier/1.0/vts/functional/Android.bp +++ b/input/classifier/1.0/vts/functional/Android.bp @@ -18,9 +18,11 @@ cc_test { name: "VtsHalInputClassifierV1_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], srcs: ["VtsHalInputClassifierV1_0TargetTest.cpp"], + header_libs: ["jni_headers"], static_libs: [ "android.hardware.input.classifier@1.0", "android.hardware.input.common@1.0", + "libui-types", ], test_suites: [ "general-tests", diff --git a/input/common/1.0/Android.bp b/input/common/1.0/Android.bp index 2c7c517cce..07ced7ab05 100644 --- a/input/common/1.0/Android.bp +++ b/input/common/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.input.common@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", ], diff --git a/ir/1.0/Android.bp b/ir/1.0/Android.bp index 5fca96dca5..6a521f7d51 100644 --- a/ir/1.0/Android.bp +++ b/ir/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.ir@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IConsumerIr.hal", diff --git a/keymaster/3.0/Android.bp b/keymaster/3.0/Android.bp index 0fdc32c810..d0c7a7cd3e 100644 --- a/keymaster/3.0/Android.bp +++ b/keymaster/3.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.keymaster@3.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IKeymasterDevice.hal", diff --git a/keymaster/4.0/Android.bp b/keymaster/4.0/Android.bp index ea328f4c15..5774718601 100644 --- a/keymaster/4.0/Android.bp +++ b/keymaster/4.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.keymaster@4.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IKeymasterDevice.hal", diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h index befb7d3ef3..a76150bf91 100644 --- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h +++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h @@ -115,6 +115,11 @@ DECLARE_TYPED_TAG(APPLICATION_ID); DECLARE_TYPED_TAG(ASSOCIATED_DATA); DECLARE_TYPED_TAG(ATTESTATION_APPLICATION_ID); DECLARE_TYPED_TAG(ATTESTATION_CHALLENGE); +DECLARE_TYPED_TAG(ATTESTATION_ID_BRAND); +DECLARE_TYPED_TAG(ATTESTATION_ID_DEVICE); +DECLARE_TYPED_TAG(ATTESTATION_ID_PRODUCT); +DECLARE_TYPED_TAG(ATTESTATION_ID_MANUFACTURER); +DECLARE_TYPED_TAG(ATTESTATION_ID_MODEL); DECLARE_TYPED_TAG(AUTH_TIMEOUT); DECLARE_TYPED_TAG(BLOB_USAGE_REQUIREMENTS); DECLARE_TYPED_TAG(BLOCK_MODE); @@ -158,21 +163,22 @@ DECLARE_TYPED_TAG(VENDOR_PATCHLEVEL); template <typename... Elems> struct MetaList {}; -using all_tags_t = - MetaList<TAG_INVALID_t, TAG_KEY_SIZE_t, TAG_MAC_LENGTH_t, TAG_CALLER_NONCE_t, - TAG_MIN_MAC_LENGTH_t, TAG_RSA_PUBLIC_EXPONENT_t, TAG_INCLUDE_UNIQUE_ID_t, - TAG_ACTIVE_DATETIME_t, TAG_ORIGINATION_EXPIRE_DATETIME_t, TAG_USAGE_EXPIRE_DATETIME_t, - TAG_MIN_SECONDS_BETWEEN_OPS_t, TAG_MAX_USES_PER_BOOT_t, TAG_USER_ID_t, - TAG_USER_SECURE_ID_t, TAG_NO_AUTH_REQUIRED_t, TAG_AUTH_TIMEOUT_t, - TAG_ALLOW_WHILE_ON_BODY_t, TAG_UNLOCKED_DEVICE_REQUIRED_t, TAG_APPLICATION_ID_t, - TAG_APPLICATION_DATA_t, TAG_CREATION_DATETIME_t, TAG_ROLLBACK_RESISTANCE_t, - TAG_HARDWARE_TYPE_t, TAG_ROOT_OF_TRUST_t, TAG_ASSOCIATED_DATA_t, TAG_NONCE_t, - TAG_BOOTLOADER_ONLY_t, TAG_OS_VERSION_t, TAG_OS_PATCHLEVEL_t, TAG_UNIQUE_ID_t, - TAG_ATTESTATION_CHALLENGE_t, TAG_ATTESTATION_APPLICATION_ID_t, - TAG_RESET_SINCE_ID_ROTATION_t, TAG_PURPOSE_t, TAG_ALGORITHM_t, TAG_BLOCK_MODE_t, - TAG_DIGEST_t, TAG_PADDING_t, TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, - TAG_USER_AUTH_TYPE_t, TAG_EC_CURVE_t, TAG_BOOT_PATCHLEVEL_t, TAG_VENDOR_PATCHLEVEL_t, - TAG_TRUSTED_CONFIRMATION_REQUIRED_t, TAG_TRUSTED_USER_PRESENCE_REQUIRED_t>; +using all_tags_t = MetaList< + TAG_INVALID_t, TAG_KEY_SIZE_t, TAG_MAC_LENGTH_t, TAG_CALLER_NONCE_t, TAG_MIN_MAC_LENGTH_t, + TAG_RSA_PUBLIC_EXPONENT_t, TAG_INCLUDE_UNIQUE_ID_t, TAG_ACTIVE_DATETIME_t, + TAG_ORIGINATION_EXPIRE_DATETIME_t, TAG_USAGE_EXPIRE_DATETIME_t, + TAG_MIN_SECONDS_BETWEEN_OPS_t, TAG_MAX_USES_PER_BOOT_t, TAG_USER_ID_t, TAG_USER_SECURE_ID_t, + TAG_NO_AUTH_REQUIRED_t, TAG_AUTH_TIMEOUT_t, TAG_ALLOW_WHILE_ON_BODY_t, + TAG_UNLOCKED_DEVICE_REQUIRED_t, TAG_APPLICATION_ID_t, TAG_APPLICATION_DATA_t, + TAG_CREATION_DATETIME_t, TAG_ROLLBACK_RESISTANCE_t, TAG_HARDWARE_TYPE_t, + TAG_ROOT_OF_TRUST_t, TAG_ASSOCIATED_DATA_t, TAG_NONCE_t, TAG_BOOTLOADER_ONLY_t, + TAG_OS_VERSION_t, TAG_OS_PATCHLEVEL_t, TAG_UNIQUE_ID_t, TAG_ATTESTATION_CHALLENGE_t, + TAG_ATTESTATION_APPLICATION_ID_t, TAG_ATTESTATION_ID_BRAND_t, TAG_ATTESTATION_ID_DEVICE_t, + TAG_ATTESTATION_ID_PRODUCT_t, TAG_ATTESTATION_ID_MANUFACTURER_t, TAG_ATTESTATION_ID_MODEL_t, + TAG_RESET_SINCE_ID_ROTATION_t, TAG_PURPOSE_t, TAG_ALGORITHM_t, TAG_BLOCK_MODE_t, + TAG_DIGEST_t, TAG_PADDING_t, TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, + TAG_USER_AUTH_TYPE_t, TAG_EC_CURVE_t, TAG_BOOT_PATCHLEVEL_t, TAG_VENDOR_PATCHLEVEL_t, + TAG_TRUSTED_CONFIRMATION_REQUIRED_t, TAG_TRUSTED_USER_PRESENCE_REQUIRED_t>; template <typename TypedTagType> struct TypedTag2ValueType; diff --git a/keymaster/4.1/Android.bp b/keymaster/4.1/Android.bp index f6ac6f8426..4e7e944564 100644 --- a/keymaster/4.1/Android.bp +++ b/keymaster/4.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.keymaster@4.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IKeymasterDevice.hal", diff --git a/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp b/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp index 495de0f97d..728a523d65 100644 --- a/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp +++ b/keymaster/4.1/vts/functional/DeviceUniqueAttestationTest.cpp @@ -212,9 +212,11 @@ TEST_P(DeviceUniqueAttestationTest, NonStrongBoxOnly) { EXPECT_EQ(ErrorCode::UNIMPLEMENTED, convert(AttestKey( AuthorizationSetBuilder() + .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION) .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge")) .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")), &cert_chain))); + CheckedDeleteKey(); } TEST_P(DeviceUniqueAttestationTest, Rsa) { diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp index 56a3ca99e7..52067214c2 100644 --- a/keymaster/aidl/Android.bp +++ b/keymaster/aidl/Android.bp @@ -20,3 +20,12 @@ aidl_interface { "2", ], } + +// This is a reminder that the next version of keymaster should be frozen at +// version "5" to avoid confusion with other versions of this interface. +cc_library { + name: "android.hardware.keymaster-V3-java", +} +cc_library { + name: "android.hardware.keymaster-V4-java", +} diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp index d51f10dfb8..ae6d37c387 100644 --- a/light/2.0/Android.bp +++ b/light/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.light@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ILight.hal", diff --git a/media/bufferpool/1.0/Android.bp b/media/bufferpool/1.0/Android.bp index 079e47fceb..5dbbadd436 100644 --- a/media/bufferpool/1.0/Android.bp +++ b/media/bufferpool/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.media.bufferpool@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IAccessor.hal", diff --git a/media/c2/1.0/Android.bp b/media/c2/1.0/Android.bp index 391e6c4a1f..089ce981eb 100644 --- a/media/c2/1.0/Android.bp +++ b/media/c2/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.media.c2@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IComponent.hal", diff --git a/media/c2/1.1/Android.bp b/media/c2/1.1/Android.bp index c3e30b215f..a3d31dfaff 100644 --- a/media/c2/1.1/Android.bp +++ b/media/c2/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.media.c2@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IComponent.hal", "IComponentStore.hal", diff --git a/media/omx/1.0/vts/functional/common/Android.bp b/media/omx/1.0/vts/functional/common/Android.bp index 720ea9f1cf..3845b9f36f 100644 --- a/media/omx/1.0/vts/functional/common/Android.bp +++ b/media/omx/1.0/vts/functional/common/Android.bp @@ -68,11 +68,11 @@ cc_defaults { "android.hidl.allocator@1.0", "android.hidl.memory@1.0", "libhidlmemory", - "libnativehelper", ], // TODO(b/64437680): Assume these libs are always available on the device. shared_libs: [ + "libnativehelper", "libstagefright_foundation", "libstagefright_omx_utils", ], diff --git a/neuralnetworks/1.0/Android.bp b/neuralnetworks/1.0/Android.bp index 3e740c435d..20de9d56ec 100644 --- a/neuralnetworks/1.0/Android.bp +++ b/neuralnetworks/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.neuralnetworks@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDevice.hal", diff --git a/neuralnetworks/1.1/Android.bp b/neuralnetworks/1.1/Android.bp index bef21c037c..52d866f853 100644 --- a/neuralnetworks/1.1/Android.bp +++ b/neuralnetworks/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.neuralnetworks@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDevice.hal", diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp index 4aa90aa54c..9e1db1e8f8 100644 --- a/neuralnetworks/1.2/Android.bp +++ b/neuralnetworks/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.neuralnetworks@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBurstCallback.hal", diff --git a/neuralnetworks/1.2/IDevice.hal b/neuralnetworks/1.2/IDevice.hal index ff20c12867..5fb339f1d9 100644 --- a/neuralnetworks/1.2/IDevice.hal +++ b/neuralnetworks/1.2/IDevice.hal @@ -40,7 +40,7 @@ interface IDevice extends @1.1::IDevice { * NNAPI applications filter devices based on their needs: * - An application demands a certain level of performance, but a specific version of * the driver cannot meet that requirement because of a performance regression. - * The application can blacklist the driver based on the version provided. + * The application can disallow the driver based on the version provided. * - An application has a minimum precision requirement, but certain versions of * the driver cannot meet that requirement because of bugs or certain optimizations. * The application can filter out versions of these drivers. diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index 92cf2aa5e4..7441a54dba 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -4853,15 +4853,18 @@ struct Operand { /** * Quantized scale of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or - * TENSOR_INT32. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ float scale; /** * Quantized zero-point offset of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ int32_t zeroPoint; diff --git a/neuralnetworks/1.2/types.t b/neuralnetworks/1.2/types.t index d197f6b541..21d88acf8f 100644 --- a/neuralnetworks/1.2/types.t +++ b/neuralnetworks/1.2/types.t @@ -251,15 +251,18 @@ struct Operand { /** * Quantized scale of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or - * TENSOR_INT32. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ float scale; /** * Quantized zero-point offset of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ int32_t zeroPoint; diff --git a/neuralnetworks/1.3/Android.bp b/neuralnetworks/1.3/Android.bp index 7b02cc510f..3e02c909c7 100644 --- a/neuralnetworks/1.3/Android.bp +++ b/neuralnetworks/1.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.neuralnetworks@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IBuffer.hal", diff --git a/neuralnetworks/1.3/types.hal b/neuralnetworks/1.3/types.hal index 3b2b14c98c..5f5ee0360c 100644 --- a/neuralnetworks/1.3/types.hal +++ b/neuralnetworks/1.3/types.hal @@ -5103,8 +5103,8 @@ enum OperationType : int32_t { * signature of this operation. That is, if the operation has (3 + n) inputs * and m outputs, both subgraphs must have n inputs and m outputs with the same * types, ranks, dimensions, scales, - * zeroPoints, and extraParams as the corresponding operation inputs and - * outputs. + * zeroPoints, and extraParams as the corresponding operation + * inputs and outputs. * All of the operands mentioned must have fully specified dimensions. * * Inputs: @@ -5170,15 +5170,15 @@ enum OperationType : int32_t { * * 0: A {@link OperandType::SUBGRAPH} reference to the condition * subgraph. The subgraph must have (m + k + n) inputs with * the same types, ranks, dimensions, - * scales, zeroPoints, and extraParams as the corresponding inputs of - * the WHILE operation and exactly one output of - * {@link OperandType::TENSOR_BOOL8} and shape [1]. + * scales, zeroPoints, and extraParams as the + * corresponding inputs of the WHILE operation and exactly one output + * of {@link OperandType::TENSOR_BOOL8} and shape [1]. * All of the operands mentioned must have fully specified dimensions. * * 1: A {@link OperandType::SUBGRAPH} reference to the body subgraph. * The subgraph must have (m + k + n) inputs and (m + k) outputs with * the same types, ranks, dimensions, - * scales, zeroPoints, and extraParams as the corresponding inputs and - * outputs of the WHILE operation. + * scales, zeroPoints, and extraParams as the + * corresponding inputs and outputs of the WHILE operation. * All of the operands mentioned must have fully specified dimensions. * * (m inputs): Initial values for input-output operands. * * (k inputs): Initial values for state-only operands. @@ -5538,15 +5538,18 @@ struct Operand { /** * Quantized scale of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or - * TENSOR_INT32. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ float scale; /** * Quantized zero-point offset of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ int32_t zeroPoint; @@ -5740,8 +5743,8 @@ struct Request { * Input data and information to be used in the execution of a prepared * model. * - * The index of the input corresponds to the index in Model.inputIndexes. - * E.g., input[i] corresponds to Model.inputIndexes[i]. + * The index of the input corresponds to the index in Model.main.inputIndexes. + * E.g., input[i] corresponds to Model.main.inputIndexes[i]. */ vec<RequestArgument> inputs; @@ -5749,8 +5752,8 @@ struct Request { * Output data and information to be used in the execution of a prepared * model. * - * The index of the output corresponds to the index in Model.outputIndexes. - * E.g., output[i] corresponds to Model.outputIndexes[i]. + * The index of the output corresponds to the index in Model.main.outputIndexes. + * E.g., output[i] corresponds to Model.main.outputIndexes[i]. */ vec<RequestArgument> outputs; diff --git a/neuralnetworks/1.3/types.t b/neuralnetworks/1.3/types.t index 7220e372a7..2901d18525 100644 --- a/neuralnetworks/1.3/types.t +++ b/neuralnetworks/1.3/types.t @@ -303,15 +303,18 @@ struct Operand { /** * Quantized scale of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM or - * TENSOR_INT32. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ float scale; /** * Quantized zero-point offset of the operand. * - * Only applicable if the operand is of type TENSOR_QUANT8_ASYMM. + * Must be 0 when not applicable to an operand type. + * + * See {@link OperandType}. */ int32_t zeroPoint; @@ -505,8 +508,8 @@ struct Request { * Input data and information to be used in the execution of a prepared * model. * - * The index of the input corresponds to the index in Model.inputIndexes. - * E.g., input[i] corresponds to Model.inputIndexes[i]. + * The index of the input corresponds to the index in Model.main.inputIndexes. + * E.g., input[i] corresponds to Model.main.inputIndexes[i]. */ vec<RequestArgument> inputs; @@ -514,8 +517,8 @@ struct Request { * Output data and information to be used in the execution of a prepared * model. * - * The index of the output corresponds to the index in Model.outputIndexes. - * E.g., output[i] corresponds to Model.outputIndexes[i]. + * The index of the output corresponds to the index in Model.main.outputIndexes. + * E.g., output[i] corresponds to Model.main.outputIndexes[i]. */ vec<RequestArgument> outputs; diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp index bd64907364..667922a4ac 100644 --- a/nfc/1.0/Android.bp +++ b/nfc/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.nfc@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "INfc.hal", diff --git a/nfc/1.1/Android.bp b/nfc/1.1/Android.bp index 1f8789fc35..a8976b06c4 100644 --- a/nfc/1.1/Android.bp +++ b/nfc/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.nfc@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "INfc.hal", diff --git a/nfc/1.2/Android.bp b/nfc/1.2/Android.bp index aa68d2fde1..514d5313aa 100644 --- a/nfc/1.2/Android.bp +++ b/nfc/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.nfc@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "INfc.hal", diff --git a/oemlock/1.0/Android.bp b/oemlock/1.0/Android.bp index e784be098b..8ab2911b8e 100644 --- a/oemlock/1.0/Android.bp +++ b/oemlock/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.oemlock@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IOemLock.hal", diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp index 6ba1d78e33..7381c709c9 100644 --- a/power/1.0/Android.bp +++ b/power/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.power@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IPower.hal", diff --git a/power/1.1/Android.bp b/power/1.1/Android.bp index 6b133cce00..e026e7021f 100644 --- a/power/1.1/Android.bp +++ b/power/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.power@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IPower.hal", diff --git a/power/1.2/Android.bp b/power/1.2/Android.bp index 296965b5c2..ccf66dc1a6 100644 --- a/power/1.2/Android.bp +++ b/power/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.power@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IPower.hal", diff --git a/power/1.3/Android.bp b/power/1.3/Android.bp index 00ca750212..15955e5db5 100644 --- a/power/1.3/Android.bp +++ b/power/1.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.power@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IPower.hal", diff --git a/power/stats/1.0/Android.bp b/power/stats/1.0/Android.bp index c592006089..2a71490522 100644 --- a/power/stats/1.0/Android.bp +++ b/power/stats/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.power.stats@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IPowerStats.hal", diff --git a/prebuilt_hashes/26.txt b/prebuilt_hashes/26.txt deleted file mode 100644 index f2feb4c5c0..0000000000 --- a/prebuilt_hashes/26.txt +++ /dev/null @@ -1,186 +0,0 @@ -# Do not change this file except to add new interfaces. Changing -# pre-existing interfaces will fail VTS and break framework-only OTAs - -# HALs released in Android O - -f219c3b5b8c6cb1d659d4c7328f67246abfe1a8613f469826fd3b9ad090417a2 android.hardware.audio@2.0::IDevice -4d579cae1cd87a783fd49233e10ce720ba183cfd1d5ccd80149e69de5c1c7362 android.hardware.audio@2.0::IDevicesFactory -203e23f18011390b8cd10c303e0c16c4eebc8fa187e80e40d6be4624c2b0848a android.hardware.audio@2.0::IPrimaryDevice -aaf93123deec336eb247ad8099849469a541ca0cf7c28c5f5336cebe1ee86748 android.hardware.audio@2.0::IStream -0468c5723b0d44c5b451bdfa06153000c6f352fd3336e0ad2697127b04b766df android.hardware.audio@2.0::IStreamIn -7296f7064fd3ab24082b43a1da34cc876268065310b785499fba5178d063680a android.hardware.audio@2.0::IStreamOut -19d241d71c3e1140afba8140dcb57448446025a5fc03739788c4c25e9a98b6c2 android.hardware.audio@2.0::IStreamOutCallback -c84da9f586087227daa3b96d42b4575326bccfd5bc8a2a5acf86d774f8ea2648 android.hardware.audio@2.0::types -1305786c06e22b9b24ebde136054cc827b63c86d8bf4a136d6f7f54752b8566b android.hardware.audio.common@2.0::types -fa8fbae3d1da3c264e4f3110728076abc09b4e65f12af6ae136367328de988ab android.hardware.audio.effect@2.0::IAcousticEchoCancelerEffect -ca4752545d54547ff069eae161af7550cb5f5a7e8b60316ddd132a30906a68e7 android.hardware.audio.effect@2.0::IAutomaticGainControlEffect -d2b8af988dc66f514d886bcee44b440d8034bc2a762f7161717ef3c956073067 android.hardware.audio.effect@2.0::IBassBoostEffect -611bc09c75e796f3512b1ca6be508b0a9ba996759b8a2c60507784ff58076229 android.hardware.audio.effect@2.0::IDownmixEffect -36a57369dfdc75180e8b64ae80b1970db8f6d9085dbff6ca931715038cc056e1 android.hardware.audio.effect@2.0::IEffect -d2aa2df6d189c580f5be8460fa0ff4134d9c05a383f3204659baee426a6f0edf android.hardware.audio.effect@2.0::IEffectBufferProviderCallback -217f9161983a48d3bf3faeb158f868aa8bf0ce25889e4ee3d2bab1a2e8d33e77 android.hardware.audio.effect@2.0::IEffectsFactory -c2b38bc07991e880c83ca8cb88181411eeef708b8b936aedd2f2e0acade7df69 android.hardware.audio.effect@2.0::IEnvironmentalReverbEffect -2ff9f9704be5f167745b4de790e9dafc3cc4719e2f6e2e5497085e679853cfe7 android.hardware.audio.effect@2.0::IEqualizerEffect -c31447fb02dbc8b56c359941dad22f416511860173c5c5fd278d1bf2312b13de android.hardware.audio.effect@2.0::ILoudnessEnhancerEffect -804831ca258802eb3eb65a0a7b5d5e3d37d4a15ba8c2836b4276eda98b47e1d0 android.hardware.audio.effect@2.0::INoiseSuppressionEffect -778fd5b9837f481d8e47425b3e2a3bd0c6362a0b6870291518e2d863530fdb61 android.hardware.audio.effect@2.0::IPresetReverbEffect -c93cb25a1a92d07aa80a617c01e8d22fc97bf8cefd3962b6a5be386ad4704d89 android.hardware.audio.effect@2.0::IVirtualizerEffect -918f331780c9c7b04f2151a2e563aab088198ede8e6f865302ebaa13905bd9ce android.hardware.audio.effect@2.0::IVisualizerEffect -4caad099f8fc00262b6c03ba41271808b37cea90ac98b534299bbf4ee823af02 android.hardware.audio.effect@2.0::types -# android.hardware.automotive.* are unfrozen -1fbdc1f852f8bd2e4a6c5cb30ac2b78668c98dce118a61762d4034ae859f43d8 android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprint -aabb5c3c585592d71ee57b77298c14993d77914ddeaa64b2c5109a602b02ea47 android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprintClientCallback -1ec60d4efddae9a7b2469278a576967b4751e88de5b8d7e9df6eff6bc0da7bc9 android.hardware.biometrics.fingerprint@2.1::types -347ce746815607567f5f3b53e4800998ca5ab9355141f0880fc0cf0c1fc5c355 android.hardware.bluetooth@1.0::IBluetoothHci -835f41be2281bfb22f3e33c6fa870bde7bc21e37e5cfbaf9a36fff170632f754 android.hardware.bluetooth@1.0::IBluetoothHciCallbacks -a8dfd0dbe463a3cdbcf1d985b38a28b3d93ba2ae5a1d1db4aaef4c38a5781b91 android.hardware.bluetooth@1.0::types -7192d756aeba00aba32f4504981df8172ffca83e210c4838dabf295e53e93590 android.hardware.boot@1.0::IBootControl -cebaa803b8e33807a0d69f46652b650ccb549e8f9b19d6becbbf26690e828b49 android.hardware.boot@1.0::types -a98d49f23712a7cc327d1e0602d05f6f3ad32cfb5c74711d009c726611ee1c93 android.hardware.broadcastradio@1.0::IBroadcastRadio -ed82579c0c165feaa12d0e33c06b3342ab41ec0a439247f202775e8369e46ef6 android.hardware.broadcastradio@1.0::IBroadcastRadioFactory -da6ab32ee2793d2c86d3b603075d5383852b89d7eaa201861aa0473d418f3c7f android.hardware.broadcastradio@1.0::ITuner -04d3ca022e25c308d9efd2e7eb77b3a7a206907cdc1b9ea9326340b377868172 android.hardware.broadcastradio@1.0::ITunerCallback -bd42c8d7838cfed1998b49c39745dec116d2d6edc2c11a4c0399b8f3a1d1655a android.hardware.broadcastradio@1.0::types -81164323115d6588e259e8319fddf7487adfa1f49ce60f7e80ba74e0783392a4 android.hardware.camera.common@1.0::types -c1705e9d62438a1d955269965af915ae28e692bd480a3b1ce67056fef992d62f android.hardware.camera.device@1.0::ICameraDevice -78e9b44cf8660bdc1e98dca07451804153824efcd28db208a62f5ad728f44076 android.hardware.camera.device@1.0::ICameraDeviceCallback -28f0386ba86ddf41e53a8117b48a0328d7a4d2574213e89f4a1062398a244566 android.hardware.camera.device@1.0::ICameraDevicePreviewCallback -4db48439ce9dde97f1cfb3d7408f6c737f621ac0f7494aeea35ed599bc2352a3 android.hardware.camera.device@1.0::types -b32f9aeaf1c442195eb06ffc7600968c919d005b2718874f09c57287fae55918 android.hardware.camera.device@3.2::ICameraDevice -63bfc3da0f2d2301f7a0508c7c2b9ffc521d4d545ee03718da70e9d6273b3b21 android.hardware.camera.device@3.2::ICameraDeviceCallback -0fa3e1e64819283b8737fc4e5ab759f0cb4ac1a996e8a51cc4aa8025a457208e android.hardware.camera.device@3.2::ICameraDeviceSession -030be3d2b159cbde7920485807140f6b6064ef4a5de4a40a6c4bc8d2c72f7cd3 android.hardware.camera.device@3.2::types -5ba7947cee515d7a2359bfcbfb9678c1c3a768c288471919ac095b96ae6f3d40 android.hardware.camera.metadata@3.2::types -f7e299d85033ac52d1095a35784fcfeaff43603f58c751e4153c85bbade3b330 android.hardware.camera.provider@2.4::ICameraProvider -a501ca1aecd09f1b9fd70a9af84205430dbd49a808e8fa395d363b9902e6f58c android.hardware.camera.provider@2.4::ICameraProviderCallback -7f5fe8f4f8a24037153c504d8b4d3313c2ce33d81c8c69fe5194ddd2d4080e72 android.hardware.configstore@1.0::ISurfaceFlingerConfigs -87beacc481897cf02fb1628d75e68133de6d74d4cffe582cda2f5e16bdd74516 android.hardware.configstore@1.0::types -a5ae0fe8667f0b1af09b13e72d29600f4eb3853b257079c45a99b6f4a3360649 android.hardware.contexthub@1.0::IContexthub -2ab3054c2d9302d8417ee7495353a2887fe338f913276f2eb41e80f11395ec2e android.hardware.contexthub@1.0::IContexthubCallback -c3b2b37d561d31ea094411f251bf73bea334f4fe849a4390aef5e20bca6cadba android.hardware.contexthub@1.0::types -df174c1871c864b4c79ca9f64aae7936d24a272eca3191a30458ca2b706dec79 android.hardware.drm@1.0::ICryptoFactory -83639e90caeb996b0274e420de3cd556779de1ca48464b68eee799bef32b34cd android.hardware.drm@1.0::ICryptoPlugin -1440cffdfaeb12830ac10ee6ffdb0f1083e701057b806df11fb4787b4c91e718 android.hardware.drm@1.0::IDrmFactory -78ba33b108f620e6a0eec01ef654547e69a85754578ea4c9ef03ec205f16121c android.hardware.drm@1.0::IDrmPlugin -701d9e51952172364e4ea70db9c397f08c3b4577ba33051f050a6cdd532de1b4 android.hardware.drm@1.0::IDrmPluginListener -4238d62ad90df63aa338c6f1b6264c09c5a3706945d5c49d1189c0be1dc9e942 android.hardware.drm@1.0::types -f07b1ee3ba11a2fc9f200421b2e1afb7c1854ee987000e45c987fb9507795055 android.hardware.dumpstate@1.0::IDumpstateDevice -c9d318df7922bde3b265927b521ff5a965002826fc0cabfcaef52a56760f2d34 android.hardware.gatekeeper@1.0::IGatekeeper -da13bd69282fb275767abb18704c57ff8038e6c139ad17157dc702810f70d06a android.hardware.gatekeeper@1.0::types -37c7da4f823ec958dfa9c960e2d341c48f877e0bfa758f3fa9e2d9c1e1bd66d9 android.hardware.gnss@1.0::IAGnss -7ec9afdb964bfb8369866913caf018f2636592885bcb558a65de2c5436ab4f60 android.hardware.gnss@1.0::IAGnssCallback -d16e6a359be6963ea753d7138e84ecf2b93052097938938c4d36d7a47ea2e2ae android.hardware.gnss@1.0::IAGnssRil -2f907708d74d94b1e121ed27651c9c72af65952d347b58ff07dac5d5d7a7f678 android.hardware.gnss@1.0::IAGnssRilCallback -5ac7edad06d76064b882be161f3f9d9692a997ec72e9f36addb7fe8918f49992 android.hardware.gnss@1.0::IGnss -b05c983c87c3376e145223688c3b541b5e11b827f211e38d5a31af1ca3a2e222 android.hardware.gnss@1.0::IGnssBatching -4981d2d2c4e725c7544be0956099a91fc7bbc8048c563394158083fe924e651e android.hardware.gnss@1.0::IGnssBatchingCallback -3cd22d92cc1f935150c5048310e84886f14eed2556e8f00636733d204045cc4f android.hardware.gnss@1.0::IGnssCallback -175185a5eda87476193ca5461df75dd16d36664591e8130530dd8ef0eb2ddf6a android.hardware.gnss@1.0::IGnssConfiguration -4542122b96fbf27101cb8222bafb76e7c8d032d977dd1058edd8e5881ca5752f android.hardware.gnss@1.0::IGnssDebug -e6dd0c8416e523ab9cbd14d56ab6f016481a8aef3bc8a750051122d31075f6c7 android.hardware.gnss@1.0::IGnssGeofenceCallback -f90e4ddc652706299d8e3d8ba18e0745c3bae9bf4d1be6bd06d9c1f50ec8d28a android.hardware.gnss@1.0::IGnssGeofencing -9ea8987bb1089c8c5d7b67866575b866ef516045021d9efcc37c6352bce072a3 android.hardware.gnss@1.0::IGnssMeasurement -cf20492673d6a423e4c2e87fdfb5a4c4a602431721978db852e246f258e25edb android.hardware.gnss@1.0::IGnssMeasurementCallback -af85aa0f48ae99a39f4688c344e4419304f681f9af818a5c8d759286fc4418de android.hardware.gnss@1.0::IGnssNavigationMessage -76b0874ea4c06b29f66418c59820f4286b3be9629cd872923d0dfbb602cd432d android.hardware.gnss@1.0::IGnssNavigationMessageCallback -248bcf51da4273d64f367bf6877baef2feeaca365459842fd3c214a2dc6e0224 android.hardware.gnss@1.0::IGnssNi -c781b7b125f68be5db8a8c3d412d526acdbdf77dcc592a4c0ed70b8ce4fe6c49 android.hardware.gnss@1.0::IGnssNiCallback -c1142657de16fdb292a502372fe938614d65270ab8359217d6e13604fe4dbca4 android.hardware.gnss@1.0::IGnssXtra -bd366b83d8d565d0e8bfabff3adfcab0259d75b4e2a9f8e1b91e11d1593a2ffb android.hardware.gnss@1.0::IGnssXtraCallback -881bc2f94026784d194cffbff166c6e8bf911de4e02abe96fc7d89ec75b0574a android.hardware.gnss@1.0::types -17971eb8a482893dadcfc16e0583f492d42a034ef95d9b0b709417af30838396 android.hardware.graphics.allocator@2.0::IAllocator -60bf42a4898e4fb70dbd720b263aeafd7f35f5e1a5effeabb4d5d659878a5f18 android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer -b8a75617b9ec12bea641f3a73d4025a33e8b9a2f9169dd46094af56adf9249c5 android.hardware.graphics.bufferqueue@1.0::IProducerListener -4f6dedbcdd21c309dfc650acea81a096d6b242493ffe49c8d61bd3c43aad354e android.hardware.graphics.common@1.0::types -b3aac6c3817f039964fcd62268274b3039e17bd7d0d5b40b4d1d1c7b19a1f866 android.hardware.graphics.composer@2.1::IComposer -b19d00eb8a8b3b0034a0321f22e8f32162bf4c2aebbce6da22c025f56e459ea2 android.hardware.graphics.composer@2.1::IComposerCallback -61ee43ffe6fb6dbe8b22dc17c51ff3d5ba703fc6029cba211f901f3d79c8a72d android.hardware.graphics.composer@2.1::IComposerClient -1c98c2f5154345312ec054871792a2982ec5f3e2bc2abfb61a10c0b517978e20 android.hardware.graphics.composer@2.1::types -a695898589e1ef15b2b2510f11edd6aafac9918d9cf8d74b4b6143b309dee542 android.hardware.graphics.mapper@2.0::IMapper -28507d385a3dd224bf3c32f1bfd9f96092c4701b9c1cc66caa578fc3efc97877 android.hardware.graphics.mapper@2.0::types -91e2ba3805c923f01fc1231ec9ff838942aee3346f2d7614ecc0caeadbe57ed4 android.hardware.health@1.0::IHealth -1275aa2e8732909101b26aec49ed2285489e89d97b8610a8908b7868e35a3cc5 android.hardware.health@1.0::types -3a8d3922e06e6d4f8e0befc6be78d0e9e07aed1585b3da6521bed406d25a9483 android.hardware.ir@1.0::IConsumerIr -7090bd37912fcf723a12f4bc17783e3527577c4944805a028c296fd7a95bd682 android.hardware.ir@1.0::types -cc7925a78c0ab022515f48840d3dae76f384ed3a1287abadcb461a5cd5396163 android.hardware.keymaster@3.0::IKeymasterDevice -822998d7bb76f0cd719a409291434fcb56e6d50bc4780788bb157a3374d63b8c android.hardware.keymaster@3.0::types -d4ed2f0e14f9e914d0b1275d2e0363192fe30aca9059c84edb5fad15995f9ec4 android.hardware.light@2.0::ILight -d9584bfcaedd6e62cf337881748246b23e36cbc2bc3aa84c01b6a1e622061400 android.hardware.light@2.0::types -16c0cf0f73de1e5208a95020c6c6474903e7094f76b2d782651afaca0e5fd86f android.hardware.media@1.0::types -8bc2f5fdcad68856eb61a62fe4cc043fa064bb7f1dab95a71d1918ec1eef7b55 android.hardware.media.omx@1.0::IGraphicBufferSource -0d3de9cd89d4718ea3b772f2d8b93be004feb3abb7e7dc5402e37047cc730d05 android.hardware.media.omx@1.0::IOmx -32002e1c358c64de106c977a6dc6af7da27be4803a5bb66fd6f891a5ba0a1617 android.hardware.media.omx@1.0::IOmxBufferSource -81ad8d8bb1cf6f41923cf11dd39354a8fe433db284a234cc675de7e75a82224c android.hardware.media.omx@1.0::IOmxNode -494c0c8bf6065edc82ec127228ed19dd2243dc1c2f7d601c7c6be7b7015c1713 android.hardware.media.omx@1.0::IOmxObserver -252c2fc50c78fd6de8365e5b60e5115119ace107db0b94b0b26815cbf3d2b64a android.hardware.media.omx@1.0::IOmxStore -148c1b50b0958988373145ffdf5fa0e1b6534e0a2034a570e74b15c127cf7c5e android.hardware.media.omx@1.0::types -c66902fe48d687ac6740a3e32ae55fb75532c48c36c6386461c2b4416ad2e0f1 android.hardware.memtrack@1.0::IMemtrack -860bacd8b11a269c40567542b613fe4ca448d5cb4326d0058899e608e89dfca1 android.hardware.memtrack@1.0::types -07ac2dc95270321ec7d4c33cd25e5085a057f47fe350d645af6f7a7a11e3cf57 android.hardware.nfc@1.0::INfc -f2fe54426c07d67388d4774a60641ad4c0538f22eb6e1111722f231772655de6 android.hardware.nfc@1.0::INfcClientCallback -9626fd18db113d709faf593a70caf19bd0980294d23c468c80c30186f9d298a6 android.hardware.nfc@1.0::types -deee1dc4948f33af207e1008aba0f6cc07afb7900eab53f33192c8cac137eefc android.hardware.power@1.0::IPower -efc83df3f962b93c7c0290d691d7d300dabe12683e2cde3591fb3c0beedce20f android.hardware.power@1.0::types -9b5aa499ec3b4226f15f48f5ed08896e2fc0676f978c9e199c1da21daaf002a6 android.hardware.radio@1.0::IRadio -5c8efbb9c451a59737ed2c6c20230aae4745839ca01d8088d6dcc9020e52d2c5 android.hardware.radio@1.0::IRadioIndication -69f6b4b8ec40ca02ccc7bb8227a097135c20c00bd94c822e421cd9af1267252c android.hardware.radio@1.0::IRadioResponse -de3ab9f73b1073cd677b19d886fb927e9381b30161a704712d2b30f875873f5c android.hardware.radio@1.0::ISap -d183e406ef0897df2117a9dde384e8e6ea4fa6ab1c7f6f28e65b87011218c9ea android.hardware.radio@1.0::ISapCallback -96986fbd22f0e6ca752e1fcdc0a64bda213995a81f5f36bc4faf3532d9306b97 android.hardware.radio@1.0::types -00f70085d6fae1d482fb700a3fd42ed475384c95b51c9269b9ae5037b74ad4dd android.hardware.radio.deprecated@1.0::IOemHook -06837b6d7e843cfa9cd20fed4070feca7a9b5c81a9ed643bf7d06803455a9816 android.hardware.radio.deprecated@1.0::IOemHookIndication -6fd4874f0eddd4626a27658fd94fad526c317f3563439e79718bdb1a3a2309d5 android.hardware.radio.deprecated@1.0::IOemHookResponse -6983a2cafe39d5c57dfdc1743055fb0f757a0df8c78e00423d5e1810836927e1 android.hardware.renderscript@1.0::IContext -7f9417a0ccf78ea042ec7a8ac8e3750346d4d9d7e5ae01b1b35fde303f47c24d android.hardware.renderscript@1.0::IDevice -fc6f325b266b32353f7d1534fbe58e0d368265a12b77fa396fb556e8c443f739 android.hardware.renderscript@1.0::types -89585ff541c319de4091a5a0b687dd526ac81c6382ffd7b979a4164b3d7419a6 android.hardware.sensors@1.0::ISensors -e04ab978fc28f4c515f4a75617dfda8607733a64f13666beeb0e604a07a39333 android.hardware.sensors@1.0::types -5befc019cbe94953661e2cdb95e3cf64f5e565c29403e1c2daecc2be44e0a55c android.hardware.soundtrigger@2.0::ISoundTriggerHw -d7ec5f612a5e0a59ea4f2b61317e208ff56dd50920fd4eb441e0cbc8f97e4f49 android.hardware.soundtrigger@2.0::ISoundTriggerHwCallback -5bee9e70f7e5ec7ee252883b28f98f12b59960f4c2a0b4cc9a4526e4669ebcd4 android.hardware.soundtrigger@2.0::types -97f1ec446043bc5a6645b74529a6276496bdb35e0aee41eda55cb92d51eb7802 android.hardware.thermal@1.0::IThermal -84965a6908bceb4ef51546bf8731f309f1ea9d09a0177dcc7974132e523dd6d2 android.hardware.thermal@1.0::types -938850621c3c5ef426a4b88e752ba99b3559037e782a3d938604f3aef5cc0f1b android.hardware.tv.cec@1.0::IHdmiCec -e75b6eea711d36fac678bce072b3cec6544b27fa9f4cd903999404e5c110ca10 android.hardware.tv.cec@1.0::IHdmiCecCallback -6e25f8dbfadb668e1d4ec80eb9acd95d8bc9e0a240c36d27e662adb440314b95 android.hardware.tv.cec@1.0::types -0cafa3c8388e9631916d2d800f78decbcec2904f11415b32c71a31d9a51ebf79 android.hardware.tv.input@1.0::ITvInput -dee83e5c864fbbee8f02448d0800be32f06856386b9f907bc5d952208c9434f9 android.hardware.tv.input@1.0::ITvInputCallback -07aab30410b612381234dca6d453d4ab96f2e536368715717c6e28101b9851b5 android.hardware.tv.input@1.0::types -4ef57499273f38bdbdd0c15e56ee7a4bc5f18a5644092170a531df3541d9e015 android.hardware.usb@1.0::IUsb -4be7881e411ba42784bf5b7354c14ae0cf161004d39433aaecaab0d19ea99354 android.hardware.usb@1.0::IUsbCallback -f7e6e747910a3cd0a35846141e3b990a6a612a297b2b70ccd5740b646a450a8c android.hardware.usb@1.0::types -06ea64cc3565777f3b259e400ffa7100d07f3827ad9357b0c5d3c651384e5553 android.hardware.vibrator@1.0::IVibrator -0fecd34ae64f32eff6aa615fd662349242c0b8b6e303ef05a7cb5776c732f413 android.hardware.vibrator@1.0::types -4b962968a7df4ab104d1315d66a0a7348a713fecbb5d2c1b23688494458f37ce android.hardware.vr@1.0::IVr -b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi -ee0224ee18813506d9d6f13d8c8e4679f053c290a443a52a7c52a5d3c852262b android.hardware.wifi@1.0::IWifiApIface -f3eecc489deb4c74892f59eb7adb769063bd5c354ac132b626a5f42b363d36bc android.hardware.wifi@1.0::IWifiChip -a1b988377645a58e5e2542ca2bad4e17c21a4a389213d05de2f0e32d57b7d339 android.hardware.wifi@1.0::IWifiChipEventCallback -5ed6760ce77e84bc6c49d1acb3f7d8117c9176b3f06514bc44ad3af84c80dcfe android.hardware.wifi@1.0::IWifiEventCallback -6b9ad43a5efbe6ca214f751e22ce43cf5cd4d5d5f2cba80f24ccd3755a72401c android.hardware.wifi@1.0::IWifiIface -ba5aa74f1ba714f0093864227923492808795bda6199c4ea0891322d27f8c931 android.hardware.wifi@1.0::IWifiNanIface -325c94f3e1a565b56bbc74faddbd0ba7cb824f263dccf9dfff2daf62b86ed774 android.hardware.wifi@1.0::IWifiNanIfaceEventCallback -c2c3f0372b41780fb6dfe83c022296806c2024d7046682fd201de5aa9b791c7a android.hardware.wifi@1.0::IWifiP2pIface -766e9765f5c9c759b2a763c2288353fb5deff3389c2cc28f81d79c939704ce8b android.hardware.wifi@1.0::IWifiRttController -72ab6f3e120cbf07aa6f8e87ca89112bdeb36b7fbb96bce5af3712323ab8b8e6 android.hardware.wifi@1.0::IWifiRttControllerEventCallback -3b8093d39ef1e10e43c5538afbf5ff6e39b8d8168ebbe1998d993e89e25f14a5 android.hardware.wifi@1.0::IWifiStaIface -7fbfc551c3e23c8b4398c3e16e452b516457e6921424a53474cbf373ca306fa9 android.hardware.wifi@1.0::IWifiStaIfaceEventCallback -e20d5132d6d23e072c15de065b5e2aa13ff965031246a2c82581732bae56bf6d android.hardware.wifi@1.0::types -f7e55c08187d8c855068a1ee3d0c8daeee7570292d96509c21a8756d4f5cfb9b android.hardware.wifi.supplicant@1.0::ISupplicant -56b5c7267cb3d3337f44eb8b0b38ff4c6260dcc70e07687fcab94b1ccea8d159 android.hardware.wifi.supplicant@1.0::ISupplicantCallback -35ba7bcdf18f24a866a7e5429548f06768bb20a257f75b10a397c4d825ef8438 android.hardware.wifi.supplicant@1.0::ISupplicantIface -cda01008c06922fa37c1213e9bb831a109b3174532805616fb7161edc403866f android.hardware.wifi.supplicant@1.0::ISupplicantNetwork -4907410338c5e8dbeec4b5edc2608ea323f5561945f8810af81810c47b019184 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIface -8b63f5efa2e3be3a7cb8a428760d82285a4ab79bcbdea6ef90aa547555e582d4 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIfaceCallback -56128f74560571b6777d59453f35c6b35693ee377e2a23c807708906928f09de android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetwork -2067c22197bca9743dab66a6f561a8a8375c67b4f76aed05f776839499bd4c8f android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetworkCallback -7752e1de93aaf5fed37011c219ac247069f6af320b0810daa98510584a10e7b4 android.hardware.wifi.supplicant@1.0::ISupplicantStaIface -d781c8d7e7b3fe5cca8cf6e1d8806e770982ae5358c7816ed51b0f0ec272e70d android.hardware.wifi.supplicant@1.0::ISupplicantStaIfaceCallback -b12ef0bdd8a4d247a8a6e960b227ed32383f2b0241f55d67fcea6eff6a6737fa android.hardware.wifi.supplicant@1.0::ISupplicantStaNetwork -d8f0877ae1d321c1d884c7631dfe36cab0ec8a4b2863d4b687f85d3549a63bcc android.hardware.wifi.supplicant@1.0::ISupplicantStaNetworkCallback -fe3c3c2f572b72f15f8594c538b0577bd5c28722c31879cfe6231330cddb6747 android.hardware.wifi.supplicant@1.0::types - -# ABI preserving changes to HALs released in Android O - -78589343d8ee2e1b155acad3fbdc7fcbb6af94491aee968b2383c21627264f8b android.hardware.radio@1.0::IRadioResponse -c2c50ec74c87a583c683b4493f8f9f2e454a8d41c57af5b3eb88823a999f0ea4 android.hardware.radio@1.0::IRadioResponse diff --git a/prebuilt_hashes/27.txt b/prebuilt_hashes/27.txt deleted file mode 100644 index 23f2004b90..0000000000 --- a/prebuilt_hashes/27.txt +++ /dev/null @@ -1,249 +0,0 @@ -# Do not change this file except to add new interfaces. Changing -# pre-existing interfaces will fail VTS and break framework-only OTAs - -# HALs released in Android O - -f219c3b5b8c6cb1d659d4c7328f67246abfe1a8613f469826fd3b9ad090417a2 android.hardware.audio@2.0::IDevice -4d579cae1cd87a783fd49233e10ce720ba183cfd1d5ccd80149e69de5c1c7362 android.hardware.audio@2.0::IDevicesFactory -203e23f18011390b8cd10c303e0c16c4eebc8fa187e80e40d6be4624c2b0848a android.hardware.audio@2.0::IPrimaryDevice -aaf93123deec336eb247ad8099849469a541ca0cf7c28c5f5336cebe1ee86748 android.hardware.audio@2.0::IStream -0468c5723b0d44c5b451bdfa06153000c6f352fd3336e0ad2697127b04b766df android.hardware.audio@2.0::IStreamIn -7296f7064fd3ab24082b43a1da34cc876268065310b785499fba5178d063680a android.hardware.audio@2.0::IStreamOut -19d241d71c3e1140afba8140dcb57448446025a5fc03739788c4c25e9a98b6c2 android.hardware.audio@2.0::IStreamOutCallback -c84da9f586087227daa3b96d42b4575326bccfd5bc8a2a5acf86d774f8ea2648 android.hardware.audio@2.0::types -1305786c06e22b9b24ebde136054cc827b63c86d8bf4a136d6f7f54752b8566b android.hardware.audio.common@2.0::types -fa8fbae3d1da3c264e4f3110728076abc09b4e65f12af6ae136367328de988ab android.hardware.audio.effect@2.0::IAcousticEchoCancelerEffect -ca4752545d54547ff069eae161af7550cb5f5a7e8b60316ddd132a30906a68e7 android.hardware.audio.effect@2.0::IAutomaticGainControlEffect -d2b8af988dc66f514d886bcee44b440d8034bc2a762f7161717ef3c956073067 android.hardware.audio.effect@2.0::IBassBoostEffect -611bc09c75e796f3512b1ca6be508b0a9ba996759b8a2c60507784ff58076229 android.hardware.audio.effect@2.0::IDownmixEffect -36a57369dfdc75180e8b64ae80b1970db8f6d9085dbff6ca931715038cc056e1 android.hardware.audio.effect@2.0::IEffect -d2aa2df6d189c580f5be8460fa0ff4134d9c05a383f3204659baee426a6f0edf android.hardware.audio.effect@2.0::IEffectBufferProviderCallback -217f9161983a48d3bf3faeb158f868aa8bf0ce25889e4ee3d2bab1a2e8d33e77 android.hardware.audio.effect@2.0::IEffectsFactory -c2b38bc07991e880c83ca8cb88181411eeef708b8b936aedd2f2e0acade7df69 android.hardware.audio.effect@2.0::IEnvironmentalReverbEffect -2ff9f9704be5f167745b4de790e9dafc3cc4719e2f6e2e5497085e679853cfe7 android.hardware.audio.effect@2.0::IEqualizerEffect -c31447fb02dbc8b56c359941dad22f416511860173c5c5fd278d1bf2312b13de android.hardware.audio.effect@2.0::ILoudnessEnhancerEffect -804831ca258802eb3eb65a0a7b5d5e3d37d4a15ba8c2836b4276eda98b47e1d0 android.hardware.audio.effect@2.0::INoiseSuppressionEffect -778fd5b9837f481d8e47425b3e2a3bd0c6362a0b6870291518e2d863530fdb61 android.hardware.audio.effect@2.0::IPresetReverbEffect -c93cb25a1a92d07aa80a617c01e8d22fc97bf8cefd3962b6a5be386ad4704d89 android.hardware.audio.effect@2.0::IVirtualizerEffect -918f331780c9c7b04f2151a2e563aab088198ede8e6f865302ebaa13905bd9ce android.hardware.audio.effect@2.0::IVisualizerEffect -4caad099f8fc00262b6c03ba41271808b37cea90ac98b534299bbf4ee823af02 android.hardware.audio.effect@2.0::types -# android.hardware.automotive.* are unfrozen -1fbdc1f852f8bd2e4a6c5cb30ac2b78668c98dce118a61762d4034ae859f43d8 android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprint -aabb5c3c585592d71ee57b77298c14993d77914ddeaa64b2c5109a602b02ea47 android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprintClientCallback -1ec60d4efddae9a7b2469278a576967b4751e88de5b8d7e9df6eff6bc0da7bc9 android.hardware.biometrics.fingerprint@2.1::types -347ce746815607567f5f3b53e4800998ca5ab9355141f0880fc0cf0c1fc5c355 android.hardware.bluetooth@1.0::IBluetoothHci -835f41be2281bfb22f3e33c6fa870bde7bc21e37e5cfbaf9a36fff170632f754 android.hardware.bluetooth@1.0::IBluetoothHciCallbacks -a8dfd0dbe463a3cdbcf1d985b38a28b3d93ba2ae5a1d1db4aaef4c38a5781b91 android.hardware.bluetooth@1.0::types -7192d756aeba00aba32f4504981df8172ffca83e210c4838dabf295e53e93590 android.hardware.boot@1.0::IBootControl -cebaa803b8e33807a0d69f46652b650ccb549e8f9b19d6becbbf26690e828b49 android.hardware.boot@1.0::types -a98d49f23712a7cc327d1e0602d05f6f3ad32cfb5c74711d009c726611ee1c93 android.hardware.broadcastradio@1.0::IBroadcastRadio -ed82579c0c165feaa12d0e33c06b3342ab41ec0a439247f202775e8369e46ef6 android.hardware.broadcastradio@1.0::IBroadcastRadioFactory -da6ab32ee2793d2c86d3b603075d5383852b89d7eaa201861aa0473d418f3c7f android.hardware.broadcastradio@1.0::ITuner -04d3ca022e25c308d9efd2e7eb77b3a7a206907cdc1b9ea9326340b377868172 android.hardware.broadcastradio@1.0::ITunerCallback -bd42c8d7838cfed1998b49c39745dec116d2d6edc2c11a4c0399b8f3a1d1655a android.hardware.broadcastradio@1.0::types -81164323115d6588e259e8319fddf7487adfa1f49ce60f7e80ba74e0783392a4 android.hardware.camera.common@1.0::types -c1705e9d62438a1d955269965af915ae28e692bd480a3b1ce67056fef992d62f android.hardware.camera.device@1.0::ICameraDevice -78e9b44cf8660bdc1e98dca07451804153824efcd28db208a62f5ad728f44076 android.hardware.camera.device@1.0::ICameraDeviceCallback -28f0386ba86ddf41e53a8117b48a0328d7a4d2574213e89f4a1062398a244566 android.hardware.camera.device@1.0::ICameraDevicePreviewCallback -4db48439ce9dde97f1cfb3d7408f6c737f621ac0f7494aeea35ed599bc2352a3 android.hardware.camera.device@1.0::types -b32f9aeaf1c442195eb06ffc7600968c919d005b2718874f09c57287fae55918 android.hardware.camera.device@3.2::ICameraDevice -63bfc3da0f2d2301f7a0508c7c2b9ffc521d4d545ee03718da70e9d6273b3b21 android.hardware.camera.device@3.2::ICameraDeviceCallback -0fa3e1e64819283b8737fc4e5ab759f0cb4ac1a996e8a51cc4aa8025a457208e android.hardware.camera.device@3.2::ICameraDeviceSession -030be3d2b159cbde7920485807140f6b6064ef4a5de4a40a6c4bc8d2c72f7cd3 android.hardware.camera.device@3.2::types -5ba7947cee515d7a2359bfcbfb9678c1c3a768c288471919ac095b96ae6f3d40 android.hardware.camera.metadata@3.2::types -f7e299d85033ac52d1095a35784fcfeaff43603f58c751e4153c85bbade3b330 android.hardware.camera.provider@2.4::ICameraProvider -a501ca1aecd09f1b9fd70a9af84205430dbd49a808e8fa395d363b9902e6f58c android.hardware.camera.provider@2.4::ICameraProviderCallback -7f5fe8f4f8a24037153c504d8b4d3313c2ce33d81c8c69fe5194ddd2d4080e72 android.hardware.configstore@1.0::ISurfaceFlingerConfigs -87beacc481897cf02fb1628d75e68133de6d74d4cffe582cda2f5e16bdd74516 android.hardware.configstore@1.0::types -a5ae0fe8667f0b1af09b13e72d29600f4eb3853b257079c45a99b6f4a3360649 android.hardware.contexthub@1.0::IContexthub -2ab3054c2d9302d8417ee7495353a2887fe338f913276f2eb41e80f11395ec2e android.hardware.contexthub@1.0::IContexthubCallback -c3b2b37d561d31ea094411f251bf73bea334f4fe849a4390aef5e20bca6cadba android.hardware.contexthub@1.0::types -df174c1871c864b4c79ca9f64aae7936d24a272eca3191a30458ca2b706dec79 android.hardware.drm@1.0::ICryptoFactory -83639e90caeb996b0274e420de3cd556779de1ca48464b68eee799bef32b34cd android.hardware.drm@1.0::ICryptoPlugin -1440cffdfaeb12830ac10ee6ffdb0f1083e701057b806df11fb4787b4c91e718 android.hardware.drm@1.0::IDrmFactory -78ba33b108f620e6a0eec01ef654547e69a85754578ea4c9ef03ec205f16121c android.hardware.drm@1.0::IDrmPlugin -701d9e51952172364e4ea70db9c397f08c3b4577ba33051f050a6cdd532de1b4 android.hardware.drm@1.0::IDrmPluginListener -4238d62ad90df63aa338c6f1b6264c09c5a3706945d5c49d1189c0be1dc9e942 android.hardware.drm@1.0::types -f07b1ee3ba11a2fc9f200421b2e1afb7c1854ee987000e45c987fb9507795055 android.hardware.dumpstate@1.0::IDumpstateDevice -c9d318df7922bde3b265927b521ff5a965002826fc0cabfcaef52a56760f2d34 android.hardware.gatekeeper@1.0::IGatekeeper -da13bd69282fb275767abb18704c57ff8038e6c139ad17157dc702810f70d06a android.hardware.gatekeeper@1.0::types -37c7da4f823ec958dfa9c960e2d341c48f877e0bfa758f3fa9e2d9c1e1bd66d9 android.hardware.gnss@1.0::IAGnss -7ec9afdb964bfb8369866913caf018f2636592885bcb558a65de2c5436ab4f60 android.hardware.gnss@1.0::IAGnssCallback -d16e6a359be6963ea753d7138e84ecf2b93052097938938c4d36d7a47ea2e2ae android.hardware.gnss@1.0::IAGnssRil -2f907708d74d94b1e121ed27651c9c72af65952d347b58ff07dac5d5d7a7f678 android.hardware.gnss@1.0::IAGnssRilCallback -5ac7edad06d76064b882be161f3f9d9692a997ec72e9f36addb7fe8918f49992 android.hardware.gnss@1.0::IGnss -b05c983c87c3376e145223688c3b541b5e11b827f211e38d5a31af1ca3a2e222 android.hardware.gnss@1.0::IGnssBatching -4981d2d2c4e725c7544be0956099a91fc7bbc8048c563394158083fe924e651e android.hardware.gnss@1.0::IGnssBatchingCallback -3cd22d92cc1f935150c5048310e84886f14eed2556e8f00636733d204045cc4f android.hardware.gnss@1.0::IGnssCallback -175185a5eda87476193ca5461df75dd16d36664591e8130530dd8ef0eb2ddf6a android.hardware.gnss@1.0::IGnssConfiguration -4542122b96fbf27101cb8222bafb76e7c8d032d977dd1058edd8e5881ca5752f android.hardware.gnss@1.0::IGnssDebug -e6dd0c8416e523ab9cbd14d56ab6f016481a8aef3bc8a750051122d31075f6c7 android.hardware.gnss@1.0::IGnssGeofenceCallback -f90e4ddc652706299d8e3d8ba18e0745c3bae9bf4d1be6bd06d9c1f50ec8d28a android.hardware.gnss@1.0::IGnssGeofencing -9ea8987bb1089c8c5d7b67866575b866ef516045021d9efcc37c6352bce072a3 android.hardware.gnss@1.0::IGnssMeasurement -cf20492673d6a423e4c2e87fdfb5a4c4a602431721978db852e246f258e25edb android.hardware.gnss@1.0::IGnssMeasurementCallback -af85aa0f48ae99a39f4688c344e4419304f681f9af818a5c8d759286fc4418de android.hardware.gnss@1.0::IGnssNavigationMessage -76b0874ea4c06b29f66418c59820f4286b3be9629cd872923d0dfbb602cd432d android.hardware.gnss@1.0::IGnssNavigationMessageCallback -248bcf51da4273d64f367bf6877baef2feeaca365459842fd3c214a2dc6e0224 android.hardware.gnss@1.0::IGnssNi -c781b7b125f68be5db8a8c3d412d526acdbdf77dcc592a4c0ed70b8ce4fe6c49 android.hardware.gnss@1.0::IGnssNiCallback -c1142657de16fdb292a502372fe938614d65270ab8359217d6e13604fe4dbca4 android.hardware.gnss@1.0::IGnssXtra -bd366b83d8d565d0e8bfabff3adfcab0259d75b4e2a9f8e1b91e11d1593a2ffb android.hardware.gnss@1.0::IGnssXtraCallback -881bc2f94026784d194cffbff166c6e8bf911de4e02abe96fc7d89ec75b0574a android.hardware.gnss@1.0::types -17971eb8a482893dadcfc16e0583f492d42a034ef95d9b0b709417af30838396 android.hardware.graphics.allocator@2.0::IAllocator -60bf42a4898e4fb70dbd720b263aeafd7f35f5e1a5effeabb4d5d659878a5f18 android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer -b8a75617b9ec12bea641f3a73d4025a33e8b9a2f9169dd46094af56adf9249c5 android.hardware.graphics.bufferqueue@1.0::IProducerListener -4f6dedbcdd21c309dfc650acea81a096d6b242493ffe49c8d61bd3c43aad354e android.hardware.graphics.common@1.0::types -b3aac6c3817f039964fcd62268274b3039e17bd7d0d5b40b4d1d1c7b19a1f866 android.hardware.graphics.composer@2.1::IComposer -b19d00eb8a8b3b0034a0321f22e8f32162bf4c2aebbce6da22c025f56e459ea2 android.hardware.graphics.composer@2.1::IComposerCallback -61ee43ffe6fb6dbe8b22dc17c51ff3d5ba703fc6029cba211f901f3d79c8a72d android.hardware.graphics.composer@2.1::IComposerClient -1c98c2f5154345312ec054871792a2982ec5f3e2bc2abfb61a10c0b517978e20 android.hardware.graphics.composer@2.1::types -a695898589e1ef15b2b2510f11edd6aafac9918d9cf8d74b4b6143b309dee542 android.hardware.graphics.mapper@2.0::IMapper -28507d385a3dd224bf3c32f1bfd9f96092c4701b9c1cc66caa578fc3efc97877 android.hardware.graphics.mapper@2.0::types -91e2ba3805c923f01fc1231ec9ff838942aee3346f2d7614ecc0caeadbe57ed4 android.hardware.health@1.0::IHealth -1275aa2e8732909101b26aec49ed2285489e89d97b8610a8908b7868e35a3cc5 android.hardware.health@1.0::types -3a8d3922e06e6d4f8e0befc6be78d0e9e07aed1585b3da6521bed406d25a9483 android.hardware.ir@1.0::IConsumerIr -7090bd37912fcf723a12f4bc17783e3527577c4944805a028c296fd7a95bd682 android.hardware.ir@1.0::types -cc7925a78c0ab022515f48840d3dae76f384ed3a1287abadcb461a5cd5396163 android.hardware.keymaster@3.0::IKeymasterDevice -822998d7bb76f0cd719a409291434fcb56e6d50bc4780788bb157a3374d63b8c android.hardware.keymaster@3.0::types -d4ed2f0e14f9e914d0b1275d2e0363192fe30aca9059c84edb5fad15995f9ec4 android.hardware.light@2.0::ILight -d9584bfcaedd6e62cf337881748246b23e36cbc2bc3aa84c01b6a1e622061400 android.hardware.light@2.0::types -16c0cf0f73de1e5208a95020c6c6474903e7094f76b2d782651afaca0e5fd86f android.hardware.media@1.0::types -8bc2f5fdcad68856eb61a62fe4cc043fa064bb7f1dab95a71d1918ec1eef7b55 android.hardware.media.omx@1.0::IGraphicBufferSource -0d3de9cd89d4718ea3b772f2d8b93be004feb3abb7e7dc5402e37047cc730d05 android.hardware.media.omx@1.0::IOmx -32002e1c358c64de106c977a6dc6af7da27be4803a5bb66fd6f891a5ba0a1617 android.hardware.media.omx@1.0::IOmxBufferSource -81ad8d8bb1cf6f41923cf11dd39354a8fe433db284a234cc675de7e75a82224c android.hardware.media.omx@1.0::IOmxNode -494c0c8bf6065edc82ec127228ed19dd2243dc1c2f7d601c7c6be7b7015c1713 android.hardware.media.omx@1.0::IOmxObserver -252c2fc50c78fd6de8365e5b60e5115119ace107db0b94b0b26815cbf3d2b64a android.hardware.media.omx@1.0::IOmxStore -148c1b50b0958988373145ffdf5fa0e1b6534e0a2034a570e74b15c127cf7c5e android.hardware.media.omx@1.0::types -c66902fe48d687ac6740a3e32ae55fb75532c48c36c6386461c2b4416ad2e0f1 android.hardware.memtrack@1.0::IMemtrack -860bacd8b11a269c40567542b613fe4ca448d5cb4326d0058899e608e89dfca1 android.hardware.memtrack@1.0::types -07ac2dc95270321ec7d4c33cd25e5085a057f47fe350d645af6f7a7a11e3cf57 android.hardware.nfc@1.0::INfc -f2fe54426c07d67388d4774a60641ad4c0538f22eb6e1111722f231772655de6 android.hardware.nfc@1.0::INfcClientCallback -9626fd18db113d709faf593a70caf19bd0980294d23c468c80c30186f9d298a6 android.hardware.nfc@1.0::types -deee1dc4948f33af207e1008aba0f6cc07afb7900eab53f33192c8cac137eefc android.hardware.power@1.0::IPower -efc83df3f962b93c7c0290d691d7d300dabe12683e2cde3591fb3c0beedce20f android.hardware.power@1.0::types -9b5aa499ec3b4226f15f48f5ed08896e2fc0676f978c9e199c1da21daaf002a6 android.hardware.radio@1.0::IRadio -5c8efbb9c451a59737ed2c6c20230aae4745839ca01d8088d6dcc9020e52d2c5 android.hardware.radio@1.0::IRadioIndication -69f6b4b8ec40ca02ccc7bb8227a097135c20c00bd94c822e421cd9af1267252c android.hardware.radio@1.0::IRadioResponse -de3ab9f73b1073cd677b19d886fb927e9381b30161a704712d2b30f875873f5c android.hardware.radio@1.0::ISap -d183e406ef0897df2117a9dde384e8e6ea4fa6ab1c7f6f28e65b87011218c9ea android.hardware.radio@1.0::ISapCallback -96986fbd22f0e6ca752e1fcdc0a64bda213995a81f5f36bc4faf3532d9306b97 android.hardware.radio@1.0::types -00f70085d6fae1d482fb700a3fd42ed475384c95b51c9269b9ae5037b74ad4dd android.hardware.radio.deprecated@1.0::IOemHook -06837b6d7e843cfa9cd20fed4070feca7a9b5c81a9ed643bf7d06803455a9816 android.hardware.radio.deprecated@1.0::IOemHookIndication -6fd4874f0eddd4626a27658fd94fad526c317f3563439e79718bdb1a3a2309d5 android.hardware.radio.deprecated@1.0::IOemHookResponse -6983a2cafe39d5c57dfdc1743055fb0f757a0df8c78e00423d5e1810836927e1 android.hardware.renderscript@1.0::IContext -7f9417a0ccf78ea042ec7a8ac8e3750346d4d9d7e5ae01b1b35fde303f47c24d android.hardware.renderscript@1.0::IDevice -fc6f325b266b32353f7d1534fbe58e0d368265a12b77fa396fb556e8c443f739 android.hardware.renderscript@1.0::types -89585ff541c319de4091a5a0b687dd526ac81c6382ffd7b979a4164b3d7419a6 android.hardware.sensors@1.0::ISensors -e04ab978fc28f4c515f4a75617dfda8607733a64f13666beeb0e604a07a39333 android.hardware.sensors@1.0::types -5befc019cbe94953661e2cdb95e3cf64f5e565c29403e1c2daecc2be44e0a55c android.hardware.soundtrigger@2.0::ISoundTriggerHw -d7ec5f612a5e0a59ea4f2b61317e208ff56dd50920fd4eb441e0cbc8f97e4f49 android.hardware.soundtrigger@2.0::ISoundTriggerHwCallback -5bee9e70f7e5ec7ee252883b28f98f12b59960f4c2a0b4cc9a4526e4669ebcd4 android.hardware.soundtrigger@2.0::types -97f1ec446043bc5a6645b74529a6276496bdb35e0aee41eda55cb92d51eb7802 android.hardware.thermal@1.0::IThermal -84965a6908bceb4ef51546bf8731f309f1ea9d09a0177dcc7974132e523dd6d2 android.hardware.thermal@1.0::types -938850621c3c5ef426a4b88e752ba99b3559037e782a3d938604f3aef5cc0f1b android.hardware.tv.cec@1.0::IHdmiCec -e75b6eea711d36fac678bce072b3cec6544b27fa9f4cd903999404e5c110ca10 android.hardware.tv.cec@1.0::IHdmiCecCallback -6e25f8dbfadb668e1d4ec80eb9acd95d8bc9e0a240c36d27e662adb440314b95 android.hardware.tv.cec@1.0::types -0cafa3c8388e9631916d2d800f78decbcec2904f11415b32c71a31d9a51ebf79 android.hardware.tv.input@1.0::ITvInput -dee83e5c864fbbee8f02448d0800be32f06856386b9f907bc5d952208c9434f9 android.hardware.tv.input@1.0::ITvInputCallback -07aab30410b612381234dca6d453d4ab96f2e536368715717c6e28101b9851b5 android.hardware.tv.input@1.0::types -4ef57499273f38bdbdd0c15e56ee7a4bc5f18a5644092170a531df3541d9e015 android.hardware.usb@1.0::IUsb -4be7881e411ba42784bf5b7354c14ae0cf161004d39433aaecaab0d19ea99354 android.hardware.usb@1.0::IUsbCallback -f7e6e747910a3cd0a35846141e3b990a6a612a297b2b70ccd5740b646a450a8c android.hardware.usb@1.0::types -06ea64cc3565777f3b259e400ffa7100d07f3827ad9357b0c5d3c651384e5553 android.hardware.vibrator@1.0::IVibrator -0fecd34ae64f32eff6aa615fd662349242c0b8b6e303ef05a7cb5776c732f413 android.hardware.vibrator@1.0::types -4b962968a7df4ab104d1315d66a0a7348a713fecbb5d2c1b23688494458f37ce android.hardware.vr@1.0::IVr -b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi -ee0224ee18813506d9d6f13d8c8e4679f053c290a443a52a7c52a5d3c852262b android.hardware.wifi@1.0::IWifiApIface -f3eecc489deb4c74892f59eb7adb769063bd5c354ac132b626a5f42b363d36bc android.hardware.wifi@1.0::IWifiChip -a1b988377645a58e5e2542ca2bad4e17c21a4a389213d05de2f0e32d57b7d339 android.hardware.wifi@1.0::IWifiChipEventCallback -5ed6760ce77e84bc6c49d1acb3f7d8117c9176b3f06514bc44ad3af84c80dcfe android.hardware.wifi@1.0::IWifiEventCallback -6b9ad43a5efbe6ca214f751e22ce43cf5cd4d5d5f2cba80f24ccd3755a72401c android.hardware.wifi@1.0::IWifiIface -ba5aa74f1ba714f0093864227923492808795bda6199c4ea0891322d27f8c931 android.hardware.wifi@1.0::IWifiNanIface -325c94f3e1a565b56bbc74faddbd0ba7cb824f263dccf9dfff2daf62b86ed774 android.hardware.wifi@1.0::IWifiNanIfaceEventCallback -c2c3f0372b41780fb6dfe83c022296806c2024d7046682fd201de5aa9b791c7a android.hardware.wifi@1.0::IWifiP2pIface -766e9765f5c9c759b2a763c2288353fb5deff3389c2cc28f81d79c939704ce8b android.hardware.wifi@1.0::IWifiRttController -72ab6f3e120cbf07aa6f8e87ca89112bdeb36b7fbb96bce5af3712323ab8b8e6 android.hardware.wifi@1.0::IWifiRttControllerEventCallback -3b8093d39ef1e10e43c5538afbf5ff6e39b8d8168ebbe1998d993e89e25f14a5 android.hardware.wifi@1.0::IWifiStaIface -7fbfc551c3e23c8b4398c3e16e452b516457e6921424a53474cbf373ca306fa9 android.hardware.wifi@1.0::IWifiStaIfaceEventCallback -e20d5132d6d23e072c15de065b5e2aa13ff965031246a2c82581732bae56bf6d android.hardware.wifi@1.0::types -f7e55c08187d8c855068a1ee3d0c8daeee7570292d96509c21a8756d4f5cfb9b android.hardware.wifi.supplicant@1.0::ISupplicant -56b5c7267cb3d3337f44eb8b0b38ff4c6260dcc70e07687fcab94b1ccea8d159 android.hardware.wifi.supplicant@1.0::ISupplicantCallback -35ba7bcdf18f24a866a7e5429548f06768bb20a257f75b10a397c4d825ef8438 android.hardware.wifi.supplicant@1.0::ISupplicantIface -cda01008c06922fa37c1213e9bb831a109b3174532805616fb7161edc403866f android.hardware.wifi.supplicant@1.0::ISupplicantNetwork -4907410338c5e8dbeec4b5edc2608ea323f5561945f8810af81810c47b019184 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIface -8b63f5efa2e3be3a7cb8a428760d82285a4ab79bcbdea6ef90aa547555e582d4 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIfaceCallback -56128f74560571b6777d59453f35c6b35693ee377e2a23c807708906928f09de android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetwork -2067c22197bca9743dab66a6f561a8a8375c67b4f76aed05f776839499bd4c8f android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetworkCallback -7752e1de93aaf5fed37011c219ac247069f6af320b0810daa98510584a10e7b4 android.hardware.wifi.supplicant@1.0::ISupplicantStaIface -d781c8d7e7b3fe5cca8cf6e1d8806e770982ae5358c7816ed51b0f0ec272e70d android.hardware.wifi.supplicant@1.0::ISupplicantStaIfaceCallback -b12ef0bdd8a4d247a8a6e960b227ed32383f2b0241f55d67fcea6eff6a6737fa android.hardware.wifi.supplicant@1.0::ISupplicantStaNetwork -d8f0877ae1d321c1d884c7631dfe36cab0ec8a4b2863d4b687f85d3549a63bcc android.hardware.wifi.supplicant@1.0::ISupplicantStaNetworkCallback -fe3c3c2f572b72f15f8594c538b0577bd5c28722c31879cfe6231330cddb6747 android.hardware.wifi.supplicant@1.0::types - -# ABI preserving changes to HALs during Android O MR1 (Initial Set) - -# android.hardware.automotive.* are unfrozen -150a338ce11fcec70757c9675d83cf6a5d7b40d0c812741b91671fecce59eac9 android.hardware.broadcastradio@1.0::types -dc7e6d4f537b9943e27edc4f86c5a03bb643b18f18f866f8c3c71c0ac4ea8cbc android.hardware.broadcastradio@1.0::types -760485232f6cce07f8bb05e3475509956996b702f77415ee5bff05e2ec5a5bcc android.hardware.dumpstate@1.0::IDumpstateDevice -e822cb7f4a1bdd45689c5e92ccd19a2201c20b771bd4b2ec1ae627e324591f9d android.hardware.radio@1.0::IRadioResponse -6e69adb24d7c0b0ca3a54a38c49a5625b161b3f5d5f7d6fda0befdbbfc8e9e06 android.hardware.radio@1.0::IRadioResponse -28e929b453df3d9f5060af2764e6cdb123ddb893e3e86923c877f6ff7e5f02c9 android.hardware.wifi@1.0::types -df1d7b27e644bfed0a4f606a8c44d35d45cafce82c7c648494c8a25c7cd4a949 android.hardware.wifi@1.0::types - -# HALs released in Android O MR1 (Initial Set) - -4b65763663a94a3920134011691f8fbb42ccb7b7795589efddc049a9106047d6 android.hardware.oemlock@1.0::IOemLock -e02cd3722cb5e8fa51179f5defacb4f7866f903c9c7c51dc01a3148473a71525 android.hardware.oemlock@1.0::types -224f9d22a367a0016f09b6dc676f53f1446697d9dc747163032329e5da552de5 android.hardware.power@1.1::IPower -574fd9758b7cab4922c72cc5a9f36d1cd48ffd3425fdd776426653280d3d4138 android.hardware.power@1.1::types -f79edf50a378a9c9bb737f93f205dab91b4c63ea49723afc6f856c138203ea81 android.hardware.radio@1.1::IRadio -fcc5c8c88b85a9f63fba67d9e674da466c72a98ca287f343fb5721d098713f86 android.hardware.radio@1.1::IRadioIndication -50f27e8c7ec009d5d4418b2ce8392b940bbf052ecc1d7251285f332485a5ba4e android.hardware.radio@1.1::IRadioResponse -be981148c95c0089f3ae92854f0e7ae999d308e927db3e065f12a4fabe07852f android.hardware.radio@1.1::ISap -d8d6bf7b4d36c04ce587df75953c3f723cfbe71c896c1aa8ab6478eae126723d android.hardware.radio@1.1::types -d8aae01606bfd34bf2fb9a59cadc016f46f318e56cddb8f15a945c5b3c1222bc android.hardware.tetheroffload.config@1.0::IOffloadConfig -447b00306bc95a7aafec1d660f6f3e9f76ac8bc0353193435e5579ab833da619 android.hardware.tetheroffload.control@1.0::IOffloadControl -07658829339d75962016e00ed81b005ad29fca7ac12ad3bc3ccd86b08d94c2d3 android.hardware.tetheroffload.control@1.0::ITetheringOffloadCallback -0df5b0178af15c53cdce8fcf8ca14035e8e08db4fa76fdc12009ddbe0b53626b android.hardware.tetheroffload.control@1.0::types -b30ef02ef26ff804e2f6acf1201bc141b59e134e6a0338562284491102cb13e3 android.hardware.usb@1.1::IUsb -13a580e35af01270a1e9774177c51db51d8672e6139ba00851e654e68a4d7dff android.hardware.usb@1.1::IUsbCallback -f0ed667288908c08fced570bd1f3c4a0f236aa927938e805f0d9fece525da81e android.hardware.usb@1.1::types -f95a1e85612f2d0d616eacd2eb63c52d10dfa889f165df57697c30e1f47b4785 android.hardware.vibrator@1.1::IVibrator -246fb9d9e2b4800aeb0adc3cdbaa15d0321ebab54b7bd1ab87da5b67c7b0b064 android.hardware.vibrator@1.1::types -9bc43413b80cd0c59a022e93da1448dcb82dd10c6dd31932df4659e4bdcb1368 android.hardware.weaver@1.0::IWeaver -7728b0393a2ed9796537d4165c7d95407e9d8cb447a647b545fdfe06a28689e7 android.hardware.weaver@1.0::types -bb7c96762d0aa3ddb874c8815bacdd3cbc8fb87ea2f82b928bc29e24a3593055 android.hardware.wifi.offload@1.0::IOffload -c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback -b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types -c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi -b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip - -# ABI preserving changes to HALs during Android O MR1 (Final Set) -2d833aeed0cd1d59437aca210be590a953cf32bcb6683cd63d089762a643fb49 android.hardware.radio@1.0::IRadioResponse -05aa3de6130a9788fdb6f4d3cc57c3ea90f067e77a5e09d6a772ec7f6bca33d2 android.hardware.radio@1.1::IRadioResponse - -# HALs released in Android O MR1 (Final Set) -044cb039378b8a0e36f40ff1e6ce04dc0d339da02095f968d5062a051e99d108 android.hardware.broadcastradio@1.1::types -c9699483f8cefe4f9b39b4b9609b76cab2dd1659a06188056b45797d337d4256 android.hardware.broadcastradio@1.1::IBroadcastRadio -b5d62dcd663fc4fcc977b252af59b333043bdfe73de2f11fe6d6a8bf438a0f92 android.hardware.broadcastradio@1.1::IBroadcastRadioFactory -bc7e054a6e93adebedff345aeed44549be89e6b1b6ffe071ff47a61de764b232 android.hardware.broadcastradio@1.1::ITuner -e9139fc755be578693f17c8cd1e27c75f412cfc722157bab5bf03ee68896e31d android.hardware.broadcastradio@1.1::ITunerCallback -63929c99e5755d9e09d9e0fd2527391fbb1609dda0508f5933b7943b92ae0fbc android.hardware.camera.device@3.3::types -bbcfc3f748b078f6a66c4e228084a679d30bd61bfde8bb7a91efd507b91c1bfd android.hardware.camera.device@3.3::ICameraDeviceSession -4a6998cd6793a3f9f03989c29d662589b1bc9d38826c6698c6c17864f7a814f5 android.hardware.cas@1.0::types -0e656ba1bac11461a17096ef752b69d24b000d820ef5652f0150a0f9731d54c2 android.hardware.cas@1.0::ICas -b80e1456b81f80032d0de7cb45652ac15af11e7474d520d757481ecaad796dff android.hardware.cas@1.0::ICasListener -a432d6d9200248dc2126827bcd6cdea31dd65eff39b939f64585d27d915a5857 android.hardware.cas@1.0::IDescramblerBase -86ba9c03978b79a742e990420bc5ced0673d25a939f82572996bef92621e2014 android.hardware.cas@1.0::IMediaCasService -503da837d1a67cbdb7c08a033e927e5430ae1b159d98bf72c6336b4dcc5e76f5 android.hardware.cas.native@1.0::types -619600109232ed64b827c8a11beed8070b1827ae464547d7aa146cf0473b4bca android.hardware.cas.native@1.0::IDescrambler -0a159f81359cd4f71bbe00972ee8403ea79351fb7c0cd48be72ebb3e424dbaef android.hardware.radio@1.0::types -09342041e17c429fce0034b9096d17849122111436a5f0053e7e59500e1cb89c android.hardware.media.omx@1.0::IOmxStore -246a56d37d57a47224562c9d077b4a2886ce6242b9311bd98a17325944c280d7 android.hardware.neuralnetworks@1.0::types -93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 android.hardware.neuralnetworks@1.0::IDevice -f66f9a38541bf92001d3adcce678cd7e3da2262124befb460b1c9aea9492813b android.hardware.neuralnetworks@1.0::IExecutionCallback -953607822954435874f4b81686440a604e2a88cdd2d9164c6293f3d5772510d7 android.hardware.neuralnetworks@1.0::IPreparedModel -73e03573494ba96f0e711ab7f1956c5b2d54c3da690cd7ecf4d6d0f287447730 android.hardware.neuralnetworks@1.0::IPreparedModelCallback -f4945e397b5dea41bb64518dfde59be71245d8a125fd1e0acffeb57ac7b08fed android.hardware.thermal@1.1::IThermal -c8bc853546dd55584611def2a9fa1d99f657e3366c976d2f60fe6b8aa6d2cb87 android.hardware.thermal@1.1::IThermalCallback diff --git a/prebuilt_hashes/28.txt b/prebuilt_hashes/28.txt deleted file mode 100644 index 8a45ca579b..0000000000 --- a/prebuilt_hashes/28.txt +++ /dev/null @@ -1,384 +0,0 @@ -# Do not change this file except to add new interfaces. Changing -# pre-existing interfaces will fail VTS and break framework-only OTAs - -# HALs released in Android O - -f219c3b5b8c6cb1d659d4c7328f67246abfe1a8613f469826fd3b9ad090417a2 android.hardware.audio@2.0::IDevice -4d579cae1cd87a783fd49233e10ce720ba183cfd1d5ccd80149e69de5c1c7362 android.hardware.audio@2.0::IDevicesFactory -203e23f18011390b8cd10c303e0c16c4eebc8fa187e80e40d6be4624c2b0848a android.hardware.audio@2.0::IPrimaryDevice -aaf93123deec336eb247ad8099849469a541ca0cf7c28c5f5336cebe1ee86748 android.hardware.audio@2.0::IStream -0468c5723b0d44c5b451bdfa06153000c6f352fd3336e0ad2697127b04b766df android.hardware.audio@2.0::IStreamIn -7296f7064fd3ab24082b43a1da34cc876268065310b785499fba5178d063680a android.hardware.audio@2.0::IStreamOut -19d241d71c3e1140afba8140dcb57448446025a5fc03739788c4c25e9a98b6c2 android.hardware.audio@2.0::IStreamOutCallback -c84da9f586087227daa3b96d42b4575326bccfd5bc8a2a5acf86d774f8ea2648 android.hardware.audio@2.0::types -1305786c06e22b9b24ebde136054cc827b63c86d8bf4a136d6f7f54752b8566b android.hardware.audio.common@2.0::types -fa8fbae3d1da3c264e4f3110728076abc09b4e65f12af6ae136367328de988ab android.hardware.audio.effect@2.0::IAcousticEchoCancelerEffect -ca4752545d54547ff069eae161af7550cb5f5a7e8b60316ddd132a30906a68e7 android.hardware.audio.effect@2.0::IAutomaticGainControlEffect -d2b8af988dc66f514d886bcee44b440d8034bc2a762f7161717ef3c956073067 android.hardware.audio.effect@2.0::IBassBoostEffect -611bc09c75e796f3512b1ca6be508b0a9ba996759b8a2c60507784ff58076229 android.hardware.audio.effect@2.0::IDownmixEffect -36a57369dfdc75180e8b64ae80b1970db8f6d9085dbff6ca931715038cc056e1 android.hardware.audio.effect@2.0::IEffect -d2aa2df6d189c580f5be8460fa0ff4134d9c05a383f3204659baee426a6f0edf android.hardware.audio.effect@2.0::IEffectBufferProviderCallback -217f9161983a48d3bf3faeb158f868aa8bf0ce25889e4ee3d2bab1a2e8d33e77 android.hardware.audio.effect@2.0::IEffectsFactory -c2b38bc07991e880c83ca8cb88181411eeef708b8b936aedd2f2e0acade7df69 android.hardware.audio.effect@2.0::IEnvironmentalReverbEffect -2ff9f9704be5f167745b4de790e9dafc3cc4719e2f6e2e5497085e679853cfe7 android.hardware.audio.effect@2.0::IEqualizerEffect -c31447fb02dbc8b56c359941dad22f416511860173c5c5fd278d1bf2312b13de android.hardware.audio.effect@2.0::ILoudnessEnhancerEffect -804831ca258802eb3eb65a0a7b5d5e3d37d4a15ba8c2836b4276eda98b47e1d0 android.hardware.audio.effect@2.0::INoiseSuppressionEffect -778fd5b9837f481d8e47425b3e2a3bd0c6362a0b6870291518e2d863530fdb61 android.hardware.audio.effect@2.0::IPresetReverbEffect -c93cb25a1a92d07aa80a617c01e8d22fc97bf8cefd3962b6a5be386ad4704d89 android.hardware.audio.effect@2.0::IVirtualizerEffect -918f331780c9c7b04f2151a2e563aab088198ede8e6f865302ebaa13905bd9ce android.hardware.audio.effect@2.0::IVisualizerEffect -4caad099f8fc00262b6c03ba41271808b37cea90ac98b534299bbf4ee823af02 android.hardware.audio.effect@2.0::types -1fbdc1f852f8bd2e4a6c5cb30ac2b78668c98dce118a61762d4034ae859f43d8 android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprint -aabb5c3c585592d71ee57b77298c14993d77914ddeaa64b2c5109a602b02ea47 android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprintClientCallback -1ec60d4efddae9a7b2469278a576967b4751e88de5b8d7e9df6eff6bc0da7bc9 android.hardware.biometrics.fingerprint@2.1::types -347ce746815607567f5f3b53e4800998ca5ab9355141f0880fc0cf0c1fc5c355 android.hardware.bluetooth@1.0::IBluetoothHci -835f41be2281bfb22f3e33c6fa870bde7bc21e37e5cfbaf9a36fff170632f754 android.hardware.bluetooth@1.0::IBluetoothHciCallbacks -a8dfd0dbe463a3cdbcf1d985b38a28b3d93ba2ae5a1d1db4aaef4c38a5781b91 android.hardware.bluetooth@1.0::types -7192d756aeba00aba32f4504981df8172ffca83e210c4838dabf295e53e93590 android.hardware.boot@1.0::IBootControl -cebaa803b8e33807a0d69f46652b650ccb549e8f9b19d6becbbf26690e828b49 android.hardware.boot@1.0::types -a98d49f23712a7cc327d1e0602d05f6f3ad32cfb5c74711d009c726611ee1c93 android.hardware.broadcastradio@1.0::IBroadcastRadio -ed82579c0c165feaa12d0e33c06b3342ab41ec0a439247f202775e8369e46ef6 android.hardware.broadcastradio@1.0::IBroadcastRadioFactory -da6ab32ee2793d2c86d3b603075d5383852b89d7eaa201861aa0473d418f3c7f android.hardware.broadcastradio@1.0::ITuner -04d3ca022e25c308d9efd2e7eb77b3a7a206907cdc1b9ea9326340b377868172 android.hardware.broadcastradio@1.0::ITunerCallback -bd42c8d7838cfed1998b49c39745dec116d2d6edc2c11a4c0399b8f3a1d1655a android.hardware.broadcastradio@1.0::types -81164323115d6588e259e8319fddf7487adfa1f49ce60f7e80ba74e0783392a4 android.hardware.camera.common@1.0::types -c1705e9d62438a1d955269965af915ae28e692bd480a3b1ce67056fef992d62f android.hardware.camera.device@1.0::ICameraDevice -78e9b44cf8660bdc1e98dca07451804153824efcd28db208a62f5ad728f44076 android.hardware.camera.device@1.0::ICameraDeviceCallback -28f0386ba86ddf41e53a8117b48a0328d7a4d2574213e89f4a1062398a244566 android.hardware.camera.device@1.0::ICameraDevicePreviewCallback -4db48439ce9dde97f1cfb3d7408f6c737f621ac0f7494aeea35ed599bc2352a3 android.hardware.camera.device@1.0::types -b32f9aeaf1c442195eb06ffc7600968c919d005b2718874f09c57287fae55918 android.hardware.camera.device@3.2::ICameraDevice -63bfc3da0f2d2301f7a0508c7c2b9ffc521d4d545ee03718da70e9d6273b3b21 android.hardware.camera.device@3.2::ICameraDeviceCallback -0fa3e1e64819283b8737fc4e5ab759f0cb4ac1a996e8a51cc4aa8025a457208e android.hardware.camera.device@3.2::ICameraDeviceSession -030be3d2b159cbde7920485807140f6b6064ef4a5de4a40a6c4bc8d2c72f7cd3 android.hardware.camera.device@3.2::types -5ba7947cee515d7a2359bfcbfb9678c1c3a768c288471919ac095b96ae6f3d40 android.hardware.camera.metadata@3.2::types -f7e299d85033ac52d1095a35784fcfeaff43603f58c751e4153c85bbade3b330 android.hardware.camera.provider@2.4::ICameraProvider -a501ca1aecd09f1b9fd70a9af84205430dbd49a808e8fa395d363b9902e6f58c android.hardware.camera.provider@2.4::ICameraProviderCallback -7f5fe8f4f8a24037153c504d8b4d3313c2ce33d81c8c69fe5194ddd2d4080e72 android.hardware.configstore@1.0::ISurfaceFlingerConfigs -87beacc481897cf02fb1628d75e68133de6d74d4cffe582cda2f5e16bdd74516 android.hardware.configstore@1.0::types -a5ae0fe8667f0b1af09b13e72d29600f4eb3853b257079c45a99b6f4a3360649 android.hardware.contexthub@1.0::IContexthub -2ab3054c2d9302d8417ee7495353a2887fe338f913276f2eb41e80f11395ec2e android.hardware.contexthub@1.0::IContexthubCallback -c3b2b37d561d31ea094411f251bf73bea334f4fe849a4390aef5e20bca6cadba android.hardware.contexthub@1.0::types -df174c1871c864b4c79ca9f64aae7936d24a272eca3191a30458ca2b706dec79 android.hardware.drm@1.0::ICryptoFactory -83639e90caeb996b0274e420de3cd556779de1ca48464b68eee799bef32b34cd android.hardware.drm@1.0::ICryptoPlugin -1440cffdfaeb12830ac10ee6ffdb0f1083e701057b806df11fb4787b4c91e718 android.hardware.drm@1.0::IDrmFactory -78ba33b108f620e6a0eec01ef654547e69a85754578ea4c9ef03ec205f16121c android.hardware.drm@1.0::IDrmPlugin -701d9e51952172364e4ea70db9c397f08c3b4577ba33051f050a6cdd532de1b4 android.hardware.drm@1.0::IDrmPluginListener -4238d62ad90df63aa338c6f1b6264c09c5a3706945d5c49d1189c0be1dc9e942 android.hardware.drm@1.0::types -f07b1ee3ba11a2fc9f200421b2e1afb7c1854ee987000e45c987fb9507795055 android.hardware.dumpstate@1.0::IDumpstateDevice -c9d318df7922bde3b265927b521ff5a965002826fc0cabfcaef52a56760f2d34 android.hardware.gatekeeper@1.0::IGatekeeper -da13bd69282fb275767abb18704c57ff8038e6c139ad17157dc702810f70d06a android.hardware.gatekeeper@1.0::types -37c7da4f823ec958dfa9c960e2d341c48f877e0bfa758f3fa9e2d9c1e1bd66d9 android.hardware.gnss@1.0::IAGnss -7ec9afdb964bfb8369866913caf018f2636592885bcb558a65de2c5436ab4f60 android.hardware.gnss@1.0::IAGnssCallback -d16e6a359be6963ea753d7138e84ecf2b93052097938938c4d36d7a47ea2e2ae android.hardware.gnss@1.0::IAGnssRil -2f907708d74d94b1e121ed27651c9c72af65952d347b58ff07dac5d5d7a7f678 android.hardware.gnss@1.0::IAGnssRilCallback -5ac7edad06d76064b882be161f3f9d9692a997ec72e9f36addb7fe8918f49992 android.hardware.gnss@1.0::IGnss -b05c983c87c3376e145223688c3b541b5e11b827f211e38d5a31af1ca3a2e222 android.hardware.gnss@1.0::IGnssBatching -4981d2d2c4e725c7544be0956099a91fc7bbc8048c563394158083fe924e651e android.hardware.gnss@1.0::IGnssBatchingCallback -3cd22d92cc1f935150c5048310e84886f14eed2556e8f00636733d204045cc4f android.hardware.gnss@1.0::IGnssCallback -175185a5eda87476193ca5461df75dd16d36664591e8130530dd8ef0eb2ddf6a android.hardware.gnss@1.0::IGnssConfiguration -4542122b96fbf27101cb8222bafb76e7c8d032d977dd1058edd8e5881ca5752f android.hardware.gnss@1.0::IGnssDebug -e6dd0c8416e523ab9cbd14d56ab6f016481a8aef3bc8a750051122d31075f6c7 android.hardware.gnss@1.0::IGnssGeofenceCallback -f90e4ddc652706299d8e3d8ba18e0745c3bae9bf4d1be6bd06d9c1f50ec8d28a android.hardware.gnss@1.0::IGnssGeofencing -9ea8987bb1089c8c5d7b67866575b866ef516045021d9efcc37c6352bce072a3 android.hardware.gnss@1.0::IGnssMeasurement -cf20492673d6a423e4c2e87fdfb5a4c4a602431721978db852e246f258e25edb android.hardware.gnss@1.0::IGnssMeasurementCallback -af85aa0f48ae99a39f4688c344e4419304f681f9af818a5c8d759286fc4418de android.hardware.gnss@1.0::IGnssNavigationMessage -76b0874ea4c06b29f66418c59820f4286b3be9629cd872923d0dfbb602cd432d android.hardware.gnss@1.0::IGnssNavigationMessageCallback -248bcf51da4273d64f367bf6877baef2feeaca365459842fd3c214a2dc6e0224 android.hardware.gnss@1.0::IGnssNi -c781b7b125f68be5db8a8c3d412d526acdbdf77dcc592a4c0ed70b8ce4fe6c49 android.hardware.gnss@1.0::IGnssNiCallback -c1142657de16fdb292a502372fe938614d65270ab8359217d6e13604fe4dbca4 android.hardware.gnss@1.0::IGnssXtra -bd366b83d8d565d0e8bfabff3adfcab0259d75b4e2a9f8e1b91e11d1593a2ffb android.hardware.gnss@1.0::IGnssXtraCallback -881bc2f94026784d194cffbff166c6e8bf911de4e02abe96fc7d89ec75b0574a android.hardware.gnss@1.0::types -17971eb8a482893dadcfc16e0583f492d42a034ef95d9b0b709417af30838396 android.hardware.graphics.allocator@2.0::IAllocator -60bf42a4898e4fb70dbd720b263aeafd7f35f5e1a5effeabb4d5d659878a5f18 android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer -b8a75617b9ec12bea641f3a73d4025a33e8b9a2f9169dd46094af56adf9249c5 android.hardware.graphics.bufferqueue@1.0::IProducerListener -4f6dedbcdd21c309dfc650acea81a096d6b242493ffe49c8d61bd3c43aad354e android.hardware.graphics.common@1.0::types -b3aac6c3817f039964fcd62268274b3039e17bd7d0d5b40b4d1d1c7b19a1f866 android.hardware.graphics.composer@2.1::IComposer -b19d00eb8a8b3b0034a0321f22e8f32162bf4c2aebbce6da22c025f56e459ea2 android.hardware.graphics.composer@2.1::IComposerCallback -61ee43ffe6fb6dbe8b22dc17c51ff3d5ba703fc6029cba211f901f3d79c8a72d android.hardware.graphics.composer@2.1::IComposerClient -1c98c2f5154345312ec054871792a2982ec5f3e2bc2abfb61a10c0b517978e20 android.hardware.graphics.composer@2.1::types -a695898589e1ef15b2b2510f11edd6aafac9918d9cf8d74b4b6143b309dee542 android.hardware.graphics.mapper@2.0::IMapper -28507d385a3dd224bf3c32f1bfd9f96092c4701b9c1cc66caa578fc3efc97877 android.hardware.graphics.mapper@2.0::types -91e2ba3805c923f01fc1231ec9ff838942aee3346f2d7614ecc0caeadbe57ed4 android.hardware.health@1.0::IHealth -1275aa2e8732909101b26aec49ed2285489e89d97b8610a8908b7868e35a3cc5 android.hardware.health@1.0::types -3a8d3922e06e6d4f8e0befc6be78d0e9e07aed1585b3da6521bed406d25a9483 android.hardware.ir@1.0::IConsumerIr -7090bd37912fcf723a12f4bc17783e3527577c4944805a028c296fd7a95bd682 android.hardware.ir@1.0::types -cc7925a78c0ab022515f48840d3dae76f384ed3a1287abadcb461a5cd5396163 android.hardware.keymaster@3.0::IKeymasterDevice -822998d7bb76f0cd719a409291434fcb56e6d50bc4780788bb157a3374d63b8c android.hardware.keymaster@3.0::types -d4ed2f0e14f9e914d0b1275d2e0363192fe30aca9059c84edb5fad15995f9ec4 android.hardware.light@2.0::ILight -d9584bfcaedd6e62cf337881748246b23e36cbc2bc3aa84c01b6a1e622061400 android.hardware.light@2.0::types -16c0cf0f73de1e5208a95020c6c6474903e7094f76b2d782651afaca0e5fd86f android.hardware.media@1.0::types -8bc2f5fdcad68856eb61a62fe4cc043fa064bb7f1dab95a71d1918ec1eef7b55 android.hardware.media.omx@1.0::IGraphicBufferSource -0d3de9cd89d4718ea3b772f2d8b93be004feb3abb7e7dc5402e37047cc730d05 android.hardware.media.omx@1.0::IOmx -32002e1c358c64de106c977a6dc6af7da27be4803a5bb66fd6f891a5ba0a1617 android.hardware.media.omx@1.0::IOmxBufferSource -81ad8d8bb1cf6f41923cf11dd39354a8fe433db284a234cc675de7e75a82224c android.hardware.media.omx@1.0::IOmxNode -494c0c8bf6065edc82ec127228ed19dd2243dc1c2f7d601c7c6be7b7015c1713 android.hardware.media.omx@1.0::IOmxObserver -252c2fc50c78fd6de8365e5b60e5115119ace107db0b94b0b26815cbf3d2b64a android.hardware.media.omx@1.0::IOmxStore -148c1b50b0958988373145ffdf5fa0e1b6534e0a2034a570e74b15c127cf7c5e android.hardware.media.omx@1.0::types -c66902fe48d687ac6740a3e32ae55fb75532c48c36c6386461c2b4416ad2e0f1 android.hardware.memtrack@1.0::IMemtrack -860bacd8b11a269c40567542b613fe4ca448d5cb4326d0058899e608e89dfca1 android.hardware.memtrack@1.0::types -07ac2dc95270321ec7d4c33cd25e5085a057f47fe350d645af6f7a7a11e3cf57 android.hardware.nfc@1.0::INfc -f2fe54426c07d67388d4774a60641ad4c0538f22eb6e1111722f231772655de6 android.hardware.nfc@1.0::INfcClientCallback -9626fd18db113d709faf593a70caf19bd0980294d23c468c80c30186f9d298a6 android.hardware.nfc@1.0::types -deee1dc4948f33af207e1008aba0f6cc07afb7900eab53f33192c8cac137eefc android.hardware.power@1.0::IPower -efc83df3f962b93c7c0290d691d7d300dabe12683e2cde3591fb3c0beedce20f android.hardware.power@1.0::types -9b5aa499ec3b4226f15f48f5ed08896e2fc0676f978c9e199c1da21daaf002a6 android.hardware.radio@1.0::IRadio -5c8efbb9c451a59737ed2c6c20230aae4745839ca01d8088d6dcc9020e52d2c5 android.hardware.radio@1.0::IRadioIndication -69f6b4b8ec40ca02ccc7bb8227a097135c20c00bd94c822e421cd9af1267252c android.hardware.radio@1.0::IRadioResponse -de3ab9f73b1073cd677b19d886fb927e9381b30161a704712d2b30f875873f5c android.hardware.radio@1.0::ISap -d183e406ef0897df2117a9dde384e8e6ea4fa6ab1c7f6f28e65b87011218c9ea android.hardware.radio@1.0::ISapCallback -96986fbd22f0e6ca752e1fcdc0a64bda213995a81f5f36bc4faf3532d9306b97 android.hardware.radio@1.0::types -00f70085d6fae1d482fb700a3fd42ed475384c95b51c9269b9ae5037b74ad4dd android.hardware.radio.deprecated@1.0::IOemHook -06837b6d7e843cfa9cd20fed4070feca7a9b5c81a9ed643bf7d06803455a9816 android.hardware.radio.deprecated@1.0::IOemHookIndication -6fd4874f0eddd4626a27658fd94fad526c317f3563439e79718bdb1a3a2309d5 android.hardware.radio.deprecated@1.0::IOemHookResponse -6983a2cafe39d5c57dfdc1743055fb0f757a0df8c78e00423d5e1810836927e1 android.hardware.renderscript@1.0::IContext -7f9417a0ccf78ea042ec7a8ac8e3750346d4d9d7e5ae01b1b35fde303f47c24d android.hardware.renderscript@1.0::IDevice -fc6f325b266b32353f7d1534fbe58e0d368265a12b77fa396fb556e8c443f739 android.hardware.renderscript@1.0::types -89585ff541c319de4091a5a0b687dd526ac81c6382ffd7b979a4164b3d7419a6 android.hardware.sensors@1.0::ISensors -e04ab978fc28f4c515f4a75617dfda8607733a64f13666beeb0e604a07a39333 android.hardware.sensors@1.0::types -5befc019cbe94953661e2cdb95e3cf64f5e565c29403e1c2daecc2be44e0a55c android.hardware.soundtrigger@2.0::ISoundTriggerHw -d7ec5f612a5e0a59ea4f2b61317e208ff56dd50920fd4eb441e0cbc8f97e4f49 android.hardware.soundtrigger@2.0::ISoundTriggerHwCallback -5bee9e70f7e5ec7ee252883b28f98f12b59960f4c2a0b4cc9a4526e4669ebcd4 android.hardware.soundtrigger@2.0::types -97f1ec446043bc5a6645b74529a6276496bdb35e0aee41eda55cb92d51eb7802 android.hardware.thermal@1.0::IThermal -84965a6908bceb4ef51546bf8731f309f1ea9d09a0177dcc7974132e523dd6d2 android.hardware.thermal@1.0::types -938850621c3c5ef426a4b88e752ba99b3559037e782a3d938604f3aef5cc0f1b android.hardware.tv.cec@1.0::IHdmiCec -e75b6eea711d36fac678bce072b3cec6544b27fa9f4cd903999404e5c110ca10 android.hardware.tv.cec@1.0::IHdmiCecCallback -6e25f8dbfadb668e1d4ec80eb9acd95d8bc9e0a240c36d27e662adb440314b95 android.hardware.tv.cec@1.0::types -0cafa3c8388e9631916d2d800f78decbcec2904f11415b32c71a31d9a51ebf79 android.hardware.tv.input@1.0::ITvInput -dee83e5c864fbbee8f02448d0800be32f06856386b9f907bc5d952208c9434f9 android.hardware.tv.input@1.0::ITvInputCallback -07aab30410b612381234dca6d453d4ab96f2e536368715717c6e28101b9851b5 android.hardware.tv.input@1.0::types -4ef57499273f38bdbdd0c15e56ee7a4bc5f18a5644092170a531df3541d9e015 android.hardware.usb@1.0::IUsb -4be7881e411ba42784bf5b7354c14ae0cf161004d39433aaecaab0d19ea99354 android.hardware.usb@1.0::IUsbCallback -f7e6e747910a3cd0a35846141e3b990a6a612a297b2b70ccd5740b646a450a8c android.hardware.usb@1.0::types -06ea64cc3565777f3b259e400ffa7100d07f3827ad9357b0c5d3c651384e5553 android.hardware.vibrator@1.0::IVibrator -0fecd34ae64f32eff6aa615fd662349242c0b8b6e303ef05a7cb5776c732f413 android.hardware.vibrator@1.0::types -4b962968a7df4ab104d1315d66a0a7348a713fecbb5d2c1b23688494458f37ce android.hardware.vr@1.0::IVr -b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi -ee0224ee18813506d9d6f13d8c8e4679f053c290a443a52a7c52a5d3c852262b android.hardware.wifi@1.0::IWifiApIface -f3eecc489deb4c74892f59eb7adb769063bd5c354ac132b626a5f42b363d36bc android.hardware.wifi@1.0::IWifiChip -a1b988377645a58e5e2542ca2bad4e17c21a4a389213d05de2f0e32d57b7d339 android.hardware.wifi@1.0::IWifiChipEventCallback -5ed6760ce77e84bc6c49d1acb3f7d8117c9176b3f06514bc44ad3af84c80dcfe android.hardware.wifi@1.0::IWifiEventCallback -6b9ad43a5efbe6ca214f751e22ce43cf5cd4d5d5f2cba80f24ccd3755a72401c android.hardware.wifi@1.0::IWifiIface -ba5aa74f1ba714f0093864227923492808795bda6199c4ea0891322d27f8c931 android.hardware.wifi@1.0::IWifiNanIface -325c94f3e1a565b56bbc74faddbd0ba7cb824f263dccf9dfff2daf62b86ed774 android.hardware.wifi@1.0::IWifiNanIfaceEventCallback -c2c3f0372b41780fb6dfe83c022296806c2024d7046682fd201de5aa9b791c7a android.hardware.wifi@1.0::IWifiP2pIface -766e9765f5c9c759b2a763c2288353fb5deff3389c2cc28f81d79c939704ce8b android.hardware.wifi@1.0::IWifiRttController -72ab6f3e120cbf07aa6f8e87ca89112bdeb36b7fbb96bce5af3712323ab8b8e6 android.hardware.wifi@1.0::IWifiRttControllerEventCallback -3b8093d39ef1e10e43c5538afbf5ff6e39b8d8168ebbe1998d993e89e25f14a5 android.hardware.wifi@1.0::IWifiStaIface -7fbfc551c3e23c8b4398c3e16e452b516457e6921424a53474cbf373ca306fa9 android.hardware.wifi@1.0::IWifiStaIfaceEventCallback -e20d5132d6d23e072c15de065b5e2aa13ff965031246a2c82581732bae56bf6d android.hardware.wifi@1.0::types -f7e55c08187d8c855068a1ee3d0c8daeee7570292d96509c21a8756d4f5cfb9b android.hardware.wifi.supplicant@1.0::ISupplicant -56b5c7267cb3d3337f44eb8b0b38ff4c6260dcc70e07687fcab94b1ccea8d159 android.hardware.wifi.supplicant@1.0::ISupplicantCallback -35ba7bcdf18f24a866a7e5429548f06768bb20a257f75b10a397c4d825ef8438 android.hardware.wifi.supplicant@1.0::ISupplicantIface -cda01008c06922fa37c1213e9bb831a109b3174532805616fb7161edc403866f android.hardware.wifi.supplicant@1.0::ISupplicantNetwork -4907410338c5e8dbeec4b5edc2608ea323f5561945f8810af81810c47b019184 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIface -8b63f5efa2e3be3a7cb8a428760d82285a4ab79bcbdea6ef90aa547555e582d4 android.hardware.wifi.supplicant@1.0::ISupplicantP2pIfaceCallback -56128f74560571b6777d59453f35c6b35693ee377e2a23c807708906928f09de android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetwork -2067c22197bca9743dab66a6f561a8a8375c67b4f76aed05f776839499bd4c8f android.hardware.wifi.supplicant@1.0::ISupplicantP2pNetworkCallback -7752e1de93aaf5fed37011c219ac247069f6af320b0810daa98510584a10e7b4 android.hardware.wifi.supplicant@1.0::ISupplicantStaIface -d781c8d7e7b3fe5cca8cf6e1d8806e770982ae5358c7816ed51b0f0ec272e70d android.hardware.wifi.supplicant@1.0::ISupplicantStaIfaceCallback -b12ef0bdd8a4d247a8a6e960b227ed32383f2b0241f55d67fcea6eff6a6737fa android.hardware.wifi.supplicant@1.0::ISupplicantStaNetwork -d8f0877ae1d321c1d884c7631dfe36cab0ec8a4b2863d4b687f85d3549a63bcc android.hardware.wifi.supplicant@1.0::ISupplicantStaNetworkCallback -fe3c3c2f572b72f15f8594c538b0577bd5c28722c31879cfe6231330cddb6747 android.hardware.wifi.supplicant@1.0::types - -# ABI preserving changes to HALs during Android O MR1 (Initial Set) - -150a338ce11fcec70757c9675d83cf6a5d7b40d0c812741b91671fecce59eac9 android.hardware.broadcastradio@1.0::types -dc7e6d4f537b9943e27edc4f86c5a03bb643b18f18f866f8c3c71c0ac4ea8cbc android.hardware.broadcastradio@1.0::types -760485232f6cce07f8bb05e3475509956996b702f77415ee5bff05e2ec5a5bcc android.hardware.dumpstate@1.0::IDumpstateDevice -78589343d8ee2e1b155acad3fbdc7fcbb6af94491aee968b2383c21627264f8b android.hardware.radio@1.0::IRadioResponse # Available in Android O, b/68061860 -e822cb7f4a1bdd45689c5e92ccd19a2201c20b771bd4b2ec1ae627e324591f9d android.hardware.radio@1.0::IRadioResponse -6e69adb24d7c0b0ca3a54a38c49a5625b161b3f5d5f7d6fda0befdbbfc8e9e06 android.hardware.radio@1.0::IRadioResponse -c2c50ec74c87a583c683b4493f8f9f2e454a8d41c57af5b3eb88823a999f0ea4 android.hardware.radio@1.0::IRadioResponse # Added for b/65230472 for Android O -4922dd58e89a03181ed1c48a6e118e47633b73b11090bdfed5aa920d25a7592b android.hardware.radio@1.0::IRadioResponse # Added for b/65230472 for Android O DR -28e929b453df3d9f5060af2764e6cdb123ddb893e3e86923c877f6ff7e5f02c9 android.hardware.wifi@1.0::types -df1d7b27e644bfed0a4f606a8c44d35d45cafce82c7c648494c8a25c7cd4a949 android.hardware.wifi@1.0::types - -# HALs released in Android O MR1 (Initial Set) - -4b65763663a94a3920134011691f8fbb42ccb7b7795589efddc049a9106047d6 android.hardware.oemlock@1.0::IOemLock -e02cd3722cb5e8fa51179f5defacb4f7866f903c9c7c51dc01a3148473a71525 android.hardware.oemlock@1.0::types -224f9d22a367a0016f09b6dc676f53f1446697d9dc747163032329e5da552de5 android.hardware.power@1.1::IPower -574fd9758b7cab4922c72cc5a9f36d1cd48ffd3425fdd776426653280d3d4138 android.hardware.power@1.1::types -f79edf50a378a9c9bb737f93f205dab91b4c63ea49723afc6f856c138203ea81 android.hardware.radio@1.1::IRadio -fcc5c8c88b85a9f63fba67d9e674da466c72a98ca287f343fb5721d098713f86 android.hardware.radio@1.1::IRadioIndication -50f27e8c7ec009d5d4418b2ce8392b940bbf052ecc1d7251285f332485a5ba4e android.hardware.radio@1.1::IRadioResponse -be981148c95c0089f3ae92854f0e7ae999d308e927db3e065f12a4fabe07852f android.hardware.radio@1.1::ISap -d8d6bf7b4d36c04ce587df75953c3f723cfbe71c896c1aa8ab6478eae126723d android.hardware.radio@1.1::types -d8aae01606bfd34bf2fb9a59cadc016f46f318e56cddb8f15a945c5b3c1222bc android.hardware.tetheroffload.config@1.0::IOffloadConfig -447b00306bc95a7aafec1d660f6f3e9f76ac8bc0353193435e5579ab833da619 android.hardware.tetheroffload.control@1.0::IOffloadControl -07658829339d75962016e00ed81b005ad29fca7ac12ad3bc3ccd86b08d94c2d3 android.hardware.tetheroffload.control@1.0::ITetheringOffloadCallback -0df5b0178af15c53cdce8fcf8ca14035e8e08db4fa76fdc12009ddbe0b53626b android.hardware.tetheroffload.control@1.0::types -b30ef02ef26ff804e2f6acf1201bc141b59e134e6a0338562284491102cb13e3 android.hardware.usb@1.1::IUsb -13a580e35af01270a1e9774177c51db51d8672e6139ba00851e654e68a4d7dff android.hardware.usb@1.1::IUsbCallback -f0ed667288908c08fced570bd1f3c4a0f236aa927938e805f0d9fece525da81e android.hardware.usb@1.1::types -f95a1e85612f2d0d616eacd2eb63c52d10dfa889f165df57697c30e1f47b4785 android.hardware.vibrator@1.1::IVibrator -246fb9d9e2b4800aeb0adc3cdbaa15d0321ebab54b7bd1ab87da5b67c7b0b064 android.hardware.vibrator@1.1::types -9bc43413b80cd0c59a022e93da1448dcb82dd10c6dd31932df4659e4bdcb1368 android.hardware.weaver@1.0::IWeaver -7728b0393a2ed9796537d4165c7d95407e9d8cb447a647b545fdfe06a28689e7 android.hardware.weaver@1.0::types -bb7c96762d0aa3ddb874c8815bacdd3cbc8fb87ea2f82b928bc29e24a3593055 android.hardware.wifi.offload@1.0::IOffload -c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback -b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types -c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi -b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip - -# ABI preserving changes to HALs during Android O MR1 (Final Set) -09342041e17c429fce0034b9096d17849122111436a5f0053e7e59500e1cb89c android.hardware.media.omx@1.0::IOmxStore -2d833aeed0cd1d59437aca210be590a953cf32bcb6683cd63d089762a643fb49 android.hardware.radio@1.0::IRadioResponse -0a159f81359cd4f71bbe00972ee8403ea79351fb7c0cd48be72ebb3e424dbaef android.hardware.radio@1.0::types -05aa3de6130a9788fdb6f4d3cc57c3ea90f067e77a5e09d6a772ec7f6bca33d2 android.hardware.radio@1.1::IRadioResponse - -# HALs released in Android O MR1 (Final Set) -044cb039378b8a0e36f40ff1e6ce04dc0d339da02095f968d5062a051e99d108 android.hardware.broadcastradio@1.1::types -c9699483f8cefe4f9b39b4b9609b76cab2dd1659a06188056b45797d337d4256 android.hardware.broadcastradio@1.1::IBroadcastRadio -b5d62dcd663fc4fcc977b252af59b333043bdfe73de2f11fe6d6a8bf438a0f92 android.hardware.broadcastradio@1.1::IBroadcastRadioFactory -bc7e054a6e93adebedff345aeed44549be89e6b1b6ffe071ff47a61de764b232 android.hardware.broadcastradio@1.1::ITuner -e9139fc755be578693f17c8cd1e27c75f412cfc722157bab5bf03ee68896e31d android.hardware.broadcastradio@1.1::ITunerCallback -63929c99e5755d9e09d9e0fd2527391fbb1609dda0508f5933b7943b92ae0fbc android.hardware.camera.device@3.3::types -bbcfc3f748b078f6a66c4e228084a679d30bd61bfde8bb7a91efd507b91c1bfd android.hardware.camera.device@3.3::ICameraDeviceSession -4a6998cd6793a3f9f03989c29d662589b1bc9d38826c6698c6c17864f7a814f5 android.hardware.cas@1.0::types -0e656ba1bac11461a17096ef752b69d24b000d820ef5652f0150a0f9731d54c2 android.hardware.cas@1.0::ICas -b80e1456b81f80032d0de7cb45652ac15af11e7474d520d757481ecaad796dff android.hardware.cas@1.0::ICasListener -a432d6d9200248dc2126827bcd6cdea31dd65eff39b939f64585d27d915a5857 android.hardware.cas@1.0::IDescramblerBase -86ba9c03978b79a742e990420bc5ced0673d25a939f82572996bef92621e2014 android.hardware.cas@1.0::IMediaCasService -503da837d1a67cbdb7c08a033e927e5430ae1b159d98bf72c6336b4dcc5e76f5 android.hardware.cas.native@1.0::types -619600109232ed64b827c8a11beed8070b1827ae464547d7aa146cf0473b4bca android.hardware.cas.native@1.0::IDescrambler -93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 android.hardware.neuralnetworks@1.0::IDevice -f66f9a38541bf92001d3adcce678cd7e3da2262124befb460b1c9aea9492813b android.hardware.neuralnetworks@1.0::IExecutionCallback -953607822954435874f4b81686440a604e2a88cdd2d9164c6293f3d5772510d7 android.hardware.neuralnetworks@1.0::IPreparedModel -73e03573494ba96f0e711ab7f1956c5b2d54c3da690cd7ecf4d6d0f287447730 android.hardware.neuralnetworks@1.0::IPreparedModelCallback -246a56d37d57a47224562c9d077b4a2886ce6242b9311bd98a17325944c280d7 android.hardware.neuralnetworks@1.0::types -f4945e397b5dea41bb64518dfde59be71245d8a125fd1e0acffeb57ac7b08fed android.hardware.thermal@1.1::IThermal -c8bc853546dd55584611def2a9fa1d99f657e3366c976d2f60fe6b8aa6d2cb87 android.hardware.thermal@1.1::IThermalCallback - -# ABI preserving changes to HALs during Android P -9e7a0b650d0e461ece2cfec0e1072abf8676f592b41a7fb48f01e88fc3c8f780 android.hardware.broadcastradio@1.0::types -cf72ff5a52bfa4d08e9e1000cf3ab5952a2d280c7f13cdad5ab7905c08050766 android.hardware.camera.metadata@3.2::types -3902efc42097cba55f0655aa389e052ea70164e99ced1a6d1ef53dafc13f7650 android.hardware.camera.provider@2.4::ICameraProvider -6fa9804a17a8bb7923a56bd10493a5483c20007e4c9026fd04287bee7c945a8c android.hardware.gnss@1.0::IGnssCallback -fb92e2b40f8e9d494e8fd3b4ac18499a3216342e7cff160714c3bbf3660b6e79 android.hardware.gnss@1.0::IGnssConfiguration -251594ea9b27447bfa005ebd806e58fb0ae4aad84a69938129c9800ec0c64eda android.hardware.gnss@1.0::IGnssMeasurementCallback -4e7169919d24fbe5573e5bcd683d0bd7abf553a4e6c34c41f9dfc1e12050db07 android.hardware.gnss@1.0::IGnssNavigationMessageCallback -190ea4898809de6cf379afe318f5fa9564686157b24d9a2d7f5698b0c977d8b2 android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer -25892789b50eb673506b6c5a2cdab5d9aa428d41608aab10280cc898538b524a android.hardware.graphics.composer@2.1::IComposerClient -e205dd30f5ff99445b706a901de8ebc46c379e9d7c1921d6a327ed2082cfa83d android.hardware.graphics.composer@2.1::types -a46251718abfada458dc64c41ce94915757bf6c87cfa2d9e99cfb01fa8e32331 android.hardware.graphics.mapper@2.0::IMapper -bd33ac23c57b4a07632691d2191bc2c93930f57e62f4ccf459748fdaa5c0f480 android.hardware.graphics.mapper@2.0::types -ad8a28ca3a5549fb9bc24cf5f80ac8f660cc27be885210d76266780aa52ddb8d android.hardware.keymaster@3.0::types -5804ca86611d72e5481f022b3a0c1b334217f2e4988dad25730c42af2d1f4d1c android.hardware.neuralnetworks@1.0::IDevice -12e8dca4ab7d8aadd0ef8f1b438021938e2396139e85db2ed65783b08800aa52 android.hardware.neuralnetworks@1.0::IExecutionCallback -86b77e06da756a76aa3685be88765852dd982a86d8c90b8b4fc1130ed4184c8f android.hardware.neuralnetworks@1.0::types -d4840db8efabdf1e4b344fc981cd36e5fe81a39aff6e199f6d06c1c8da413efd android.hardware.radio@1.0::types -f96cbc59dfe16c8d0c2a7e06db24d8738a6328b6e90f7b8e1640ea2b4600debd android.hardware.radio@1.1::ISap -2d86929794795e5c70f4fdb5073485fd05835c9c6f496116687c3d9f32e6df3e android.hardware.radio@1.2::ISap -905a4af79c8329b39d8b11b08f015137216bb078b427b6986f32884a04bc1bec android.hardware.tv.cec@1.0::types -aebcd9ff2da05c9d4c439916f40dfd219ba7629919007cb981ebf150064b4f82 android.hardware.usb@1.1::IUsb -e29fb1941b40a990676f8e9c676a38761defd890b81a9c034608eb7ba6496023 android.hardware.wifi@1.0::IWifiP2pIface -b280c4704dfcc548a9bf127b59b7c3578f460c50cce70a06b66fe0df8b27cff0 android.hardware.wifi@1.0::types - -# HALs released in Android P -5860cf040a3d5d771967ecf648b00d06876a7120da985ee2b3e95d01f634dd20 android.hardware.audio@4.0::IDevice -cf82a0249e918fdc657e189895e92d60af0491868477e82cdc30f6cab0ca2c65 android.hardware.audio@4.0::IDevicesFactory -be3dc9baed45a0d330152eca3ca24fa419b375b20a41644c88d4fb46b72784d2 android.hardware.audio@4.0::IPrimaryDevice -3e3acb70c4e6c7d578f511f4a44ee764ab9126f887a3bf65d523c42e40012bf6 android.hardware.audio@4.0::IStream -d5de64e66b95f135dd42492250a309134b8227203ef3524440798c66b6f5a392 android.hardware.audio@4.0::IStreamIn -888ac906461327fa0bd93854d5109be8c292a33afdb467164826970a8bd5b789 android.hardware.audio@4.0::IStreamOut -15f6ae78e73344c8e7d68847ef03caec64fcd9f951bbcf59957d1712c247fcff android.hardware.audio@4.0::IStreamOutCallback -61f0eaa4d08547d039e9b1dd7c82abe2c004286d1b9b8153c2491ff46a8a63ca android.hardware.audio@4.0::types -5d47a2ad2c136b8aba067dd45bb10d0ad390dd76340764154f580658f98f4fe6 android.hardware.audio.common@4.0::types -b04b6b364938b80008e61fa2e318bc299622433e57c2e1f6cfba332a3f6e3f15 android.hardware.audio.effect@4.0::IAcousticEchoCancelerEffect -1c17d4ece5c8ba3f7a646a305ee0dd109b0d51372e1bd585812e513cd40e1852 android.hardware.audio.effect@4.0::IAutomaticGainControlEffect -34174259fe6fbb1bb14e7103e097f2f25529271a676687845b2f55d6d0d9d617 android.hardware.audio.effect@4.0::IBassBoostEffect -7a18e9bd0163f3784448f6e24be0db75f877e2f0f9bd0d7ec427f1c34b382c0b android.hardware.audio.effect@4.0::IDownmixEffect -bac81bffbe2661d5b6839087d2dd3a27eded66e60c6c76d35c68d54014cd5c06 android.hardware.audio.effect@4.0::IEffect -65f0bcf9e498b26f3266ad10cf513a6c2b5906cc49f9db4bc5c7d3ba11a72e05 android.hardware.audio.effect@4.0::IEffectBufferProviderCallback -5a746e81175489eb2371b88864c36c9bb63bc64ef799fae74cd96003b013c0d1 android.hardware.audio.effect@4.0::IEffectsFactory -839980c7c5be79da6b95fdb9354a62b04407b4b084749b7a21d2c340773d7638 android.hardware.audio.effect@4.0::IEnvironmentalReverbEffect -2805fbdac7cff050a1c095b9276bb41ac02a3b7b354336817487eb9a4b6bb462 android.hardware.audio.effect@4.0::IEqualizerEffect -a91b547f5922f39fe4231d97fac1c3825c1c1b0c8ef7a5136689ceed37e8bfe9 android.hardware.audio.effect@4.0::ILoudnessEnhancerEffect -1145f5b921ddec184fda5bdc87487b46f2a89cd9f42cc882bbb3a54f4ac80466 android.hardware.audio.effect@4.0::INoiseSuppressionEffect -3661fa0623056922fdc4235ac5a9c91a2d066ab6f1ab4297e3b240fe302ba500 android.hardware.audio.effect@4.0::IPresetReverbEffect -e88e520f8c98a62fccd8d5316c6687808f775de145d1405a7a9a66587ee6a001 android.hardware.audio.effect@4.0::IVirtualizerEffect -fe28829dab10d171783b79ac9cc45412739f8ff275e90228d7c6370ef189b859 android.hardware.audio.effect@4.0::IVisualizerEffect -21c8a702579356480236c6851b5b2c16b9bd369ce12bdd6ffdc4626a89f34f73 android.hardware.audio.effect@4.0::types -42a06dc288f61b0690580f3d37b30b663c31d74d50bb58d0772386b550d5faab android.hardware.authsecret@1.0::IAuthSecret -32cc50cc2a7658ec613c0c2dd2accbf6a05113b749852879e818b8b7b438db19 android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioHost -ff4be64d7992f8bec97dff37f35450e79b3430c61f85f54322ce45bef229dc3b android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload -27f22d2e873e6201f9620cf4d8e2facb25bd0dd30a2b911e441b4600d560fa62 android.hardware.bluetooth.a2dp@1.0::types -3d8ed67d807e9f15d0708390a416bee00920f6a22196c104cc9e443c8d217df8 android.hardware.broadcastradio@2.0::IAnnouncementListener -44017c42e6f4d8cb30f07eb1da04540a98736a336ac28c7e0ed2e69e1589f8d1 android.hardware.broadcastradio@2.0::IBroadcastRadio -e5f4960290b4f3089163dd43251e1a032c81e9bdb796e75a87fc7c5810c262b3 android.hardware.broadcastradio@2.0::ICloseHandle -af24b87ca8b8f02fcde205e47db6a9609fc7e9d77d73e694ec8f9c508ca19575 android.hardware.broadcastradio@2.0::ITunerCallback -d70464c517a4a1b5167730843775a97f455102919e945b04f717b9da390c0f39 android.hardware.broadcastradio@2.0::ITunerSession -2afa59ebf8145e7fbc090cf49605c27280c07d4178d47cd7f9d82b3b95a47af0 android.hardware.broadcastradio@2.0::types -4fb0725c36ed4f77a42b42e3f18d8b5f7919cb62b90098b23143a555aa7dd96d android.hardware.camera.device@3.4::ICameraDeviceCallback -812fa66aa10ba0cba27cfddc2fd7f0ee27a8ab65a1f15aa79fdad97d403e6a14 android.hardware.camera.device@3.4::ICameraDeviceSession -cc288f1f78d1e643eb3d3dbc16e1401d44033d8e6856761f5156814a29986ec7 android.hardware.camera.device@3.4::types -f9278c8beb9d42d96e26d73ecabe1dff1d7e2fb301ab7f737d93e5ffae8d3312 android.hardware.camera.metadata@3.3::types -f858091b10f7d5927be60573c06df4805275d37226bbb41a732190bfb81457ec android.hardware.configstore@1.1::ISurfaceFlingerConfigs -5b0fb9842f8b0eb3730b93c30a7925290ab44763ab86bb493bfa58d0f2eeb369 android.hardware.configstore@1.1::types -1a46aeae45b7a0e47f79b7207300532986f9d9cd7060779afc7a529f54d712ab android.hardware.confirmationui@1.0::IConfirmationResultCallback -6d8347ff3cd7de471065ac3e8e68385073630cdeebe9f8fa58cb91cf44436c95 android.hardware.confirmationui@1.0::IConfirmationUI -a3ff916784dce87a56c757ab5c86433f0cdf562280999a5f978a6e8a0f3f19e7 android.hardware.confirmationui@1.0::types -1fbf2d7e383632216aaaa1d972a21a618f55659263d2e6f0b309e3cb323b4b63 android.hardware.drm@1.1::ICryptoFactory -7877ff8e4c1e48b825e6e5e66d050288e5656ed535c61cc7830a92ed4a9e1990 android.hardware.drm@1.1::IDrmFactory -fef2f0ebde7704548fb203df46673ceb342272fc4fa9d0af25a980d2584a36e7 android.hardware.drm@1.1::IDrmPlugin -5047a346ecce239404b9020959f60dd467318e9c17b290a6386bc3894df62c3c android.hardware.drm@1.1::types -a830336ac8627d6432cfafb1b884343ad9f885dee0a5323e380e6d3c519156b8 android.hardware.gnss@1.1::IGnss -8ad55bc35bb3a83e65c018bdfde7ae5ebc749ff2bf6b79412ded0bc6c89b97d8 android.hardware.gnss@1.1::IGnssCallback -3c5183d7506010be57e0f748e3640fc2ded1ba955784b6256ba427f4c399591c android.hardware.gnss@1.1::IGnssConfiguration -1a07d1383e847c3deb696ec7a2c9e33b9683772945660448a010b18063da67a4 android.hardware.gnss@1.1::IGnssMeasurement -83e7a10ff3702147bd7ffa04567b20d407a3b16bbb7705644af44d919afe9103 android.hardware.gnss@1.1::IGnssMeasurementCallback -0b96e0254e2168cfecb30c1ed5fb42681652cc00faa68c6e07568fafe64d1d50 android.hardware.graphics.common@1.1::types -7d2cef99c838fb58038de8bbfd3cdb76ff4797241987077721715297f8d45e34 android.hardware.graphics.common@1.1::types # b/78135149 -d9b40a5b09962a5a0780b10fe33a4e607e69e2e088fc83de88a584115b7cb1c0 android.hardware.graphics.composer@2.2::IComposer -a2f183f7fcc79aabedaef11095ab223aac0ed5ef984d850893872515e7f560c7 android.hardware.graphics.composer@2.2::IComposerClient -dd83be076b6b3f10ed62ab34d8c8b95f2415961fb785200eb842e7bfb2b0ee92 android.hardware.graphics.mapper@2.1::IMapper -675682dd3007805c985eaaec91612abc88f4c25b3431fb84070b7584a1a741fb android.hardware.health@2.0::IHealth -434c4c32c00b0e54bb05e40c79503208b40f786a318029a2a4f66e34f10f2a76 android.hardware.health@2.0::IHealthInfoCallback -c9e498f1ade5e26f00d290b4763a9671ec6720f915e7d592844b62e8cb1f9b5c android.hardware.health@2.0::types -201f9723353fdbd40bf3705537fb7e015e4c399879425e68688fe0f43606ea4d android.hardware.keymaster@4.0::IKeymasterDevice -1b7d2090c0a28b229d37c4b96160796b1f0d703950ac6ccc163fccd280830503 android.hardware.keymaster@4.0::types -6d5c646a83538f0f9d8438c259932509f4353410c6c76e56db0d6ca98b69c3bb android.hardware.media.bufferpool@1.0::IAccessor -b8c7ed58aa8740361e63d0ce9e7c94227572a629f356958840b34809d2393a7c android.hardware.media.bufferpool@1.0::IClientManager -4a2c0dc82780e6c90731725a103feab8ab6ecf85a64e049b9cbd2b2c61620fe1 android.hardware.media.bufferpool@1.0::IConnection -6aef1218e5949f867b0104752ac536c1b707222a403341720de90141df129e3e android.hardware.media.bufferpool@1.0::types -7698dc2382a2eeb43541840e3ee624f34108efdfb976b2bfa7c13ef15fb8c4c4 android.hardware.neuralnetworks@1.1::IDevice -72cc6126632456e8fbb8776fe50150c3c4dd5d09145653193affb70785211dfa android.hardware.neuralnetworks@1.1::types -8d3d86da0bfa4bf070970d8303c659f67f35d670c287d45a3f542e4fedadd578 android.hardware.nfc@1.1::INfc -e85f566698d2a2c28100e264fcf2c691a066756ddf8dd341d009ff50cfe10614 android.hardware.nfc@1.1::INfcClientCallback -5e278fcaa3287d397d8eebe1c22aaa28150f5caae1cf9381cd6dc32cb37899c5 android.hardware.nfc@1.1::types -163e115e833fc1d77cdd4a8cf0c833bb8b8d74fe35c880fe693101d17774926f android.hardware.power@1.2::IPower -7899b9305587b2d5cd74a3cc87e9090f58bf4ae74256ce3ee36e7ec011822840 android.hardware.power@1.2::types -5a464e6db53fad223986d655028a18185b73db8e2bfa9663f9042c9623eb0aa0 android.hardware.power@1.3::IPower -a54a28d39b892d27a3cb06829181c038edcdd9e8eef359543b01e4313ae59aa0 android.hardware.power@1.3::types -ab132c990a62f0aca35871c092c22fb9c85d478e22124ef6a4d0a2302da76a9f android.hardware.radio@1.2::IRadio -cda752aeabaabc20486a82ac57a3dd107785c006094a349bc5e224e8aa22a17c android.hardware.radio@1.2::IRadioIndication -da8c6ae991c6a4b284cc6e445332e064e28ee8a09482ed5afff9d159ec6694b7 android.hardware.radio@1.2::IRadioResponse -b65332996eb39ba63300a1011404141fa59ce5c252bc17afae637be6eeca5f55 android.hardware.radio@1.2::ISap -a9361522cc97ef66209d39ba324095b2f08344054bb4d3481e803eee0480623a android.hardware.radio@1.2::types -87385469cf4409f0f33b01508e7a477cf71f2a11e466dd7e3ab5971a1baaa72b android.hardware.radio.config@1.0::IRadioConfig -228b2ee3c8c276c9f0afad2dc313ca3d6bbd9e482ddf313c7204c60ad9b636ab android.hardware.radio.config@1.0::IRadioConfigIndication -a2e9b7aa09f79426f765838174e04b6f9a3e6c8b76b923fc1705632207bad44b android.hardware.radio.config@1.0::IRadioConfigResponse -4307696b64ded9bd8de06887f9dfc533e875c4e0d83b8008df4d705164bde0b1 android.hardware.radio.config@1.0::types -bd7699f07ba5392310fefd33ea964e01f4f4a66015146845c85055004823cc81 android.hardware.secure_element@1.0::ISecureElement -a65aa82bbe48d81a9ae9e86247bb1b89fd2d3138d4053d7a5b716c71149b7dee android.hardware.secure_element@1.0::ISecureElementHalCallback -2984c069f48ba35cd1bf49b0e17daad0d418fef52cb7a4a84dba0043114063d4 android.hardware.secure_element@1.0::types -b4f507b4dc9b5cd5f0e4445926acb7d94525ae60dc307b3951142283632207b6 android.hardware.soundtrigger@2.1::ISoundTriggerHw -92c2cc0f06ef744c5bda21f1d660258f7937203109b493eee22c3f3e2dbb0d3e android.hardware.soundtrigger@2.1::ISoundTriggerHwCallback -8ddfa7542772cc7bca19972b2d856264efa31914bfd098aeb7c2079d950194cb android.hardware.usb.gadget@1.0::IUsbGadget -ad0a620cda08f01b151c30cb7afa23b0637cc84340cf8dec00ac8e32cf54a8db android.hardware.usb.gadget@1.0::IUsbGadgetCallback -51fc20f223561ac3a32ace3217837ef3860265bd91c8b7ae3859532caef9bc39 android.hardware.usb.gadget@1.0::types -1bfc9fd9536ed09f04bcaf222a332bc919f1565d4d08bddccdebe1bfca8f01b5 android.hardware.vibrator@1.2::IVibrator -a0aefa29881235c21e4761d15c55edc35ef85c2e0d9e01d0966176d1dbf5f811 android.hardware.vibrator@1.2::types -8bc75a0dfac15c6f87ffec950b76c7d7de30d516b54e8e0b1f3c0ff9c7c6873b android.hardware.wifi@1.2::IWifi -780c16fdeda13b779d993953a67f7ca578c938a172a9424c1c715ae81bc40fd7 android.hardware.wifi@1.2::IWifiChip -167af870fdb87e1cbbaa0fa62ef35e1031caad20dd1ba695983dedb1e9993486 android.hardware.wifi@1.2::IWifiChipEventCallback -8c7ef32fc78d5ec6e6956de3784cc2c6f42614b5272d2e461f6d60534ba38ec2 android.hardware.wifi@1.2::IWifiNanIface -1e6074efad9da333803fb7c1acdb719d51c30b2e1e92087b0420341631c30b60 android.hardware.wifi@1.2::IWifiNanIfaceEventCallback -f5682dbf19f712bef9cc3faa5fe3dc670b6ffbcb62a147a1d86b9d43574cd83f android.hardware.wifi@1.2::IWifiStaIface -6db2e7d274be2dca9bf3087afd1f774a68c99d2b4dc7eeaf41690e5cebcbef7a android.hardware.wifi@1.2::types -ee08280de21cb41e3ec26d6ed636c701b7f70516e71fb22f4fe60a13e603f406 android.hardware.wifi.hostapd@1.0::IHostapd -b2479cd7a417a1cf4f3a22db4e4579e21bac38fdcaf381e2bf10176d05397e01 android.hardware.wifi.hostapd@1.0::types -e362203b941f18bd4cba29a62adfa02453ed00d6be5b72cdb6c4d7e0bf394a40 android.hardware.wifi.supplicant@1.1::ISupplicant -21757d0e5dd4b7e4bd981a4a20531bca3c32271ad9777b17b74eb5a1ea508384 android.hardware.wifi.supplicant@1.1::ISupplicantStaIface -cd4330c3196bda1d642a32abfe23a7d64ebfbda721940643af6867af3b3f0aa9 android.hardware.wifi.supplicant@1.1::ISupplicantStaIfaceCallback -10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork diff --git a/prebuilt_hashes/Android.bp b/prebuilt_hashes/Android.bp deleted file mode 100644 index 4692b766f7..0000000000 --- a/prebuilt_hashes/Android.bp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2018 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. - -python_binary_host { - name: "dump_hals_for_release", - - srcs: [ - "dump_hals_for_release.py", - ], - - version: { - py2: { - enabled: true, - }, - py3: { - enabled: false, - }, - }, -} diff --git a/prebuilt_hashes/dump_hals_for_release.py b/prebuilt_hashes/dump_hals_for_release.py deleted file mode 100755 index e9ed4c2f6f..0000000000 --- a/prebuilt_hashes/dump_hals_for_release.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2018 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. -# - -""" -Dump new HIDL types that are introduced in each dessert release. -""" - -from __future__ import print_function - -import argparse -import collections -import json -import os -import re - -class Globals: - pass - -class Constants: - CURRENT = 'current' - HAL_PATH_PATTERN = r'/((?:[a-zA-Z_][a-zA-Z0-9_]*/)*)(\d+\.\d+)/([a-zA-Z_][a-zA-Z0-9_]*).hal' - CURRENT_TXT_PATTERN = r'(?:.*/)?([0-9]+|current).txt' - -def trim_trailing_comments(line): - idx = line.find('#') - if idx < 0: return line - return line[0:idx] - -def strip_begin(s, prefix): - if s.startswith(prefix): - return strip_begin(s[len(prefix):], prefix) - return s - -def strip_end(s, suffix): - if s.endswith(suffix): - return strip_end(s[0:-len(suffix)], suffix) - return s - -def get_interfaces(file_name): - with open(file_name) as file: - for line in file: - line_tokens = trim_trailing_comments(line).strip().split() - if not line_tokens: - continue - assert len(line_tokens) == 2, \ - "Unrecognized line in file {}:\n{}".format(file_name, line) - yield line_tokens[1] - -def api_level_to_int(api_level): - try: - if api_level == Constants.CURRENT: return float('inf') - return int(api_level) - except ValueError: - return None - -def get_interfaces_from_package_root(package, root): - root = strip_end(root, '/') - for dirpath, _, filenames in os.walk(root, topdown=False): - dirpath = strip_begin(dirpath, root) - for filename in filenames: - filepath = os.path.join(dirpath, filename) - mo = re.match(Constants.HAL_PATH_PATTERN, filepath) - if not mo: - continue - yield '{}.{}@{}::{}'.format( - package, mo.group(1).strip('/').replace('/', '.'), mo.group(2), mo.group(3)) - -def filter_out(iterable): - return iterable if not Globals.filter_out else filter( - lambda s: all(re.search(pattern, s) is None for pattern in Globals.filter_out), - iterable) - -def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument('--pretty', help='Print pretty JSON', action='store_true') - parser.add_argument('--package-root', metavar='PACKAGE:PATH', nargs='*', - help='package root of current directory, e.g. android.hardware:hardware/interfaces') - parser.add_argument('--filter-out', metavar='REGEX', nargs='*', - help='A regular expression that filters out interfaces.') - parser.add_argument('hashes', metavar='FILE', nargs='*', - help='Locations of current.txt for each release.') - parser.parse_args(namespace=Globals) - - interfaces_for_level = dict() - - for filename in Globals.hashes or tuple(): - mo = re.match(Constants.CURRENT_TXT_PATTERN, filename) - assert mo is not None, \ - 'Input hash file names must have the format {} but is {}'.format(Constants.CURRENT_TXT_PATTERN, filename) - - api_level = mo.group(1) - assert api_level_to_int(api_level) is not None - - if api_level not in interfaces_for_level: - interfaces_for_level[api_level] = set() - interfaces_for_level[api_level].update(filter_out(get_interfaces(filename))) - - for package_root in Globals.package_root or tuple(): - tup = package_root.split(':') - assert len(tup) == 2, \ - '--package-root must have the format PACKAGE:PATH, but is {}'.format(package_root) - if Constants.CURRENT not in interfaces_for_level: - interfaces_for_level[Constants.CURRENT] = set() - interfaces_for_level[Constants.CURRENT].update(filter_out(get_interfaces_from_package_root(*tup))) - - seen_interfaces = set() - new_interfaces_for_level = collections.OrderedDict() - for level, interfaces in sorted(interfaces_for_level.items(), key=lambda tup: api_level_to_int(tup[0])): - if level != Constants.CURRENT: - removed_interfaces = seen_interfaces - interfaces - assert not removed_interfaces, \ - "The following interfaces are removed from API level {}:\n{}".format( - level, removed_interfaces) - new_interfaces_for_level[level] = sorted(interfaces - seen_interfaces) - seen_interfaces.update(interfaces) - - print(json.dumps(new_interfaces_for_level, - separators=None if Globals.pretty else (',',':'), - indent=4 if Globals.pretty else None)) - -if __name__ == '__main__': - main() diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp index 6765b4da7d..f3cc2e0ad4 100644 --- a/radio/1.0/Android.bp +++ b/radio/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadio.hal", diff --git a/radio/1.1/Android.bp b/radio/1.1/Android.bp index 28388b0ebe..b325015824 100644 --- a/radio/1.1/Android.bp +++ b/radio/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadio.hal", diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp index 28e6b266cc..0a4caf11f5 100644 --- a/radio/1.2/Android.bp +++ b/radio/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadio.hal", diff --git a/radio/1.3/Android.bp b/radio/1.3/Android.bp index b6af874956..1c8e6c2242 100644 --- a/radio/1.3/Android.bp +++ b/radio/1.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadio.hal", diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp index ff2e0d60d6..6c3a7d2563 100644 --- a/radio/1.4/Android.bp +++ b/radio/1.4/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio@1.4", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadio.hal", diff --git a/radio/1.4/types.hal b/radio/1.4/types.hal index 393716b7ce..a830816822 100644 --- a/radio/1.4/types.hal +++ b/radio/1.4/types.hal @@ -1847,9 +1847,9 @@ struct NrSignalStrength { /** * SS reference signal received quality, multipled by -1. * - * Reference: 3GPP TS 38.215. + * Reference: 3GPP TS 38.215, 3GPP TS 38.133 section 10. * - * Range [3, 20], INT_MAX means invalid/unreported. + * Range [-20 dB, 43 dB], INT_MAX means invalid/unreported. */ int32_t ssRsrq; diff --git a/radio/1.5/Android.bp b/radio/1.5/Android.bp index 06a2a6ecf3..0542924e2d 100644 --- a/radio/1.5/Android.bp +++ b/radio/1.5/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio@1.5", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadio.hal", diff --git a/radio/1.5/types.hal b/radio/1.5/types.hal index b061bd51c8..c1f3f0358e 100644 --- a/radio/1.5/types.hal +++ b/radio/1.5/types.hal @@ -107,9 +107,9 @@ enum SignalMeasurementType : int32_t { SSRSRP = 6, /** * 5G SS reference signal received quality. - * Range: -20 dB to -3 dB. + * Range: -43 dB to 20 dB. * Used RAN: NGRAN - * Reference: 3GPP TS 38.215. + * Reference: 3GPP TS 38.215, 3GPP TS 38.133 section 10 */ SSRSRQ = 7, /** diff --git a/radio/1.6/Android.bp b/radio/1.6/Android.bp new file mode 100644 index 0000000000..b363f57fad --- /dev/null +++ b/radio/1.6/Android.bp @@ -0,0 +1,22 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.radio@1.6", + root: "android.hardware", + srcs: [ + "types.hal", + "IRadio.hal", + "IRadioIndication.hal", + "IRadioResponse.hal", + ], + interfaces: [ + "android.hardware.radio@1.0", + "android.hardware.radio@1.1", + "android.hardware.radio@1.2", + "android.hardware.radio@1.3", + "android.hardware.radio@1.4", + "android.hardware.radio@1.5", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal new file mode 100644 index 0000000000..a084b92fb7 --- /dev/null +++ b/radio/1.6/IRadio.hal @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio@1.6; + +import @1.5::IRadio; + +/** + * This interface is used by telephony and telecom to talk to cellular radio. + * All the functions have minimum one parameter: + * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the + * duration of a method call. If clients provide colliding serials (including passing the same + * serial to different methods), multiple responses (one for each method call) must still be served. + * setResponseFunctions must work with @1.6:IRadioResponse and @1.6::IRadioIndication. + */ +interface IRadio extends @1.5::IRadio { +}; diff --git a/radio/1.6/IRadioIndication.hal b/radio/1.6/IRadioIndication.hal new file mode 100644 index 0000000000..9951dd94b9 --- /dev/null +++ b/radio/1.6/IRadioIndication.hal @@ -0,0 +1,25 @@ +/* + * 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.radio@1.6; + +import @1.5::IRadioIndication; + +/** + * Interface declaring unsolicited radio indications. + */ +interface IRadioIndication extends @1.5::IRadioIndication { +}; diff --git a/radio/1.6/IRadioResponse.hal b/radio/1.6/IRadioResponse.hal new file mode 100644 index 0000000000..a67aa3fe53 --- /dev/null +++ b/radio/1.6/IRadioResponse.hal @@ -0,0 +1,25 @@ +/* + * 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.radio@1.6; + +import @1.5::IRadioResponse; + +/** + * Interface declaring response functions to solicited radio requests. + */ +interface IRadioResponse extends @1.5::IRadioResponse { +}; diff --git a/radio/1.6/types.hal b/radio/1.6/types.hal new file mode 100644 index 0000000000..3395619c3c --- /dev/null +++ b/radio/1.6/types.hal @@ -0,0 +1,17 @@ +/* + * 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.radio@1.6; diff --git a/radio/1.6/vts/OWNERS b/radio/1.6/vts/OWNERS new file mode 100644 index 0000000000..3629a6c1f4 --- /dev/null +++ b/radio/1.6/vts/OWNERS @@ -0,0 +1,10 @@ +# Telephony team +refuhoo@google.com +amitmahajan@google.com +jackyu@google.com +fionaxu@google.com +# more to add + +# VTS team +yuexima@google.com +dshi@google.com
\ No newline at end of file diff --git a/radio/1.6/vts/functional/Android.bp b/radio/1.6/vts/functional/Android.bp new file mode 100644 index 0000000000..a6cfc6f631 --- /dev/null +++ b/radio/1.6/vts/functional/Android.bp @@ -0,0 +1,41 @@ +// +// Copyright (C) 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_test { + name: "VtsHalRadioV1_6TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "radio_hidl_hal_api.cpp", + "radio_hidl_hal_test.cpp", + "radio_response.cpp", + "radio_indication.cpp", + "VtsHalRadioV1_6TargetTest.cpp", + ], + static_libs: [ + "RadioVtsTestUtilBase", + "android.hardware.radio@1.6", + "android.hardware.radio@1.5", + "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", + "android.hardware.radio.config@1.0", + "android.hardware.radio.config@1.1", + ], + header_libs: ["radio.util.header@1.0"], + test_suites: ["general-tests", "vts"] +} diff --git a/radio/1.6/vts/functional/VtsHalRadioV1_6TargetTest.cpp b/radio/1.6/vts/functional/VtsHalRadioV1_6TargetTest.cpp new file mode 100644 index 0000000000..12cefd6caf --- /dev/null +++ b/radio/1.6/vts/functional/VtsHalRadioV1_6TargetTest.cpp @@ -0,0 +1,22 @@ +/* + * 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 <radio_hidl_hal_utils_v1_6.h> + +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioHidlTest_v1_6, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + android::hardware::radio::V1_6::IRadio::descriptor)), + android::hardware::PrintInstanceNameToString); diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp new file mode 100644 index 0000000000..8ed56edaca --- /dev/null +++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp @@ -0,0 +1,19 @@ +/* + * 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 <radio_hidl_hal_utils_v1_6.h> + +#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) diff --git a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp new file mode 100644 index 0000000000..e9a4542018 --- /dev/null +++ b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp @@ -0,0 +1,74 @@ +/* + * 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 <radio_hidl_hal_utils_v1_6.h> + +void RadioHidlTest_v1_6::SetUp() { + radio_v1_6 = android::hardware::radio::V1_6::IRadio::getService(GetParam()); + ASSERT_NE(nullptr, radio_v1_6.get()); + + radioRsp_v1_6 = new (std::nothrow) RadioResponse_v1_6(*this); + ASSERT_NE(nullptr, radioRsp_v1_6.get()); + + count_ = 0; + + radioInd_v1_6 = new (std::nothrow) RadioIndication_v1_6(*this); + ASSERT_NE(nullptr, radioInd_v1_6.get()); + + radio_v1_6->setResponseFunctions(radioRsp_v1_6, radioInd_v1_6); + + getDataCallList(); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); + EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); + EXPECT_EQ(RadioError::NONE, radioRsp_v1_6->rspInfo.error); + + sp<::android::hardware::radio::config::V1_1::IRadioConfig> radioConfig = + ::android::hardware::radio::config::V1_1::IRadioConfig::getService(); + /* Enforce Vts testing with RadioConfig is existed. */ + ASSERT_NE(nullptr, radioConfig.get()); + + /* Enforce Vts Testing with Sim Status Present only. */ + 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; +} 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 new file mode 100644 index 0000000000..66846ea009 --- /dev/null +++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h @@ -0,0 +1,856 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <android-base/logging.h> + +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/ServiceManagement.h> +#include <utils/Log.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> +#include <android/hardware/radio/1.6/types.h> + +#include "vts_test_util.h" + +using namespace ::android::hardware::radio::V1_6; +using namespace ::android::hardware::radio::V1_5; +using namespace ::android::hardware::radio::V1_4; +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 ::android::sp; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +#define TIMEOUT_PERIOD 75 +#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 +#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 + +#define RADIO_SERVICE_NAME "slot1" + +class RadioHidlTest_v1_6; +extern ::android::hardware::radio::V1_5::CardStatus cardStatus; + +/* Callback class for radio response v1_5 */ +class RadioResponse_v1_6 : public ::android::hardware::radio::V1_6::IRadioResponse { + protected: + RadioHidlTest_v1_6& parent_v1_6; + + public: + hidl_vec<RadioBandMode> radioBandModes; + + RadioResponseInfo rspInfo; + + // Call + hidl_vec<::android::hardware::radio::V1_2::Call> currentCalls; + + // Modem + bool isModemEnabled; + bool enableModemResponseToggle; + + ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_4::RadioAccessFamily> + networkTypeBitmapResponse; + + // Data + ::android::hardware::radio::V1_4::DataRegStateResult dataRegResp; + + // SimLock status + ::android::hardware::radio::V1_4::CarrierRestrictionsWithPriority carrierRestrictionsResp; + ::android::hardware::radio::V1_4::SimLockMultiSimPolicy multiSimPolicyResp; + + // Whether toggling uicc applications operation is supported. + bool canToggleUiccApplicationsEnablement; + + // Whether Uicc applications are enabled or not. + bool areUiccApplicationsEnabled; + + // Barring Info Response + ::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); + virtual ~RadioResponse_v1_6() = default; + + Return<void> getIccCardStatusResponse( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_0::CardStatus& cardStatus); + + Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info, + int32_t remainingRetries); + + Return<void> getCurrentCallsResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& calls); + + Return<void> dialResponse(const RadioResponseInfo& info); + + Return<void> getIMSIForAppResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& imsi); + + Return<void> hangupConnectionResponse(const RadioResponseInfo& info); + + Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info); + + Return<void> hangupForegroundResumeBackgroundResponse(const RadioResponseInfo& info); + + Return<void> switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info); + + Return<void> conferenceResponse(const RadioResponseInfo& info); + + Return<void> rejectCallResponse(const RadioResponseInfo& info); + + Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info, + const LastCallFailCauseInfo& failCauseInfo); + + Return<void> getSignalStrengthResponse( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_0::SignalStrength& sigStrength); + + Return<void> getVoiceRegistrationStateResponse( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_0::VoiceRegStateResult& voiceRegResponse); + + Return<void> getDataRegistrationStateResponse( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_0::DataRegStateResult& dataRegResponse); + + Return<void> getOperatorResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& longName, + const ::android::hardware::hidl_string& shortName, + const ::android::hardware::hidl_string& numeric); + + Return<void> setRadioPowerResponse(const RadioResponseInfo& info); + + Return<void> sendDtmfResponse(const RadioResponseInfo& info); + + Return<void> sendSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms); + + Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info, const SendSmsResult& sms); + + Return<void> setupDataCallResponse( + const RadioResponseInfo& info, + const android::hardware::radio::V1_0::SetupDataCallResult& dcResponse); + + Return<void> iccIOForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo); + + Return<void> sendUssdResponse(const RadioResponseInfo& info); + + Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info); + + Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m); + + Return<void> setClirResponse(const RadioResponseInfo& info); + + Return<void> getCallForwardStatusResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos); + + Return<void> setCallForwardResponse(const RadioResponseInfo& info); + + Return<void> getCallWaitingResponse(const RadioResponseInfo& info, bool enable, + int32_t serviceClass); + + Return<void> setCallWaitingResponse(const RadioResponseInfo& info); + + Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info); + + Return<void> acceptCallResponse(const RadioResponseInfo& info); + + Return<void> deactivateDataCallResponse(const RadioResponseInfo& info); + + Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t response); + + Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t retry); + + Return<void> setBarringPasswordResponse(const RadioResponseInfo& info); + + Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info, bool manual); + + Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info); + + Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info); + + Return<void> getAvailableNetworksResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos); + + Return<void> startDtmfResponse(const RadioResponseInfo& info); + + Return<void> stopDtmfResponse(const RadioResponseInfo& info); + + Return<void> getBasebandVersionResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& version); + + Return<void> separateConnectionResponse(const RadioResponseInfo& info); + + Return<void> setMuteResponse(const RadioResponseInfo& info); + + Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable); + + Return<void> getClipResponse(const RadioResponseInfo& info, ClipStatus status); + + Return<void> getDataCallListResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec< + android::hardware::radio::V1_0::SetupDataCallResult>& dcResponse); + + Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<uint8_t>& data); + + Return<void> sendOemRilRequestStringsResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data); + + Return<void> setSuppServiceNotificationsResponse(const RadioResponseInfo& info); + + Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index); + + Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info); + + Return<void> setBandModeResponse(const RadioResponseInfo& info); + + Return<void> getAvailableBandModesResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<RadioBandMode>& bandModes); + + Return<void> sendEnvelopeResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& commandResponse); + + Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info); + + Return<void> handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo& info); + + Return<void> explicitCallTransferResponse(const RadioResponseInfo& info); + + Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info); + + Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info, + PreferredNetworkType nwType); + + Return<void> getNeighboringCidsResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<NeighboringCell>& cells); + + Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info); + + Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info); + + Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info); + + Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info, + CdmaRoamingType type); + + Return<void> setTTYModeResponse(const RadioResponseInfo& info); + + Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode); + + Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info); + + Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable); + + Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info); + + Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info); + + Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms); + + Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info); + + Return<void> getGsmBroadcastConfigResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs); + + Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info); + + Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info); + + Return<void> getCdmaBroadcastConfigResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs); + + Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info); + + Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info); + + Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& mdn, + const ::android::hardware::hidl_string& hSid, + const ::android::hardware::hidl_string& hNid, + const ::android::hardware::hidl_string& min, + const ::android::hardware::hidl_string& prl); + + Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index); + + Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info); + + Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& imei, + const ::android::hardware::hidl_string& imeisv, + const ::android::hardware::hidl_string& esn, + const ::android::hardware::hidl_string& meid); + + Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info); + + Return<void> getSmscAddressResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& smsc); + + Return<void> setSmscAddressResponse(const RadioResponseInfo& info); + + Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info); + + Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info); + + Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info, + CdmaSubscriptionSource source); + + Return<void> requestIsimAuthenticationResponse( + const RadioResponseInfo& info, const ::android::hardware::hidl_string& response); + + Return<void> acknowledgeIncomingGsmSmsWithPduResponse(const RadioResponseInfo& info); + + Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info, + const IccIoResult& iccIo); + + Return<void> getVoiceRadioTechnologyResponse( + const RadioResponseInfo& info, ::android::hardware::radio::V1_0::RadioTechnology rat); + + Return<void> getCellInfoListResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>& + cellInfo); + + Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info); + + Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info); + + Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info, bool isRegistered, + RadioTechnologyFamily ratFamily); + + Return<void> sendImsSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms); + + Return<void> iccTransmitApduBasicChannelResponse(const RadioResponseInfo& info, + const IccIoResult& result); + + Return<void> iccOpenLogicalChannelResponse( + const RadioResponseInfo& info, int32_t channelId, + const ::android::hardware::hidl_vec<int8_t>& selectResponse); + + Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info); + + Return<void> iccTransmitApduLogicalChannelResponse(const RadioResponseInfo& info, + const IccIoResult& result); + + Return<void> nvReadItemResponse(const RadioResponseInfo& info, + const ::android::hardware::hidl_string& result); + + Return<void> nvWriteItemResponse(const RadioResponseInfo& info); + + Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info); + + Return<void> nvResetConfigResponse(const RadioResponseInfo& info); + + Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info); + + Return<void> setDataAllowedResponse(const RadioResponseInfo& info); + + Return<void> getHardwareConfigResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<HardwareConfig>& config); + + Return<void> requestIccSimAuthenticationResponse(const RadioResponseInfo& info, + const IccIoResult& result); + + Return<void> setDataProfileResponse(const RadioResponseInfo& info); + + Return<void> requestShutdownResponse(const RadioResponseInfo& info); + + Return<void> getRadioCapabilityResponse( + const RadioResponseInfo& info, + const android::hardware::radio::V1_0::RadioCapability& rc); + + Return<void> setRadioCapabilityResponse( + const RadioResponseInfo& info, + const android::hardware::radio::V1_0::RadioCapability& rc); + + Return<void> startLceServiceResponse(const RadioResponseInfo& info, + const LceStatusInfo& statusInfo); + + Return<void> stopLceServiceResponse(const RadioResponseInfo& info, + const LceStatusInfo& statusInfo); + + Return<void> pullLceDataResponse(const RadioResponseInfo& info, const LceDataInfo& lceInfo); + + Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info, + const ActivityStatsInfo& activityInfo); + + Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info, int32_t numAllowed); + + Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info, bool allAllowed, + const CarrierRestrictions& carriers); + + Return<void> sendDeviceStateResponse(const RadioResponseInfo& info); + + Return<void> setIndicationFilterResponse(const RadioResponseInfo& info); + + Return<void> setSimCardPowerResponse(const RadioResponseInfo& info); + + Return<void> acknowledgeRequest(int32_t serial); + + /* 1.1 Api */ + Return<void> setCarrierInfoForImsiEncryptionResponse(const RadioResponseInfo& info); + + Return<void> setSimCardPowerResponse_1_1(const RadioResponseInfo& info); + + Return<void> startNetworkScanResponse(const RadioResponseInfo& info); + + Return<void> stopNetworkScanResponse(const RadioResponseInfo& info); + + Return<void> startKeepaliveResponse(const RadioResponseInfo& info, + const KeepaliveStatus& status); + + Return<void> stopKeepaliveResponse(const RadioResponseInfo& info); + + /* 1.2 Api */ + Return<void> setSignalStrengthReportingCriteriaResponse(const RadioResponseInfo& info); + + Return<void> setLinkCapacityReportingCriteriaResponse(const RadioResponseInfo& info); + + Return<void> getIccCardStatusResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_2::CardStatus& card_status); + + Return<void> getCurrentCallsResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls); + + Return<void> getSignalStrengthResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_2::SignalStrength& sig_strength); + + Return<void> getSignalStrengthResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_4::SignalStrength& sig_strength); + + Return<void> getCellInfoListResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>& + cellInfo); + + Return<void> getVoiceRegistrationStateResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse); + + Return<void> getDataRegistrationStateResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_2::DataRegStateResult& dataRegResponse); + + /* 1.3 Api */ + Return<void> setSystemSelectionChannelsResponse(const RadioResponseInfo& info); + + Return<void> enableModemResponse(const RadioResponseInfo& info); + + Return<void> getModemStackStatusResponse(const RadioResponseInfo& info, const bool enabled); + + /* 1.4 Api */ + Return<void> emergencyDialResponse(const RadioResponseInfo& info); + + Return<void> startNetworkScanResponse_1_4(const RadioResponseInfo& info); + + Return<void> getCellInfoListResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_4::CellInfo>& + cellInfo); + + Return<void> getDataRegistrationStateResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_4::DataRegStateResult& dataRegResponse); + + Return<void> getIccCardStatusResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_4::CardStatus& card_status); + + Return<void> getPreferredNetworkTypeBitmapResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_bitfield< + ::android::hardware::radio::V1_4::RadioAccessFamily> + networkTypeBitmap); + + Return<void> setPreferredNetworkTypeBitmapResponse(const RadioResponseInfo& info); + + Return<void> getDataCallListResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_4::SetupDataCallResult>& dcResponse); + + Return<void> setupDataCallResponse_1_4( + const RadioResponseInfo& info, + const android::hardware::radio::V1_4::SetupDataCallResult& dcResponse); + + Return<void> setAllowedCarriersResponse_1_4(const RadioResponseInfo& info); + + Return<void> getAllowedCarriersResponse_1_4(const RadioResponseInfo& info, + const CarrierRestrictionsWithPriority& carriers, + SimLockMultiSimPolicy multiSimPolicy); + + /* 1.5 Api */ + Return<void> setSignalStrengthReportingCriteriaResponse_1_5(const RadioResponseInfo& info); + + Return<void> setLinkCapacityReportingCriteriaResponse_1_5(const RadioResponseInfo& info); + + Return<void> enableUiccApplicationsResponse(const RadioResponseInfo& info); + + Return<void> areUiccApplicationsEnabledResponse(const RadioResponseInfo& info, bool enabled); + + Return<void> canToggleUiccApplicationsEnablementResponse(const RadioResponseInfo& info, + bool canToggle); + + Return<void> setSystemSelectionChannelsResponse_1_5(const RadioResponseInfo& info); + + Return<void> startNetworkScanResponse_1_5(const RadioResponseInfo& info); + + Return<void> setupDataCallResponse_1_5( + const RadioResponseInfo& info, + const android::hardware::radio::V1_5::SetupDataCallResult& dcResponse); + + Return<void> getDataCallListResponse_1_5( + const RadioResponseInfo& info, + const hidl_vec<::android::hardware::radio::V1_5::SetupDataCallResult>& dcResponse); + + Return<void> setInitialAttachApnResponse_1_5(const RadioResponseInfo& info); + + Return<void> setDataProfileResponse_1_5(const RadioResponseInfo& info); + + Return<void> setRadioPowerResponse_1_5(const RadioResponseInfo& info); + + Return<void> setIndicationFilterResponse_1_5(const RadioResponseInfo& info); + + Return<void> getBarringInfoResponse( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::CellIdentity& cellIdentity, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::BarringInfo>& + barringInfos); + + Return<void> getVoiceRegistrationStateResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::RegStateResult& regResponse); + + Return<void> getDataRegistrationStateResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::RegStateResult& regResponse); + + Return<void> getCellInfoListResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::CellInfo>& + cellInfo); + + Return<void> setNetworkSelectionModeManualResponse_1_5(const RadioResponseInfo& info); + + Return<void> sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info, + const SendSmsResult& sms); + + Return<void> supplySimDepersonalizationResponse( + const RadioResponseInfo& info, + ::android::hardware::radio::V1_5::PersoSubstate persoType, int32_t remainingRetries); + + Return<void> getIccCardStatusResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::CardStatus& card_status); + + /* 1.6 Api */ +}; + +/* Callback class for radio indication */ +class RadioIndication_v1_6 : public ::android::hardware::radio::V1_6::IRadioIndication { + protected: + RadioHidlTest_v1_6& parent_v1_6; + + public: + RadioIndication_v1_6(RadioHidlTest_v1_6& parent_v1_6); + virtual ~RadioIndication_v1_6() = default; + + /* 1.6 Api */ + + /* 1.5 Api */ + Return<void> uiccApplicationsEnablementChanged(RadioIndicationType type, bool enabled); + + Return<void> networkScanResult_1_5( + RadioIndicationType type, + const ::android::hardware::radio::V1_5::NetworkScanResult& result); + + Return<void> cellInfoList_1_5( + RadioIndicationType type, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::CellInfo>& + records); + + Return<void> dataCallListChanged_1_5( + RadioIndicationType type, + const hidl_vec<::android::hardware::radio::V1_5::SetupDataCallResult>& dcList); + + /* 1.4 Api */ + Return<void> currentEmergencyNumberList( + RadioIndicationType type, + const ::android::hardware::hidl_vec<EmergencyNumber>& emergencyNumberList); + + Return<void> cellInfoList_1_4( + RadioIndicationType type, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_4::CellInfo>& + records); + + Return<void> networkScanResult_1_4( + RadioIndicationType type, + const ::android::hardware::radio::V1_4::NetworkScanResult& result); + + Return<void> currentPhysicalChannelConfigs_1_4( + RadioIndicationType type, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_4::PhysicalChannelConfig>& configs); + + Return<void> dataCallListChanged_1_4( + RadioIndicationType type, + const ::android::hardware::hidl_vec< + android::hardware::radio::V1_4::SetupDataCallResult>& dcList); + + /* 1.2 Api */ + Return<void> networkScanResult_1_2( + RadioIndicationType type, + const ::android::hardware::radio::V1_2::NetworkScanResult& result); + + Return<void> cellInfoList_1_2( + RadioIndicationType type, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::CellInfo>& + records); + + Return<void> currentLinkCapacityEstimate( + RadioIndicationType type, + const ::android::hardware::radio::V1_2::LinkCapacityEstimate& lce); + + Return<void> currentPhysicalChannelConfigs( + RadioIndicationType type, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_2::PhysicalChannelConfig>& configs); + + Return<void> currentSignalStrength_1_2( + RadioIndicationType type, + const ::android::hardware::radio::V1_2::SignalStrength& signalStrength); + + Return<void> currentSignalStrength_1_4( + RadioIndicationType type, + const ::android::hardware::radio::V1_4::SignalStrength& signalStrength); + + /* 1.1 Api */ + Return<void> carrierInfoForImsiEncryption(RadioIndicationType info); + + Return<void> networkScanResult( + RadioIndicationType type, + const ::android::hardware::radio::V1_1::NetworkScanResult& result); + + Return<void> keepaliveStatus(RadioIndicationType type, const KeepaliveStatus& status); + + /* 1.0 Api */ + Return<void> radioStateChanged(RadioIndicationType type, RadioState radioState); + + Return<void> callStateChanged(RadioIndicationType type); + + Return<void> networkStateChanged(RadioIndicationType type); + + Return<void> newSms(RadioIndicationType type, + const ::android::hardware::hidl_vec<uint8_t>& pdu); + + Return<void> newSmsStatusReport(RadioIndicationType type, + const ::android::hardware::hidl_vec<uint8_t>& pdu); + + Return<void> newSmsOnSim(RadioIndicationType type, int32_t recordNumber); + + Return<void> onUssd(RadioIndicationType type, UssdModeType modeType, + const ::android::hardware::hidl_string& msg); + + Return<void> nitzTimeReceived(RadioIndicationType type, + const ::android::hardware::hidl_string& nitzTime, + uint64_t receivedTime); + + Return<void> currentSignalStrength( + RadioIndicationType type, + const ::android::hardware::radio::V1_0::SignalStrength& signalStrength); + + Return<void> dataCallListChanged( + RadioIndicationType type, + const ::android::hardware::hidl_vec< + android::hardware::radio::V1_0::SetupDataCallResult>& dcList); + + Return<void> suppSvcNotify(RadioIndicationType type, const SuppSvcNotification& suppSvc); + + Return<void> stkSessionEnd(RadioIndicationType type); + + Return<void> stkProactiveCommand(RadioIndicationType type, + const ::android::hardware::hidl_string& cmd); + + Return<void> stkEventNotify(RadioIndicationType type, + const ::android::hardware::hidl_string& cmd); + + Return<void> stkCallSetup(RadioIndicationType type, int64_t timeout); + + Return<void> simSmsStorageFull(RadioIndicationType type); + + Return<void> simRefresh(RadioIndicationType type, const SimRefreshResult& refreshResult); + + Return<void> callRing(RadioIndicationType type, bool isGsm, const CdmaSignalInfoRecord& record); + + Return<void> simStatusChanged(RadioIndicationType type); + + Return<void> cdmaNewSms(RadioIndicationType type, const CdmaSmsMessage& msg); + + Return<void> newBroadcastSms(RadioIndicationType type, + const ::android::hardware::hidl_vec<uint8_t>& data); + + Return<void> cdmaRuimSmsStorageFull(RadioIndicationType type); + + Return<void> restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state); + + Return<void> enterEmergencyCallbackMode(RadioIndicationType type); + + Return<void> cdmaCallWaiting(RadioIndicationType type, + const CdmaCallWaiting& callWaitingRecord); + + Return<void> cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status); + + Return<void> cdmaInfoRec(RadioIndicationType type, const CdmaInformationRecords& records); + + Return<void> indicateRingbackTone(RadioIndicationType type, bool start); + + Return<void> resendIncallMute(RadioIndicationType type); + + Return<void> cdmaSubscriptionSourceChanged(RadioIndicationType type, + CdmaSubscriptionSource cdmaSource); + + Return<void> cdmaPrlChanged(RadioIndicationType type, int32_t version); + + Return<void> exitEmergencyCallbackMode(RadioIndicationType type); + + Return<void> rilConnected(RadioIndicationType type); + + Return<void> voiceRadioTechChanged(RadioIndicationType type, + ::android::hardware::radio::V1_0::RadioTechnology rat); + + Return<void> cellInfoList( + RadioIndicationType type, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::CellInfo>& + records); + + Return<void> imsNetworkStateChanged(RadioIndicationType type); + + Return<void> subscriptionStatusChanged(RadioIndicationType type, bool activate); + + Return<void> srvccStateNotify(RadioIndicationType type, SrvccState state); + + Return<void> hardwareConfigChanged( + RadioIndicationType type, const ::android::hardware::hidl_vec<HardwareConfig>& configs); + + Return<void> radioCapabilityIndication( + RadioIndicationType type, const android::hardware::radio::V1_0::RadioCapability& rc); + + Return<void> onSupplementaryServiceIndication(RadioIndicationType type, + const StkCcUnsolSsResult& ss); + + Return<void> stkCallControlAlphaNotify(RadioIndicationType type, + const ::android::hardware::hidl_string& alpha); + + Return<void> lceData(RadioIndicationType type, const LceDataInfo& lce); + + Return<void> pcoData(RadioIndicationType type, const PcoDataInfo& pco); + + Return<void> modemReset(RadioIndicationType type, + const ::android::hardware::hidl_string& reason); + + Return<void> registrationFailed( + RadioIndicationType type, + const ::android::hardware::radio::V1_5::CellIdentity& cellIdentity, + const ::android::hardware::hidl_string& chosenPlmn, + ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_5::Domain> domain, + int32_t causeCode, int32_t additionalCauseCode); + + Return<void> barringInfoChanged( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_5::CellIdentity& /*cellIdentity*/, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::BarringInfo>& + /*barringInfos*/); +}; + +// The main test class for Radio HIDL. +class RadioHidlTest_v1_6 : public ::testing::TestWithParam<std::string> { + protected: + std::mutex mtx_; + std::condition_variable cv_; + int count_; + + /* Serial number for radio request */ + int serial; + + /* Clear Potential Established Calls */ + void clearPotentialEstablishedCalls(); + + /* Get current data call list */ + void getDataCallList(); + + 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(); + + /* radio service handle */ + sp<::android::hardware::radio::V1_6::IRadio> radio_v1_6; + + /* radio response handle */ + sp<RadioResponse_v1_6> radioRsp_v1_6; + + /* radio indication handle */ + sp<RadioIndication_v1_6> radioInd_v1_6; +}; diff --git a/radio/1.6/vts/functional/radio_indication.cpp b/radio/1.6/vts/functional/radio_indication.cpp new file mode 100644 index 0000000000..857ea3c6c6 --- /dev/null +++ b/radio/1.6/vts/functional/radio_indication.cpp @@ -0,0 +1,372 @@ +/* + * 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 <radio_hidl_hal_utils_v1_6.h> + +RadioIndication_v1_6::RadioIndication_v1_6(RadioHidlTest_v1_6& parent) : parent_v1_6(parent) {} + +/* 1.6 Apis */ + +/* 1.5 Apis */ +Return<void> RadioIndication_v1_6::uiccApplicationsEnablementChanged(RadioIndicationType /*type*/, + bool /*enabled*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::registrationFailed( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_5::CellIdentity& /*cellIdentity*/, + const hidl_string& /*chosenPlmn*/, + ::android::hardware::hidl_bitfield<::android::hardware::radio::V1_5::Domain> /*domain*/, + int32_t /*causeCode*/, int32_t /*additionalCauseCode*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::barringInfoChanged( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_5::CellIdentity& /*cellIdentity*/, + const hidl_vec<::android::hardware::radio::V1_5::BarringInfo>& /*barringInfos*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::networkScanResult_1_5( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_5::NetworkScanResult& /*result*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cellInfoList_1_5( + RadioIndicationType /*type*/, + const hidl_vec<::android::hardware::radio::V1_5::CellInfo>& /*records*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::dataCallListChanged_1_5( + RadioIndicationType /*type*/, + const hidl_vec<android::hardware::radio::V1_5::SetupDataCallResult>& /*dcList*/) { + return Void(); +} + +/* 1.4 Apis */ +Return<void> RadioIndication_v1_6::currentPhysicalChannelConfigs_1_4( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_4::PhysicalChannelConfig>& /*configs*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::networkScanResult_1_4( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_4::NetworkScanResult& /*result*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cellInfoList_1_4( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_4::CellInfo>& /*records*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::currentEmergencyNumberList( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec<EmergencyNumber>& /*emergencyNumberList*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::dataCallListChanged_1_4( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec<android::hardware::radio::V1_4::SetupDataCallResult>& + /*dcList*/) { + return Void(); +} + +/* 1.2 Apis */ +Return<void> RadioIndication_v1_6::networkScanResult_1_2( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_2::NetworkScanResult& /*result*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cellInfoList_1_2( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_2::CellInfo>& /*records*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::currentLinkCapacityEstimate( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_2::LinkCapacityEstimate& /*lce*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::currentPhysicalChannelConfigs( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_2::PhysicalChannelConfig>& /*configs*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::currentSignalStrength_1_2( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_2::SignalStrength& /*signalStrength*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::currentSignalStrength_1_4( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_4::SignalStrength& /*signalStrength*/) { + return Void(); +} + +/* 1.1 Apis */ +Return<void> RadioIndication_v1_6::carrierInfoForImsiEncryption(RadioIndicationType /*info*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::networkScanResult( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_1::NetworkScanResult& /*result*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::keepaliveStatus(RadioIndicationType /*type*/, + const KeepaliveStatus& /*status*/) { + return Void(); +} + +/* 1.0 Apis */ +Return<void> RadioIndication_v1_6::radioStateChanged(RadioIndicationType /*type*/, + RadioState /*radioState*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::callStateChanged(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::networkStateChanged(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::newSms(RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::newSmsStatusReport( + RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*pdu*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::newSmsOnSim(RadioIndicationType /*type*/, + int32_t /*recordNumber*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::onUssd(RadioIndicationType /*type*/, UssdModeType /*modeType*/, + const ::android::hardware::hidl_string& /*msg*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::nitzTimeReceived( + RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*nitzTime*/, + uint64_t /*receivedTime*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::currentSignalStrength( + RadioIndicationType /*type*/, + const ::android::hardware::radio::V1_0::SignalStrength& /*signalStrength*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::dataCallListChanged( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec<android::hardware::radio::V1_0::SetupDataCallResult>& + /*dcList*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::suppSvcNotify(RadioIndicationType /*type*/, + const SuppSvcNotification& /*suppSvc*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::stkSessionEnd(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::stkProactiveCommand( + RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*cmd*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::stkEventNotify(RadioIndicationType /*type*/, + const ::android::hardware::hidl_string& /*cmd*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::stkCallSetup(RadioIndicationType /*type*/, int64_t /*timeout*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::simSmsStorageFull(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::simRefresh(RadioIndicationType /*type*/, + const SimRefreshResult& /*refreshResult*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::callRing(RadioIndicationType /*type*/, bool /*isGsm*/, + const CdmaSignalInfoRecord& /*record*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::simStatusChanged(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaNewSms(RadioIndicationType /*type*/, + const CdmaSmsMessage& /*msg*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::newBroadcastSms( + RadioIndicationType /*type*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaRuimSmsStorageFull(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::restrictedStateChanged(RadioIndicationType /*type*/, + PhoneRestrictedState /*state*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::enterEmergencyCallbackMode(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaCallWaiting(RadioIndicationType /*type*/, + const CdmaCallWaiting& /*callWaitingRecord*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaOtaProvisionStatus(RadioIndicationType /*type*/, + CdmaOtaProvisionStatus /*status*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaInfoRec(RadioIndicationType /*type*/, + const CdmaInformationRecords& /*records*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::indicateRingbackTone(RadioIndicationType /*type*/, + bool /*start*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::resendIncallMute(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaSubscriptionSourceChanged( + RadioIndicationType /*type*/, CdmaSubscriptionSource /*cdmaSource*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cdmaPrlChanged(RadioIndicationType /*type*/, + int32_t /*version*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::exitEmergencyCallbackMode(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::rilConnected(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::voiceRadioTechChanged( + RadioIndicationType /*type*/, ::android::hardware::radio::V1_0::RadioTechnology /*rat*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::cellInfoList( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_0::CellInfo>& /*records*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::imsNetworkStateChanged(RadioIndicationType /*type*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::subscriptionStatusChanged(RadioIndicationType /*type*/, + bool /*activate*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::srvccStateNotify(RadioIndicationType /*type*/, + SrvccState /*state*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::hardwareConfigChanged( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec<HardwareConfig>& /*configs*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::radioCapabilityIndication( + RadioIndicationType /*type*/, + const android::hardware::radio::V1_0::RadioCapability& /*rc*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::onSupplementaryServiceIndication( + RadioIndicationType /*type*/, const StkCcUnsolSsResult& /*ss*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::stkCallControlAlphaNotify( + RadioIndicationType /*type*/, const ::android::hardware::hidl_string& /*alpha*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::lceData(RadioIndicationType /*type*/, + const LceDataInfo& /*lce*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::pcoData(RadioIndicationType /*type*/, + const PcoDataInfo& /*pco*/) { + return Void(); +} + +Return<void> RadioIndication_v1_6::modemReset(RadioIndicationType /*type*/, + const ::android::hardware::hidl_string& /*reason*/) { + return Void(); +} diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp new file mode 100644 index 0000000000..44e61b9a6e --- /dev/null +++ b/radio/1.6/vts/functional/radio_response.cpp @@ -0,0 +1,1044 @@ +/* + * 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 <radio_hidl_hal_utils_v1_6.h> + +::android::hardware::radio::V1_5::CardStatus cardStatus; + +RadioResponse_v1_6::RadioResponse_v1_6(RadioHidlTest_v1_6& parent) : parent_v1_6(parent) {} + +/* 1.0 Apis */ +Return<void> RadioResponse_v1_6::getIccCardStatusResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::radio::V1_0::CardStatus& /*card_status*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::supplyIccPinForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::supplyIccPukForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::supplyIccPin2ForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::supplyIccPuk2ForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::changeIccPinForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::changeIccPin2ForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::supplyNetworkDepersonalizationResponse( + const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCurrentCallsResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_0::Call>& /*calls*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::dialResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getIMSIForAppResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imsi*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::hangupConnectionResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::hangupWaitingOrBackgroundResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::hangupForegroundResumeBackgroundResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::switchWaitingOrHoldingAndActiveResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::conferenceResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::rejectCallResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getLastCallFailCauseResponse( + const RadioResponseInfo& /*info*/, const LastCallFailCauseInfo& /*failCauseInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getSignalStrengthResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::radio::V1_0::SignalStrength& /*sig_strength*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::radio::V1_0::VoiceRegStateResult& /*voiceRegResponse*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::radio::V1_0::DataRegStateResult& /*dataRegResponse*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getOperatorResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*longName*/, + const ::android::hardware::hidl_string& /*shortName*/, + const ::android::hardware::hidl_string& /*numeric*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setRadioPowerResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendDtmfResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendSmsResponse(const RadioResponseInfo& /*info*/, + const SendSmsResult& /*sms*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendSMSExpectMoreResponse(const RadioResponseInfo& /*info*/, + const SendSmsResult& /*sms*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setupDataCallResponse( + const RadioResponseInfo& /*info*/, + const android::hardware::radio::V1_0::SetupDataCallResult& /*dcResponse*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::iccIOForAppResponse(const RadioResponseInfo& /*info*/, + const IccIoResult& /*iccIo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendUssdResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::cancelPendingUssdResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getClirResponse(const RadioResponseInfo& /*info*/, int32_t /*n*/, + int32_t /*m*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setClirResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCallForwardStatusResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<CallForwardInfo>& + /*callForwardInfos*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCallForwardResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCallWaitingResponse(const RadioResponseInfo& /*info*/, + bool /*enable*/, int32_t /*serviceClass*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCallWaitingResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::acknowledgeLastIncomingGsmSmsResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::acceptCallResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::deactivateDataCallResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getFacilityLockForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*response*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setFacilityLockForAppResponse(const RadioResponseInfo& /*info*/, + int32_t /*retry*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setBarringPasswordResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getNetworkSelectionModeResponse(const RadioResponseInfo& /*info*/, + bool /*manual*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setNetworkSelectionModeAutomaticResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setNetworkSelectionModeManualResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getAvailableNetworksResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::startDtmfResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::stopDtmfResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getBasebandVersionResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*version*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::separateConnectionResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setMuteResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getMuteResponse(const RadioResponseInfo& /*info*/, + bool /*enable*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getClipResponse(const RadioResponseInfo& /*info*/, + ClipStatus /*status*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataCallListResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<android::hardware::radio::V1_0::SetupDataCallResult>& + /*dcResponse*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendOemRilRequestRawResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_vec<uint8_t>& /*data*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendOemRilRequestStringsResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& /*data*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setSuppServiceNotificationsResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::writeSmsToSimResponse(const RadioResponseInfo& /*info*/, + int32_t /*index*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::deleteSmsOnSimResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setBandModeResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getAvailableBandModesResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<RadioBandMode>& bandModes) { + rspInfo = info; + radioBandModes = bandModes; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::sendEnvelopeResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_string& /*commandResponse*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendTerminalResponseToSimResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::handleStkCallSetupRequestFromSimResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::explicitCallTransferResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setPreferredNetworkTypeResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getPreferredNetworkTypeResponse(const RadioResponseInfo& /*info*/, + PreferredNetworkType /*nw_type*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getNeighboringCidsResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setLocationUpdatesResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCdmaSubscriptionSourceResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCdmaRoamingPreferenceResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCdmaRoamingPreferenceResponse(const RadioResponseInfo& /*info*/, + CdmaRoamingType /*type*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setTTYModeResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getTTYModeResponse(const RadioResponseInfo& /*info*/, + TtyMode /*mode*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setPreferredVoicePrivacyResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getPreferredVoicePrivacyResponse(const RadioResponseInfo& /*info*/, + bool /*enable*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendCDMAFeatureCodeResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendBurstDtmfResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendCdmaSmsResponse(const RadioResponseInfo& /*info*/, + const SendSmsResult& /*sms*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::acknowledgeLastIncomingCdmaSmsResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getGsmBroadcastConfigResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setGsmBroadcastConfigResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setGsmBroadcastActivationResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCdmaBroadcastConfigResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCdmaBroadcastConfigResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCdmaBroadcastActivationResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCDMASubscriptionResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*mdn*/, + const ::android::hardware::hidl_string& /*hSid*/, + const ::android::hardware::hidl_string& /*hNid*/, + const ::android::hardware::hidl_string& /*min*/, + const ::android::hardware::hidl_string& /*prl*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::writeSmsToRuimResponse(const RadioResponseInfo& /*info*/, + uint32_t /*index*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::deleteSmsOnRuimResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getDeviceIdentityResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imei*/, + const ::android::hardware::hidl_string& /*imeisv*/, + const ::android::hardware::hidl_string& /*esn*/, + const ::android::hardware::hidl_string& /*meid*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::exitEmergencyCallbackModeResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getSmscAddressResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*smsc*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setSmscAddressResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::reportSmsMemoryStatusResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::reportStkServiceIsRunningResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCdmaSubscriptionSourceResponse( + const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::requestIsimAuthenticationResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*response*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::acknowledgeIncomingGsmSmsWithPduResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendEnvelopeWithStatusResponse(const RadioResponseInfo& /*info*/, + const IccIoResult& /*iccIo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getVoiceRadioTechnologyResponse( + const RadioResponseInfo& /*info*/, + ::android::hardware::radio::V1_0::RadioTechnology /*rat*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCellInfoListResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_0::CellInfo>& /*cellInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setCellInfoListRateResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setInitialAttachApnResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getImsRegistrationStateResponse( + const RadioResponseInfo& /*info*/, bool /*isRegistered*/, + RadioTechnologyFamily /*ratFamily*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendImsSmsResponse(const RadioResponseInfo& /*info*/, + const SendSmsResult& /*sms*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::iccTransmitApduBasicChannelResponse( + const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::iccOpenLogicalChannelResponse( + const RadioResponseInfo& /*info*/, int32_t /*channelId*/, + const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::iccCloseLogicalChannelResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::iccTransmitApduLogicalChannelResponse( + const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::nvReadItemResponse( + const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*result*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::nvWriteItemResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::nvResetConfigResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setUiccSubscriptionResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setDataAllowedResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getHardwareConfigResponse( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::requestIccSimAuthenticationResponse( + const RadioResponseInfo& /*info*/, const IccIoResult& /*result*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setDataProfileResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::requestShutdownResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getRadioCapabilityResponse( + const RadioResponseInfo& /*info*/, + const android::hardware::radio::V1_0::RadioCapability& /*rc*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setRadioCapabilityResponse( + const RadioResponseInfo& /*info*/, + const android::hardware::radio::V1_0::RadioCapability& /*rc*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::startLceServiceResponse(const RadioResponseInfo& /*info*/, + const LceStatusInfo& /*statusInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::stopLceServiceResponse(const RadioResponseInfo& /*info*/, + const LceStatusInfo& /*statusInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::pullLceDataResponse(const RadioResponseInfo& /*info*/, + const LceDataInfo& /*lceInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getModemActivityInfoResponse( + const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setAllowedCarriersResponse(const RadioResponseInfo& /*info*/, + int32_t /*numAllowed*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getAllowedCarriersResponse( + const RadioResponseInfo& /*info*/, bool /*allAllowed*/, + const CarrierRestrictions& /*carriers*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::sendDeviceStateResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setIndicationFilterResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setSimCardPowerResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::acknowledgeRequest(int32_t /*serial*/) { + return Void(); +} + +/* 1.1 Apis */ +Return<void> RadioResponse_v1_6::setCarrierInfoForImsiEncryptionResponse( + const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setSimCardPowerResponse_1_1(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::startNetworkScanResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::stopNetworkScanResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::startKeepaliveResponse(const RadioResponseInfo& /*info*/, + const KeepaliveStatus& /*status*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) { + return Void(); +} + +/* 1.2 Apis */ +Return<void> RadioResponse_v1_6::setSignalStrengthReportingCriteriaResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setLinkCapacityReportingCriteriaResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getIccCardStatusResponse_1_2( + const RadioResponseInfo& /*info*/, + const ::android::hardware::radio::V1_2::CardStatus& /*card_status*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getCurrentCallsResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_2::Call>& calls) { + rspInfo = info; + currentCalls = calls; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getSignalStrengthResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_2::SignalStrength& /*sig_strength*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getSignalStrengthResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_4::SignalStrength& /*sig_strength*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getCellInfoListResponse_1_2( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_2::CellInfo>& /*cellInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse_1_2( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse_1_2( + const RadioResponseInfo& /*info*/, + const ::android::hardware::radio::V1_2::DataRegStateResult& /*dataRegResponse*/) { + return Void(); +} + +/* 1.3 Apis */ +Return<void> RadioResponse_v1_6::setSystemSelectionChannelsResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::enableModemResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getModemStackStatusResponse(const RadioResponseInfo& info, + const bool enabled) { + rspInfo = info; + isModemEnabled = enabled; + parent_v1_6.notify(info.serial); + return Void(); +} + +/* 1.4 Apis */ +Return<void> RadioResponse_v1_6::emergencyDialResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::startNetworkScanResponse_1_4(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_4::DataRegStateResult& dataRegResponse) { + rspInfo = info; + dataRegResp = dataRegResponse; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getCellInfoListResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_4::CellInfo>& /*cellInfo*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getIccCardStatusResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_4::CardStatus& /*card_status*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getPreferredNetworkTypeBitmapResponse( + const RadioResponseInfo& info, const ::android::hardware::hidl_bitfield< + ::android::hardware::radio::V1_4::RadioAccessFamily> + networkTypeBitmap) { + rspInfo = info; + networkTypeBitmapResponse = networkTypeBitmap; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setPreferredNetworkTypeBitmapResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataCallListResponse_1_4( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_4::SetupDataCallResult>& + /*dcResponse*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setupDataCallResponse_1_4( + const RadioResponseInfo& info, + const android::hardware::radio::V1_4::SetupDataCallResult& /*dcResponse*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setAllowedCarriersResponse_1_4(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getAllowedCarriersResponse_1_4( + const RadioResponseInfo& info, const CarrierRestrictionsWithPriority& carriers, + SimLockMultiSimPolicy multiSimPolicy) { + rspInfo = info; + carrierRestrictionsResp = carriers; + multiSimPolicyResp = multiSimPolicy; + parent_v1_6.notify(info.serial); + return Void(); +} + +/* 1.5 Apis */ +Return<void> RadioResponse_v1_6::setSignalStrengthReportingCriteriaResponse_1_5( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setLinkCapacityReportingCriteriaResponse_1_5( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::enableUiccApplicationsResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::areUiccApplicationsEnabledResponse(const RadioResponseInfo& info, + bool enabled) { + rspInfo = info; + areUiccApplicationsEnabled = enabled; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::canToggleUiccApplicationsEnablementResponse( + const RadioResponseInfo& info, bool canToggle) { + rspInfo = info; + canToggleUiccApplicationsEnablement = canToggle; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setSystemSelectionChannelsResponse_1_5( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::startNetworkScanResponse_1_5(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setupDataCallResponse_1_5( + const RadioResponseInfo& info, + const android::hardware::radio::V1_5::SetupDataCallResult& /* dcResponse */) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataCallListResponse_1_5( + const RadioResponseInfo& info, + const hidl_vec<::android::hardware::radio::V1_5::SetupDataCallResult>& /* dcResponse */) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setInitialAttachApnResponse_1_5(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setDataProfileResponse_1_5(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setRadioPowerResponse_1_5(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::setIndicationFilterResponse_1_5(const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getBarringInfoResponse( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::CellIdentity& cellIdentity, + const ::android::hardware::hidl_vec<::android::hardware::radio::V1_5::BarringInfo>& + barringInfos) { + this->barringCellIdentity = cellIdentity; + this->barringInfos = barringInfos; + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::RegStateResult& /*regResponse*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getDataRegistrationStateResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::RegStateResult& /*regResponse*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::getCellInfoListResponse_1_5( + const RadioResponseInfo& /*info*/, + const ::android::hardware::hidl_vec< + ::android::hardware::radio::V1_5::CellInfo>& /*cellInfo*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::setNetworkSelectionModeManualResponse_1_5( + const RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info, + const SendSmsResult& /*sms*/) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + +Return<void> RadioResponse_v1_6::supplySimDepersonalizationResponse( + const RadioResponseInfo& /*info*/, + ::android::hardware::radio::V1_5::PersoSubstate /*persoType*/, + int32_t /*remainingRetries*/) { + return Void(); +} + +Return<void> RadioResponse_v1_6::getIccCardStatusResponse_1_5( + const RadioResponseInfo& info, + const ::android::hardware::radio::V1_5::CardStatus& card_status) { + rspInfo = info; + cardStatus = card_status; + parent_v1_6.notify(info.serial); + return Void(); +} + +/* 1.6 Apis */ + diff --git a/radio/config/1.0/Android.bp b/radio/config/1.0/Android.bp index 387f953edb..eea4c34b90 100644 --- a/radio/config/1.0/Android.bp +++ b/radio/config/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio.config@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadioConfig.hal", diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp index 1e9071ab9a..a5c3114728 100644 --- a/radio/config/1.1/Android.bp +++ b/radio/config/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio.config@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadioConfig.hal", diff --git a/radio/config/1.2/Android.bp b/radio/config/1.2/Android.bp index 812f16643e..39d55ffa7a 100644 --- a/radio/config/1.2/Android.bp +++ b/radio/config/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio.config@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IRadioConfigIndication.hal", diff --git a/radio/deprecated/1.0/Android.bp b/radio/deprecated/1.0/Android.bp index cb13b86ca9..1a7cb940ae 100644 --- a/radio/deprecated/1.0/Android.bp +++ b/radio/deprecated/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.radio.deprecated@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IOemHook.hal", "IOemHookIndication.hal", diff --git a/rebootescrow/aidl/default/RebootEscrow.cpp b/rebootescrow/aidl/default/RebootEscrow.cpp index dbc09215b3..8e5e97c80c 100644 --- a/rebootescrow/aidl/default/RebootEscrow.cpp +++ b/rebootescrow/aidl/default/RebootEscrow.cpp @@ -28,7 +28,7 @@ namespace rebootescrow { using ::android::base::unique_fd; -ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<int8_t>& kek) { +ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<uint8_t>& ukek) { int rawFd = TEMP_FAILURE_RETRY(::open(devicePath_.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); unique_fd fd(rawFd); if (fd.get() < 0) { @@ -36,7 +36,6 @@ ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<int8_t>& kek) { return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); } - std::vector<uint8_t> ukek(kek.begin(), kek.end()); auto encoded = hadamard::EncodeKey(ukek); if (!::android::base::WriteFully(fd, encoded.data(), encoded.size())) { @@ -47,7 +46,7 @@ ndk::ScopedAStatus RebootEscrow::storeKey(const std::vector<int8_t>& kek) { return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector<int8_t>* _aidl_return) { +ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector<uint8_t>* _aidl_return) { int rawFd = TEMP_FAILURE_RETRY(::open(devicePath_.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC)); unique_fd fd(rawFd); if (fd.get() < 0) { @@ -63,8 +62,7 @@ ndk::ScopedAStatus RebootEscrow::retrieveKey(std::vector<int8_t>* _aidl_return) auto keyBytes = hadamard::DecodeKey(encodedBytes); - std::vector<int8_t> signedKeyBytes(keyBytes.begin(), keyBytes.end()); - *_aidl_return = signedKeyBytes; + *_aidl_return = keyBytes; return ndk::ScopedAStatus::ok(); } diff --git a/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h b/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h index 00ff16b2ea..cdbeb67eba 100644 --- a/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h +++ b/rebootescrow/aidl/default/include/rebootescrow-impl/RebootEscrow.h @@ -26,8 +26,8 @@ namespace rebootescrow { class RebootEscrow : public BnRebootEscrow { public: explicit RebootEscrow(const std::string& devicePath) : devicePath_(devicePath) {} - ndk::ScopedAStatus storeKey(const std::vector<int8_t>& kek) override; - ndk::ScopedAStatus retrieveKey(std::vector<int8_t>* _aidl_return) override; + ndk::ScopedAStatus storeKey(const std::vector<uint8_t>& kek) override; + ndk::ScopedAStatus retrieveKey(std::vector<uint8_t>* _aidl_return) override; private: const std::string devicePath_; diff --git a/secure_element/1.0/Android.bp b/secure_element/1.0/Android.bp index 32b752ba3c..a32b9d1401 100644 --- a/secure_element/1.0/Android.bp +++ b/secure_element/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.secure_element@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISecureElement.hal", diff --git a/secure_element/1.0/vts/functional/AndroidTest.xml b/secure_element/1.0/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..4724f23b70 --- /dev/null +++ b/secure_element/1.0/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs VtsHalSecureElementV1_0TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + <option name="config-descriptor:metadata" key="token" value="SECURE_ELEMENT_SIM_CARD" /> + + <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="VtsHalSecureElementV1_0TargetTest->/data/local/tmp/VtsHalSecureElementV1_0TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalSecureElementV1_0TargetTest" /> + </test> +</configuration> diff --git a/secure_element/1.1/Android.bp b/secure_element/1.1/Android.bp index 3ea2de94d1..08e6c8855e 100644 --- a/secure_element/1.1/Android.bp +++ b/secure_element/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.secure_element@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ISecureElement.hal", "ISecureElementHalCallback.hal", diff --git a/secure_element/1.1/vts/functional/AndroidTest.xml b/secure_element/1.1/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..3d7b7157d8 --- /dev/null +++ b/secure_element/1.1/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs VtsHalSecureElementV1_1TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + <option name="config-descriptor:metadata" key="token" value="SECURE_ELEMENT_SIM_CARD" /> + + <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="VtsHalSecureElementV1_1TargetTest->/data/local/tmp/VtsHalSecureElementV1_1TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalSecureElementV1_1TargetTest" /> + </test> +</configuration> diff --git a/secure_element/1.2/Android.bp b/secure_element/1.2/Android.bp index e134771880..03df5f9d68 100644 --- a/secure_element/1.2/Android.bp +++ b/secure_element/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.secure_element@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ISecureElement.hal", ], diff --git a/secure_element/1.2/vts/functional/AndroidTest.xml b/secure_element/1.2/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..0bd8061d70 --- /dev/null +++ b/secure_element/1.2/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Runs VtsHalSecureElementV1_2TargetTest."> + <option name="test-suite-tag" value="apct" /> + <option name="test-suite-tag" value="apct-native" /> + <option name="config-descriptor:metadata" key="token" value="SECURE_ELEMENT_SIM_CARD" /> + + <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="VtsHalSecureElementV1_2TargetTest->/data/local/tmp/VtsHalSecureElementV1_2TargetTest" /> + </target_preparer> + + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="VtsHalSecureElementV1_2TargetTest" /> + </test> +</configuration> diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp index 509f72fc4a..109367106a 100644 --- a/sensors/1.0/Android.bp +++ b/sensors/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.sensors@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISensors.hal", diff --git a/sensors/2.0/Android.bp b/sensors/2.0/Android.bp index c8517c8dcb..d71f07b355 100644 --- a/sensors/2.0/Android.bp +++ b/sensors/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.sensors@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISensors.hal", diff --git a/sensors/2.1/Android.bp b/sensors/2.1/Android.bp index 8e80e1fb5d..9ba3248085 100644 --- a/sensors/2.1/Android.bp +++ b/sensors/2.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.sensors@2.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISensors.hal", diff --git a/soundtrigger/2.1/Android.bp b/soundtrigger/2.1/Android.bp index 30173cbcd8..024e0f6b5a 100644 --- a/soundtrigger/2.1/Android.bp +++ b/soundtrigger/2.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.soundtrigger@2.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ISoundTriggerHw.hal", "ISoundTriggerHwCallback.hal", diff --git a/soundtrigger/2.2/Android.bp b/soundtrigger/2.2/Android.bp index 7556aa4fb5..dbf4f8bacd 100644 --- a/soundtrigger/2.2/Android.bp +++ b/soundtrigger/2.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.soundtrigger@2.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ISoundTriggerHw.hal", ], diff --git a/soundtrigger/2.3/Android.bp b/soundtrigger/2.3/Android.bp index 3253a86695..480df4daa4 100644 --- a/soundtrigger/2.3/Android.bp +++ b/soundtrigger/2.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.soundtrigger@2.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISoundTriggerHw.hal", diff --git a/tests/baz/1.0/.hidl_for_test b/tests/baz/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/baz/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/expression/1.0/.hidl_for_test b/tests/expression/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/expression/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/extension/light/2.0/.hidl_for_test b/tests/extension/light/2.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/extension/light/2.0/.hidl_for_test +++ /dev/null diff --git a/tests/foo/1.0/.hidl_for_test b/tests/foo/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/foo/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/hash/1.0/.hidl_for_test b/tests/hash/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/hash/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/inheritance/1.0/.hidl_for_test b/tests/inheritance/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/inheritance/1.0/.hidl_for_test +++ /dev/null diff --git a/MODULE_LICENSE_APACHE2 b/tests/lazy/1.0/.hidl_for_system_ext index e69de29bb2..e69de29bb2 100644 --- a/MODULE_LICENSE_APACHE2 +++ b/tests/lazy/1.0/.hidl_for_system_ext diff --git a/tests/lazy/1.0/.hidl_for_test b/tests/lazy/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/lazy/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/bar/1.0/.hidl_for_test b/tests/lazy/1.1/.hidl_for_system_ext index e69de29bb2..e69de29bb2 100644 --- a/tests/bar/1.0/.hidl_for_test +++ b/tests/lazy/1.1/.hidl_for_system_ext diff --git a/tests/lazy/1.1/Android.bp b/tests/lazy/1.1/Android.bp new file mode 100644 index 0000000000..ccedd8d576 --- /dev/null +++ b/tests/lazy/1.1/Android.bp @@ -0,0 +1,15 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.tests.lazy@1.1", + root: "android.hardware", + system_ext_specific: true, + srcs: [ + "ILazy.hal", + ], + interfaces: [ + "android.hardware.tests.lazy@1.0", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/tests/lazy/1.1/ILazy.hal b/tests/lazy/1.1/ILazy.hal new file mode 100644 index 0000000000..a15e0e3641 --- /dev/null +++ b/tests/lazy/1.1/ILazy.hal @@ -0,0 +1,21 @@ +/* + * 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.tests.lazy@1.1; + +import android.hardware.tests.lazy@1.0; + +interface ILazy extends @1.0::ILazy {}; diff --git a/tests/libhwbinder/1.0/.hidl_for_test b/tests/libhwbinder/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/libhwbinder/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/libhwbinder/aidl/.hidl_for_test b/tests/libhwbinder/aidl/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/libhwbinder/aidl/.hidl_for_test +++ /dev/null diff --git a/tests/memory/1.0/.hidl_for_test b/tests/memory/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/memory/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/memory/2.0/.hidl_for_test b/tests/memory/2.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/memory/2.0/.hidl_for_test +++ /dev/null diff --git a/tests/msgq/1.0/.hidl_for_test b/tests/msgq/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/msgq/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/msgq/1.0/default/mq_test_service.cpp b/tests/msgq/1.0/default/mq_test_service.cpp index b5cb662549..b921bfd34e 100644 --- a/tests/msgq/1.0/default/mq_test_service.cpp +++ b/tests/msgq/1.0/default/mq_test_service.cpp @@ -24,5 +24,6 @@ using android::hardware::tests::msgq::V1_0::ITestMsgQ; using android::hardware::defaultPassthroughServiceImplementation; int main() { + android::hardware::details::setTrebleTestingOverride(true); return defaultPassthroughServiceImplementation<ITestMsgQ>(); } diff --git a/tests/multithread/1.0/.hidl_for_test b/tests/multithread/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/multithread/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/safeunion/1.0/.hidl_for_test b/tests/safeunion/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/safeunion/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/safeunion/cpp/1.0/.hidl_for_test b/tests/safeunion/cpp/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/safeunion/cpp/1.0/.hidl_for_test +++ /dev/null diff --git a/tests/trie/1.0/.hidl_for_test b/tests/trie/1.0/.hidl_for_test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/trie/1.0/.hidl_for_test +++ /dev/null diff --git a/tetheroffload/config/1.0/Android.bp b/tetheroffload/config/1.0/Android.bp index 321224ad86..e774048751 100644 --- a/tetheroffload/config/1.0/Android.bp +++ b/tetheroffload/config/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.tetheroffload.config@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IOffloadConfig.hal", ], diff --git a/tetheroffload/control/1.0/Android.bp b/tetheroffload/control/1.0/Android.bp index f894448ea4..4bcaed2dbf 100644 --- a/tetheroffload/control/1.0/Android.bp +++ b/tetheroffload/control/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.tetheroffload.control@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IOffloadControl.hal", diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp index de168d877d..10eeddc07d 100644 --- a/thermal/1.0/Android.bp +++ b/thermal/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.thermal@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IThermal.hal", diff --git a/thermal/1.1/Android.bp b/thermal/1.1/Android.bp index f38ed3b107..7dc30a324d 100644 --- a/thermal/1.1/Android.bp +++ b/thermal/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.thermal@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IThermal.hal", "IThermalCallback.hal", diff --git a/thermal/2.0/Android.bp b/thermal/2.0/Android.bp index 1b76f37f27..3d9cea1230 100644 --- a/thermal/2.0/Android.bp +++ b/thermal/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.thermal@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IThermal.hal", diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp index d41a7e73eb..0e0f284d51 100644 --- a/tv/cec/1.0/Android.bp +++ b/tv/cec/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.tv.cec@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHdmiCec.hal", diff --git a/tv/cec/2.0/Android.bp b/tv/cec/2.0/Android.bp index 61450ac4fb..5463b6da61 100644 --- a/tv/cec/2.0/Android.bp +++ b/tv/cec/2.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.tv.cec@2.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHdmiCec.hal", diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp index 1164430e93..1121f4ed46 100644 --- a/tv/input/1.0/Android.bp +++ b/tv/input/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.tv.input@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ITvInput.hal", diff --git a/tv/tuner/1.0/Android.bp b/tv/tuner/1.0/Android.bp index d78f3f2f5c..e5786418f5 100644 --- a/tv/tuner/1.0/Android.bp +++ b/tv/tuner/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.tv.tuner@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IDemux.hal", diff --git a/tv/tuner/1.0/default/Demux.cpp b/tv/tuner/1.0/default/Demux.cpp index 67eff1bd63..9055a43bd8 100644 --- a/tv/tuner/1.0/default/Demux.cpp +++ b/tv/tuner/1.0/default/Demux.cpp @@ -163,6 +163,7 @@ Return<Result> Demux::close() { mRecordFilterIds.clear(); mFilters.clear(); mLastUsedFilterId = -1; + mTunerService->removeDemux(mDemuxId); return Result::SUCCESS; } @@ -294,6 +295,11 @@ void Demux::updateFilterOutput(uint16_t filterId, vector<uint8_t> data) { mFilters[filterId]->updateFilterOutput(data); } +void Demux::updateMediaFilterOutput(uint16_t filterId, vector<uint8_t> data, uint64_t pts) { + updateFilterOutput(filterId, data); + mFilters[filterId]->updatePts(pts); +} + uint16_t Demux::getFilterTpid(uint32_t filterId) { return mFilters[filterId]->getTpid(); } @@ -313,6 +319,12 @@ void Demux::frontendInputThreadLoop() { std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); mFrontendInputThreadRunning = true; + if (!mDvrPlayback) { + ALOGW("[Demux] No software Frontend input configured. Ending Frontend thread loop."); + mFrontendInputThreadRunning = false; + return; + } + while (mFrontendInputThreadRunning) { uint32_t efState = 0; status_t status = mDvrPlayback->getDvrEventFlag()->wait( @@ -322,6 +334,12 @@ void Demux::frontendInputThreadLoop() { ALOGD("[Demux] wait for data ready on the playback FMQ"); continue; } + if (mDvrPlayback->getSettings().playback().dataFormat == DataFormat::ES) { + if (!mDvrPlayback->processEsDataOnPlayback(true /*isVirtualFrontend*/, mIsRecording)) { + ALOGE("[Demux] playback es data failed to be filtered. Ending thread"); + break; + } + } // Our current implementation filter the data and write it into the filter FMQ immediately // after the DATA_READY from the VTS/framework if (!mDvrPlayback->readPlaybackFMQ(true /*isVirtualFrontend*/, mIsRecording) || diff --git a/tv/tuner/1.0/default/Demux.h b/tv/tuner/1.0/default/Demux.h index 7f282b250f..6e93ea32f8 100644 --- a/tv/tuner/1.0/default/Demux.h +++ b/tv/tuner/1.0/default/Demux.h @@ -87,6 +87,7 @@ class Demux : public IDemux { bool detachRecordFilter(int filterId); Result startFilterHandler(uint32_t filterId); void updateFilterOutput(uint16_t filterId, vector<uint8_t> data); + void updateMediaFilterOutput(uint16_t filterId, vector<uint8_t> data, uint64_t pts); uint16_t getFilterTpid(uint32_t filterId); void setIsRecording(bool isRecording); void startFrontendInputLoop(); diff --git a/tv/tuner/1.0/default/Dvr.cpp b/tv/tuner/1.0/default/Dvr.cpp index 68e175c17d..c3edac973e 100644 --- a/tv/tuner/1.0/default/Dvr.cpp +++ b/tv/tuner/1.0/default/Dvr.cpp @@ -129,7 +129,7 @@ Return<Result> Dvr::stop() { mDvrThreadRunning = false; - std::lock_guard<std::mutex> lock(mDvrThreadLock); + lock_guard<mutex> lock(mDvrThreadLock); mIsRecordStarted = false; mDemux->setIsRecording(false); @@ -155,14 +155,13 @@ bool Dvr::createDvrMQ() { ALOGV("%s", __FUNCTION__); // Create a synchronized FMQ that supports blocking read/write - std::unique_ptr<DvrMQ> tmpDvrMQ = - std::unique_ptr<DvrMQ>(new (std::nothrow) DvrMQ(mBufferSize, true)); + unique_ptr<DvrMQ> tmpDvrMQ = unique_ptr<DvrMQ>(new (nothrow) DvrMQ(mBufferSize, true)); if (!tmpDvrMQ->isValid()) { ALOGW("[Dvr] Failed to create FMQ of DVR"); return false; } - mDvrMQ = std::move(tmpDvrMQ); + mDvrMQ = move(tmpDvrMQ); if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != OK) { return false; @@ -183,7 +182,7 @@ void* Dvr::__threadLoopPlayback(void* user) { void Dvr::playbackThreadLoop() { ALOGD("[Dvr] playback threadLoop start."); - std::lock_guard<std::mutex> lock(mDvrThreadLock); + lock_guard<mutex> lock(mDvrThreadLock); mDvrThreadRunning = true; while (mDvrThreadRunning) { @@ -195,6 +194,14 @@ void Dvr::playbackThreadLoop() { ALOGD("[Dvr] wait for data ready on the playback FMQ"); continue; } + + if (mDvrSettings.playback().dataFormat == DataFormat::ES) { + if (!processEsDataOnPlayback(false /*isVirtualFrontend*/, false /*isRecording*/)) { + ALOGE("[Dvr] playback es data failed to be filtered. Ending thread"); + break; + } + maySendPlaybackStatusCallback(); + } // Our current implementation filter the data and write it into the filter FMQ immediately // after the DATA_READY from the VTS/framework if (!readPlaybackFMQ(false /*isVirtualFrontend*/, false /*isRecording*/) || @@ -211,7 +218,7 @@ void Dvr::playbackThreadLoop() { } void Dvr::maySendPlaybackStatusCallback() { - std::lock_guard<std::mutex> lock(mPlaybackStatusLock); + lock_guard<mutex> lock(mPlaybackStatusLock); int availableToRead = mDvrMQ->availableToRead(); int availableToWrite = mDvrMQ->availableToWrite(); @@ -263,8 +270,128 @@ bool Dvr::readPlaybackFMQ(bool isVirtualFrontend, bool isRecording) { return true; } +bool Dvr::processEsDataOnPlayback(bool isVirtualFrontend, bool isRecording) { + // Read ES from the DVR FMQ + // Note that currently we only provides ES with metaData in a specific format to be parsed. + // The ES size should be smaller than the Playback FMQ size to avoid reading truncated data. + int size = mDvrMQ->availableToRead(); + vector<uint8_t> dataOutputBuffer; + dataOutputBuffer.resize(size); + if (!mDvrMQ->read(dataOutputBuffer.data(), size)) { + return false; + } + + int metaDataSize = size; + int totalFrames = 0; + int videoEsDataSize = 0; + int audioEsDataSize = 0; + int audioPid = 0; + int videoPid = 0; + + vector<MediaEsMetaData> esMeta; + int videoReadPointer = 0; + int audioReadPointer = 0; + int frameCount = 0; + // Get meta data from the es + for (int i = 0; i < metaDataSize; i++) { + switch (dataOutputBuffer[i]) { + case 'm': + metaDataSize = 0; + getMetaDataValue(i, dataOutputBuffer.data(), metaDataSize); + videoReadPointer = metaDataSize; + continue; + case 'l': + getMetaDataValue(i, dataOutputBuffer.data(), totalFrames); + esMeta.resize(totalFrames); + continue; + case 'V': + getMetaDataValue(i, dataOutputBuffer.data(), videoEsDataSize); + audioReadPointer = metaDataSize + videoEsDataSize; + continue; + case 'A': + getMetaDataValue(i, dataOutputBuffer.data(), audioEsDataSize); + continue; + case 'p': + if (dataOutputBuffer[++i] == 'a') { + getMetaDataValue(i, dataOutputBuffer.data(), audioPid); + } else if (dataOutputBuffer[i] == 'v') { + getMetaDataValue(i, dataOutputBuffer.data(), videoPid); + } + continue; + case 'v': + case 'a': + if (dataOutputBuffer[i + 1] != ',') { + ALOGE("[Dvr] Invalid format meta data."); + return false; + } + esMeta[frameCount] = { + .isAudio = dataOutputBuffer[i] == 'a' ? true : false, + }; + i += 5; // Move to Len + getMetaDataValue(i, dataOutputBuffer.data(), esMeta[frameCount].len); + if (esMeta[frameCount].isAudio) { + esMeta[frameCount].startIndex = audioReadPointer; + audioReadPointer += esMeta[frameCount].len; + } else { + esMeta[frameCount].startIndex = videoReadPointer; + videoReadPointer += esMeta[frameCount].len; + } + i += 4; // move to PTS + getMetaDataValue(i, dataOutputBuffer.data(), esMeta[frameCount].pts); + frameCount++; + continue; + default: + continue; + } + } + + if (frameCount != totalFrames) { + ALOGE("[Dvr] Invalid meta data, frameCount=%d, totalFrames reported=%d", frameCount, + totalFrames); + return false; + } + + if (metaDataSize + audioEsDataSize + videoEsDataSize != size) { + ALOGE("[Dvr] Invalid meta data, metaSize=%d, videoSize=%d, audioSize=%d, totolSize=%d", + metaDataSize, videoEsDataSize, audioEsDataSize, size); + return false; + } + + // Read es raw data from the FMQ per meta data built previously + vector<uint8_t> frameData; + map<uint32_t, sp<IFilter>>::iterator it; + int pid = 0; + for (int i = 0; i < totalFrames; i++) { + frameData.resize(esMeta[i].len); + pid = esMeta[i].isAudio ? audioPid : videoPid; + memcpy(frameData.data(), dataOutputBuffer.data() + esMeta[i].startIndex, esMeta[i].len); + // Send to the media filter + if (isVirtualFrontend && isRecording) { + // TODO validate record + mDemux->sendFrontendInputToRecord(frameData); + } else { + for (it = mFilters.begin(); it != mFilters.end(); it++) { + if (pid == mDemux->getFilterTpid(it->first)) { + mDemux->updateMediaFilterOutput(it->first, frameData, + static_cast<uint64_t>(esMeta[i].pts)); + startFilterDispatcher(isVirtualFrontend, isRecording); + } + } + } + } + + return true; +} + +void Dvr::getMetaDataValue(int& index, uint8_t* dataOutputBuffer, int& value) { + index += 2; // Move the pointer across the ":" to the value + while (dataOutputBuffer[index] != ',' && dataOutputBuffer[index] != '\n') { + value = ((dataOutputBuffer[index++] - 48) + value * 10); + } +} + void Dvr::startTpidFilter(vector<uint8_t> data) { - std::map<uint32_t, sp<IFilter>>::iterator it; + map<uint32_t, sp<IFilter>>::iterator it; for (it = mFilters.begin(); it != mFilters.end(); it++) { uint16_t pid = ((data[1] & 0x1f) << 8) | ((data[2] & 0xff)); if (DEBUG_DVR) { @@ -285,7 +412,7 @@ bool Dvr::startFilterDispatcher(bool isVirtualFrontend, bool isRecording) { } } - std::map<uint32_t, sp<IFilter>>::iterator it; + map<uint32_t, sp<IFilter>>::iterator it; // Handle the output data per filter type for (it = mFilters.begin(); it != mFilters.end(); it++) { if (mDemux->startFilterHandler(it->first) != Result::SUCCESS) { @@ -296,8 +423,8 @@ bool Dvr::startFilterDispatcher(bool isVirtualFrontend, bool isRecording) { return true; } -bool Dvr::writeRecordFMQ(const std::vector<uint8_t>& data) { - std::lock_guard<std::mutex> lock(mWriteLock); +bool Dvr::writeRecordFMQ(const vector<uint8_t>& data) { + lock_guard<mutex> lock(mWriteLock); if (mRecordStatus == RecordStatus::OVERFLOW) { ALOGW("[Dvr] stops writing and wait for the client side flushing."); return true; @@ -313,7 +440,7 @@ bool Dvr::writeRecordFMQ(const std::vector<uint8_t>& data) { } void Dvr::maySendRecordStatusCallback() { - std::lock_guard<std::mutex> lock(mRecordStatusLock); + lock_guard<mutex> lock(mRecordStatusLock); int availableToRead = mDvrMQ->availableToRead(); int availableToWrite = mDvrMQ->availableToWrite(); @@ -352,4 +479,4 @@ bool Dvr::removePlaybackFilter(uint32_t filterId) { } // namespace tuner } // namespace tv } // namespace hardware -} // namespace android
\ No newline at end of file +} // namespace android diff --git a/tv/tuner/1.0/default/Dvr.h b/tv/tuner/1.0/default/Dvr.h index a63a25670c..30695866ca 100644 --- a/tv/tuner/1.0/default/Dvr.h +++ b/tv/tuner/1.0/default/Dvr.h @@ -44,6 +44,13 @@ using ::android::hardware::tv::tuner::V1_0::Result; using DvrMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; +struct MediaEsMetaData { + bool isAudio; + int startIndex; + int len; + int pts; +}; + class Demux; class Filter; class Frontend; @@ -84,8 +91,10 @@ class Dvr : public IDvr { bool addPlaybackFilter(uint32_t filterId, sp<IFilter> filter); bool removePlaybackFilter(uint32_t filterId); bool readPlaybackFMQ(bool isVirtualFrontend, bool isRecording); + bool processEsDataOnPlayback(bool isVirtualFrontend, bool isRecording); bool startFilterDispatcher(bool isVirtualFrontend, bool isRecording); EventFlag* getDvrEventFlag(); + DvrSettings getSettings() { return mDvrSettings; } private: // Demux service @@ -98,6 +107,7 @@ class Dvr : public IDvr { void deleteEventFlag(); bool readDataFromMQ(); + void getMetaDataValue(int& index, uint8_t* dataOutputBuffer, int& value); void maySendPlaybackStatusCallback(); void maySendRecordStatusCallback(); PlaybackStatus checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead, diff --git a/tv/tuner/1.0/default/Filter.cpp b/tv/tuner/1.0/default/Filter.cpp index 30b19c0b07..ce748e5098 100644 --- a/tv/tuner/1.0/default/Filter.cpp +++ b/tv/tuner/1.0/default/Filter.cpp @@ -317,6 +317,11 @@ void Filter::updateFilterOutput(vector<uint8_t> data) { mFilterOutput.insert(mFilterOutput.end(), data.begin(), data.end()); } +void Filter::updatePts(uint64_t pts) { + std::lock_guard<std::mutex> lock(mFilterOutputLock); + mPts = pts; +} + void Filter::updateRecordOutput(vector<uint8_t> data) { std::lock_guard<std::mutex> lock(mRecordFilterOutputLock); mRecordFilterOutput.insert(mRecordFilterOutput.end(), data.begin(), data.end()); @@ -460,6 +465,11 @@ Result Filter::startMediaFilterHandler() { if (mFilterOutput.empty()) { return Result::SUCCESS; } + + if (mPts) { + return createMediaFilterEventWithIon(mFilterOutput); + } + for (int i = 0; i < mFilterOutput.size(); i += 188) { if (mPesSizeLeft == 0) { uint32_t prefix = (mFilterOutput[i + 4] << 16) | (mFilterOutput[i + 5] << 8) | @@ -493,46 +503,7 @@ Result Filter::startMediaFilterHandler() { continue; } - int av_fd = createAvIonFd(mPesOutput.size()); - if (av_fd == -1) { - return Result::UNKNOWN_ERROR; - } - // copy the filtered data to the buffer - uint8_t* avBuffer = getIonBuffer(av_fd, mPesOutput.size()); - if (avBuffer == NULL) { - return Result::UNKNOWN_ERROR; - } - memcpy(avBuffer, mPesOutput.data(), mPesOutput.size() * sizeof(uint8_t)); - - native_handle_t* nativeHandle = createNativeHandle(av_fd); - if (nativeHandle == NULL) { - return Result::UNKNOWN_ERROR; - } - hidl_handle handle; - handle.setTo(nativeHandle, /*shouldOwn=*/true); - - // Create a dataId and add a <dataId, av_fd> pair into the dataId2Avfd map - uint64_t dataId = mLastUsedDataId++ /*createdUID*/; - mDataId2Avfd[dataId] = dup(av_fd); - - // Create mediaEvent and send callback - DemuxFilterMediaEvent mediaEvent; - mediaEvent = { - .avMemory = std::move(handle), - .dataLength = static_cast<uint32_t>(mPesOutput.size()), - .avDataId = dataId, - }; - int size = mFilterEvent.events.size(); - mFilterEvent.events.resize(size + 1); - mFilterEvent.events[size].media(mediaEvent); - - // Clear and log - mPesOutput.clear(); - mAvBufferCopyCount = 0; - ::close(av_fd); - if (DEBUG_FILTER) { - ALOGD("[Filter] assembled av data length %d", mediaEvent.dataLength); - } + createMediaFilterEventWithIon(mPesOutput); } mFilterOutput.clear(); @@ -540,6 +511,54 @@ Result Filter::startMediaFilterHandler() { return Result::SUCCESS; } +Result Filter::createMediaFilterEventWithIon(vector<uint8_t> output) { + int av_fd = createAvIonFd(output.size()); + if (av_fd == -1) { + return Result::UNKNOWN_ERROR; + } + // copy the filtered data to the buffer + uint8_t* avBuffer = getIonBuffer(av_fd, output.size()); + if (avBuffer == NULL) { + return Result::UNKNOWN_ERROR; + } + memcpy(avBuffer, output.data(), output.size() * sizeof(uint8_t)); + + native_handle_t* nativeHandle = createNativeHandle(av_fd); + if (nativeHandle == NULL) { + return Result::UNKNOWN_ERROR; + } + hidl_handle handle; + handle.setTo(nativeHandle, /*shouldOwn=*/true); + + // Create a dataId and add a <dataId, av_fd> pair into the dataId2Avfd map + uint64_t dataId = mLastUsedDataId++ /*createdUID*/; + mDataId2Avfd[dataId] = dup(av_fd); + + // Create mediaEvent and send callback + DemuxFilterMediaEvent mediaEvent; + mediaEvent = { + .avMemory = std::move(handle), + .dataLength = static_cast<uint32_t>(output.size()), + .avDataId = dataId, + }; + if (mPts) { + mediaEvent.pts = mPts; + mPts = 0; + } + int size = mFilterEvent.events.size(); + mFilterEvent.events.resize(size + 1); + mFilterEvent.events[size].media(mediaEvent); + + // Clear and log + output.clear(); + mAvBufferCopyCount = 0; + ::close(av_fd); + if (DEBUG_FILTER) { + ALOGD("[Filter] av data length %d", mediaEvent.dataLength); + } + return Result::SUCCESS; +} + Result Filter::startRecordFilterHandler() { std::lock_guard<std::mutex> lock(mRecordFilterOutputLock); if (mRecordFilterOutput.empty()) { diff --git a/tv/tuner/1.0/default/Filter.h b/tv/tuner/1.0/default/Filter.h index 9386dca1a2..9b18a66c07 100644 --- a/tv/tuner/1.0/default/Filter.h +++ b/tv/tuner/1.0/default/Filter.h @@ -84,6 +84,7 @@ class Filter : public IFilter { uint16_t getTpid(); void updateFilterOutput(vector<uint8_t> data); void updateRecordOutput(vector<uint8_t> data); + void updatePts(uint64_t pts); Result startFilterHandler(); Result startRecordFilterHandler(); void attachFilterToRecord(const sp<Dvr> dvr); @@ -116,6 +117,7 @@ class Filter : public IFilter { bool mIsDataSourceDemux = true; vector<uint8_t> mFilterOutput; vector<uint8_t> mRecordFilterOutput; + uint64_t mPts = 0; unique_ptr<FilterMQ> mFilterMQ; bool mIsUsingFMQ = false; EventFlag* mFilterEventFlag; @@ -172,6 +174,7 @@ class Filter : public IFilter { int createAvIonFd(int size); uint8_t* getIonBuffer(int fd, int size); native_handle_t* createNativeHandle(int fd); + Result createMediaFilterEventWithIon(vector<uint8_t> output); /** * Lock to protect writes to the FMQs diff --git a/tv/tuner/1.0/default/Frontend.cpp b/tv/tuner/1.0/default/Frontend.cpp index 8bf0ec5353..6561c92caf 100644 --- a/tv/tuner/1.0/default/Frontend.cpp +++ b/tv/tuner/1.0/default/Frontend.cpp @@ -42,6 +42,7 @@ Return<Result> Frontend::close() { // Reset callback mCallback = nullptr; mIsLocked = false; + mTunerService->removeFrontend(mId); return Result::SUCCESS; } diff --git a/tv/tuner/1.0/default/Tuner.cpp b/tv/tuner/1.0/default/Tuner.cpp index 48ce384e7b..9a6ecf704f 100644 --- a/tv/tuner/1.0/default/Tuner.cpp +++ b/tv/tuner/1.0/default/Tuner.cpp @@ -37,7 +37,6 @@ Tuner::Tuner() { // Static Frontends array to maintain local frontends information // Array index matches their FrontendId in the default impl mFrontendSize = 8; - mFrontends.resize(mFrontendSize); mFrontends[0] = new Frontend(FrontendType::DVBT, 0, this); mFrontends[1] = new Frontend(FrontendType::ATSC, 1, this); mFrontends[2] = new Frontend(FrontendType::DVBC, 2, this); @@ -48,7 +47,6 @@ Tuner::Tuner() { mFrontends[7] = new Frontend(FrontendType::ATSC, 7, this); FrontendInfo::FrontendCapabilities caps; - mFrontendCaps.resize(mFrontendSize); caps = FrontendInfo::FrontendCapabilities(); caps.dvbtCaps(FrontendDvbtCapabilities()); mFrontendCaps[0] = caps; @@ -236,6 +234,21 @@ void Tuner::setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId) { } } +void Tuner::removeDemux(uint32_t demuxId) { + map<uint32_t, uint32_t>::iterator it; + for (it = mFrontendToDemux.begin(); it != mFrontendToDemux.end(); it++) { + if (it->second == demuxId) { + it = mFrontendToDemux.erase(it); + break; + } + } + mDemuxes.erase(demuxId); +} + +void Tuner::removeFrontend(uint32_t frontendId) { + mFrontendToDemux.erase(frontendId); +} + void Tuner::frontendStopTune(uint32_t frontendId) { map<uint32_t, uint32_t>::iterator it = mFrontendToDemux.find(frontendId); uint32_t demuxId; diff --git a/tv/tuner/1.0/default/Tuner.h b/tv/tuner/1.0/default/Tuner.h index 5de568f072..1c09d6c684 100644 --- a/tv/tuner/1.0/default/Tuner.h +++ b/tv/tuner/1.0/default/Tuner.h @@ -65,14 +65,16 @@ class Tuner : public ITuner { void frontendStartTune(uint32_t frontendId); void frontendStopTune(uint32_t frontendId); + void removeDemux(uint32_t demuxId); + void removeFrontend(uint32_t frontendId); private: virtual ~Tuner(); // Static mFrontends array to maintain local frontends information - vector<sp<Frontend>> mFrontends; - vector<FrontendInfo::FrontendCapabilities> mFrontendCaps; - std::map<uint32_t, uint32_t> mFrontendToDemux; - std::map<uint32_t, sp<Demux>> mDemuxes; + map<uint32_t, sp<Frontend>> mFrontends; + map<uint32_t, FrontendInfo::FrontendCapabilities> mFrontendCaps; + map<uint32_t, uint32_t> mFrontendToDemux; + map<uint32_t, sp<Demux>> mDemuxes; // To maintain how many Frontends we have int mFrontendSize; // The last used demux id. Initial value is -1. diff --git a/tv/tuner/1.0/vts/functional/DescramblerTests.cpp b/tv/tuner/1.0/vts/functional/DescramblerTests.cpp index d7440bc135..2e27475e71 100644 --- a/tv/tuner/1.0/vts/functional/DescramblerTests.cpp +++ b/tv/tuner/1.0/vts/functional/DescramblerTests.cpp @@ -102,13 +102,13 @@ AssertionResult DescramblerTests::openDescrambler(uint32_t demuxId) { AssertionResult DescramblerTests::setKeyToken(TunerKeyToken token) { Result status; - if (mDescrambler) { + if (!mDescrambler) { ALOGW("[vts] Descrambler is not opened yet."); return failure(); } status = mDescrambler->setKeyToken(token); - if (status == Result::SUCCESS) { + if (status != Result::SUCCESS) { ALOGW("[vts] setKeyToken failed."); return failure(); } @@ -118,13 +118,13 @@ AssertionResult DescramblerTests::setKeyToken(TunerKeyToken token) { AssertionResult DescramblerTests::addPid(DemuxPid pid, sp<IFilter> optionalSourceFilter) { Result status; - if (mDescrambler) { + if (!mDescrambler) { ALOGW("[vts] Descrambler is not opened yet."); return failure(); } status = mDescrambler->addPid(pid, optionalSourceFilter); - if (status == Result::SUCCESS) { + if (status != Result::SUCCESS) { ALOGW("[vts] addPid failed."); return failure(); } @@ -134,13 +134,13 @@ AssertionResult DescramblerTests::addPid(DemuxPid pid, sp<IFilter> optionalSourc AssertionResult DescramblerTests::removePid(DemuxPid pid, sp<IFilter> optionalSourceFilter) { Result status; - if (mDescrambler) { + if (!mDescrambler) { ALOGW("[vts] Descrambler is not opened yet."); return failure(); } status = mDescrambler->removePid(pid, optionalSourceFilter); - if (status == Result::SUCCESS) { + if (status != Result::SUCCESS) { ALOGW("[vts] removePid failed."); return failure(); } @@ -150,14 +150,14 @@ AssertionResult DescramblerTests::removePid(DemuxPid pid, sp<IFilter> optionalSo AssertionResult DescramblerTests::closeDescrambler() { Result status; - if (mDescrambler) { + if (!mDescrambler) { ALOGW("[vts] Descrambler is not opened yet."); return failure(); } status = mDescrambler->close(); mDescrambler = nullptr; - if (status == Result::SUCCESS) { + if (status != Result::SUCCESS) { ALOGW("[vts] close Descrambler failed."); return failure(); } diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.cpp b/tv/tuner/1.0/vts/functional/FrontendTests.cpp index 45951d2b20..b35d11220d 100644 --- a/tv/tuner/1.0/vts/functional/FrontendTests.cpp +++ b/tv/tuner/1.0/vts/functional/FrontendTests.cpp @@ -370,13 +370,11 @@ AssertionResult FrontendTests::tuneFrontend(FrontendConfig config, bool testWith mIsSoftwareFe = config.isSoftwareFe; bool result = true; if (mIsSoftwareFe && testWithDemux) { - DvrConfig dvrConfig; - getSoftwareFrontendPlaybackConfig(dvrConfig); - result &= mDvrTests.openDvrInDemux(dvrConfig.type, dvrConfig.bufferSize) == success(); - result &= mDvrTests.configDvrPlayback(dvrConfig.settings) == success(); + result &= mDvrTests.openDvrInDemux(mDvrConfig.type, mDvrConfig.bufferSize) == success(); + result &= mDvrTests.configDvrPlayback(mDvrConfig.settings) == success(); result &= mDvrTests.getDvrPlaybackMQDescriptor() == success(); - mDvrTests.startPlaybackInputThread(dvrConfig.playbackInputFile, - dvrConfig.settings.playback()); + mDvrTests.startPlaybackInputThread(mDvrConfig.playbackInputFile, + mDvrConfig.settings.playback()); if (!result) { ALOGW("[vts] Software frontend dvr configure failed."); return failure(); diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.h b/tv/tuner/1.0/vts/functional/FrontendTests.h index c536325126..4974ff351e 100644 --- a/tv/tuner/1.0/vts/functional/FrontendTests.h +++ b/tv/tuner/1.0/vts/functional/FrontendTests.h @@ -104,6 +104,7 @@ class FrontendTests { void setService(sp<ITuner> tuner) { mService = tuner; mDvrTests.setService(tuner); + getDefaultSoftwareFrontendPlaybackConfig(mDvrConfig); } AssertionResult getFrontendIds(); @@ -125,12 +126,13 @@ class FrontendTests { void setDvrTests(DvrTests dvrTests) { mDvrTests = dvrTests; } void setDemux(sp<IDemux> demux) { mDvrTests.setDemux(demux); } + void setSoftwareFrontendDvrConfig(DvrConfig conf) { mDvrConfig = conf; } protected: static AssertionResult failure() { return ::testing::AssertionFailure(); } static AssertionResult success() { return ::testing::AssertionSuccess(); } - void getSoftwareFrontendPlaybackConfig(DvrConfig& dvrConfig) { + void getDefaultSoftwareFrontendPlaybackConfig(DvrConfig& dvrConfig) { PlaybackSettings playbackSettings{ .statusMask = 0xf, .lowThreshold = 0x1000, @@ -151,4 +153,5 @@ class FrontendTests { DvrTests mDvrTests; bool mIsSoftwareFe = false; + DvrConfig mDvrConfig; }; diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 6819659915..078f5df391 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -292,18 +292,18 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m ASSERT_TRUE(mFilterTests.configFilter((*config).settings, filterId)); filterIds.insert(filterId); } - mDescramblerTests.openDescrambler(demuxId); + ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId)); TunerKeyToken token; ASSERT_TRUE(mDescramblerTests.getKeyToken(descConfig.casSystemId, descConfig.provisionStr, descConfig.hidlPvtData, token)); - mDescramblerTests.setKeyToken(token); + ASSERT_TRUE(mDescramblerTests.setKeyToken(token)); vector<DemuxPid> pids; DemuxPid pid; for (config = mediaFilterConfs.begin(); config != mediaFilterConfs.end(); config++) { ASSERT_TRUE(mDescramblerTests.getDemuxPidFromFilterSettings((*config).type, (*config).settings, pid)); pids.push_back(pid); - mDescramblerTests.addPid(pid, nullptr); + ASSERT_TRUE(mDescramblerTests.addPid(pid, nullptr)); } for (id = filterIds.begin(); id != filterIds.end(); id++) { ASSERT_TRUE(mFilterTests.startFilter(*id)); @@ -316,9 +316,9 @@ void TunerDescramblerHidlTest::scrambledBroadcastTest(set<struct FilterConfig> m ASSERT_TRUE(mFilterTests.stopFilter(*id)); } for (auto pid : pids) { - mDescramblerTests.removePid(pid, nullptr); + ASSERT_TRUE(mDescramblerTests.removePid(pid, nullptr)); } - mDescramblerTests.closeDescrambler(); + ASSERT_TRUE(mDescramblerTests.closeDescrambler()); for (id = filterIds.begin(); id != filterIds.end(); id++) { ASSERT_TRUE(mFilterTests.closeFilter(*id)); } @@ -410,9 +410,9 @@ TEST_P(TunerDemuxHidlTest, getAvSyncTime) { filterArray[TS_PCR0].bufferSize)); ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(pcrFilterId)); ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_PCR0].settings, pcrFilterId)); - mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId); + ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId)); ASSERT_TRUE(pcrFilterId == avSyncHwId); - mDemuxTests.getAvSyncTime(pcrFilterId); + ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId)); ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId)); ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId)); ASSERT_TRUE(mDemuxTests.closeDemux()); @@ -486,6 +486,62 @@ TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) { broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]); } +TEST_P(TunerBroadcastHidlTest, BroadcastEsDataFlowMediaFiltersTest) { + description("Test Meida Filters functionality in Broadcast use case with ES input."); + uint32_t feId; + uint32_t demuxId; + sp<IDemux> demux; + uint32_t filterId; + + mFrontendTests.getFrontendIdByType(frontendArray[DVBT].type, feId); + if (feId == INVALID_ID) { + // TODO broadcast test on Cuttlefish needs licensed ts input, + // these tests are runnable on vendor device with real frontend module + // or with manual ts installing and use DVBT frontend. + return; + } + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + mFrontendTests.setDemux(demux); + mFilterTests.setDemux(demux); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_AUDIO1].type, + filterArray[TS_AUDIO1].bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_AUDIO1].settings, filterId)); + ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId)); + ASSERT_TRUE(mFilterTests.startFilter(filterId)); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_VIDEO1].type, + filterArray[TS_VIDEO1].bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_VIDEO1].settings, filterId)); + ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId)); + ASSERT_TRUE(mFilterTests.startFilter(filterId)); + // tune test + PlaybackSettings playbackSettings{ + .statusMask = 0xf, + .lowThreshold = 0x1000, + .highThreshold = 0x07fff, + .dataFormat = DataFormat::ES, + .packetSize = 188, + }; + DvrConfig dvrConfig{ + .type = DvrType::PLAYBACK, + .playbackInputFile = "/data/local/tmp/test.es", + .bufferSize = FMQ_SIZE_4M, + }; + dvrConfig.settings.playback(playbackSettings); + mFrontendTests.setSoftwareFrontendDvrConfig(dvrConfig); + ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendArray[DVBT], true /*testWithDemux*/)); + ASSERT_TRUE(filterDataOutputTest(goldenOutputFiles)); + ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); + ASSERT_TRUE(mFilterTests.stopFilter(filterId)); + ASSERT_TRUE(mFilterTests.closeFilter(filterId)); + ASSERT_TRUE(mDemuxTests.closeDemux()); + ASSERT_TRUE(mFrontendTests.closeFrontend()); +} + TEST_P(TunerPlaybackHidlTest, PlaybackDataFlowWithTsSectionFilterTest) { description("Feed ts data from playback and configure Ts section filter to get output"); playbackSingleFilterTest(filterArray[TS_SECTION0], dvrArray[DVR_PLAYBACK0]); @@ -519,8 +575,8 @@ TEST_P(TunerDescramblerHidlTest, CreateDescrambler) { ASSERT_TRUE(mFrontendTests.setFrontendCallback()); ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); - mDescramblerTests.openDescrambler(demuxId); - mDescramblerTests.closeDescrambler(); + ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId)); + ASSERT_TRUE(mDescramblerTests.closeDescrambler()); ASSERT_TRUE(mDemuxTests.closeDemux()); ASSERT_TRUE(mFrontendTests.closeFrontend()); } diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h index 6c68e3588e..27c65931b8 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h @@ -77,6 +77,7 @@ typedef enum { TS_VIDEO0, TS_VIDEO1, TS_AUDIO0, + TS_AUDIO1, TS_PES0, TS_PCR0, TS_SECTION0, @@ -121,7 +122,6 @@ typedef enum { typedef enum { DVR_RECORD0, DVR_PLAYBACK0, - DVR_SOFTWARE_FE, DVR_MAX, } Dvr; @@ -274,6 +274,11 @@ inline void initFilterConfig() { filterArray[TS_AUDIO0].bufferSize = FMQ_SIZE_16M; filterArray[TS_AUDIO0].settings.ts().tpid = 256; filterArray[TS_AUDIO0].settings.ts().filterSettings.av({.isPassthrough = false}); + filterArray[TS_AUDIO1].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_AUDIO1].type.subType.tsFilterType(DemuxTsFilterType::AUDIO); + filterArray[TS_AUDIO1].bufferSize = FMQ_SIZE_16M; + filterArray[TS_AUDIO1].settings.ts().tpid = 257; + filterArray[TS_AUDIO1].settings.ts().filterSettings.av({.isPassthrough = false}); // TS PES filter setting filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS; filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES); @@ -362,17 +367,6 @@ inline void initDvrConfig() { dvrArray[DVR_PLAYBACK0].playbackInputFile = "/data/local/tmp/segment000000.ts"; dvrArray[DVR_PLAYBACK0].bufferSize = FMQ_SIZE_4M; dvrArray[DVR_PLAYBACK0].settings.playback(playbackSettings); - PlaybackSettings softwareFePlaybackSettings{ - .statusMask = 0xf, - .lowThreshold = 0x1000, - .highThreshold = 0x07fff, - .dataFormat = DataFormat::TS, - .packetSize = 188, - }; - dvrArray[DVR_SOFTWARE_FE].type = DvrType::PLAYBACK; - dvrArray[DVR_SOFTWARE_FE].playbackInputFile = "/data/local/tmp/segment000000.ts"; - dvrArray[DVR_SOFTWARE_FE].bufferSize = FMQ_SIZE_4M; - dvrArray[DVR_SOFTWARE_FE].settings.playback(softwareFePlaybackSettings); }; /** Configuration array for the descrambler test */ diff --git a/tv/tuner/1.1/Android.bp b/tv/tuner/1.1/Android.bp new file mode 100644 index 0000000000..476915e9b0 --- /dev/null +++ b/tv/tuner/1.1/Android.bp @@ -0,0 +1,17 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.tv.tuner@1.1", + root: "android.hardware", + srcs: [ + "IFilter.hal", + "ITuner.hal", + "IDemux.hal", + ], + interfaces: [ + "android.hidl.base@1.0", + "android.hidl.safe_union@1.0", + "android.hardware.tv.tuner@1.0", + ], + gen_java: false, +} diff --git a/tv/tuner/1.1/IDemux.hal b/tv/tuner/1.1/IDemux.hal new file mode 100644 index 0000000000..81cd001313 --- /dev/null +++ b/tv/tuner/1.1/IDemux.hal @@ -0,0 +1,41 @@ +/* + * Copyright 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.tv.tuner@1.1; + +import @1.0::IDemux; +import @1.0::Result; +import @1.0::IFilter; + +/** + * Demultiplexer(Demux) takes a single multiplexed input and splits it into + * one or more output. + */ +interface IDemux extends @1.0::IDemux { + /** + * Get a 64-bit hardware sync ID for audio and video. + * + * It is used by the client to get the hardware sync ID for audio and video. + * + * @param filter the filter instance. + * @return result Result status of the operation. + * SUCCESS if successful, + * INVALID_ARGUMENT if failed for a wrong filter ID. + * UNKNOWN_ERROR if failed for other reasons. + * @return avSyncHwId the id of hardware A/V sync. + */ + getAvSyncHwId64Bit(IFilter filter) generates (Result result, uint64_t avSyncHwId); +};
\ No newline at end of file diff --git a/tv/tuner/1.1/IFilter.hal b/tv/tuner/1.1/IFilter.hal new file mode 100644 index 0000000000..6c4d8a5a03 --- /dev/null +++ b/tv/tuner/1.1/IFilter.hal @@ -0,0 +1,43 @@ +/* + * Copyright 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.tv.tuner@1.1; + +import @1.0::IFilter; +import @1.0::Result; + +/** + * The Filter is used to filter wanted data according to the filter's + * configuration. + * + * To access the v1.1 IFilter APIs, the implementation can cast the IFilter + * interface returned from the @1.0::IDemux openFilter into a v1.1 IFiler + * using V1_1::IFilter::castFrom(V1_0::IFilter). + */ +interface IFilter extends @1.0::IFilter { + /** + * Get the 64-bit filter Id. This id is 32-bit in Tuner HAL 1.0. + * + * It is used by the client to ask the hardware resource id for the filter. + * + * @return result Result status of the operation. + * SUCCESS if successful, + * INVALID_STATE if failed for wrong state. + * UNKNOWN_ERROR if failed for other reasons. + * @return filterId the hardware resource Id for the filter. + */ + getId64Bit() generates (Result result, uint64_t filterId); +}; diff --git a/tv/tuner/1.1/ITuner.hal b/tv/tuner/1.1/ITuner.hal new file mode 100644 index 0000000000..915fb85806 --- /dev/null +++ b/tv/tuner/1.1/ITuner.hal @@ -0,0 +1,26 @@ +/* + * Copyright 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.tv.tuner@1.1; + +import @1.0::ITuner; +import @1.0::Result; + +/** + * Top level interface to manage Frontend, Demux and Decrambler hardware + * resources which are needed for Android TV. + */ +interface ITuner extends @1.0::ITuner {}; diff --git a/tv/tuner/1.1/TEST_MAPPING b/tv/tuner/1.1/TEST_MAPPING new file mode 100644 index 0000000000..7c91b8fe6c --- /dev/null +++ b/tv/tuner/1.1/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalTvTunerV1_1TargetTest" + } + ] +}
\ No newline at end of file diff --git a/tv/tuner/1.1/default/Android.bp b/tv/tuner/1.1/default/Android.bp new file mode 100644 index 0000000000..7e45864791 --- /dev/null +++ b/tv/tuner/1.1/default/Android.bp @@ -0,0 +1,52 @@ +cc_defaults { + name: "tuner_service_defaults@1.1", + defaults: ["hidl_defaults"], + vendor: true, + relative_install_path: "hw", + srcs: [ + "Filter.cpp", + "Frontend.cpp", + "Descrambler.cpp", + "Demux.cpp", + "Dvr.cpp", + "TimeFilter.cpp", + "Tuner.cpp", + "Lnb.cpp", + "service.cpp", + ], + + compile_multilib: "first", + + shared_libs: [ + "android.hardware.tv.tuner@1.0", + "android.hardware.tv.tuner@1.1", + "android.hidl.memory@1.0", + "libcutils", + "libfmq", + "libhidlbase", + "libhidlmemory", + "libion", + "liblog", + "libstagefright_foundation", + "libutils", + ], + header_libs: [ + "media_plugin_headers", + ], +} + +cc_binary { + name: "android.hardware.tv.tuner@1.1-service", + vintf_fragments: ["android.hardware.tv.tuner@1.1-service.xml"], + defaults: ["tuner_service_defaults@1.1"], + init_rc: ["android.hardware.tv.tuner@1.1-service.rc"], +} + +cc_binary { + name: "android.hardware.tv.tuner@1.1-service-lazy", + vintf_fragments: ["android.hardware.tv.tuner@1.1-service-lazy.xml"], + overrides: ["android.hardware.tv.tuner@1.1-service"], + defaults: ["tuner_service_defaults@1.1"], + init_rc: ["android.hardware.tv.tuner@1.1-service-lazy.rc"], + cflags: ["-DLAZY_SERVICE"], +} diff --git a/tv/tuner/1.1/default/Demux.cpp b/tv/tuner/1.1/default/Demux.cpp new file mode 100644 index 0000000000..f501d74e67 --- /dev/null +++ b/tv/tuner/1.1/default/Demux.cpp @@ -0,0 +1,445 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Demux" + +#include "Demux.h" +#include <utils/Log.h> + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +#define WAIT_TIMEOUT 3000000000 +Demux::Demux(uint32_t demuxId, sp<Tuner> tuner) { + mDemuxId = demuxId; + mTunerService = tuner; +} + +Demux::~Demux() {} + +Return<void> Demux::getAvSyncHwId64Bit(const sp<IFilter>& filter, getAvSyncHwId64Bit_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + uint64_t avSyncHwId = -1; + uint64_t id; + Result status; + + sp<V1_1::IFilter> filter_v1_1 = V1_1::IFilter::castFrom(filter); + if (filter_v1_1 != NULL) { + filter_v1_1->getId64Bit([&](Result result, uint64_t filterId) { + id = filterId; + status = result; + }); + } else { + filter->getId([&](Result result, uint32_t filterId) { + id = filterId; + status = result; + }); + } + + if (status != Result::SUCCESS) { + ALOGE("[Demux] Can't get 64-bit filter Id."); + _hidl_cb(Result::INVALID_STATE, avSyncHwId); + return Void(); + } + + if (!mFilters[id]->isMediaFilter()) { + ALOGE("[Demux] Given filter is not a media filter."); + _hidl_cb(Result::INVALID_ARGUMENT, avSyncHwId); + return Void(); + } + + if (!mPcrFilterIds.empty()) { + // Return the lowest pcr filter id in the default implementation as the av sync id + _hidl_cb(Result::SUCCESS, *mPcrFilterIds.begin()); + return Void(); + } + + ALOGE("[Demux] No PCR filter opened."); + _hidl_cb(Result::INVALID_STATE, avSyncHwId); + return Void(); +} + +Return<Result> Demux::setFrontendDataSource(uint32_t frontendId) { + ALOGV("%s", __FUNCTION__); + + if (mTunerService == nullptr) { + return Result::NOT_INITIALIZED; + } + + mFrontend = mTunerService->getFrontendById(frontendId); + + if (mFrontend == nullptr) { + return Result::INVALID_STATE; + } + + mTunerService->setFrontendAsDemuxSource(frontendId, mDemuxId); + + return Result::SUCCESS; +} + +Return<void> Demux::openFilter(const DemuxFilterType& type, uint32_t bufferSize, + const sp<IFilterCallback>& cb, openFilter_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + uint64_t filterId; + filterId = ++mLastUsedFilterId; + + if (cb == nullptr) { + ALOGW("[Demux] callback can't be null"); + _hidl_cb(Result::INVALID_ARGUMENT, new Filter()); + return Void(); + } + + sp<Filter> filter = new Filter(type, filterId, bufferSize, cb, this); + + if (!filter->createFilterMQ()) { + _hidl_cb(Result::UNKNOWN_ERROR, filter); + return Void(); + } + + mFilters[filterId] = filter; + if (filter->isPcrFilter()) { + mPcrFilterIds.insert(filterId); + } + bool result = true; + if (!filter->isRecordFilter()) { + // Only save non-record filters for now. Record filters are saved when the + // IDvr.attacheFilter is called. + mPlaybackFilterIds.insert(filterId); + if (mDvrPlayback != nullptr) { + result = mDvrPlayback->addPlaybackFilter(filterId, filter); + } + } + + _hidl_cb(result ? Result::SUCCESS : Result::INVALID_ARGUMENT, filter); + return Void(); +} + +Return<void> Demux::openTimeFilter(openTimeFilter_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + mTimeFilter = new TimeFilter(this); + + _hidl_cb(Result::SUCCESS, mTimeFilter); + return Void(); +} + +Return<void> Demux::getAvSyncHwId(const sp<IFilter>& filter, getAvSyncHwId_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + uint32_t avSyncHwId = -1; + uint64_t id; + Result status; + + sp<V1_1::IFilter> filter_v1_1 = V1_1::IFilter::castFrom(filter); + if (filter_v1_1 != NULL) { + filter_v1_1->getId64Bit([&](Result result, uint64_t filterId) { + id = filterId; + status = result; + }); + } else { + filter->getId([&](Result result, uint32_t filterId) { + id = filterId; + status = result; + }); + } + + if (status != Result::SUCCESS) { + ALOGE("[Demux] Can't get filter Id."); + _hidl_cb(Result::INVALID_STATE, avSyncHwId); + return Void(); + } + + if (!mFilters[id]->isMediaFilter()) { + ALOGE("[Demux] Given filter is not a media filter."); + _hidl_cb(Result::INVALID_ARGUMENT, avSyncHwId); + return Void(); + } + + if (!mPcrFilterIds.empty()) { + // Return the lowest pcr filter id in the default implementation as the av sync id + _hidl_cb(Result::SUCCESS, *mPcrFilterIds.begin()); + return Void(); + } + + ALOGE("[Demux] No PCR filter opened."); + _hidl_cb(Result::INVALID_STATE, avSyncHwId); + return Void(); +} + +Return<void> Demux::getAvSyncTime(AvSyncHwId avSyncHwId, getAvSyncTime_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + uint64_t avSyncTime = -1; + if (mPcrFilterIds.empty()) { + _hidl_cb(Result::INVALID_STATE, avSyncTime); + return Void(); + } + if (avSyncHwId != *mPcrFilterIds.begin()) { + _hidl_cb(Result::INVALID_ARGUMENT, avSyncTime); + return Void(); + } + + _hidl_cb(Result::SUCCESS, avSyncTime); + return Void(); +} + +Return<Result> Demux::close() { + ALOGV("%s", __FUNCTION__); + + set<uint64_t>::iterator it; + for (it = mPlaybackFilterIds.begin(); it != mPlaybackFilterIds.end(); it++) { + mDvrPlayback->removePlaybackFilter(*it); + } + mPlaybackFilterIds.clear(); + mRecordFilterIds.clear(); + mFilters.clear(); + mLastUsedFilterId = -1; + mTunerService->removeDemux(mDemuxId); + + return Result::SUCCESS; +} + +Return<void> Demux::openDvr(DvrType type, uint32_t bufferSize, const sp<IDvrCallback>& cb, + openDvr_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + if (cb == nullptr) { + ALOGW("[Demux] DVR callback can't be null"); + _hidl_cb(Result::INVALID_ARGUMENT, new Dvr()); + return Void(); + } + + set<uint64_t>::iterator it; + switch (type) { + case DvrType::PLAYBACK: + mDvrPlayback = new Dvr(type, bufferSize, cb, this); + if (!mDvrPlayback->createDvrMQ()) { + _hidl_cb(Result::UNKNOWN_ERROR, mDvrPlayback); + return Void(); + } + + for (it = mPlaybackFilterIds.begin(); it != mPlaybackFilterIds.end(); it++) { + if (!mDvrPlayback->addPlaybackFilter(*it, mFilters[*it])) { + ALOGE("[Demux] Can't get filter info for DVR playback"); + _hidl_cb(Result::UNKNOWN_ERROR, mDvrPlayback); + return Void(); + } + } + + _hidl_cb(Result::SUCCESS, mDvrPlayback); + return Void(); + case DvrType::RECORD: + mDvrRecord = new Dvr(type, bufferSize, cb, this); + if (!mDvrRecord->createDvrMQ()) { + _hidl_cb(Result::UNKNOWN_ERROR, mDvrRecord); + return Void(); + } + + _hidl_cb(Result::SUCCESS, mDvrRecord); + return Void(); + default: + _hidl_cb(Result::INVALID_ARGUMENT, nullptr); + return Void(); + } +} + +Return<Result> Demux::connectCiCam(uint32_t ciCamId) { + ALOGV("%s", __FUNCTION__); + + mCiCamId = ciCamId; + + return Result::SUCCESS; +} + +Return<Result> Demux::disconnectCiCam() { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Result Demux::removeFilter(uint64_t filterId) { + ALOGV("%s", __FUNCTION__); + + if (mDvrPlayback != nullptr) { + mDvrPlayback->removePlaybackFilter(filterId); + } + mPlaybackFilterIds.erase(filterId); + mRecordFilterIds.erase(filterId); + mFilters.erase(filterId); + + return Result::SUCCESS; +} + +void Demux::startBroadcastTsFilter(vector<uint8_t> data) { + set<uint64_t>::iterator it; + uint16_t pid = ((data[1] & 0x1f) << 8) | ((data[2] & 0xff)); + if (DEBUG_DEMUX) { + ALOGW("[Demux] start ts filter pid: %d", pid); + } + for (it = mPlaybackFilterIds.begin(); it != mPlaybackFilterIds.end(); it++) { + if (pid == mFilters[*it]->getTpid()) { + mFilters[*it]->updateFilterOutput(data); + } + } +} + +void Demux::sendFrontendInputToRecord(vector<uint8_t> data) { + set<uint64_t>::iterator it; + if (DEBUG_DEMUX) { + ALOGW("[Demux] update record filter output"); + } + for (it = mRecordFilterIds.begin(); it != mRecordFilterIds.end(); it++) { + mFilters[*it]->updateRecordOutput(data); + } +} + +bool Demux::startBroadcastFilterDispatcher() { + set<uint64_t>::iterator it; + + // Handle the output data per filter type + for (it = mPlaybackFilterIds.begin(); it != mPlaybackFilterIds.end(); it++) { + if (mFilters[*it]->startFilterHandler() != Result::SUCCESS) { + return false; + } + } + + return true; +} + +bool Demux::startRecordFilterDispatcher() { + set<uint64_t>::iterator it; + + for (it = mRecordFilterIds.begin(); it != mRecordFilterIds.end(); it++) { + if (mFilters[*it]->startRecordFilterHandler() != Result::SUCCESS) { + return false; + } + } + + return true; +} + +Result Demux::startFilterHandler(uint64_t filterId) { + return mFilters[filterId]->startFilterHandler(); +} + +void Demux::updateFilterOutput(uint64_t filterId, vector<uint8_t> data) { + mFilters[filterId]->updateFilterOutput(data); +} + +void Demux::updateMediaFilterOutput(uint64_t filterId, vector<uint8_t> data, uint64_t pts) { + updateFilterOutput(filterId, data); + mFilters[filterId]->updatePts(pts); +} + +uint16_t Demux::getFilterTpid(uint64_t filterId) { + return mFilters[filterId]->getTpid(); +} + +void Demux::startFrontendInputLoop() { + pthread_create(&mFrontendInputThread, NULL, __threadLoopFrontend, this); + pthread_setname_np(mFrontendInputThread, "frontend_input_thread"); +} + +void* Demux::__threadLoopFrontend(void* user) { + Demux* const self = static_cast<Demux*>(user); + self->frontendInputThreadLoop(); + return 0; +} + +void Demux::frontendInputThreadLoop() { + std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); + mFrontendInputThreadRunning = true; + + if (!mDvrPlayback) { + ALOGW("[Demux] No software Frontend input configured. Ending Frontend thread loop."); + mFrontendInputThreadRunning = false; + return; + } + + while (mFrontendInputThreadRunning) { + uint32_t efState = 0; + status_t status = mDvrPlayback->getDvrEventFlag()->wait( + static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_READY), &efState, WAIT_TIMEOUT, + true /* retry on spurious wake */); + if (status != OK) { + ALOGD("[Demux] wait for data ready on the playback FMQ"); + continue; + } + if (mDvrPlayback->getSettings().playback().dataFormat == DataFormat::ES) { + if (!mDvrPlayback->processEsDataOnPlayback(true /*isVirtualFrontend*/, mIsRecording)) { + ALOGE("[Demux] playback es data failed to be filtered. Ending thread"); + break; + } + } + // Our current implementation filter the data and write it into the filter FMQ immediately + // after the DATA_READY from the VTS/framework + if (!mDvrPlayback->readPlaybackFMQ(true /*isVirtualFrontend*/, mIsRecording) || + !mDvrPlayback->startFilterDispatcher(true /*isVirtualFrontend*/, mIsRecording)) { + ALOGE("[Demux] playback data failed to be filtered. Ending thread"); + break; + } + } + + mFrontendInputThreadRunning = false; + ALOGW("[Demux] Frontend Input thread end."); +} + +void Demux::stopFrontendInput() { + ALOGD("[Demux] stop frontend on demux"); + mKeepFetchingDataFromFrontend = false; + mFrontendInputThreadRunning = false; + std::lock_guard<std::mutex> lock(mFrontendInputThreadLock); +} + +void Demux::setIsRecording(bool isRecording) { + mIsRecording = isRecording; +} + +bool Demux::attachRecordFilter(uint64_t filterId) { + if (mFilters[filterId] == nullptr || mDvrRecord == nullptr || + !mFilters[filterId]->isRecordFilter()) { + return false; + } + + mRecordFilterIds.insert(filterId); + mFilters[filterId]->attachFilterToRecord(mDvrRecord); + + return true; +} + +bool Demux::detachRecordFilter(uint64_t filterId) { + if (mFilters[filterId] == nullptr || mDvrRecord == nullptr) { + return false; + } + + mRecordFilterIds.erase(filterId); + mFilters[filterId]->detachFilterFromRecord(); + + return true; +} + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Demux.h b/tv/tuner/1.1/default/Demux.h new file mode 100644 index 0000000000..f38f006aae --- /dev/null +++ b/tv/tuner/1.1/default/Demux.h @@ -0,0 +1,201 @@ +/* + * Copyright 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_TV_TUNER_V1_1_DEMUX_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_DEMUX_H_ + +#include <android/hardware/tv/tuner/1.1/IDemux.h> +#include <fmq/MessageQueue.h> +#include <math.h> +#include <set> +#include "Dvr.h" +#include "Filter.h" +#include "Frontend.h" +#include "TimeFilter.h" +#include "Tuner.h" + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +using ::android::hardware::EventFlag; +using ::android::hardware::kSynchronizedReadWrite; +using ::android::hardware::MessageQueue; +using ::android::hardware::MQDescriptorSync; + +using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; + +class Dvr; +class Filter; +class Frontend; +class TimeFilter; +class Tuner; + +class Demux : public V1_1::IDemux { + public: + Demux(uint32_t demuxId, sp<Tuner> tuner); + + ~Demux(); + + virtual Return<void> getAvSyncHwId64Bit(const sp<IFilter>& filter, + getAvSyncHwId64Bit_cb _hidl_cb) override; + + virtual Return<Result> setFrontendDataSource(uint32_t frontendId) override; + + virtual Return<void> openFilter(const DemuxFilterType& type, uint32_t bufferSize, + const sp<IFilterCallback>& cb, openFilter_cb _hidl_cb) override; + + virtual Return<void> openTimeFilter(openTimeFilter_cb _hidl_cb) override; + + virtual Return<void> getAvSyncHwId(const sp<IFilter>& filter, + getAvSyncHwId_cb _hidl_cb) override; + + virtual Return<void> getAvSyncTime(AvSyncHwId avSyncHwId, getAvSyncTime_cb _hidl_cb) override; + + virtual Return<Result> close() override; + + virtual Return<void> openDvr(DvrType type, uint32_t bufferSize, const sp<IDvrCallback>& cb, + openDvr_cb _hidl_cb) override; + + virtual Return<Result> connectCiCam(uint32_t ciCamId) override; + + virtual Return<Result> disconnectCiCam() override; + + // Functions interacts with Tuner Service + void stopFrontendInput(); + Result removeFilter(uint64_t filterId); + bool attachRecordFilter(uint64_t filterId); + bool detachRecordFilter(uint64_t filterId); + Result startFilterHandler(uint64_t filterId); + void updateFilterOutput(uint64_t filterId, vector<uint8_t> data); + void updateMediaFilterOutput(uint64_t filterId, vector<uint8_t> data, uint64_t pts); + uint16_t getFilterTpid(uint64_t filterId); + void setIsRecording(bool isRecording); + void startFrontendInputLoop(); + + /** + * A dispatcher to read and dispatch input data to all the started filters. + * Each filter handler handles the data filtering/output writing/filterEvent updating. + * Note that recording filters are not included. + */ + bool startBroadcastFilterDispatcher(); + void startBroadcastTsFilter(vector<uint8_t> data); + + void sendFrontendInputToRecord(vector<uint8_t> data); + bool startRecordFilterDispatcher(); + + private: + // Tuner service + sp<Tuner> mTunerService; + + // Frontend source + sp<Frontend> mFrontend; + + // A struct that passes the arguments to a newly created filter thread + struct ThreadArgs { + Demux* user; + uint64_t filterId; + }; + + static void* __threadLoopFrontend(void* user); + void frontendInputThreadLoop(); + + /** + * To create a FilterMQ with the next available Filter ID. + * Creating Event Flag at the same time. + * Add the successfully created/saved FilterMQ into the local list. + * + * Return false is any of the above processes fails. + */ + void deleteEventFlag(); + bool readDataFromMQ(); + + uint32_t mDemuxId = -1; + uint32_t mCiCamId; + set<uint64_t> mPcrFilterIds; + /** + * Record the last used filter id. Initial value is -1. + * Filter Id starts with 0. + */ + uint64_t mLastUsedFilterId = -1; + /** + * Record all the used playback filter Ids. + * Any removed filter id should be removed from this set. + */ + set<uint64_t> mPlaybackFilterIds; + /** + * Record all the attached record filter Ids. + * Any removed filter id should be removed from this set. + */ + set<uint64_t> mRecordFilterIds; + /** + * A list of created Filter sp. + * The array number is the filter ID. + */ + std::map<uint64_t, sp<Filter>> mFilters; + + /** + * Local reference to the opened Timer Filter instance. + */ + sp<TimeFilter> mTimeFilter; + + /** + * Local reference to the opened DVR object. + */ + sp<Dvr> mDvrPlayback; + sp<Dvr> mDvrRecord; + + // Thread handlers + pthread_t mFrontendInputThread; + /** + * If a specific filter's writing loop is still running + */ + bool mFrontendInputThreadRunning; + bool mKeepFetchingDataFromFrontend; + /** + * If the dvr recording is running. + */ + bool mIsRecording = false; + /** + * Lock to protect writes to the FMQs + */ + std::mutex mWriteLock; + /** + * Lock to protect writes to the input status + */ + std::mutex mFrontendInputThreadLock; + + // temp handle single PES filter + // TODO handle mulptiple Pes filters + int mPesSizeLeft = 0; + vector<uint8_t> mPesOutput; + + const bool DEBUG_DEMUX = false; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_DEMUX_H_ diff --git a/tv/tuner/1.1/default/Descrambler.cpp b/tv/tuner/1.1/default/Descrambler.cpp new file mode 100644 index 0000000000..1fbc780c34 --- /dev/null +++ b/tv/tuner/1.1/default/Descrambler.cpp @@ -0,0 +1,80 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Descrambler" + +#include <android/hardware/tv/tuner/1.0/IFrontendCallback.h> +#include <utils/Log.h> + +#include "Descrambler.h" + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +Descrambler::Descrambler() {} + +Descrambler::~Descrambler() {} + +Return<Result> Descrambler::setDemuxSource(uint32_t demuxId) { + ALOGV("%s", __FUNCTION__); + if (mDemuxSet) { + ALOGW("[ WARN ] Descrambler has already been set with a demux id %" PRIu32, + mSourceDemuxId); + return Result::INVALID_STATE; + } + mDemuxSet = true; + mSourceDemuxId = static_cast<uint32_t>(demuxId); + + return Result::SUCCESS; +} + +Return<Result> Descrambler::setKeyToken(const hidl_vec<uint8_t>& /* keyToken */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Descrambler::addPid(const DemuxPid& /* pid */, + const sp<IFilter>& /* optionalSourceFilter */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Descrambler::removePid(const DemuxPid& /* pid */, + const sp<IFilter>& /* optionalSourceFilter */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Descrambler::close() { + ALOGV("%s", __FUNCTION__); + mDemuxSet = false; + + return Result::SUCCESS; +} + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Descrambler.h b/tv/tuner/1.1/default/Descrambler.h new file mode 100644 index 0000000000..ffc284ddde --- /dev/null +++ b/tv/tuner/1.1/default/Descrambler.h @@ -0,0 +1,62 @@ +/* + * Copyright 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_TV_TUNER_V1_1_DESCRAMBLER_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_DESCRAMBLER_H_ + +#include <android/hardware/tv/tuner/1.0/IDescrambler.h> +#include <android/hardware/tv/tuner/1.1/ITuner.h> +#include <inttypes.h> + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +class Descrambler : public IDescrambler { + public: + Descrambler(); + + virtual Return<Result> setDemuxSource(uint32_t demuxId) override; + + virtual Return<Result> setKeyToken(const hidl_vec<uint8_t>& keyToken) override; + + virtual Return<Result> addPid(const DemuxPid& pid, + const sp<IFilter>& optionalSourceFilter) override; + + virtual Return<Result> removePid(const DemuxPid& pid, + const sp<IFilter>& optionalSourceFilter) override; + + virtual Return<Result> close() override; + + private: + virtual ~Descrambler(); + uint32_t mSourceDemuxId; + bool mDemuxSet = false; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_DESCRAMBLER_H_ diff --git a/tv/tuner/1.1/default/Dvr.cpp b/tv/tuner/1.1/default/Dvr.cpp new file mode 100644 index 0000000000..02d6a42e58 --- /dev/null +++ b/tv/tuner/1.1/default/Dvr.cpp @@ -0,0 +1,498 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Dvr" + +#include "Dvr.h" +#include <utils/Log.h> + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +#define WAIT_TIMEOUT 3000000000 + +Dvr::Dvr() {} + +Dvr::Dvr(DvrType type, uint32_t bufferSize, const sp<IDvrCallback>& cb, sp<Demux> demux) { + mType = type; + mBufferSize = bufferSize; + mCallback = cb; + mDemux = demux; +} + +Dvr::~Dvr() {} + +Return<void> Dvr::getQueueDesc(getQueueDesc_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + _hidl_cb(Result::SUCCESS, *mDvrMQ->getDesc()); + return Void(); +} + +Return<Result> Dvr::configure(const DvrSettings& settings) { + ALOGV("%s", __FUNCTION__); + + mDvrSettings = settings; + mDvrConfigured = true; + + return Result::SUCCESS; +} + +Return<Result> Dvr::attachFilter(const sp<V1_0::IFilter>& filter) { + ALOGV("%s", __FUNCTION__); + + uint64_t filterId; + Result status; + + sp<V1_1::IFilter> filter_v1_1 = V1_1::IFilter::castFrom(filter); + if (filter_v1_1 != NULL) { + filter_v1_1->getId64Bit([&](Result result, uint64_t id) { + filterId = id; + status = result; + }); + } else { + filter->getId([&](Result result, uint32_t id) { + filterId = id; + status = result; + }); + } + + if (status != Result::SUCCESS) { + return status; + } + + // TODO check if the attached filter is a record filter + if (!mDemux->attachRecordFilter(filterId)) { + return Result::INVALID_ARGUMENT; + } + + return Result::SUCCESS; +} + +Return<Result> Dvr::detachFilter(const sp<V1_0::IFilter>& filter) { + ALOGV("%s", __FUNCTION__); + + uint64_t filterId; + Result status; + + sp<V1_1::IFilter> filter_v1_1 = V1_1::IFilter::castFrom(filter); + if (filter_v1_1 != NULL) { + filter_v1_1->getId64Bit([&](Result result, uint64_t id) { + filterId = id; + status = result; + }); + } else { + filter->getId([&](Result result, uint32_t id) { + filterId = id; + status = result; + }); + } + + if (status != Result::SUCCESS) { + return status; + } + + if (!mDemux->detachRecordFilter(filterId)) { + return Result::INVALID_ARGUMENT; + } + + return Result::SUCCESS; +} + +Return<Result> Dvr::start() { + ALOGV("%s", __FUNCTION__); + + if (!mCallback) { + return Result::NOT_INITIALIZED; + } + + if (!mDvrConfigured) { + return Result::INVALID_STATE; + } + + if (mType == DvrType::PLAYBACK) { + pthread_create(&mDvrThread, NULL, __threadLoopPlayback, this); + pthread_setname_np(mDvrThread, "playback_waiting_loop"); + } else if (mType == DvrType::RECORD) { + mRecordStatus = RecordStatus::DATA_READY; + mDemux->setIsRecording(mType == DvrType::RECORD); + } + + // TODO start another thread to send filter status callback to the framework + + return Result::SUCCESS; +} + +Return<Result> Dvr::stop() { + ALOGV("%s", __FUNCTION__); + + mDvrThreadRunning = false; + + lock_guard<mutex> lock(mDvrThreadLock); + + mIsRecordStarted = false; + mDemux->setIsRecording(false); + + return Result::SUCCESS; +} + +Return<Result> Dvr::flush() { + ALOGV("%s", __FUNCTION__); + + mRecordStatus = RecordStatus::DATA_READY; + + return Result::SUCCESS; +} + +Return<Result> Dvr::close() { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +bool Dvr::createDvrMQ() { + ALOGV("%s", __FUNCTION__); + + // Create a synchronized FMQ that supports blocking read/write + unique_ptr<DvrMQ> tmpDvrMQ = unique_ptr<DvrMQ>(new (nothrow) DvrMQ(mBufferSize, true)); + if (!tmpDvrMQ->isValid()) { + ALOGW("[Dvr] Failed to create FMQ of DVR"); + return false; + } + + mDvrMQ = move(tmpDvrMQ); + + if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != OK) { + return false; + } + + return true; +} + +EventFlag* Dvr::getDvrEventFlag() { + return mDvrEventFlag; +} + +void* Dvr::__threadLoopPlayback(void* user) { + Dvr* const self = static_cast<Dvr*>(user); + self->playbackThreadLoop(); + return 0; +} + +void Dvr::playbackThreadLoop() { + ALOGD("[Dvr] playback threadLoop start."); + lock_guard<mutex> lock(mDvrThreadLock); + mDvrThreadRunning = true; + + while (mDvrThreadRunning) { + uint32_t efState = 0; + status_t status = + mDvrEventFlag->wait(static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_READY), + &efState, WAIT_TIMEOUT, true /* retry on spurious wake */); + if (status != OK) { + ALOGD("[Dvr] wait for data ready on the playback FMQ"); + continue; + } + + if (mDvrSettings.playback().dataFormat == DataFormat::ES) { + if (!processEsDataOnPlayback(false /*isVirtualFrontend*/, false /*isRecording*/)) { + ALOGE("[Dvr] playback es data failed to be filtered. Ending thread"); + break; + } + maySendPlaybackStatusCallback(); + } + // Our current implementation filter the data and write it into the filter FMQ immediately + // after the DATA_READY from the VTS/framework + if (!readPlaybackFMQ(false /*isVirtualFrontend*/, false /*isRecording*/) || + !startFilterDispatcher(false /*isVirtualFrontend*/, false /*isRecording*/)) { + ALOGE("[Dvr] playback data failed to be filtered. Ending thread"); + break; + } + + maySendPlaybackStatusCallback(); + } + + mDvrThreadRunning = false; + ALOGD("[Dvr] playback thread ended."); +} + +void Dvr::maySendPlaybackStatusCallback() { + lock_guard<mutex> lock(mPlaybackStatusLock); + int availableToRead = mDvrMQ->availableToRead(); + int availableToWrite = mDvrMQ->availableToWrite(); + + PlaybackStatus newStatus = checkPlaybackStatusChange(availableToWrite, availableToRead, + mDvrSettings.playback().highThreshold, + mDvrSettings.playback().lowThreshold); + if (mPlaybackStatus != newStatus) { + mCallback->onPlaybackStatus(newStatus); + mPlaybackStatus = newStatus; + } +} + +PlaybackStatus Dvr::checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead, + uint32_t highThreshold, uint32_t lowThreshold) { + if (availableToWrite == 0) { + return PlaybackStatus::SPACE_FULL; + } else if (availableToRead > highThreshold) { + return PlaybackStatus::SPACE_ALMOST_FULL; + } else if (availableToRead < lowThreshold) { + return PlaybackStatus::SPACE_ALMOST_EMPTY; + } else if (availableToRead == 0) { + return PlaybackStatus::SPACE_EMPTY; + } + return mPlaybackStatus; +} + +bool Dvr::readPlaybackFMQ(bool isVirtualFrontend, bool isRecording) { + // Read playback data from the input FMQ + int size = mDvrMQ->availableToRead(); + int playbackPacketSize = mDvrSettings.playback().packetSize; + vector<uint8_t> dataOutputBuffer; + dataOutputBuffer.resize(playbackPacketSize); + // Dispatch the packet to the PID matching filter output buffer + for (int i = 0; i < size / playbackPacketSize; i++) { + if (!mDvrMQ->read(dataOutputBuffer.data(), playbackPacketSize)) { + return false; + } + if (isVirtualFrontend) { + if (isRecording) { + mDemux->sendFrontendInputToRecord(dataOutputBuffer); + } else { + mDemux->startBroadcastTsFilter(dataOutputBuffer); + } + } else { + startTpidFilter(dataOutputBuffer); + } + } + + return true; +} + +bool Dvr::processEsDataOnPlayback(bool isVirtualFrontend, bool isRecording) { + // Read ES from the DVR FMQ + // Note that currently we only provides ES with metaData in a specific format to be parsed. + // The ES size should be smaller than the Playback FMQ size to avoid reading truncated data. + int size = mDvrMQ->availableToRead(); + vector<uint8_t> dataOutputBuffer; + dataOutputBuffer.resize(size); + if (!mDvrMQ->read(dataOutputBuffer.data(), size)) { + return false; + } + + int metaDataSize = size; + int totalFrames = 0; + int videoEsDataSize = 0; + int audioEsDataSize = 0; + int audioPid = 0; + int videoPid = 0; + + vector<MediaEsMetaData> esMeta; + int videoReadPointer = 0; + int audioReadPointer = 0; + int frameCount = 0; + // Get meta data from the es + for (int i = 0; i < metaDataSize; i++) { + switch (dataOutputBuffer[i]) { + case 'm': + metaDataSize = 0; + getMetaDataValue(i, dataOutputBuffer.data(), metaDataSize); + videoReadPointer = metaDataSize; + continue; + case 'l': + getMetaDataValue(i, dataOutputBuffer.data(), totalFrames); + esMeta.resize(totalFrames); + continue; + case 'V': + getMetaDataValue(i, dataOutputBuffer.data(), videoEsDataSize); + audioReadPointer = metaDataSize + videoEsDataSize; + continue; + case 'A': + getMetaDataValue(i, dataOutputBuffer.data(), audioEsDataSize); + continue; + case 'p': + if (dataOutputBuffer[++i] == 'a') { + getMetaDataValue(i, dataOutputBuffer.data(), audioPid); + } else if (dataOutputBuffer[i] == 'v') { + getMetaDataValue(i, dataOutputBuffer.data(), videoPid); + } + continue; + case 'v': + case 'a': + if (dataOutputBuffer[i + 1] != ',') { + ALOGE("[Dvr] Invalid format meta data."); + return false; + } + esMeta[frameCount] = { + .isAudio = dataOutputBuffer[i] == 'a' ? true : false, + }; + i += 5; // Move to Len + getMetaDataValue(i, dataOutputBuffer.data(), esMeta[frameCount].len); + if (esMeta[frameCount].isAudio) { + esMeta[frameCount].startIndex = audioReadPointer; + audioReadPointer += esMeta[frameCount].len; + } else { + esMeta[frameCount].startIndex = videoReadPointer; + videoReadPointer += esMeta[frameCount].len; + } + i += 4; // move to PTS + getMetaDataValue(i, dataOutputBuffer.data(), esMeta[frameCount].pts); + frameCount++; + continue; + default: + continue; + } + } + + if (frameCount != totalFrames) { + ALOGE("[Dvr] Invalid meta data, frameCount=%d, totalFrames reported=%d", frameCount, + totalFrames); + return false; + } + + if (metaDataSize + audioEsDataSize + videoEsDataSize != size) { + ALOGE("[Dvr] Invalid meta data, metaSize=%d, videoSize=%d, audioSize=%d, totolSize=%d", + metaDataSize, videoEsDataSize, audioEsDataSize, size); + return false; + } + + // Read es raw data from the FMQ per meta data built previously + vector<uint8_t> frameData; + map<uint64_t, sp<IFilter>>::iterator it; + int pid = 0; + for (int i = 0; i < totalFrames; i++) { + frameData.resize(esMeta[i].len); + pid = esMeta[i].isAudio ? audioPid : videoPid; + memcpy(dataOutputBuffer.data() + esMeta[i].startIndex, frameData.data(), esMeta[i].len); + // Send to the media filter + if (isVirtualFrontend && isRecording) { + // TODO validate record + mDemux->sendFrontendInputToRecord(frameData); + } else { + for (it = mFilters.begin(); it != mFilters.end(); it++) { + if (pid == mDemux->getFilterTpid(it->first)) { + mDemux->updateMediaFilterOutput(it->first, frameData, + static_cast<uint64_t>(esMeta[i].pts)); + startFilterDispatcher(isVirtualFrontend, isRecording); + } + } + } + } + + return true; +} + +void Dvr::getMetaDataValue(int& index, uint8_t* dataOutputBuffer, int& value) { + index += 2; // Move the pointer across the ":" to the value + while (dataOutputBuffer[index] != ',' && dataOutputBuffer[index] != '\n') { + value = ((dataOutputBuffer[index++] - 48) + value * 10); + } +} + +void Dvr::startTpidFilter(vector<uint8_t> data) { + map<uint64_t, sp<IFilter>>::iterator it; + for (it = mFilters.begin(); it != mFilters.end(); it++) { + uint16_t pid = ((data[1] & 0x1f) << 8) | ((data[2] & 0xff)); + if (DEBUG_DVR) { + ALOGW("[Dvr] start ts filter pid: %d", pid); + } + if (pid == mDemux->getFilterTpid(it->first)) { + mDemux->updateFilterOutput(it->first, data); + } + } +} + +bool Dvr::startFilterDispatcher(bool isVirtualFrontend, bool isRecording) { + if (isVirtualFrontend) { + if (isRecording) { + return mDemux->startRecordFilterDispatcher(); + } else { + return mDemux->startBroadcastFilterDispatcher(); + } + } + + map<uint64_t, sp<IFilter>>::iterator it; + // Handle the output data per filter type + for (it = mFilters.begin(); it != mFilters.end(); it++) { + if (mDemux->startFilterHandler(it->first) != Result::SUCCESS) { + return false; + } + } + + return true; +} + +bool Dvr::writeRecordFMQ(const vector<uint8_t>& data) { + lock_guard<mutex> lock(mWriteLock); + if (mRecordStatus == RecordStatus::OVERFLOW) { + ALOGW("[Dvr] stops writing and wait for the client side flushing."); + return true; + } + if (mDvrMQ->write(data.data(), data.size())) { + mDvrEventFlag->wake(static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_READY)); + maySendRecordStatusCallback(); + return true; + } + + maySendRecordStatusCallback(); + return false; +} + +void Dvr::maySendRecordStatusCallback() { + lock_guard<mutex> lock(mRecordStatusLock); + int availableToRead = mDvrMQ->availableToRead(); + int availableToWrite = mDvrMQ->availableToWrite(); + + RecordStatus newStatus = checkRecordStatusChange(availableToWrite, availableToRead, + mDvrSettings.record().highThreshold, + mDvrSettings.record().lowThreshold); + if (mRecordStatus != newStatus) { + mCallback->onRecordStatus(newStatus); + mRecordStatus = newStatus; + } +} + +RecordStatus Dvr::checkRecordStatusChange(uint32_t availableToWrite, uint32_t availableToRead, + uint32_t highThreshold, uint32_t lowThreshold) { + if (availableToWrite == 0) { + return DemuxFilterStatus::OVERFLOW; + } else if (availableToRead > highThreshold) { + return DemuxFilterStatus::HIGH_WATER; + } else if (availableToRead < lowThreshold) { + return DemuxFilterStatus::LOW_WATER; + } + return mRecordStatus; +} + +bool Dvr::addPlaybackFilter(uint64_t filterId, sp<IFilter> filter) { + mFilters[filterId] = filter; + return true; +} + +bool Dvr::removePlaybackFilter(uint64_t filterId) { + mFilters.erase(filterId); + return true; +} +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Dvr.h b/tv/tuner/1.1/default/Dvr.h new file mode 100644 index 0000000000..7b7efefada --- /dev/null +++ b/tv/tuner/1.1/default/Dvr.h @@ -0,0 +1,167 @@ +/* + * Copyright 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_TV_TUNER_V1_1_DVR_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_DVR_H_ + +#include <fmq/MessageQueue.h> +#include <math.h> +#include <set> +#include "Demux.h" +#include "Frontend.h" +#include "Tuner.h" + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +using ::android::hardware::EventFlag; +using ::android::hardware::kSynchronizedReadWrite; +using ::android::hardware::MessageQueue; +using ::android::hardware::MQDescriptorSync; + +using DvrMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; + +struct MediaEsMetaData { + bool isAudio; + int startIndex; + int len; + int pts; +}; + +class Demux; +class Filter; +class Frontend; +class Tuner; + +class Dvr : public IDvr { + public: + Dvr(); + + Dvr(DvrType type, uint32_t bufferSize, const sp<IDvrCallback>& cb, sp<Demux> demux); + + ~Dvr(); + + virtual Return<void> getQueueDesc(getQueueDesc_cb _hidl_cb) override; + + virtual Return<Result> configure(const DvrSettings& settings) override; + + virtual Return<Result> attachFilter(const sp<IFilter>& filter) override; + + virtual Return<Result> detachFilter(const sp<IFilter>& filter) override; + + virtual Return<Result> start() override; + + virtual Return<Result> stop() override; + + virtual Return<Result> flush() override; + + virtual Return<Result> close() override; + + /** + * To create a DvrMQ and its Event Flag. + * + * Return false is any of the above processes fails. + */ + bool createDvrMQ(); + void sendBroadcastInputToDvrRecord(vector<uint8_t> byteBuffer); + bool writeRecordFMQ(const std::vector<uint8_t>& data); + bool addPlaybackFilter(uint64_t filterId, sp<IFilter> filter); + bool removePlaybackFilter(uint64_t filterId); + bool readPlaybackFMQ(bool isVirtualFrontend, bool isRecording); + bool processEsDataOnPlayback(bool isVirtualFrontend, bool isRecording); + bool startFilterDispatcher(bool isVirtualFrontend, bool isRecording); + EventFlag* getDvrEventFlag(); + DvrSettings getSettings() { return mDvrSettings; } + + private: + // Demux service + sp<Demux> mDemux; + + DvrType mType; + uint32_t mBufferSize; + sp<IDvrCallback> mCallback; + std::map<uint64_t, sp<IFilter>> mFilters; + + void deleteEventFlag(); + bool readDataFromMQ(); + void getMetaDataValue(int& index, uint8_t* dataOutputBuffer, int& value); + void maySendPlaybackStatusCallback(); + void maySendRecordStatusCallback(); + PlaybackStatus checkPlaybackStatusChange(uint32_t availableToWrite, uint32_t availableToRead, + uint32_t highThreshold, uint32_t lowThreshold); + RecordStatus checkRecordStatusChange(uint32_t availableToWrite, uint32_t availableToRead, + uint32_t highThreshold, uint32_t lowThreshold); + /** + * A dispatcher to read and dispatch input data to all the started filters. + * Each filter handler handles the data filtering/output writing/filterEvent updating. + */ + void startTpidFilter(vector<uint8_t> data); + static void* __threadLoopPlayback(void* user); + static void* __threadLoopRecord(void* user); + void playbackThreadLoop(); + void recordThreadLoop(); + + unique_ptr<DvrMQ> mDvrMQ; + EventFlag* mDvrEventFlag; + /** + * Demux callbacks used on filter events or IO buffer status + */ + bool mDvrConfigured = false; + DvrSettings mDvrSettings; + + // Thread handlers + pthread_t mDvrThread; + + // FMQ status local records + PlaybackStatus mPlaybackStatus; + RecordStatus mRecordStatus; + /** + * If a specific filter's writing loop is still running + */ + bool mDvrThreadRunning; + bool mKeepFetchingDataFromFrontend; + /** + * Lock to protect writes to the FMQs + */ + std::mutex mWriteLock; + /** + * Lock to protect writes to the input status + */ + std::mutex mPlaybackStatusLock; + std::mutex mRecordStatusLock; + std::mutex mDvrThreadLock; + + const bool DEBUG_DVR = false; + + // Booleans to check if recording is running. + // Recording is ready when both of the following are set to true. + bool mIsRecordStarted = false; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_DVR_H_
\ No newline at end of file diff --git a/tv/tuner/1.1/default/Filter.cpp b/tv/tuner/1.1/default/Filter.cpp new file mode 100644 index 0000000000..108baf74f3 --- /dev/null +++ b/tv/tuner/1.1/default/Filter.cpp @@ -0,0 +1,672 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Filter" + +#include "Filter.h" +#include <utils/Log.h> + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +#define WAIT_TIMEOUT 3000000000 + +Filter::Filter() {} + +Filter::Filter(DemuxFilterType type, uint64_t filterId, uint32_t bufferSize, + const sp<IFilterCallback>& cb, sp<Demux> demux) { + mType = type; + mFilterId = filterId; + mBufferSize = bufferSize; + mCallback = cb; + mDemux = demux; + + switch (mType.mainType) { + case DemuxFilterMainType::TS: + if (mType.subType.tsFilterType() == DemuxTsFilterType::AUDIO || + mType.subType.tsFilterType() == DemuxTsFilterType::VIDEO) { + mIsMediaFilter = true; + } + if (mType.subType.tsFilterType() == DemuxTsFilterType::PCR) { + mIsPcrFilter = true; + } + if (mType.subType.tsFilterType() == DemuxTsFilterType::RECORD) { + mIsRecordFilter = true; + } + break; + case DemuxFilterMainType::MMTP: + if (mType.subType.mmtpFilterType() == DemuxMmtpFilterType::AUDIO || + mType.subType.mmtpFilterType() == DemuxMmtpFilterType::VIDEO) { + mIsMediaFilter = true; + } + if (mType.subType.mmtpFilterType() == DemuxMmtpFilterType::RECORD) { + mIsRecordFilter = true; + } + break; + case DemuxFilterMainType::IP: + break; + case DemuxFilterMainType::TLV: + break; + case DemuxFilterMainType::ALP: + break; + default: + break; + } +} + +Filter::~Filter() {} + +Return<void> Filter::getId64Bit(getId64Bit_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + _hidl_cb(Result::SUCCESS, mFilterId); + return Void(); +} + +Return<void> Filter::getId(getId_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + _hidl_cb(Result::SUCCESS, static_cast<uint32_t>(mFilterId)); + return Void(); +} + +Return<Result> Filter::setDataSource(const sp<V1_0::IFilter>& filter) { + ALOGV("%s", __FUNCTION__); + + mDataSource = filter; + mIsDataSourceDemux = false; + + return Result::SUCCESS; +} + +Return<void> Filter::getQueueDesc(getQueueDesc_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + mIsUsingFMQ = true; + + _hidl_cb(Result::SUCCESS, *mFilterMQ->getDesc()); + return Void(); +} + +Return<Result> Filter::configure(const DemuxFilterSettings& settings) { + ALOGV("%s", __FUNCTION__); + + mFilterSettings = settings; + switch (mType.mainType) { + case DemuxFilterMainType::TS: + mTpid = settings.ts().tpid; + break; + case DemuxFilterMainType::MMTP: + break; + case DemuxFilterMainType::IP: + break; + case DemuxFilterMainType::TLV: + break; + case DemuxFilterMainType::ALP: + break; + default: + break; + } + + return Result::SUCCESS; +} + +Return<Result> Filter::start() { + ALOGV("%s", __FUNCTION__); + + return startFilterLoop(); +} + +Return<Result> Filter::stop() { + ALOGV("%s", __FUNCTION__); + + mFilterThreadRunning = false; + + std::lock_guard<std::mutex> lock(mFilterThreadLock); + + return Result::SUCCESS; +} + +Return<Result> Filter::flush() { + ALOGV("%s", __FUNCTION__); + + // temp implementation to flush the FMQ + int size = mFilterMQ->availableToRead(); + char* buffer = new char[size]; + mFilterMQ->read((unsigned char*)&buffer[0], size); + delete[] buffer; + mFilterStatus = DemuxFilterStatus::DATA_READY; + + return Result::SUCCESS; +} + +Return<Result> Filter::releaseAvHandle(const hidl_handle& /*avMemory*/, uint64_t avDataId) { + ALOGV("%s", __FUNCTION__); + if (mDataId2Avfd.find(avDataId) == mDataId2Avfd.end()) { + return Result::INVALID_ARGUMENT; + } + + ::close(mDataId2Avfd[avDataId]); + return Result::SUCCESS; +} + +Return<Result> Filter::close() { + ALOGV("%s", __FUNCTION__); + + return mDemux->removeFilter(mFilterId); +} + +bool Filter::createFilterMQ() { + ALOGV("%s", __FUNCTION__); + + // Create a synchronized FMQ that supports blocking read/write + std::unique_ptr<FilterMQ> tmpFilterMQ = + std::unique_ptr<FilterMQ>(new (std::nothrow) FilterMQ(mBufferSize, true)); + if (!tmpFilterMQ->isValid()) { + ALOGW("[Filter] Failed to create FMQ of filter with id: %" PRIu64, mFilterId); + return false; + } + + mFilterMQ = std::move(tmpFilterMQ); + + if (EventFlag::createEventFlag(mFilterMQ->getEventFlagWord(), &mFilterEventFlag) != OK) { + return false; + } + + return true; +} + +Result Filter::startFilterLoop() { + pthread_create(&mFilterThread, NULL, __threadLoopFilter, this); + pthread_setname_np(mFilterThread, "filter_waiting_loop"); + + return Result::SUCCESS; +} + +void* Filter::__threadLoopFilter(void* user) { + Filter* const self = static_cast<Filter*>(user); + self->filterThreadLoop(); + return 0; +} + +void Filter::filterThreadLoop() { + ALOGD("[Filter] filter %" PRIu64 " threadLoop start.", mFilterId); + std::lock_guard<std::mutex> lock(mFilterThreadLock); + mFilterThreadRunning = true; + + // 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. + while (mFilterThreadRunning) { + if (mFilterEvent.events.size() == 0) { + if (DEBUG_FILTER) { + ALOGD("[Filter] wait for filter data output."); + } + usleep(1000 * 1000); + continue; + } + // After successfully write, send a callback and wait for the read to be done + mCallback->onFilterEvent(mFilterEvent); + freeAvHandle(); + mFilterEvent.events.resize(0); + mFilterStatus = DemuxFilterStatus::DATA_READY; + if (mCallback == nullptr) { + ALOGD("[Filter] filter %" PRIu64 " does not hava callback. Ending thread", mFilterId); + break; + } + mCallback->onFilterStatus(mFilterStatus); + break; + } + + while (mFilterThreadRunning) { + uint32_t efState = 0; + // 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++) { + while (mFilterThreadRunning && mIsUsingFMQ) { + status_t status = mFilterEventFlag->wait( + static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_CONSUMED), &efState, + WAIT_TIMEOUT, true /* retry on spurious wake */); + if (status != OK) { + ALOGD("[Filter] wait for data consumed"); + continue; + } + break; + } + + maySendFilterStatusCallback(); + + while (mFilterThreadRunning) { + std::lock_guard<std::mutex> lock(mFilterEventLock); + if (mFilterEvent.events.size() == 0) { + continue; + } + // After successfully write, send a callback and wait for the read to be done + mCallback->onFilterEvent(mFilterEvent); + mFilterEvent.events.resize(0); + break; + } + // We do not wait for the last read to be done + // VTS can verify the read result itself. + if (i == SECTION_WRITE_COUNT - 1) { + ALOGD("[Filter] filter %" PRIu64 " writing done. Ending thread", mFilterId); + break; + } + } + mFilterThreadRunning = false; + } + + ALOGD("[Filter] filter thread ended."); +} + +void Filter::freeAvHandle() { + if (!mIsMediaFilter) { + return; + } + for (int i = 0; i < mFilterEvent.events.size(); i++) { + ::close(mFilterEvent.events[i].media().avMemory.getNativeHandle()->data[0]); + native_handle_close(mFilterEvent.events[i].media().avMemory.getNativeHandle()); + } +} + +void Filter::maySendFilterStatusCallback() { + if (!mIsUsingFMQ) { + return; + } + std::lock_guard<std::mutex> lock(mFilterStatusLock); + int availableToRead = mFilterMQ->availableToRead(); + int availableToWrite = mFilterMQ->availableToWrite(); + int fmqSize = mFilterMQ->getQuantumCount(); + + DemuxFilterStatus newStatus = checkFilterStatusChange( + availableToWrite, availableToRead, ceil(fmqSize * 0.75), ceil(fmqSize * 0.25)); + if (mFilterStatus != newStatus) { + mCallback->onFilterStatus(newStatus); + mFilterStatus = newStatus; + } +} + +DemuxFilterStatus Filter::checkFilterStatusChange(uint32_t availableToWrite, + uint32_t availableToRead, uint32_t highThreshold, + uint32_t lowThreshold) { + if (availableToWrite == 0) { + return DemuxFilterStatus::OVERFLOW; + } else if (availableToRead > highThreshold) { + return DemuxFilterStatus::HIGH_WATER; + } else if (availableToRead < lowThreshold) { + return DemuxFilterStatus::LOW_WATER; + } + return mFilterStatus; +} + +uint16_t Filter::getTpid() { + return mTpid; +} + +void Filter::updateFilterOutput(vector<uint8_t> data) { + std::lock_guard<std::mutex> lock(mFilterOutputLock); + mFilterOutput.insert(mFilterOutput.end(), data.begin(), data.end()); +} + +void Filter::updatePts(uint64_t pts) { + std::lock_guard<std::mutex> lock(mFilterOutputLock); + mPts = pts; +} + +void Filter::updateRecordOutput(vector<uint8_t> data) { + std::lock_guard<std::mutex> lock(mRecordFilterOutputLock); + mRecordFilterOutput.insert(mRecordFilterOutput.end(), data.begin(), data.end()); +} + +Result Filter::startFilterHandler() { + std::lock_guard<std::mutex> lock(mFilterOutputLock); + switch (mType.mainType) { + case DemuxFilterMainType::TS: + switch (mType.subType.tsFilterType()) { + case DemuxTsFilterType::UNDEFINED: + break; + case DemuxTsFilterType::SECTION: + startSectionFilterHandler(); + break; + case DemuxTsFilterType::PES: + startPesFilterHandler(); + break; + case DemuxTsFilterType::TS: + startTsFilterHandler(); + break; + case DemuxTsFilterType::AUDIO: + case DemuxTsFilterType::VIDEO: + startMediaFilterHandler(); + break; + case DemuxTsFilterType::PCR: + startPcrFilterHandler(); + break; + case DemuxTsFilterType::TEMI: + startTemiFilterHandler(); + break; + default: + 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 Result::SUCCESS; +} + +Result Filter::startSectionFilterHandler() { + if (mFilterOutput.empty()) { + return Result::SUCCESS; + } + if (!writeSectionsAndCreateEvent(mFilterOutput)) { + ALOGD("[Filter] filter %" PRIu64 " fails to write into FMQ. Ending thread", mFilterId); + return Result::UNKNOWN_ERROR; + } + + mFilterOutput.clear(); + + return Result::SUCCESS; +} + +Result Filter::startPesFilterHandler() { + std::lock_guard<std::mutex> lock(mFilterEventLock); + if (mFilterOutput.empty()) { + return Result::SUCCESS; + } + + for (int i = 0; i < mFilterOutput.size(); i += 188) { + if (mPesSizeLeft == 0) { + uint32_t prefix = (mFilterOutput[i + 4] << 16) | (mFilterOutput[i + 5] << 8) | + mFilterOutput[i + 6]; + if (DEBUG_FILTER) { + ALOGD("[Filter] prefix %d", prefix); + } + if (prefix == 0x000001) { + // TODO handle mulptiple Pes filters + mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9]; + mPesSizeLeft += 6; + if (DEBUG_FILTER) { + ALOGD("[Filter] pes data length %d", mPesSizeLeft); + } + } else { + continue; + } + } + + int endPoint = min(184, mPesSizeLeft); + // append data and check size + vector<uint8_t>::const_iterator first = mFilterOutput.begin() + i + 4; + vector<uint8_t>::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint; + mPesOutput.insert(mPesOutput.end(), first, last); + // size does not match then continue + mPesSizeLeft -= endPoint; + if (DEBUG_FILTER) { + ALOGD("[Filter] pes data left %d", mPesSizeLeft); + } + if (mPesSizeLeft > 0) { + continue; + } + // size match then create event + if (!writeDataToFilterMQ(mPesOutput)) { + ALOGD("[Filter] pes data write failed"); + mFilterOutput.clear(); + return Result::INVALID_STATE; + } + maySendFilterStatusCallback(); + DemuxFilterPesEvent pesEvent; + pesEvent = { + // temp dump meta data + .streamId = mPesOutput[3], + .dataLength = static_cast<uint16_t>(mPesOutput.size()), + }; + if (DEBUG_FILTER) { + ALOGD("[Filter] assembled pes data length %d", pesEvent.dataLength); + } + + int size = mFilterEvent.events.size(); + mFilterEvent.events.resize(size + 1); + mFilterEvent.events[size].pes(pesEvent); + mPesOutput.clear(); + } + + mFilterOutput.clear(); + + return Result::SUCCESS; +} + +Result Filter::startTsFilterHandler() { + // TODO handle starting TS filter + return Result::SUCCESS; +} + +Result Filter::startMediaFilterHandler() { + std::lock_guard<std::mutex> lock(mFilterEventLock); + if (mFilterOutput.empty()) { + return Result::SUCCESS; + } + + if (mPts) { + return createMediaFilterEventWithIon(mFilterOutput); + } + + for (int i = 0; i < mFilterOutput.size(); i += 188) { + if (mPesSizeLeft == 0) { + uint32_t prefix = (mFilterOutput[i + 4] << 16) | (mFilterOutput[i + 5] << 8) | + mFilterOutput[i + 6]; + if (DEBUG_FILTER) { + ALOGD("[Filter] prefix %d", prefix); + } + if (prefix == 0x000001) { + // TODO handle mulptiple Pes filters + mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9]; + mPesSizeLeft += 6; + if (DEBUG_FILTER) { + ALOGD("[Filter] pes data length %d", mPesSizeLeft); + } + } else { + continue; + } + } + + int endPoint = min(184, mPesSizeLeft); + // append data and check size + vector<uint8_t>::const_iterator first = mFilterOutput.begin() + i + 4; + vector<uint8_t>::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint; + mPesOutput.insert(mPesOutput.end(), first, last); + // size does not match then continue + mPesSizeLeft -= endPoint; + if (DEBUG_FILTER) { + ALOGD("[Filter] pes data left %d", mPesSizeLeft); + } + if (mPesSizeLeft > 0 || mAvBufferCopyCount++ < 10) { + continue; + } + + createMediaFilterEventWithIon(mPesOutput); + } + + mFilterOutput.clear(); + + return Result::SUCCESS; +} + +Result Filter::createMediaFilterEventWithIon(vector<uint8_t> output) { + int av_fd = createAvIonFd(output.size()); + if (av_fd == -1) { + return Result::UNKNOWN_ERROR; + } + // copy the filtered data to the buffer + uint8_t* avBuffer = getIonBuffer(av_fd, output.size()); + if (avBuffer == NULL) { + return Result::UNKNOWN_ERROR; + } + memcpy(avBuffer, output.data(), output.size() * sizeof(uint8_t)); + + native_handle_t* nativeHandle = createNativeHandle(av_fd); + if (nativeHandle == NULL) { + return Result::UNKNOWN_ERROR; + } + hidl_handle handle; + handle.setTo(nativeHandle, /*shouldOwn=*/true); + + // Create a dataId and add a <dataId, av_fd> pair into the dataId2Avfd map + uint64_t dataId = mLastUsedDataId++ /*createdUID*/; + mDataId2Avfd[dataId] = dup(av_fd); + + // Create mediaEvent and send callback + DemuxFilterMediaEvent mediaEvent; + mediaEvent = { + .avMemory = std::move(handle), + .dataLength = static_cast<uint32_t>(output.size()), + .avDataId = dataId, + }; + if (mPts) { + mediaEvent.pts = mPts; + mPts = 0; + } + int size = mFilterEvent.events.size(); + mFilterEvent.events.resize(size + 1); + mFilterEvent.events[size].media(mediaEvent); + + // Clear and log + output.clear(); + mAvBufferCopyCount = 0; + ::close(av_fd); + if (DEBUG_FILTER) { + ALOGD("[Filter] av data length %d", mediaEvent.dataLength); + } + return Result::SUCCESS; +} + +Result Filter::startRecordFilterHandler() { + std::lock_guard<std::mutex> lock(mRecordFilterOutputLock); + if (mRecordFilterOutput.empty()) { + return Result::SUCCESS; + } + + if (mDvr == nullptr || !mDvr->writeRecordFMQ(mRecordFilterOutput)) { + ALOGD("[Filter] dvr fails to write into record FMQ."); + return Result::UNKNOWN_ERROR; + } + + mRecordFilterOutput.clear(); + return Result::SUCCESS; +} + +Result Filter::startPcrFilterHandler() { + // TODO handle starting PCR filter + return Result::SUCCESS; +} + +Result Filter::startTemiFilterHandler() { + // TODO handle starting TEMI filter + return Result::SUCCESS; +} + +bool Filter::writeSectionsAndCreateEvent(vector<uint8_t> data) { + // TODO check how many sections has been read + ALOGD("[Filter] section handler"); + std::lock_guard<std::mutex> lock(mFilterEventLock); + if (!writeDataToFilterMQ(data)) { + return false; + } + int size = mFilterEvent.events.size(); + mFilterEvent.events.resize(size + 1); + DemuxFilterSectionEvent secEvent; + secEvent = { + // temp dump meta data + .tableId = 0, + .version = 1, + .sectionNum = 1, + .dataLength = static_cast<uint16_t>(data.size()), + }; + mFilterEvent.events[size].section(secEvent); + return true; +} + +bool Filter::writeDataToFilterMQ(const std::vector<uint8_t>& data) { + std::lock_guard<std::mutex> lock(mWriteLock); + if (mFilterMQ->write(data.data(), data.size())) { + return true; + } + return false; +} + +void Filter::attachFilterToRecord(const sp<Dvr> dvr) { + mDvr = dvr; +} + +void Filter::detachFilterFromRecord() { + mDvr = nullptr; +} + +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); + 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) { + ALOGE("[Filter] Failed to create av fd %d", errno); + return -1; + } + return av_fd; +} + +uint8_t* Filter::getIonBuffer(int fd, int size) { + uint8_t* avBuf = static_cast<uint8_t*>( + mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 /*offset*/)); + if (avBuf == MAP_FAILED) { + ALOGE("[Filter] fail to allocate buffer %d", errno); + return NULL; + } + return avBuf; +} + +native_handle_t* Filter::createNativeHandle(int fd) { + // Create a native handle to pass the av fd via the callback event. + native_handle_t* nativeHandle = native_handle_create(/*numFd*/ 1, 0); + if (nativeHandle == NULL) { + ALOGE("[Filter] Failed to create native_handle %d", errno); + return NULL; + } + nativeHandle->data[0] = dup(fd); + return nativeHandle; +} +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Filter.h b/tv/tuner/1.1/default/Filter.h new file mode 100644 index 0000000000..d5801d4f74 --- /dev/null +++ b/tv/tuner/1.1/default/Filter.h @@ -0,0 +1,214 @@ +/* + * Copyright 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_TV_TUNER_V1_1_FILTER_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_FILTER_H_ + +#include <android/hardware/tv/tuner/1.1/IFilter.h> +#include <fmq/MessageQueue.h> +#include <inttypes.h> +#include <ion/ion.h> +#include <math.h> +#include <set> +#include "Demux.h" +#include "Dvr.h" +#include "Frontend.h" + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +using ::android::hardware::EventFlag; +using ::android::hardware::kSynchronizedReadWrite; +using ::android::hardware::MessageQueue; +using ::android::hardware::MQDescriptorSync; + +using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; + +class Demux; +class Dvr; + +class Filter : public V1_1::IFilter { + public: + Filter(); + + Filter(DemuxFilterType type, uint64_t filterId, uint32_t bufferSize, + const sp<IFilterCallback>& cb, sp<Demux> demux); + + ~Filter(); + + virtual Return<void> getId64Bit(getId64Bit_cb _hidl_cb) override; + + virtual Return<void> getId(getId_cb _hidl_cb) override; + + virtual Return<Result> setDataSource(const sp<V1_0::IFilter>& filter) override; + + virtual Return<void> getQueueDesc(getQueueDesc_cb _hidl_cb) override; + + virtual Return<Result> configure(const DemuxFilterSettings& settings) override; + + virtual Return<Result> start() override; + + virtual Return<Result> stop() override; + + virtual Return<Result> flush() override; + + virtual Return<Result> releaseAvHandle(const hidl_handle& avMemory, uint64_t avDataId) override; + + virtual Return<Result> close() override; + + /** + * To create a FilterMQ and its Event Flag. + * + * Return false is any of the above processes fails. + */ + bool createFilterMQ(); + uint16_t getTpid(); + void updateFilterOutput(vector<uint8_t> data); + void updateRecordOutput(vector<uint8_t> data); + void updatePts(uint64_t pts); + Result startFilterHandler(); + Result startRecordFilterHandler(); + void attachFilterToRecord(const sp<Dvr> dvr); + void detachFilterFromRecord(); + void freeAvHandle(); + bool isMediaFilter() { return mIsMediaFilter; }; + bool isPcrFilter() { return mIsPcrFilter; }; + bool isRecordFilter() { return mIsRecordFilter; }; + + private: + // Tuner service + sp<Demux> mDemux; + // Dvr reference once the filter is attached to any + sp<Dvr> mDvr = nullptr; + /** + * Filter callbacks used on filter events or FMQ status + */ + sp<IFilterCallback> mCallback; + + uint64_t mFilterId; + uint32_t mBufferSize; + DemuxFilterType mType; + bool mIsMediaFilter = false; + bool mIsPcrFilter = false; + bool mIsRecordFilter = false; + DemuxFilterSettings mFilterSettings; + + uint16_t mTpid; + sp<V1_0::IFilter> mDataSource; + bool mIsDataSourceDemux = true; + vector<uint8_t> mFilterOutput; + vector<uint8_t> mRecordFilterOutput; + uint64_t mPts = 0; + unique_ptr<FilterMQ> mFilterMQ; + bool mIsUsingFMQ = false; + EventFlag* mFilterEventFlag; + DemuxFilterEvent mFilterEvent; + + // Thread handlers + pthread_t mFilterThread; + + // FMQ status local records + DemuxFilterStatus mFilterStatus; + /** + * If a specific filter's writing loop is still running + */ + bool mFilterThreadRunning; + bool mKeepFetchingDataFromFrontend; + + /** + * How many times a filter should write + * TODO make this dynamic/random/can take as a parameter + */ + const uint16_t SECTION_WRITE_COUNT = 10; + + bool DEBUG_FILTER = false; + + /** + * Filter handlers to handle the data filtering. + * They are also responsible to write the filtered output into the filter FMQ + * and update the filterEvent bound with the same filterId. + */ + Result startSectionFilterHandler(); + Result startPesFilterHandler(); + Result startTsFilterHandler(); + Result startMediaFilterHandler(); + Result startPcrFilterHandler(); + Result startTemiFilterHandler(); + Result startFilterLoop(); + + void deleteEventFlag(); + bool writeDataToFilterMQ(const std::vector<uint8_t>& data); + bool readDataFromMQ(); + bool writeSectionsAndCreateEvent(vector<uint8_t> data); + void maySendFilterStatusCallback(); + DemuxFilterStatus checkFilterStatusChange(uint32_t availableToWrite, uint32_t availableToRead, + uint32_t highThreshold, uint32_t lowThreshold); + /** + * A dispatcher to read and dispatch input data to all the started filters. + * Each filter handler handles the data filtering/output writing/filterEvent updating. + */ + void startTsFilter(vector<uint8_t> data); + bool startFilterDispatcher(); + static void* __threadLoopFilter(void* user); + void filterThreadLoop(); + + int createAvIonFd(int size); + uint8_t* getIonBuffer(int fd, int size); + native_handle_t* createNativeHandle(int fd); + Result createMediaFilterEventWithIon(vector<uint8_t> output); + + /** + * Lock to protect writes to the FMQs + */ + std::mutex mWriteLock; + /** + * Lock to protect writes to the filter event + */ + // TODO make each filter separate event lock + std::mutex mFilterEventLock; + /** + * Lock to protect writes to the input status + */ + std::mutex mFilterStatusLock; + std::mutex mFilterThreadLock; + std::mutex mFilterOutputLock; + std::mutex mRecordFilterOutputLock; + + // temp handle single PES filter + // TODO handle mulptiple Pes filters + int mPesSizeLeft = 0; + vector<uint8_t> mPesOutput; + + // A map from data id to ion handle + std::map<uint64_t, int> mDataId2Avfd; + uint64_t mLastUsedDataId = 1; + int mAvBufferCopyCount = 0; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_FILTER_H_ diff --git a/tv/tuner/1.1/default/Frontend.cpp b/tv/tuner/1.1/default/Frontend.cpp new file mode 100644 index 0000000000..6f5885fad7 --- /dev/null +++ b/tv/tuner/1.1/default/Frontend.cpp @@ -0,0 +1,285 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Frontend" + +#include "Frontend.h" +#include <android/hardware/tv/tuner/1.0/IFrontendCallback.h> +#include <utils/Log.h> + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +Frontend::Frontend(FrontendType type, FrontendId id, sp<Tuner> tuner) { + mType = type; + mId = id; + mTunerService = tuner; + // Init callback to nullptr + mCallback = nullptr; +} + +Frontend::~Frontend() {} + +Return<Result> Frontend::close() { + ALOGV("%s", __FUNCTION__); + // Reset callback + mCallback = nullptr; + mIsLocked = false; + mTunerService->removeFrontend(mId); + + return Result::SUCCESS; +} + +Return<Result> Frontend::setCallback(const sp<IFrontendCallback>& callback) { + ALOGV("%s", __FUNCTION__); + if (callback == nullptr) { + ALOGW("[ WARN ] Set Frontend callback with nullptr"); + return Result::INVALID_ARGUMENT; + } + + mCallback = callback; + return Result::SUCCESS; +} + +Return<Result> Frontend::tune(const FrontendSettings& /* settings */) { + ALOGV("%s", __FUNCTION__); + if (mCallback == nullptr) { + ALOGW("[ WARN ] Frontend callback is not set when tune"); + return Result::INVALID_STATE; + } + + mTunerService->frontendStartTune(mId); + mCallback->onEvent(FrontendEventType::LOCKED); + mIsLocked = true; + return Result::SUCCESS; +} + +Return<Result> Frontend::stopTune() { + ALOGV("%s", __FUNCTION__); + + mTunerService->frontendStopTune(mId); + mIsLocked = false; + + return Result::SUCCESS; +} + +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) { + msg.isEnd(true); + mCallback->onScanMessage(FrontendScanMessageType::END, msg); + return Result::SUCCESS; + } + + uint32_t frequency = settings.dvbt().frequency; + 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; + + return Result::SUCCESS; +} + +Return<Result> Frontend::stopScan() { + ALOGV("%s", __FUNCTION__); + + mIsLocked = false; + return Result::SUCCESS; +} + +Return<void> Frontend::getStatus(const hidl_vec<FrontendStatusType>& statusTypes, + getStatus_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + vector<FrontendStatus> statuses; + for (int i = 0; i < statusTypes.size(); i++) { + FrontendStatusType type = statusTypes[i]; + FrontendStatus status; + // assign randomly selected values for testing. + switch (type) { + case FrontendStatusType::DEMOD_LOCK: { + status.isDemodLocked(true); + break; + } + case FrontendStatusType::SNR: { + status.snr(221); + break; + } + case FrontendStatusType::BER: { + status.ber(1); + break; + } + case FrontendStatusType::PER: { + status.per(2); + break; + } + case FrontendStatusType::PRE_BER: { + status.preBer(3); + break; + } + case FrontendStatusType::SIGNAL_QUALITY: { + status.signalQuality(4); + break; + } + case FrontendStatusType::SIGNAL_STRENGTH: { + status.signalStrength(5); + break; + } + case FrontendStatusType::SYMBOL_RATE: { + status.symbolRate(6); + break; + } + case FrontendStatusType::FEC: { + status.innerFec(FrontendInnerFec::FEC_2_9); // value = 1 << 7 + break; + } + case FrontendStatusType::MODULATION: { + FrontendModulationStatus modulationStatus; + modulationStatus.isdbt(FrontendIsdbtModulation::MOD_16QAM); // value = 1 << 3 + status.modulation(modulationStatus); + break; + } + case FrontendStatusType::SPECTRAL: { + status.inversion(FrontendDvbcSpectralInversion::NORMAL); + break; + } + case FrontendStatusType::LNB_VOLTAGE: { + status.lnbVoltage(LnbVoltage::VOLTAGE_5V); + break; + } + case FrontendStatusType::PLP_ID: { + status.plpId(101); // type uint8_t + break; + } + case FrontendStatusType::EWBS: { + status.isEWBS(false); + break; + } + case FrontendStatusType::AGC: { + status.agc(7); + break; + } + case FrontendStatusType::LNA: { + status.isLnaOn(false); + break; + } + case FrontendStatusType::LAYER_ERROR: { + vector<bool> v = {false, true, true}; + status.isLayerError(v); + break; + } + case FrontendStatusType::MER: { + status.mer(8); + break; + } + case FrontendStatusType::FREQ_OFFSET: { + status.freqOffset(9); + break; + } + case FrontendStatusType::HIERARCHY: { + status.hierarchy(FrontendDvbtHierarchy::HIERARCHY_1_NATIVE); + break; + } + case FrontendStatusType::RF_LOCK: { + status.isRfLocked(false); + break; + } + case FrontendStatusType::ATSC3_PLP_INFO: { + vector<FrontendStatusAtsc3PlpInfo> v; + FrontendStatusAtsc3PlpInfo info1{ + .plpId = 3, + .isLocked = false, + .uec = 313, + }; + FrontendStatusAtsc3PlpInfo info2{ + .plpId = 5, + .isLocked = true, + .uec = 515, + }; + v.push_back(info1); + v.push_back(info2); + status.plpInfo(v); + break; + } + default: { + continue; + } + } + statuses.push_back(status); + } + _hidl_cb(Result::SUCCESS, statuses); + + return Void(); +} + +Return<Result> Frontend::setLna(bool /* bEnable */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Frontend::setLnb(uint32_t /* lnb */) { + ALOGV("%s", __FUNCTION__); + if (!supportsSatellite()) { + return Result::INVALID_STATE; + } + return Result::SUCCESS; +} + +FrontendType Frontend::getFrontendType() { + return mType; +} + +FrontendId Frontend::getFrontendId() { + return mId; +} + +bool Frontend::supportsSatellite() { + return mType == FrontendType::DVBS || mType == FrontendType::ISDBS || + mType == FrontendType::ISDBS3; +} + +bool Frontend::isLocked() { + return mIsLocked; +} +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Frontend.h b/tv/tuner/1.1/default/Frontend.h new file mode 100644 index 0000000000..89b4a6b5f3 --- /dev/null +++ b/tv/tuner/1.1/default/Frontend.h @@ -0,0 +1,85 @@ +/* + * Copyright 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_TV_TUNER_V1_1_FRONTEND_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_ + +#include <fstream> +#include <iostream> +#include "Tuner.h" + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +class Tuner; + +class Frontend : public IFrontend { + public: + Frontend(FrontendType type, FrontendId id, sp<Tuner> tuner); + + virtual Return<Result> close() override; + + virtual Return<Result> setCallback(const sp<IFrontendCallback>& callback) override; + + virtual Return<Result> tune(const FrontendSettings& settings) override; + + virtual Return<Result> stopTune() override; + + virtual Return<Result> scan(const FrontendSettings& settings, FrontendScanType type) override; + + virtual Return<Result> stopScan() override; + + virtual Return<void> getStatus(const hidl_vec<FrontendStatusType>& statusTypes, + getStatus_cb _hidl_cb) override; + + virtual Return<Result> setLna(bool bEnable) override; + + virtual Return<Result> setLnb(uint32_t lnb) override; + + FrontendType getFrontendType(); + + FrontendId getFrontendId(); + + string getSourceFile(); + + bool isLocked(); + + private: + virtual ~Frontend(); + bool supportsSatellite(); + sp<IFrontendCallback> mCallback; + sp<Tuner> mTunerService; + FrontendType mType = FrontendType::UNDEFINED; + FrontendId mId = 0; + bool mIsLocked = false; + + std::ifstream mFrontendData; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_ diff --git a/tv/tuner/1.1/default/Lnb.cpp b/tv/tuner/1.1/default/Lnb.cpp new file mode 100644 index 0000000000..044727ff54 --- /dev/null +++ b/tv/tuner/1.1/default/Lnb.cpp @@ -0,0 +1,81 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Lnb" + +#include "Lnb.h" +#include <utils/Log.h> + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +Lnb::Lnb() {} +Lnb::Lnb(int id) { + mId = id; +} + +Lnb::~Lnb() {} + +Return<Result> Lnb::setCallback(const sp<ILnbCallback>& /* callback */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Lnb::setVoltage(LnbVoltage /* voltage */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Lnb::setTone(LnbTone /* tone */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Lnb::setSatellitePosition(LnbPosition /* position */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Lnb::sendDiseqcMessage(const hidl_vec<uint8_t>& /* diseqcMessage */) { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +Return<Result> Lnb::close() { + ALOGV("%s", __FUNCTION__); + + return Result::SUCCESS; +} + +int Lnb::getId() { + return mId; +} + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Lnb.h b/tv/tuner/1.1/default/Lnb.h new file mode 100644 index 0000000000..70a8e41b8b --- /dev/null +++ b/tv/tuner/1.1/default/Lnb.h @@ -0,0 +1,63 @@ +/* + * Copyright 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_TV_TUNER_V1_1_LNB_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_LNB_H_ + +#include <android/hardware/tv/tuner/1.0/ILnb.h> +#include <android/hardware/tv/tuner/1.1/ITuner.h> + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +class Lnb : public ILnb { + public: + Lnb(); + Lnb(int id); + + virtual Return<Result> setCallback(const sp<ILnbCallback>& callback) override; + + virtual Return<Result> setVoltage(LnbVoltage voltage) override; + + virtual Return<Result> setTone(LnbTone tone) override; + + virtual Return<Result> setSatellitePosition(LnbPosition position) override; + + virtual Return<Result> sendDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage) override; + + virtual Return<Result> close() override; + + int getId(); + + private: + int mId; + virtual ~Lnb(); +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_LNB_H_ diff --git a/tv/tuner/1.1/default/OWNERS b/tv/tuner/1.1/default/OWNERS new file mode 100644 index 0000000000..1b3d095f9c --- /dev/null +++ b/tv/tuner/1.1/default/OWNERS @@ -0,0 +1,4 @@ +nchalko@google.com +amyjojo@google.com +shubang@google.com +quxiangfang@google.com diff --git a/tv/tuner/1.1/default/TimeFilter.cpp b/tv/tuner/1.1/default/TimeFilter.cpp new file mode 100644 index 0000000000..bb243a66bc --- /dev/null +++ b/tv/tuner/1.1/default/TimeFilter.cpp @@ -0,0 +1,87 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-TimeFilter" + +#include "TimeFilter.h" +#include <utils/Log.h> + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +TimeFilter::TimeFilter() {} + +TimeFilter::TimeFilter(sp<Demux> demux) { + mDemux = demux; +} + +TimeFilter::~TimeFilter() {} + +Return<Result> TimeFilter::setTimeStamp(uint64_t timeStamp) { + ALOGV("%s", __FUNCTION__); + if (timeStamp == INVALID_TIME_STAMP) { + return Result::INVALID_ARGUMENT; + } + mTimeStamp = timeStamp; + mBeginTime = time(NULL); + + return Result::SUCCESS; +} + +Return<Result> TimeFilter::clearTimeStamp() { + ALOGV("%s", __FUNCTION__); + mTimeStamp = INVALID_TIME_STAMP; + + return Result::SUCCESS; +} + +Return<void> TimeFilter::getTimeStamp(getTimeStamp_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + if (mTimeStamp == INVALID_TIME_STAMP) { + _hidl_cb(Result::INVALID_STATE, mTimeStamp); + } + + uint64_t currentTimeStamp = mTimeStamp + difftime(time(NULL), mBeginTime) * 900000; + _hidl_cb(Result::SUCCESS, currentTimeStamp); + return Void(); +} + +Return<void> TimeFilter::getSourceTime(getSourceTime_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + uint64_t time = 0; + + _hidl_cb(Result::SUCCESS, time); + return Void(); +} + +Return<Result> TimeFilter::close() { + ALOGV("%s", __FUNCTION__); + mTimeStamp = INVALID_TIME_STAMP; + + return Result::SUCCESS; +} + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android
\ No newline at end of file diff --git a/tv/tuner/1.1/default/TimeFilter.h b/tv/tuner/1.1/default/TimeFilter.h new file mode 100644 index 0000000000..d53ad2c900 --- /dev/null +++ b/tv/tuner/1.1/default/TimeFilter.h @@ -0,0 +1,70 @@ +/* + * Copyright 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_TV_TUNER_V1_1_TIMEFILTER_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_TIMEFILTER_H_ + +#include <android/hardware/tv/tuner/1.0/ITimeFilter.h> +#include "Demux.h" +#include "time.h" + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; + +#define INVALID_TIME_STAMP -1 + +class Demux; + +class TimeFilter : public ITimeFilter { + public: + TimeFilter(); + + TimeFilter(sp<Demux> demux); + + ~TimeFilter(); + + virtual Return<Result> setTimeStamp(uint64_t timeStamp) override; + + virtual Return<Result> clearTimeStamp() override; + + virtual Return<void> getTimeStamp(getTimeStamp_cb _hidl_cb) override; + + virtual Return<void> getSourceTime(getSourceTime_cb _hidl_cb) override; + + virtual Return<Result> close() override; + + private: + sp<Demux> mDemux; + uint64_t mTimeStamp = INVALID_TIME_STAMP; + time_t mBeginTime; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_TIMEFILTER_H_
\ No newline at end of file diff --git a/tv/tuner/1.1/default/Tuner.cpp b/tv/tuner/1.1/default/Tuner.cpp new file mode 100644 index 0000000000..0a0667e87d --- /dev/null +++ b/tv/tuner/1.1/default/Tuner.cpp @@ -0,0 +1,273 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.tuner@1.1-Tuner" + +#include "Tuner.h" +#include <utils/Log.h> +#include "Demux.h" +#include "Descrambler.h" +#include "Frontend.h" +#include "Lnb.h" + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +Tuner::Tuner() { + // Static Frontends array to maintain local frontends information + // Array index matches their FrontendId in the default impl + mFrontendSize = 8; + mFrontends[0] = new Frontend(FrontendType::DVBT, 0, this); + mFrontends[1] = new Frontend(FrontendType::ATSC, 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); + + FrontendInfo::FrontendCapabilities caps; + caps = FrontendInfo::FrontendCapabilities(); + caps.dvbtCaps(FrontendDvbtCapabilities()); + mFrontendCaps[0] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.atscCaps(FrontendAtscCapabilities()); + mFrontendCaps[1] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.dvbcCaps(FrontendDvbcCapabilities()); + mFrontendCaps[2] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.dvbsCaps(FrontendDvbsCapabilities()); + mFrontendCaps[3] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.dvbtCaps(FrontendDvbtCapabilities()); + mFrontendCaps[4] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + FrontendIsdbtCapabilities isdbtCaps{ + .modeCap = FrontendIsdbtMode::MODE_1 | FrontendIsdbtMode::MODE_2, + .bandwidthCap = (unsigned int)FrontendIsdbtBandwidth::BANDWIDTH_6MHZ, + .modulationCap = (unsigned int)FrontendIsdbtModulation::MOD_16QAM, + // ISDBT shares coderate and guard interval with DVBT + .coderateCap = FrontendDvbtCoderate::CODERATE_4_5 | FrontendDvbtCoderate::CODERATE_6_7, + .guardIntervalCap = (unsigned int)FrontendDvbtGuardInterval::INTERVAL_1_128, + }; + caps.isdbtCaps(isdbtCaps); + mFrontendCaps[5] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.analogCaps(FrontendAnalogCapabilities()); + mFrontendCaps[6] = caps; + + caps = FrontendInfo::FrontendCapabilities(); + caps.atscCaps(FrontendAtscCapabilities()); + mFrontendCaps[7] = caps; + + mLnbs.resize(2); + mLnbs[0] = new Lnb(0); + mLnbs[1] = new Lnb(1); +} + +Tuner::~Tuner() {} + +Return<void> Tuner::getFrontendIds(getFrontendIds_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + vector<FrontendId> frontendIds; + frontendIds.resize(mFrontendSize); + for (int i = 0; i < mFrontendSize; i++) { + frontendIds[i] = mFrontends[i]->getFrontendId(); + } + + _hidl_cb(Result::SUCCESS, frontendIds); + return Void(); +} + +Return<void> Tuner::openFrontendById(uint32_t frontendId, openFrontendById_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + if (frontendId >= mFrontendSize || frontendId < 0) { + ALOGW("[ WARN ] Frontend with id %d isn't available", frontendId); + _hidl_cb(Result::UNAVAILABLE, nullptr); + return Void(); + } + + _hidl_cb(Result::SUCCESS, mFrontends[frontendId]); + return Void(); +} + +Return<void> Tuner::openDemux(openDemux_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + uint32_t demuxId = mLastUsedId + 1; + mLastUsedId += 1; + sp<Demux> demux = new Demux(demuxId, this); + mDemuxes[demuxId] = demux; + + _hidl_cb(Result::SUCCESS, demuxId, demux); + return Void(); +} + +Return<void> Tuner::getDemuxCaps(getDemuxCaps_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + DemuxCapabilities caps; + + // IP filter can be an MMTP filter's data source. + caps.linkCaps = {0x00, 0x00, 0x02, 0x00, 0x00}; + _hidl_cb(Result::SUCCESS, caps); + return Void(); +} + +Return<void> Tuner::openDescrambler(openDescrambler_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + sp<V1_0::IDescrambler> descrambler = new Descrambler(); + + _hidl_cb(Result::SUCCESS, descrambler); + return Void(); +} + +Return<void> Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + FrontendInfo info; + if (frontendId >= mFrontendSize) { + _hidl_cb(Result::INVALID_ARGUMENT, info); + return Void(); + } + + vector<FrontendStatusType> statusCaps = { + FrontendStatusType::DEMOD_LOCK, + FrontendStatusType::SNR, + FrontendStatusType::FEC, + FrontendStatusType::MODULATION, + FrontendStatusType::PLP_ID, + FrontendStatusType::LAYER_ERROR, + FrontendStatusType::ATSC3_PLP_INFO, + }; + // assign randomly selected values for testing. + info = { + .type = mFrontends[frontendId]->getFrontendType(), + .minFrequency = 139, + .maxFrequency = 1139, + .minSymbolRate = 45, + .maxSymbolRate = 1145, + .acquireRange = 30, + .exclusiveGroupId = 57, + .statusCaps = statusCaps, + .frontendCaps = mFrontendCaps[frontendId], + }; + + _hidl_cb(Result::SUCCESS, info); + return Void(); +} + +Return<void> Tuner::getLnbIds(getLnbIds_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + vector<V1_0::LnbId> lnbIds; + lnbIds.resize(mLnbs.size()); + for (int i = 0; i < lnbIds.size(); i++) { + lnbIds[i] = mLnbs[i]->getId(); + } + + _hidl_cb(Result::SUCCESS, lnbIds); + return Void(); +} + +Return<void> Tuner::openLnbById(V1_0::LnbId lnbId, openLnbById_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + if (lnbId >= mLnbs.size()) { + _hidl_cb(Result::INVALID_ARGUMENT, nullptr); + return Void(); + } + + _hidl_cb(Result::SUCCESS, mLnbs[lnbId]); + return Void(); +} + +sp<Frontend> Tuner::getFrontendById(uint32_t frontendId) { + ALOGV("%s", __FUNCTION__); + + return mFrontends[frontendId]; +} + +Return<void> Tuner::openLnbByName(const hidl_string& /*lnbName*/, openLnbByName_cb _hidl_cb) { + ALOGV("%s", __FUNCTION__); + + sp<V1_0::ILnb> lnb = new Lnb(); + + _hidl_cb(Result::SUCCESS, 1234, lnb); + return Void(); +} + +void Tuner::setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId) { + mFrontendToDemux[frontendId] = demuxId; + if (mFrontends[frontendId] != nullptr && mFrontends[frontendId]->isLocked()) { + mDemuxes[demuxId]->startFrontendInputLoop(); + } +} + +void Tuner::removeDemux(uint32_t demuxId) { + map<uint32_t, uint32_t>::iterator it; + for (it = mFrontendToDemux.begin(); it != mFrontendToDemux.end();) { + if (it->second == demuxId) { + it = mFrontendToDemux.erase(it); + } else { + it++; + } + } + mDemuxes.erase(demuxId); +} + +void Tuner::removeFrontend(uint32_t frontendId) { + mFrontendToDemux.erase(frontendId); +} + +void Tuner::frontendStopTune(uint32_t frontendId) { + map<uint32_t, uint32_t>::iterator it = mFrontendToDemux.find(frontendId); + uint32_t demuxId; + if (it != mFrontendToDemux.end()) { + demuxId = it->second; + mDemuxes[demuxId]->stopFrontendInput(); + } +} + +void Tuner::frontendStartTune(uint32_t frontendId) { + map<uint32_t, uint32_t>::iterator it = mFrontendToDemux.find(frontendId); + uint32_t demuxId; + if (it != mFrontendToDemux.end()) { + demuxId = it->second; + mDemuxes[demuxId]->startFrontendInputLoop(); + } +} + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android diff --git a/tv/tuner/1.1/default/Tuner.h b/tv/tuner/1.1/default/Tuner.h new file mode 100644 index 0000000000..3b1574b8aa --- /dev/null +++ b/tv/tuner/1.1/default/Tuner.h @@ -0,0 +1,96 @@ +/* + * Copyright 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_TV_TUNER_V1_1_TUNER_H_ +#define ANDROID_HARDWARE_TV_TUNER_V1_1_TUNER_H_ + +#include <android/hardware/tv/tuner/1.1/ITuner.h> +#include <map> +#include "Demux.h" +#include "Frontend.h" +#include "Lnb.h" + +using namespace std; + +namespace android { +namespace hardware { +namespace tv { +namespace tuner { +namespace V1_0 { +namespace implementation { + +using ::android::hardware::tv::tuner::V1_1::ITuner; + +class Frontend; +class Demux; +class Lnb; + +class Tuner : public ITuner { + public: + Tuner(); + + virtual Return<void> getFrontendIds(getFrontendIds_cb _hidl_cb) override; + + virtual Return<void> openFrontendById(uint32_t frontendId, + openFrontendById_cb _hidl_cb) override; + + virtual Return<void> openDemux(openDemux_cb _hidl_cb) override; + + virtual Return<void> getDemuxCaps(getDemuxCaps_cb _hidl_cb) override; + + virtual Return<void> openDescrambler(openDescrambler_cb _hidl_cb) override; + + virtual Return<void> getFrontendInfo(uint32_t frontendId, getFrontendInfo_cb _hidl_cb) override; + + virtual Return<void> getLnbIds(getLnbIds_cb _hidl_cb) override; + + virtual Return<void> openLnbById(uint32_t lnbId, openLnbById_cb _hidl_cb) override; + + virtual Return<void> openLnbByName(const hidl_string& lnbName, + openLnbByName_cb _hidl_cb) override; + + sp<Frontend> getFrontendById(uint32_t frontendId); + + void setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId); + + void frontendStartTune(uint32_t frontendId); + void frontendStopTune(uint32_t frontendId); + void removeDemux(uint32_t demuxId); + void removeFrontend(uint32_t frontendId); + + private: + virtual ~Tuner(); + // Static mFrontends array to maintain local frontends information + map<uint32_t, sp<Frontend>> mFrontends; + map<uint32_t, FrontendInfo::FrontendCapabilities> mFrontendCaps; + map<uint32_t, uint32_t> mFrontendToDemux; + map<uint32_t, sp<Demux>> mDemuxes; + // To maintain how many Frontends we have + int mFrontendSize; + // The last used demux id. Initial value is -1. + // First used id will be 0. + uint32_t mLastUsedId = -1; + vector<sp<Lnb>> mLnbs; +}; + +} // namespace implementation +} // namespace V1_0 +} // namespace tuner +} // namespace tv +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_TUNER_H_ diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc new file mode 100644 index 0000000000..9e228f7d58 --- /dev/null +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc @@ -0,0 +1,9 @@ +service vendor.tuner-hal-1-1 /vendor/bin/hw/android.hardware.tv.tuner@1.1-service-lazy + interface android.hardware.tv.tuner@1.1::ITuner default + oneshot + disabled + class hal + user media + group mediadrm drmrpc + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks
\ No newline at end of file diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.xml b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.xml new file mode 100644 index 0000000000..86b044525f --- /dev/null +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.xml @@ -0,0 +1,11 @@ +<manifest version="1.0" type="device"> + <hal format="hidl"> + <name>android.hardware.tv.tuner</name> + <transport>hwbinder</transport> + <version>1.1</version> + <interface> + <name>ITuner</name> + <instance>default</instance> + </interface> + </hal> +</manifest>
\ No newline at end of file diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc new file mode 100644 index 0000000000..3718a9388f --- /dev/null +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc @@ -0,0 +1,6 @@ +service vendor.tuner-hal-1-1 /vendor/bin/hw/android.hardware.tv.tuner@1.1-service + class hal + user media + group mediadrm drmrpc + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks
\ No newline at end of file diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.xml b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.xml new file mode 100644 index 0000000000..86b044525f --- /dev/null +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.xml @@ -0,0 +1,11 @@ +<manifest version="1.0" type="device"> + <hal format="hidl"> + <name>android.hardware.tv.tuner</name> + <transport>hwbinder</transport> + <version>1.1</version> + <interface> + <name>ITuner</name> + <instance>default</instance> + </interface> + </hal> +</manifest>
\ No newline at end of file diff --git a/tv/tuner/1.1/default/service.cpp b/tv/tuner/1.1/default/service.cpp new file mode 100644 index 0000000000..232030850d --- /dev/null +++ b/tv/tuner/1.1/default/service.cpp @@ -0,0 +1,57 @@ +/* + * Copyright 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. + */ + +//#define LOG_NDEBUG 0 +#ifdef LAZY_SERVICE +#define LOG_TAG "android.hardware.tv.tuner@1.1-service-lazy" +#else +#define LOG_TAG "android.hardware.tv.tuner@1.1-service" +#endif + +#include <hidl/HidlTransportSupport.h> +#include <hidl/LegacySupport.h> + +#include "Tuner.h" + +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::hardware::LazyServiceRegistrar; +using android::hardware::tv::tuner::V1_0::implementation::Tuner; +using android::hardware::tv::tuner::V1_1::ITuner; + +#ifdef LAZY_SERVICE +const bool kLazyService = true; +#else +const bool kLazyService = false; +#endif + +int main() { + configureRpcThreadpool(8, true /* callerWillJoin */); + + // Setup hwbinder service + android::sp<ITuner> service = new Tuner(); + android::status_t status; + if (kLazyService) { + auto serviceRegistrar = LazyServiceRegistrar::getInstance(); + status = serviceRegistrar.registerService(service); + } else { + status = service->registerAsService(); + } + LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering tuner service: %d", status); + + joinRpcThreadpool(); + return 0; +} diff --git a/tv/tuner/1.1/vts/OWNERS b/tv/tuner/1.1/vts/OWNERS new file mode 100644 index 0000000000..1b3d095f9c --- /dev/null +++ b/tv/tuner/1.1/vts/OWNERS @@ -0,0 +1,4 @@ +nchalko@google.com +amyjojo@google.com +shubang@google.com +quxiangfang@google.com diff --git a/tv/tuner/1.1/vts/functional/Android.bp b/tv/tuner/1.1/vts/functional/Android.bp new file mode 100644 index 0000000000..7ab0f87119 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/Android.bp @@ -0,0 +1,48 @@ +// +// Copyright 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_test { + name: "VtsHalTvTunerV1_1TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "VtsHalTvTunerV1_1TargetTest.cpp", + "FrontendTests.cpp", + "DemuxTests.cpp", + "FilterTests.cpp", + ], + static_libs: [ + "android.hardware.cas@1.0", + "android.hardware.cas@1.1", + "android.hardware.cas@1.2", + "android.hardware.tv.tuner@1.0", + "android.hardware.tv.tuner@1.1", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "libhidlallocatorutils", + "libhidlmemory", + "libcutils", + "libfmq", + ], + shared_libs: [ + "libbinder", + ], + test_suites: [ + "general-tests", + "vts", + ], + + require_root: true, +} diff --git a/tv/tuner/1.1/vts/functional/DemuxTests.cpp b/tv/tuner/1.1/vts/functional/DemuxTests.cpp new file mode 100644 index 0000000000..e0600b62a1 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/DemuxTests.cpp @@ -0,0 +1,71 @@ +/* + * Copyright 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 "DemuxTests.h" + +AssertionResult DemuxTests::openDemux(sp<IDemux>& demux, uint32_t& demuxId) { + Result status; + mService->openDemux([&](Result result, uint32_t id, const sp<IDemux>& demuxSp) { + mDemux = demuxSp; + demux = demuxSp; + demuxId = id; + status = result; + }); + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult DemuxTests::setDemuxFrontendDataSource(uint32_t frontendId) { + EXPECT_TRUE(mDemux) << "Test with openDemux first."; + auto status = mDemux->setFrontendDataSource(frontendId); + return AssertionResult(status.isOk()); +} + +AssertionResult DemuxTests::closeDemux() { + EXPECT_TRUE(mDemux) << "Test with openDemux first."; + auto status = mDemux->close(); + mDemux = nullptr; + return AssertionResult(status.isOk()); +} + +AssertionResult DemuxTests::getAvSyncId_64bit(sp<IFilter> filter, uint64_t& avSyncHwId) { + EXPECT_TRUE(mDemux) << "Demux is not opened yet."; + Result status; + + sp<android::hardware::tv::tuner::V1_1::IDemux> demux_v1_1 = + android::hardware::tv::tuner::V1_1::IDemux::castFrom(mDemux); + if (demux_v1_1 != NULL) { + demux_v1_1->getAvSyncHwId64Bit(filter, [&](Result result, uint64_t id) { + status = result; + avSyncHwId = id; + }); + } else { + ALOGW("[vts] Can't cast IDemux into v1_1."); + return failure(); + } + + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult DemuxTests::getAvSyncTime(uint32_t avSyncId) { + EXPECT_TRUE(mDemux) << "Demux is not opened yet."; + Result status; + uint64_t syncTime; + mDemux->getAvSyncTime(avSyncId, [&](Result result, uint64_t time) { + status = result; + syncTime = time; + }); + return AssertionResult(status == Result::SUCCESS); +}
\ No newline at end of file diff --git a/tv/tuner/1.1/vts/functional/DemuxTests.h b/tv/tuner/1.1/vts/functional/DemuxTests.h new file mode 100644 index 0000000000..393757c3b6 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/DemuxTests.h @@ -0,0 +1,59 @@ +/* + * Copyright 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 <android-base/logging.h> +#include <android/hardware/tv/tuner/1.0/IDemux.h> +#include <android/hardware/tv/tuner/1.0/types.h> +#include <android/hardware/tv/tuner/1.1/IDemux.h> +#include <android/hardware/tv/tuner/1.1/IFilter.h> +#include <android/hardware/tv/tuner/1.1/ITuner.h> +#include <binder/MemoryDealer.h> +#include <gtest/gtest.h> +#include <hidl/ServiceManagement.h> +#include <hidl/Status.h> +#include <hidlmemory/FrameworkUtils.h> +#include <utils/Condition.h> +#include <utils/Mutex.h> +#include <map> + +using android::sp; +using android::hardware::Return; +using android::hardware::Void; +using android::hardware::tv::tuner::V1_0::IDemux; +using android::hardware::tv::tuner::V1_0::IFilter; +using android::hardware::tv::tuner::V1_0::Result; +using android::hardware::tv::tuner::V1_1::ITuner; + +using ::testing::AssertionResult; + +class DemuxTests { + public: + void setService(sp<ITuner> tuner) { mService = tuner; } + + AssertionResult openDemux(sp<IDemux>& demux, uint32_t& demuxId); + AssertionResult setDemuxFrontendDataSource(uint32_t frontendId); + AssertionResult getAvSyncId_64bit(sp<IFilter> filter, uint64_t& avSyncHwId); + AssertionResult getAvSyncTime(uint32_t avSyncId); + AssertionResult closeDemux(); + + protected: + static AssertionResult failure() { return ::testing::AssertionFailure(); } + + static AssertionResult success() { return ::testing::AssertionSuccess(); } + + sp<ITuner> mService; + sp<IDemux> mDemux; +}; diff --git a/tv/tuner/1.1/vts/functional/FilterTests.cpp b/tv/tuner/1.1/vts/functional/FilterTests.cpp new file mode 100644 index 0000000000..fb0c1a5cc8 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/FilterTests.cpp @@ -0,0 +1,111 @@ +/* + * Copyright 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 "FilterTests.h" + +AssertionResult FilterTests::openFilterInDemux(DemuxFilterType type, uint32_t bufferSize) { + Result status; + EXPECT_TRUE(mDemux) << "Test with openDemux first."; + + // Create demux callback + mFilterCallback = new FilterCallback(); + + // Add filter to the local demux + mDemux->openFilter(type, bufferSize, mFilterCallback, + [&](Result result, const sp<IFilter>& filter) { + mFilter = filter; + status = result; + }); + + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FilterTests::getNewlyOpenedFilterId_64bit(uint64_t& filterId) { + Result status; + EXPECT_TRUE(mDemux) << "Test with openDemux first."; + EXPECT_TRUE(mFilter) << "Test with openFilterInDemux first."; + EXPECT_TRUE(mFilterCallback) << "Test with openFilterInDemux first."; + + sp<android::hardware::tv::tuner::V1_1::IFilter> filter_v1_1 = + android::hardware::tv::tuner::V1_1::IFilter::castFrom(mFilter); + if (filter_v1_1 != NULL) { + filter_v1_1->getId64Bit([&](Result result, uint64_t filterId) { + mFilterId = filterId; + status = result; + }); + } else { + ALOGW("[vts] Can't cast IFilter into v1_1."); + return failure(); + } + + if (status == Result::SUCCESS) { + mUsedFilterIds.insert(mUsedFilterIds.end(), mFilterId); + mFilters[mFilterId] = mFilter; + mFilterCallbacks[mFilterId] = mFilterCallback; + filterId = mFilterId; + } + + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FilterTests::configFilter(DemuxFilterSettings setting, uint64_t filterId) { + Result status; + EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; + status = mFilters[filterId]->configure(setting); + + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FilterTests::getFilterMQDescriptor(uint64_t filterId) { + Result status; + EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; + EXPECT_TRUE(mFilterCallbacks[filterId]) << "Test with getNewlyOpenedFilterId first."; + + mFilter->getQueueDesc([&](Result result, const MQDesc& filterMQDesc) { + mFilterMQDescriptor = filterMQDesc; + status = result; + }); + + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FilterTests::startFilter(uint64_t filterId) { + EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; + Result status = mFilters[filterId]->start(); + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FilterTests::stopFilter(uint64_t filterId) { + EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; + Result status = mFilters[filterId]->stop(); + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FilterTests::closeFilter(uint64_t filterId) { + EXPECT_TRUE(mFilters[filterId]) << "Test with getNewlyOpenedFilterId first."; + Result status = mFilters[filterId]->close(); + if (status == Result::SUCCESS) { + for (int i = 0; i < mUsedFilterIds.size(); i++) { + if (mUsedFilterIds[i] == filterId) { + mUsedFilterIds.erase(mUsedFilterIds.begin() + i); + break; + } + } + mFilterCallbacks.erase(filterId); + mFilters.erase(filterId); + } + return AssertionResult(status == Result::SUCCESS); +} diff --git a/tv/tuner/1.1/vts/functional/FilterTests.h b/tv/tuner/1.1/vts/functional/FilterTests.h new file mode 100644 index 0000000000..b1b6e13759 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/FilterTests.h @@ -0,0 +1,168 @@ +/* + * Copyright 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 <android-base/logging.h> +#include <android/hardware/tv/tuner/1.0/IDemux.h> +#include <android/hardware/tv/tuner/1.0/IFilter.h> +#include <android/hardware/tv/tuner/1.0/IFilterCallback.h> +#include <android/hardware/tv/tuner/1.0/types.h> +#include <android/hardware/tv/tuner/1.1/IFilter.h> +#include <android/hardware/tv/tuner/1.1/ITuner.h> +#include <fmq/MessageQueue.h> +#include <gtest/gtest.h> +#include <hidl/HidlSupport.h> +#include <hidl/HidlTransportSupport.h> +#include <hidl/Status.h> +#include <inttypes.h> +#include <utils/Condition.h> +#include <utils/Mutex.h> +#include <map> + +using android::Condition; +using android::Mutex; +using android::sp; +using android::hardware::EventFlag; +using android::hardware::hidl_handle; +using android::hardware::hidl_string; +using android::hardware::hidl_vec; +using android::hardware::kSynchronizedReadWrite; +using android::hardware::MessageQueue; +using android::hardware::MQDescriptorSync; +using android::hardware::Return; +using android::hardware::Void; +using android::hardware::tv::tuner::V1_0::DemuxFilterEvent; +using android::hardware::tv::tuner::V1_0::DemuxFilterMainType; +using android::hardware::tv::tuner::V1_0::DemuxFilterSettings; +using android::hardware::tv::tuner::V1_0::DemuxFilterStatus; +using android::hardware::tv::tuner::V1_0::DemuxFilterType; +using android::hardware::tv::tuner::V1_0::DemuxTsFilterType; +using android::hardware::tv::tuner::V1_0::IDemux; +using android::hardware::tv::tuner::V1_0::IFilter; +using android::hardware::tv::tuner::V1_0::IFilterCallback; +using android::hardware::tv::tuner::V1_0::Result; +using android::hardware::tv::tuner::V1_1::ITuner; + +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>; + +#define WAIT_TIMEOUT 3000000000 + +class FilterCallback : public IFilterCallback { + public: + virtual Return<void> onFilterEvent(const DemuxFilterEvent& /*filterEvent*/) override { + return Void(); + } + + virtual Return<void> onFilterStatus(const DemuxFilterStatus /*status*/) override { + return Void(); + } +}; + +class FilterTests { + public: + void setService(sp<ITuner> tuner) { mService = tuner; } + void setDemux(sp<IDemux> demux) { mDemux = demux; } + sp<IFilter> getFilterById(uint64_t filterId) { return mFilters[filterId]; } + + std::map<uint64_t, sp<FilterCallback>> getFilterCallbacks() { return mFilterCallbacks; } + + AssertionResult openFilterInDemux(DemuxFilterType type, uint32_t bufferSize); + AssertionResult getNewlyOpenedFilterId_64bit(uint64_t& filterId); + AssertionResult configFilter(DemuxFilterSettings setting, uint64_t filterId); + AssertionResult getFilterMQDescriptor(uint64_t filterId); + AssertionResult startFilter(uint64_t filterId); + AssertionResult stopFilter(uint64_t filterId); + AssertionResult closeFilter(uint64_t filterId); + + 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(); } + + static AssertionResult success() { return ::testing::AssertionSuccess(); } + + sp<ITuner> mService; + sp<IFilter> mFilter; + sp<IDemux> mDemux; + std::map<uint64_t, sp<IFilter>> mFilters; + std::map<uint64_t, sp<FilterCallback>> mFilterCallbacks; + + sp<FilterCallback> mFilterCallback; + MQDesc mFilterMQDescriptor; + vector<uint64_t> mUsedFilterIds; + + uint64_t mFilterId = -1; +}; diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.cpp b/tv/tuner/1.1/vts/functional/FrontendTests.cpp new file mode 100644 index 0000000000..8c359c51a6 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/FrontendTests.cpp @@ -0,0 +1,83 @@ +/* + * Copyright 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 "FrontendTests.h" + +Return<void> FrontendCallback::onEvent(FrontendEventType /*frontendEventType*/) { + return Void(); +} + +Return<void> FrontendCallback::onScanMessage(FrontendScanMessageType /*type*/, + const FrontendScanMessage& /*message*/) { + return Void(); +} + +AssertionResult FrontendTests::getFrontendIds() { + Result status; + mService->getFrontendIds([&](Result result, const hidl_vec<FrontendId>& frontendIds) { + status = result; + mFeIds = frontendIds; + }); + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FrontendTests::getFrontendInfo(uint32_t frontendId) { + Result status; + mService->getFrontendInfo(frontendId, [&](Result result, const FrontendInfo& frontendInfo) { + mFrontendInfo = frontendInfo; + status = result; + }); + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FrontendTests::openFrontendById(uint32_t frontendId) { + Result status; + mService->openFrontendById(frontendId, [&](Result result, const sp<IFrontend>& frontend) { + mFrontend = frontend; + status = result; + }); + return AssertionResult(status == Result::SUCCESS); +} + +AssertionResult FrontendTests::setFrontendCallback() { + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; + mFrontendCallback = new FrontendCallback(); + auto callbackStatus = mFrontend->setCallback(mFrontendCallback); + return AssertionResult(callbackStatus.isOk()); +} + +AssertionResult FrontendTests::closeFrontend() { + EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; + Result status; + status = mFrontend->close(); + mFrontend = nullptr; + mFrontendCallback = nullptr; + return AssertionResult(status == Result::SUCCESS); +} + +void FrontendTests::getFrontendIdByType(FrontendType feType, uint32_t& feId) { + ASSERT_TRUE(getFrontendIds()); + ASSERT_TRUE(mFeIds.size() > 0); + for (size_t i = 0; i < mFeIds.size(); i++) { + ASSERT_TRUE(getFrontendInfo(mFeIds[i])); + if (mFrontendInfo.type != feType) { + continue; + } + feId = mFeIds[i]; + return; + } + feId = INVALID_ID; +}
\ No newline at end of file diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.h b/tv/tuner/1.1/vts/functional/FrontendTests.h new file mode 100644 index 0000000000..e68758919d --- /dev/null +++ b/tv/tuner/1.1/vts/functional/FrontendTests.h @@ -0,0 +1,96 @@ +/* + * Copyright 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 <android-base/logging.h> +#include <android/hardware/tv/tuner/1.0/IFrontend.h> +#include <android/hardware/tv/tuner/1.0/IFrontendCallback.h> +#include <android/hardware/tv/tuner/1.0/types.h> +#include <android/hardware/tv/tuner/1.1/ITuner.h> +#include <binder/MemoryDealer.h> +#include <gtest/gtest.h> +#include <hidl/GtestPrinter.h> +#include <hidl/HidlSupport.h> +#include <hidl/HidlTransportSupport.h> +#include <hidl/ServiceManagement.h> +#include <hidl/Status.h> +#include <hidlmemory/FrameworkUtils.h> +#include <utils/Condition.h> +#include <utils/Mutex.h> +#include <map> + +#include "VtsHalTvTunerV1_1TestConfigurations.h" + +#define WAIT_TIMEOUT 3000000000 +#define INVALID_ID -1 + +using android::Condition; +using android::IMemory; +using android::IMemoryHeap; +using android::MemoryDealer; +using android::Mutex; +using android::sp; +using android::hardware::fromHeap; +using android::hardware::hidl_vec; +using android::hardware::Return; +using android::hardware::Void; +using android::hardware::tv::tuner::V1_0::FrontendEventType; +using android::hardware::tv::tuner::V1_0::FrontendId; +using android::hardware::tv::tuner::V1_0::FrontendInfo; +using android::hardware::tv::tuner::V1_0::FrontendScanMessage; +using android::hardware::tv::tuner::V1_0::FrontendScanMessageType; +using android::hardware::tv::tuner::V1_0::IFrontend; +using android::hardware::tv::tuner::V1_0::IFrontendCallback; +using android::hardware::tv::tuner::V1_0::Result; +using android::hardware::tv::tuner::V1_1::ITuner; + +using ::testing::AssertionResult; + +using namespace std; + +#define INVALID_ID -1 + +class FrontendCallback : public IFrontendCallback { + public: + virtual Return<void> onEvent(FrontendEventType frontendEventType) override; + virtual Return<void> onScanMessage(FrontendScanMessageType type, + const FrontendScanMessage& message) override; +}; + +class FrontendTests { + public: + sp<ITuner> mService; + + void setService(sp<ITuner> tuner) { mService = tuner; } + + AssertionResult getFrontendIds(); + AssertionResult getFrontendInfo(uint32_t frontendId); + AssertionResult openFrontendById(uint32_t frontendId); + AssertionResult setFrontendCallback(); + AssertionResult closeFrontend(); + + void getFrontendIdByType(FrontendType feType, uint32_t& feId); + + protected: + static AssertionResult failure() { return ::testing::AssertionFailure(); } + static AssertionResult success() { return ::testing::AssertionSuccess(); } + + sp<IFrontend> mFrontend; + FrontendInfo mFrontendInfo; + sp<FrontendCallback> mFrontendCallback; + hidl_vec<FrontendId> mFeIds; + + bool mIsSoftwareFe = false; +};
\ No newline at end of file diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp new file mode 100644 index 0000000000..c74e29c002 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.cpp @@ -0,0 +1,99 @@ +/* + * Copyright 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 "VtsHalTvTunerV1_1TargetTest.h" + +namespace { + +void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf, + FrontendConfig frontendConf) { + uint32_t feId; + uint32_t demuxId; + sp<IDemux> demux; + uint64_t filterId; + + mFrontendTests.getFrontendIdByType(frontendConf.type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + mFilterTests.setDemux(demux); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterConf.type, filterConf.bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(filterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId)); + ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId)); + ASSERT_TRUE(mFilterTests.startFilter(filterId)); + ASSERT_TRUE(mFilterTests.stopFilter(filterId)); + ASSERT_TRUE(mFilterTests.closeFilter(filterId)); + ASSERT_TRUE(mDemuxTests.closeDemux()); + ASSERT_TRUE(mFrontendTests.closeFrontend()); +} + +TEST_P(TunerDemuxHidlTest, getAvSyncTime) { + description("Get the A/V sync time from a PCR filter."); + uint32_t feId; + uint32_t demuxId; + sp<IDemux> demux; + uint64_t mediaFilterId; + uint64_t pcrFilterId; + uint64_t avSyncHwId; + sp<IFilter> mediaFilter; + + mFrontendTests.getFrontendIdByType(frontendArray[DVBT].type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + mFilterTests.setDemux(demux); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_VIDEO1].type, + filterArray[TS_VIDEO1].bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(mediaFilterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_VIDEO1].settings, mediaFilterId)); + mediaFilter = mFilterTests.getFilterById(mediaFilterId); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterArray[TS_PCR0].type, + filterArray[TS_PCR0].bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(pcrFilterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterArray[TS_PCR0].settings, pcrFilterId)); + ASSERT_TRUE(mDemuxTests.getAvSyncId_64bit(mediaFilter, avSyncHwId)); + ASSERT_TRUE(pcrFilterId == avSyncHwId); + ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId)); + ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId)); + ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId)); + ASSERT_TRUE(mDemuxTests.closeDemux()); + ASSERT_TRUE(mFrontendTests.closeFrontend()); +} + +TEST_P(TunerFilterHidlTest, StartFilterInDemux) { + description("Open and start a filter in Demux."); + // TODO use parameterized tests + configSingleFilterInDemuxTest(filterArray[TS_VIDEO0], frontendArray[DVBT]); +} + +INSTANTIATE_TEST_SUITE_P( + PerInstance, TunerFilterHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)), + android::hardware::PrintInstanceNameToString); + +INSTANTIATE_TEST_SUITE_P( + PerInstance, TunerDemuxHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames(ITuner::descriptor)), + android::hardware::PrintInstanceNameToString); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerFilterHidlTest); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerDemuxHidlTest); +} // namespace diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h new file mode 100644 index 0000000000..30533b1310 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TargetTest.h @@ -0,0 +1,75 @@ +/* + * Copyright 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 "DemuxTests.h" +#include "FilterTests.h" +#include "FrontendTests.h" + +namespace { + +void initConfiguration() { + initFrontendConfig(); + initFilterConfig(); +} + +class TunerFilterHidlTest : public testing::TestWithParam<std::string> { + public: + virtual void SetUp() override { + mService = ITuner::getService(GetParam()); + ASSERT_NE(mService, nullptr); + initConfiguration(); + + mFrontendTests.setService(mService); + mDemuxTests.setService(mService); + mFilterTests.setService(mService); + } + + protected: + static void description(const std::string& description) { + RecordProperty("description", description); + } + + void configSingleFilterInDemuxTest(FilterConfig filterConf, FrontendConfig frontendConf); + + sp<ITuner> mService; + FrontendTests mFrontendTests; + DemuxTests mDemuxTests; + FilterTests mFilterTests; +}; + +class TunerDemuxHidlTest : public testing::TestWithParam<std::string> { + public: + virtual void SetUp() override { + mService = ITuner::getService(GetParam()); + ASSERT_NE(mService, nullptr); + initConfiguration(); + + mFrontendTests.setService(mService); + mDemuxTests.setService(mService); + mFilterTests.setService(mService); + } + + protected: + static void description(const std::string& description) { + RecordProperty("description", description); + } + + sp<ITuner> mService; + FrontendTests mFrontendTests; + DemuxTests mDemuxTests; + FilterTests mFilterTests; +}; +} // namespace
\ No newline at end of file diff --git a/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h new file mode 100644 index 0000000000..23c9353d03 --- /dev/null +++ b/tv/tuner/1.1/vts/functional/VtsHalTvTunerV1_1TestConfigurations.h @@ -0,0 +1,178 @@ +/* + * Copyright 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 <android/hardware/tv/tuner/1.0/types.h> +#include <binder/MemoryDealer.h> +#include <hidl/HidlSupport.h> +#include <hidl/HidlTransportSupport.h> +#include <hidl/Status.h> +#include <hidlmemory/FrameworkUtils.h> + +using android::hardware::tv::tuner::V1_0::DemuxAlpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxFilterEvent; +using android::hardware::tv::tuner::V1_0::DemuxFilterMainType; +using android::hardware::tv::tuner::V1_0::DemuxFilterSettings; +using android::hardware::tv::tuner::V1_0::DemuxFilterType; +using android::hardware::tv::tuner::V1_0::DemuxIpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxMmtpFilterType; +using android::hardware::tv::tuner::V1_0::DemuxRecordScIndexType; +using android::hardware::tv::tuner::V1_0::DemuxTsFilterType; +using android::hardware::tv::tuner::V1_0::FrontendDvbtBandwidth; +using android::hardware::tv::tuner::V1_0::FrontendDvbtCoderate; +using android::hardware::tv::tuner::V1_0::FrontendDvbtConstellation; +using android::hardware::tv::tuner::V1_0::FrontendDvbtGuardInterval; +using android::hardware::tv::tuner::V1_0::FrontendDvbtHierarchy; +using android::hardware::tv::tuner::V1_0::FrontendDvbtSettings; +using android::hardware::tv::tuner::V1_0::FrontendDvbtStandard; +using android::hardware::tv::tuner::V1_0::FrontendDvbtTransmissionMode; +using android::hardware::tv::tuner::V1_0::FrontendSettings; +using android::hardware::tv::tuner::V1_0::FrontendStatus; +using android::hardware::tv::tuner::V1_0::FrontendStatusType; +using android::hardware::tv::tuner::V1_0::FrontendType; + +using namespace std; + +const uint32_t FMQ_SIZE_1M = 0x100000; +const uint32_t FMQ_SIZE_4M = 0x400000; +const uint32_t FMQ_SIZE_16M = 0x1000000; + +typedef enum { + TS_VIDEO0, + TS_VIDEO1, + TS_AUDIO0, + TS_AUDIO1, + TS_PES0, + TS_PCR0, + TS_SECTION0, + TS_TS0, + TS_RECORD0, + FILTER_MAX, +} Filter; + +typedef enum { + DVBT, + DVBS, + FRONTEND_MAX, +} Frontend; + +struct FilterConfig { + uint32_t bufferSize; + DemuxFilterType type; + DemuxFilterSettings settings; + + bool operator<(const FilterConfig& /*c*/) const { return false; } +}; + +struct FrontendConfig { + bool isSoftwareFe; + FrontendType type; + FrontendSettings settings; + vector<FrontendStatusType> tuneStatusTypes; + vector<FrontendStatus> expectTuneStatuses; +}; + +static FrontendConfig frontendArray[FILTER_MAX]; +static FilterConfig filterArray[FILTER_MAX]; + +/** Configuration array for the frontend tune test */ +inline void initFrontendConfig() { + FrontendDvbtSettings dvbtSettings{ + .frequency = 578000, + .transmissionMode = FrontendDvbtTransmissionMode::AUTO, + .bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ, + .constellation = FrontendDvbtConstellation::AUTO, + .hierarchy = FrontendDvbtHierarchy::AUTO, + .hpCoderate = FrontendDvbtCoderate::AUTO, + .lpCoderate = FrontendDvbtCoderate::AUTO, + .guardInterval = FrontendDvbtGuardInterval::AUTO, + .isHighPriority = true, + .standard = FrontendDvbtStandard::T, + }; + frontendArray[DVBT].type = FrontendType::DVBT, frontendArray[DVBT].settings.dvbt(dvbtSettings); + vector<FrontendStatusType> types; + types.push_back(FrontendStatusType::DEMOD_LOCK); + FrontendStatus status; + status.isDemodLocked(true); + vector<FrontendStatus> statuses; + statuses.push_back(status); + frontendArray[DVBT].tuneStatusTypes = types; + frontendArray[DVBT].expectTuneStatuses = statuses; + frontendArray[DVBT].isSoftwareFe = true; + frontendArray[DVBS].type = FrontendType::DVBS; + frontendArray[DVBS].isSoftwareFe = true; +}; + +/** Configuration array for the filter test */ +inline void initFilterConfig() { + // TS VIDEO filter setting for default implementation testing + filterArray[TS_VIDEO0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_VIDEO0].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); + filterArray[TS_VIDEO0].bufferSize = FMQ_SIZE_16M; + filterArray[TS_VIDEO0].settings.ts().tpid = 256; + filterArray[TS_VIDEO0].settings.ts().filterSettings.av({.isPassthrough = false}); + filterArray[TS_VIDEO1].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_VIDEO1].type.subType.tsFilterType(DemuxTsFilterType::VIDEO); + filterArray[TS_VIDEO1].bufferSize = FMQ_SIZE_16M; + filterArray[TS_VIDEO1].settings.ts().tpid = 256; + filterArray[TS_VIDEO1].settings.ts().filterSettings.av({.isPassthrough = false}); + // TS AUDIO filter setting + filterArray[TS_AUDIO0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_AUDIO0].type.subType.tsFilterType(DemuxTsFilterType::AUDIO); + filterArray[TS_AUDIO0].bufferSize = FMQ_SIZE_16M; + filterArray[TS_AUDIO0].settings.ts().tpid = 256; + filterArray[TS_AUDIO0].settings.ts().filterSettings.av({.isPassthrough = false}); + filterArray[TS_AUDIO1].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_AUDIO1].type.subType.tsFilterType(DemuxTsFilterType::AUDIO); + filterArray[TS_AUDIO1].bufferSize = FMQ_SIZE_16M; + filterArray[TS_AUDIO1].settings.ts().tpid = 257; + filterArray[TS_AUDIO1].settings.ts().filterSettings.av({.isPassthrough = false}); + // TS PES filter setting + filterArray[TS_PES0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_PES0].type.subType.tsFilterType(DemuxTsFilterType::PES); + filterArray[TS_PES0].bufferSize = FMQ_SIZE_16M; + filterArray[TS_PES0].settings.ts().tpid = 256; + filterArray[TS_PES0].settings.ts().filterSettings.pesData({ + .isRaw = false, + .streamId = 0xbd, + }); + // TS PCR filter setting + filterArray[TS_PCR0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_PCR0].type.subType.tsFilterType(DemuxTsFilterType::PCR); + filterArray[TS_PCR0].bufferSize = FMQ_SIZE_16M; + filterArray[TS_PCR0].settings.ts().tpid = 256; + filterArray[TS_PCR0].settings.ts().filterSettings.noinit(); + // TS filter setting + filterArray[TS_TS0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_TS0].type.subType.tsFilterType(DemuxTsFilterType::TS); + filterArray[TS_TS0].bufferSize = FMQ_SIZE_16M; + filterArray[TS_TS0].settings.ts().tpid = 256; + filterArray[TS_TS0].settings.ts().filterSettings.noinit(); + // TS SECTION filter setting + filterArray[TS_SECTION0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_SECTION0].type.subType.tsFilterType(DemuxTsFilterType::SECTION); + filterArray[TS_SECTION0].bufferSize = FMQ_SIZE_16M; + filterArray[TS_SECTION0].settings.ts().tpid = 256; + filterArray[TS_SECTION0].settings.ts().filterSettings.section({ + .isRaw = false, + }); + // TS RECORD filter setting + filterArray[TS_RECORD0].type.mainType = DemuxFilterMainType::TS; + filterArray[TS_RECORD0].type.subType.tsFilterType(DemuxTsFilterType::RECORD); + filterArray[TS_RECORD0].settings.ts().tpid = 81; + filterArray[TS_RECORD0].settings.ts().filterSettings.record({ + .scIndexType = DemuxRecordScIndexType::NONE, + }); +}; diff --git a/usb/1.0/Android.bp b/usb/1.0/Android.bp index c0e883fd19..607d1aca79 100644 --- a/usb/1.0/Android.bp +++ b/usb/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.usb@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IUsb.hal", diff --git a/usb/1.1/Android.bp b/usb/1.1/Android.bp index 6f2abae27c..8742e77c57 100644 --- a/usb/1.1/Android.bp +++ b/usb/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.usb@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IUsb.hal", diff --git a/usb/1.2/Android.bp b/usb/1.2/Android.bp index b3ba81f1cf..8b9f0fb609 100644 --- a/usb/1.2/Android.bp +++ b/usb/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.usb@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IUsb.hal", diff --git a/usb/gadget/1.0/Android.bp b/usb/gadget/1.0/Android.bp index 4921abff76..21f152c36c 100644 --- a/usb/gadget/1.0/Android.bp +++ b/usb/gadget/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.usb.gadget@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IUsbGadget.hal", diff --git a/usb/gadget/1.1/Android.bp b/usb/gadget/1.1/Android.bp index b41eb9cbc5..e5100697cc 100644 --- a/usb/gadget/1.1/Android.bp +++ b/usb/gadget/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.usb.gadget@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IUsbGadget.hal", ], diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp index 792e130ee0..d6321fb163 100644 --- a/vibrator/1.0/Android.bp +++ b/vibrator/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.vibrator@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IVibrator.hal", diff --git a/vibrator/1.1/Android.bp b/vibrator/1.1/Android.bp index 0d04a870d8..0302220b56 100644 --- a/vibrator/1.1/Android.bp +++ b/vibrator/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.vibrator@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IVibrator.hal", diff --git a/vibrator/1.2/Android.bp b/vibrator/1.2/Android.bp index 290a0cfa43..1fa01144fa 100644 --- a/vibrator/1.2/Android.bp +++ b/vibrator/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.vibrator@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IVibrator.hal", diff --git a/vibrator/1.3/Android.bp b/vibrator/1.3/Android.bp index 357ea9a3e1..d742388879 100644 --- a/vibrator/1.3/Android.bp +++ b/vibrator/1.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.vibrator@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IVibrator.hal", diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp index b359100d1a..c446afdea8 100644 --- a/vibrator/aidl/default/Vibrator.cpp +++ b/vibrator/aidl/default/Vibrator.cpp @@ -163,6 +163,10 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi } LOG(INFO) << "triggering primitive " << static_cast<int>(e.primitive) << " @ scale " << e.scale; + + int32_t durationMs; + getPrimitiveDuration(e.primitive, &durationMs); + usleep(durationMs * 1000); } if (callback != nullptr) { diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp index 8340517de6..c539865218 100644 --- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp +++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp @@ -34,6 +34,7 @@ using android::hardware::vibrator::CompositePrimitive; using android::hardware::vibrator::Effect; using android::hardware::vibrator::EffectStrength; using android::hardware::vibrator::IVibrator; +using std::chrono::high_resolution_clock; const std::vector<Effect> kEffects{android::enum_range<Effect>().begin(), android::enum_range<Effect>().end()}; @@ -442,26 +443,52 @@ TEST_P(VibratorAidl, ComposeSizeBoundary) { } TEST_P(VibratorAidl, ComposeCallback) { + constexpr std::chrono::milliseconds allowedLatency{10}; + if (capabilities & IVibrator::CAP_COMPOSE_EFFECTS) { - std::promise<void> completionPromise; - std::future<void> completionFuture{completionPromise.get_future()}; - sp<CompletionCallback> callback = - new CompletionCallback([&completionPromise] { completionPromise.set_value(); }); - CompositePrimitive primitive = CompositePrimitive::CLICK; - CompositeEffect effect; - std::vector<CompositeEffect> composite; - int32_t duration; + std::vector<CompositePrimitive> supported; - effect.delayMs = 0; - effect.primitive = primitive; - effect.scale = 1.0f; - composite.emplace_back(effect); + ASSERT_TRUE(vibrator->getSupportedPrimitives(&supported).isOk()); + + for (auto primitive : supported) { + if (primitive == CompositePrimitive::NOOP) { + continue; + } + + std::promise<void> completionPromise; + std::future<void> completionFuture{completionPromise.get_future()}; + sp<CompletionCallback> callback = + new CompletionCallback([&completionPromise] { completionPromise.set_value(); }); + CompositeEffect effect; + std::vector<CompositeEffect> composite; + int32_t durationMs; + std::chrono::milliseconds duration; + std::chrono::time_point<high_resolution_clock> start, end; + std::chrono::milliseconds elapsed; + + effect.delayMs = 0; + effect.primitive = primitive; + effect.scale = 1.0f; + composite.emplace_back(effect); + + EXPECT_EQ(Status::EX_NONE, + vibrator->getPrimitiveDuration(primitive, &durationMs).exceptionCode()) + << toString(primitive); + duration = std::chrono::milliseconds(durationMs); - EXPECT_EQ(Status::EX_NONE, - vibrator->getPrimitiveDuration(primitive, &duration).exceptionCode()); - EXPECT_EQ(Status::EX_NONE, vibrator->compose(composite, callback).exceptionCode()); - EXPECT_EQ(completionFuture.wait_for(std::chrono::milliseconds(duration * 2)), - std::future_status::ready); + EXPECT_EQ(Status::EX_NONE, vibrator->compose(composite, callback).exceptionCode()) + << toString(primitive); + start = high_resolution_clock::now(); + + EXPECT_EQ(completionFuture.wait_for(duration + allowedLatency), + std::future_status::ready) + << toString(primitive); + end = high_resolution_clock::now(); + + elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); + EXPECT_LE(elapsed.count(), (duration + allowedLatency).count()) << toString(primitive); + EXPECT_GE(elapsed.count(), (duration - allowedLatency).count()) << toString(primitive); + } } } diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp index f91f874f14..769ee3b4a3 100644 --- a/vr/1.0/Android.bp +++ b/vr/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.vr@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IVr.hal", ], diff --git a/weaver/1.0/Android.bp b/weaver/1.0/Android.bp index 7d5b8fe883..11fc68560a 100644 --- a/weaver/1.0/Android.bp +++ b/weaver/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.weaver@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IWeaver.hal", diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp index 958ff3f2bf..c41864f853 100644 --- a/wifi/1.0/Android.bp +++ b/wifi/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IWifi.hal", diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp index 3ff33a564b..5b11dd3fc4 100644 --- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp +++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp @@ -89,8 +89,12 @@ bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip, } } // namespace +sp<IWifi> getWifi(const std::string& instance_name) { + return IWifi::getService(instance_name); +} + sp<IWifiChip> getWifiChip(const std::string& instance_name) { - sp<IWifi> wifi = IWifi::getService(instance_name); + sp<IWifi> wifi = getWifi(instance_name); if (!wifi.get()) { return nullptr; } diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h index d22ed77cd9..5c7863740d 100644 --- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h +++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h @@ -31,6 +31,8 @@ // Note: We only have a single instance of each of these objects currently. // These helper functions should be modified to return vectors if we support // multiple instances. +android::sp<android::hardware::wifi::V1_0::IWifi> getWifi( + const std::string& instance_name); android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip( const std::string& instance_name); android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface( diff --git a/wifi/1.1/Android.bp b/wifi/1.1/Android.bp index a34ac44218..4068b31fbb 100644 --- a/wifi/1.1/Android.bp +++ b/wifi/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IWifi.hal", "IWifiChip.hal", diff --git a/wifi/1.2/Android.bp b/wifi/1.2/Android.bp index c28d09bd77..5812b8268a 100644 --- a/wifi/1.2/Android.bp +++ b/wifi/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IWifi.hal", diff --git a/wifi/1.3/Android.bp b/wifi/1.3/Android.bp index 3719c2b76b..f4e130a7a8 100644 --- a/wifi/1.3/Android.bp +++ b/wifi/1.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IWifi.hal", diff --git a/wifi/1.4/Android.bp b/wifi/1.4/Android.bp index 3b94619b3d..5620d03553 100644 --- a/wifi/1.4/Android.bp +++ b/wifi/1.4/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi@1.4", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IWifi.hal", diff --git a/wifi/1.4/default/android.hardware.wifi@1.0-service-lazy.rc b/wifi/1.4/default/android.hardware.wifi@1.0-service-lazy.rc deleted file mode 100644 index cf917b5458..0000000000 --- a/wifi/1.4/default/android.hardware.wifi@1.0-service-lazy.rc +++ /dev/null @@ -1,8 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service-lazy - interface android.hardware.wifi@1.0::IWifi default - oneshot - disabled - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/1.5/Android.bp b/wifi/1.5/Android.bp new file mode 100644 index 0000000000..37a1cf31a4 --- /dev/null +++ b/wifi/1.5/Android.bp @@ -0,0 +1,21 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.wifi@1.5", + root: "android.hardware", + srcs: [ + "IWifi.hal", + ], + interfaces: [ + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hidl.base@1.0", + ], + gen_java: true, + apex_available: [ + "com.android.wifi", + ], +} diff --git a/wifi/1.5/IWifi.hal b/wifi/1.5/IWifi.hal new file mode 100644 index 0000000000..66d0a9c2f9 --- /dev/null +++ b/wifi/1.5/IWifi.hal @@ -0,0 +1,27 @@ +/* + * Copyright 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.wifi@1.5; + +import @1.4::IWifi; + +/** + * This is the root of the HAL module and is the interface returned when + * loading an implementation of the Wi-Fi HAL. There must be at most one + * module loaded in the system. + * IWifi.getChip() must return @1.5::IWifiChip + */ +interface IWifi extends @1.4::IWifi {}; diff --git a/wifi/1.4/default/Android.mk b/wifi/1.5/default/Android.mk index f566b80822..23250c8301 100644 --- a/wifi/1.4/default/Android.mk +++ b/wifi/1.5/default/Android.mk @@ -74,7 +74,8 @@ LOCAL_SHARED_LIBRARIES := \ android.hardware.wifi@1.1 \ android.hardware.wifi@1.2 \ android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 + android.hardware.wifi@1.4 \ + android.hardware.wifi@1.5 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) include $(BUILD_STATIC_LIBRARY) @@ -107,7 +108,8 @@ LOCAL_SHARED_LIBRARIES := \ android.hardware.wifi@1.1 \ android.hardware.wifi@1.2 \ android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 + android.hardware.wifi@1.4 \ + android.hardware.wifi@1.5 LOCAL_STATIC_LIBRARIES := \ android.hardware.wifi@1.0-service-lib LOCAL_INIT_RC := android.hardware.wifi@1.0-service.rc @@ -139,7 +141,8 @@ LOCAL_SHARED_LIBRARIES := \ android.hardware.wifi@1.1 \ android.hardware.wifi@1.2 \ android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 + android.hardware.wifi@1.4 \ + android.hardware.wifi@1.5 LOCAL_STATIC_LIBRARIES := \ android.hardware.wifi@1.0-service-lib LOCAL_INIT_RC := android.hardware.wifi@1.0-service-lazy.rc @@ -172,6 +175,7 @@ LOCAL_STATIC_LIBRARIES := \ android.hardware.wifi@1.2 \ android.hardware.wifi@1.3 \ android.hardware.wifi@1.4 \ + android.hardware.wifi@1.5 \ android.hardware.wifi@1.0-service-lib LOCAL_SHARED_LIBRARIES := \ libbase \ diff --git a/wifi/1.4/default/OWNERS b/wifi/1.5/default/OWNERS index 8bfb14882c..8bfb14882c 100644 --- a/wifi/1.4/default/OWNERS +++ b/wifi/1.5/default/OWNERS diff --git a/wifi/1.4/default/THREADING.README b/wifi/1.5/default/THREADING.README index 8366ca0201..8366ca0201 100644 --- a/wifi/1.4/default/THREADING.README +++ b/wifi/1.5/default/THREADING.README diff --git a/wifi/1.4/default/android.hardware.wifi@1.0-service.rc b/wifi/1.5/default/android.hardware.wifi@1.0-service-lazy.rc index 64a51b0ae8..061689dbe5 100644 --- a/wifi/1.4/default/android.hardware.wifi@1.0-service.rc +++ b/wifi/1.5/default/android.hardware.wifi@1.0-service-lazy.rc @@ -1,9 +1,11 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service-lazy interface android.hardware.wifi@1.0::IWifi default interface android.hardware.wifi@1.1::IWifi default interface android.hardware.wifi@1.2::IWifi default interface android.hardware.wifi@1.3::IWifi default interface android.hardware.wifi@1.4::IWifi default + oneshot + disabled class hal capabilities NET_ADMIN NET_RAW SYS_MODULE user wifi diff --git a/wifi/1.5/default/android.hardware.wifi@1.0-service.rc b/wifi/1.5/default/android.hardware.wifi@1.0-service.rc new file mode 100644 index 0000000000..05706ef4f4 --- /dev/null +++ b/wifi/1.5/default/android.hardware.wifi@1.0-service.rc @@ -0,0 +1,11 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service + interface android.hardware.wifi@1.0::IWifi default + interface android.hardware.wifi@1.1::IWifi default + interface android.hardware.wifi@1.2::IWifi default + interface android.hardware.wifi@1.3::IWifi default + interface android.hardware.wifi@1.4::IWifi default + interface android.hardware.wifi@1.5::IWifi default + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/1.4/default/android.hardware.wifi@1.0-service.xml b/wifi/1.5/default/android.hardware.wifi@1.0-service.xml index b5d25cd140..88dd1e3285 100644 --- a/wifi/1.4/default/android.hardware.wifi@1.0-service.xml +++ b/wifi/1.5/default/android.hardware.wifi@1.0-service.xml @@ -2,7 +2,7 @@ <hal format="hidl"> <name>android.hardware.wifi</name> <transport>hwbinder</transport> - <version>1.4</version> + <version>1.5</version> <interface> <name>IWifi</name> <instance>default</instance> diff --git a/wifi/1.4/default/hidl_callback_util.h b/wifi/1.5/default/hidl_callback_util.h index fc601b804a..d144658750 100644 --- a/wifi/1.4/default/hidl_callback_util.h +++ b/wifi/1.5/default/hidl_callback_util.h @@ -52,7 +52,7 @@ class HidlDeathHandler : public android::hardware::hidl_death_recipient { namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace hidl_callback_util { template <typename CallbackType> @@ -117,7 +117,7 @@ class HidlCallbackHandler { } // namespace hidl_callback_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/hidl_return_util.h b/wifi/1.5/default/hidl_return_util.h index 99c70928b7..4455185283 100644 --- a/wifi/1.4/default/hidl_return_util.h +++ b/wifi/1.5/default/hidl_return_util.h @@ -23,7 +23,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace hidl_return_util { using namespace android::hardware::wifi::V1_0; @@ -113,7 +113,7 @@ Return<void> validateAndCall( } // namespace hidl_return_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/hidl_struct_util.cpp b/wifi/1.5/default/hidl_struct_util.cpp index 87c0708845..d872af79d3 100644 --- a/wifi/1.4/default/hidl_struct_util.cpp +++ b/wifi/1.5/default/hidl_struct_util.cpp @@ -22,7 +22,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace hidl_struct_util { @@ -312,7 +312,7 @@ legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( bool convertLegacyWifiMacInfoToHidl( const legacy_hal::WifiMacInfo& legacy_mac_info, - IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) { + V1_4::IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) { if (!hidl_radio_mode_info) { return false; } @@ -324,21 +324,21 @@ bool convertLegacyWifiMacInfoToHidl( if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ_6GHZ; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ_6GHZ; } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ_6GHZ; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ_6GHZ; } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_6GHZ; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_6GHZ; } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ; } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ; } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ; } else { - hidl_radio_mode_info->bandInfo = WifiBand::BAND_UNSPECIFIED; + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_UNSPECIFIED; } std::vector<V1_2::IWifiChipEventCallback::IfaceInfo> iface_info_vec; for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { @@ -353,14 +353,15 @@ bool convertLegacyWifiMacInfoToHidl( bool convertLegacyWifiMacInfosToHidl( const std::vector<legacy_hal::WifiMacInfo>& legacy_mac_infos, - std::vector<IWifiChipEventCallback::RadioModeInfo>* hidl_radio_mode_infos) { + std::vector<V1_4::IWifiChipEventCallback::RadioModeInfo>* + hidl_radio_mode_infos) { if (!hidl_radio_mode_infos) { return false; } *hidl_radio_mode_infos = {}; for (const auto& legacy_mac_info : legacy_mac_infos) { - IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info; + V1_4::IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info; if (!convertLegacyWifiMacInfoToHidl(legacy_mac_info, &hidl_radio_mode_info)) { return false; @@ -1077,7 +1078,7 @@ void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, } bool convertHidlNanEnableRequestToLegacy( - const NanEnableRequest& hidl_request, + const V1_4::NanEnableRequest& hidl_request, legacy_hal::NanEnableRequest* legacy_request) { if (!legacy_request) { LOG(ERROR) @@ -1273,7 +1274,7 @@ bool convertHidlNanEnableRequestToLegacy( } bool convertHidlNanEnableRequest_1_4ToLegacy( - const NanEnableRequest& hidl_request1, + const V1_4::NanEnableRequest& hidl_request1, const V1_2::NanConfigRequestSupplemental& hidl_request2, legacy_hal::NanEnableRequest* legacy_request) { if (!legacy_request) { @@ -1672,7 +1673,7 @@ bool convertHidlNanTransmitFollowupRequestToLegacy( } bool convertHidlNanConfigRequestToLegacy( - const NanConfigRequest& hidl_request, + const V1_4::NanConfigRequest& hidl_request, legacy_hal::NanConfigRequest* legacy_request) { if (!legacy_request) { LOG(ERROR) @@ -1787,7 +1788,7 @@ bool convertHidlNanConfigRequestToLegacy( } bool convertHidlNanConfigRequest_1_4ToLegacy( - const NanConfigRequest& hidl_request1, + const V1_4::NanConfigRequest& hidl_request1, const V1_2::NanConfigRequestSupplemental& hidl_request2, legacy_hal::NanConfigRequest* legacy_request) { if (!legacy_request) { @@ -2296,30 +2297,32 @@ WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl( CHECK(false) << "Unknown legacy type: " << type; } -legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy(RttPreamble type) { +legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy( + V1_4::RttPreamble type) { switch (type) { - case RttPreamble::LEGACY: + case V1_4::RttPreamble::LEGACY: return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; - case RttPreamble::HT: + case V1_4::RttPreamble::HT: return legacy_hal::WIFI_RTT_PREAMBLE_HT; - case RttPreamble::VHT: + case V1_4::RttPreamble::VHT: return legacy_hal::WIFI_RTT_PREAMBLE_VHT; - case RttPreamble::HE: + case V1_4::RttPreamble::HE: return legacy_hal::WIFI_RTT_PREAMBLE_HE; }; CHECK(false); } -RttPreamble convertLegacyRttPreambleToHidl(legacy_hal::wifi_rtt_preamble type) { +V1_4::RttPreamble convertLegacyRttPreambleToHidl( + legacy_hal::wifi_rtt_preamble type) { switch (type) { case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: - return RttPreamble::LEGACY; + return V1_4::RttPreamble::LEGACY; case legacy_hal::WIFI_RTT_PREAMBLE_HT: - return RttPreamble::HT; + return V1_4::RttPreamble::HT; case legacy_hal::WIFI_RTT_PREAMBLE_VHT: - return RttPreamble::VHT; + return V1_4::RttPreamble::VHT; case legacy_hal::WIFI_RTT_PREAMBLE_HE: - return RttPreamble::HE; + return V1_4::RttPreamble::HE; }; CHECK(false) << "Unknown legacy type: " << type; } @@ -2373,20 +2376,20 @@ legacy_hal::wifi_motion_pattern convertHidlRttMotionPatternToLegacy( CHECK(false); } -WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { +V1_4::WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { switch (preamble) { case 0: - return WifiRatePreamble::OFDM; + return V1_4::WifiRatePreamble::OFDM; case 1: - return WifiRatePreamble::CCK; + return V1_4::WifiRatePreamble::CCK; case 2: - return WifiRatePreamble::HT; + return V1_4::WifiRatePreamble::HT; case 3: - return WifiRatePreamble::VHT; + return V1_4::WifiRatePreamble::VHT; case 4: - return WifiRatePreamble::HE; + return V1_4::WifiRatePreamble::HE; default: - return WifiRatePreamble::RESERVED; + return V1_4::WifiRatePreamble::RESERVED; }; CHECK(false) << "Unknown legacy preamble: " << preamble; } @@ -2476,7 +2479,7 @@ bool convertLegacyWifiChannelInfoToHidl( return true; } -bool convertHidlRttConfigToLegacy(const RttConfig& hidl_config, +bool convertHidlRttConfigToLegacy(const V1_4::RttConfig& hidl_config, legacy_hal::wifi_rtt_config* legacy_config) { if (!legacy_config) { return false; @@ -2507,7 +2510,7 @@ bool convertHidlRttConfigToLegacy(const RttConfig& hidl_config, } bool convertHidlVectorOfRttConfigToLegacy( - const std::vector<RttConfig>& hidl_configs, + const std::vector<V1_4::RttConfig>& hidl_configs, std::vector<legacy_hal::wifi_rtt_config>* legacy_configs) { if (!legacy_configs) { return false; @@ -2564,7 +2567,7 @@ bool convertHidlRttLcrInformationToLegacy( } bool convertHidlRttResponderToLegacy( - const RttResponder& hidl_responder, + const V1_4::RttResponder& hidl_responder, legacy_hal::wifi_rtt_responder* legacy_responder) { if (!legacy_responder) { return false; @@ -2581,7 +2584,7 @@ bool convertHidlRttResponderToLegacy( bool convertLegacyRttResponderToHidl( const legacy_hal::wifi_rtt_responder& legacy_responder, - RttResponder* hidl_responder) { + V1_4::RttResponder* hidl_responder) { if (!hidl_responder) { return false; } @@ -2597,7 +2600,7 @@ bool convertLegacyRttResponderToHidl( bool convertLegacyRttCapabilitiesToHidl( const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - RttCapabilities* hidl_capabilities) { + V1_4::RttCapabilities* hidl_capabilities) { if (!hidl_capabilities) { return false; } @@ -2616,7 +2619,7 @@ bool convertLegacyRttCapabilitiesToHidl( legacy_hal::WIFI_RTT_PREAMBLE_HE}) { if (legacy_capabilities.preamble_support & flag) { hidl_capabilities->preambleSupport |= - static_cast<std::underlying_type<RttPreamble>::type>( + static_cast<std::underlying_type<V1_4::RttPreamble>::type>( convertLegacyRttPreambleToHidl(flag)); } } @@ -2636,7 +2639,7 @@ bool convertLegacyRttCapabilitiesToHidl( } bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - WifiRateInfo* hidl_rate) { + V1_4::WifiRateInfo* hidl_rate) { if (!hidl_rate) { return false; } @@ -2652,7 +2655,8 @@ bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, } bool convertLegacyRttResultToHidl( - const legacy_hal::wifi_rtt_result& legacy_result, RttResult* hidl_result) { + const legacy_hal::wifi_rtt_result& legacy_result, + V1_4::RttResult* hidl_result) { if (!hidl_result) { return false; } @@ -2699,13 +2703,13 @@ bool convertLegacyRttResultToHidl( bool convertLegacyVectorOfRttResultToHidl( const std::vector<const legacy_hal::wifi_rtt_result*>& legacy_results, - std::vector<RttResult>* hidl_results) { + std::vector<V1_4::RttResult>* hidl_results) { if (!hidl_results) { return false; } *hidl_results = {}; for (const auto legacy_result : legacy_results) { - RttResult hidl_result; + V1_4::RttResult hidl_result; if (!convertLegacyRttResultToHidl(*legacy_result, &hidl_result)) { return false; } @@ -2730,7 +2734,7 @@ legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy( } } // namespace hidl_struct_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/hidl_struct_util.h b/wifi/1.5/default/hidl_struct_util.h index 929f877d96..b6567ff809 100644 --- a/wifi/1.4/default/hidl_struct_util.h +++ b/wifi/1.5/default/hidl_struct_util.h @@ -38,7 +38,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace hidl_struct_util { using namespace android::hardware::wifi::V1_0; @@ -64,7 +64,8 @@ legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( V1_2::IWifiChip::TxPowerScenario hidl_scenario); bool convertLegacyWifiMacInfosToHidl( const std::vector<legacy_hal::WifiMacInfo>& legacy_mac_infos, - std::vector<IWifiChipEventCallback::RadioModeInfo>* hidl_radio_mode_infos); + std::vector<V1_4::IWifiChipEventCallback::RadioModeInfo>* + hidl_radio_mode_infos); legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy( IfaceType hidl_interface_type); @@ -114,17 +115,17 @@ bool convertLegacyVectorOfDebugRxPacketFateToHidl( void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, WifiNanStatus* wifiNanStatus); bool convertHidlNanEnableRequestToLegacy( - const NanEnableRequest& hidl_request, + const V1_4::NanEnableRequest& hidl_request, legacy_hal::NanEnableRequest* legacy_request); bool convertHidlNanConfigRequestToLegacy( - const NanConfigRequest& hidl_request, + const V1_4::NanConfigRequest& hidl_request, legacy_hal::NanConfigRequest* legacy_request); bool convertHidlNanEnableRequest_1_4ToLegacy( - const NanEnableRequest& hidl_request1, + const V1_4::NanEnableRequest& hidl_request1, const V1_2::NanConfigRequestSupplemental& hidl_request2, legacy_hal::NanEnableRequest* legacy_request); bool convertHidlNanConfigRequest_1_4ToLegacy( - const NanConfigRequest& hidl_request1, + const V1_4::NanConfigRequest& hidl_request1, const V1_2::NanConfigRequestSupplemental& hidl_request2, legacy_hal::NanConfigRequest* legacy_request); bool convertHidlNanPublishRequestToLegacy( @@ -165,7 +166,7 @@ bool convertLegacyNanDataPathScheduleUpdateIndToHidl( // RTT controller conversion methods. bool convertHidlVectorOfRttConfigToLegacy( - const std::vector<RttConfig>& hidl_configs, + const std::vector<V1_4::RttConfig>& hidl_configs, std::vector<legacy_hal::wifi_rtt_config>* legacy_configs); bool convertHidlRttLciInformationToLegacy( const RttLciInformation& hidl_info, @@ -174,23 +175,23 @@ bool convertHidlRttLcrInformationToLegacy( const RttLcrInformation& hidl_info, legacy_hal::wifi_lcr_information* legacy_info); bool convertHidlRttResponderToLegacy( - const RttResponder& hidl_responder, + const V1_4::RttResponder& hidl_responder, legacy_hal::wifi_rtt_responder* legacy_responder); bool convertHidlWifiChannelInfoToLegacy( const WifiChannelInfo& hidl_info, legacy_hal::wifi_channel_info* legacy_info); bool convertLegacyRttResponderToHidl( const legacy_hal::wifi_rtt_responder& legacy_responder, - RttResponder* hidl_responder); + V1_4::RttResponder* hidl_responder); bool convertLegacyRttCapabilitiesToHidl( const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - RttCapabilities* hidl_capabilities); + V1_4::RttCapabilities* hidl_capabilities); bool convertLegacyVectorOfRttResultToHidl( const std::vector<const legacy_hal::wifi_rtt_result*>& legacy_results, - std::vector<RttResult>* hidl_results); + std::vector<V1_4::RttResult>* hidl_results); } // namespace hidl_struct_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/hidl_sync_util.cpp b/wifi/1.5/default/hidl_sync_util.cpp index 593a3bc5be..93eefe9560 100644 --- a/wifi/1.4/default/hidl_sync_util.cpp +++ b/wifi/1.5/default/hidl_sync_util.cpp @@ -23,7 +23,7 @@ std::recursive_mutex g_mutex; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace hidl_sync_util { @@ -33,7 +33,7 @@ std::unique_lock<std::recursive_mutex> acquireGlobalLock() { } // namespace hidl_sync_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/hidl_sync_util.h b/wifi/1.5/default/hidl_sync_util.h index 02444219e9..e706f4cd87 100644 --- a/wifi/1.4/default/hidl_sync_util.h +++ b/wifi/1.5/default/hidl_sync_util.h @@ -24,13 +24,13 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace hidl_sync_util { std::unique_lock<std::recursive_mutex> acquireGlobalLock(); } // namespace hidl_sync_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/ringbuffer.cpp b/wifi/1.5/default/ringbuffer.cpp index 0fe8ef45aa..26971ff25b 100644 --- a/wifi/1.4/default/ringbuffer.cpp +++ b/wifi/1.5/default/ringbuffer.cpp @@ -21,7 +21,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { Ringbuffer::Ringbuffer(size_t maxSize) : size_(0), maxSize_(maxSize) {} @@ -48,7 +48,7 @@ const std::list<std::vector<uint8_t>>& Ringbuffer::getData() const { } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/ringbuffer.h b/wifi/1.5/default/ringbuffer.h index ddce648949..d8b87f2171 100644 --- a/wifi/1.4/default/ringbuffer.h +++ b/wifi/1.5/default/ringbuffer.h @@ -23,7 +23,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { /** @@ -45,7 +45,7 @@ class Ringbuffer { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/service.cpp b/wifi/1.5/default/service.cpp index f40111863d..fc6f4e0d07 100644 --- a/wifi/1.4/default/service.cpp +++ b/wifi/1.5/default/service.cpp @@ -30,11 +30,11 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; using android::hardware::LazyServiceRegistrar; -using android::hardware::wifi::V1_4::implementation::feature_flags:: +using android::hardware::wifi::V1_5::implementation::feature_flags:: WifiFeatureFlags; -using android::hardware::wifi::V1_4::implementation::iface_util::WifiIfaceUtil; -using android::hardware::wifi::V1_4::implementation::legacy_hal::WifiLegacyHal; -using android::hardware::wifi::V1_4::implementation::mode_controller:: +using android::hardware::wifi::V1_5::implementation::iface_util::WifiIfaceUtil; +using android::hardware::wifi::V1_5::implementation::legacy_hal::WifiLegacyHal; +using android::hardware::wifi::V1_5::implementation::mode_controller:: WifiModeController; #ifdef ARCH_ARM_32 @@ -67,8 +67,8 @@ int main(int /*argc*/, char** argv) { const auto iface_tool = std::make_shared<android::wifi_system::InterfaceTool>(); // Setup hwbinder service - android::sp<android::hardware::wifi::V1_4::IWifi> service = - new android::hardware::wifi::V1_4::implementation::Wifi( + android::sp<android::hardware::wifi::V1_5::IWifi> service = + new android::hardware::wifi::V1_5::implementation::Wifi( iface_tool, std::make_shared<WifiLegacyHal>(iface_tool), std::make_shared<WifiModeController>(), std::make_shared<WifiIfaceUtil>(iface_tool), diff --git a/wifi/1.4/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.5/default/tests/hidl_struct_util_unit_tests.cpp index b71d549d9c..81eb14e8e0 100644 --- a/wifi/1.4/default/tests/hidl_struct_util_unit_tests.cpp +++ b/wifi/1.5/default/tests/hidl_struct_util_unit_tests.cpp @@ -34,7 +34,7 @@ constexpr char kIfaceName2[] = "wlan1"; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; using ::android::hardware::wifi::V1_0::WifiChannelWidthInMhz; @@ -55,14 +55,15 @@ TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithOneMac) { legacy_mac_info1.iface_infos.push_back(legacy_iface_info2); legacy_mac_infos.push_back(legacy_mac_info1); - std::vector<IWifiChipEventCallback::RadioModeInfo> hidl_radio_mode_infos; + std::vector<V1_4::IWifiChipEventCallback::RadioModeInfo> + hidl_radio_mode_infos; ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl( legacy_mac_infos, &hidl_radio_mode_infos)); ASSERT_EQ(1u, hidl_radio_mode_infos.size()); auto hidl_radio_mode_info1 = hidl_radio_mode_infos[0]; EXPECT_EQ(legacy_mac_info1.wlan_mac_id, hidl_radio_mode_info1.radioId); - EXPECT_EQ(WifiBand::BAND_24GHZ_5GHZ, hidl_radio_mode_info1.bandInfo); + EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ_5GHZ, hidl_radio_mode_info1.bandInfo); ASSERT_EQ(2u, hidl_radio_mode_info1.ifaceInfos.size()); auto hidl_iface_info1 = hidl_radio_mode_info1.ifaceInfos[0]; EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); @@ -89,20 +90,22 @@ TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithTwoMac) { legacy_mac_info2.iface_infos.push_back(legacy_iface_info2); legacy_mac_infos.push_back(legacy_mac_info2); - std::vector<IWifiChipEventCallback::RadioModeInfo> hidl_radio_mode_infos; + std::vector<V1_4::IWifiChipEventCallback::RadioModeInfo> + hidl_radio_mode_infos; ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl( legacy_mac_infos, &hidl_radio_mode_infos)); ASSERT_EQ(2u, hidl_radio_mode_infos.size()); // Find mac info 1. - const auto hidl_radio_mode_info1 = std::find_if( - hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), - [&legacy_mac_info1](const IWifiChipEventCallback::RadioModeInfo& x) { - return x.radioId == legacy_mac_info1.wlan_mac_id; - }); + const auto hidl_radio_mode_info1 = + std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), + [&legacy_mac_info1]( + const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { + return x.radioId == legacy_mac_info1.wlan_mac_id; + }); ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info1); - EXPECT_EQ(WifiBand::BAND_5GHZ, hidl_radio_mode_info1->bandInfo); + EXPECT_EQ(V1_4::WifiBand::BAND_5GHZ, hidl_radio_mode_info1->bandInfo); ASSERT_EQ(1u, hidl_radio_mode_info1->ifaceInfos.size()); auto hidl_iface_info1 = hidl_radio_mode_info1->ifaceInfos[0]; EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); @@ -110,13 +113,14 @@ TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithTwoMac) { hidl_iface_info1.channel); // Find mac info 2. - const auto hidl_radio_mode_info2 = std::find_if( - hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), - [&legacy_mac_info2](const IWifiChipEventCallback::RadioModeInfo& x) { - return x.radioId == legacy_mac_info2.wlan_mac_id; - }); + const auto hidl_radio_mode_info2 = + std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), + [&legacy_mac_info2]( + const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { + return x.radioId == legacy_mac_info2.wlan_mac_id; + }); ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info2); - EXPECT_EQ(WifiBand::BAND_24GHZ, hidl_radio_mode_info2->bandInfo); + EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ, hidl_radio_mode_info2->bandInfo); ASSERT_EQ(1u, hidl_radio_mode_info2->ifaceInfos.size()); auto hidl_iface_info2 = hidl_radio_mode_info2->ifaceInfos[0]; EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); @@ -288,7 +292,7 @@ TEST_F(HidlStructUtilTest, CanConvertLegacyFeaturesToHidl) { hidle_caps); } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/main.cpp b/wifi/1.5/default/tests/main.cpp index 9aac837242..9aac837242 100644 --- a/wifi/1.4/default/tests/main.cpp +++ b/wifi/1.5/default/tests/main.cpp diff --git a/wifi/1.4/default/tests/mock_interface_tool.cpp b/wifi/1.5/default/tests/mock_interface_tool.cpp index b99a16446c..b99a16446c 100644 --- a/wifi/1.4/default/tests/mock_interface_tool.cpp +++ b/wifi/1.5/default/tests/mock_interface_tool.cpp diff --git a/wifi/1.4/default/tests/mock_interface_tool.h b/wifi/1.5/default/tests/mock_interface_tool.h index 0f17551f96..0f17551f96 100644 --- a/wifi/1.4/default/tests/mock_interface_tool.h +++ b/wifi/1.5/default/tests/mock_interface_tool.h diff --git a/wifi/1.4/default/tests/mock_wifi_feature_flags.cpp b/wifi/1.5/default/tests/mock_wifi_feature_flags.cpp index b1fa432ca3..2f66ba121b 100644 --- a/wifi/1.4/default/tests/mock_wifi_feature_flags.cpp +++ b/wifi/1.5/default/tests/mock_wifi_feature_flags.cpp @@ -21,7 +21,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace feature_flags { @@ -29,7 +29,7 @@ MockWifiFeatureFlags::MockWifiFeatureFlags() {} } // namespace feature_flags } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_feature_flags.h b/wifi/1.5/default/tests/mock_wifi_feature_flags.h index 72d23045b0..92fbb055d6 100644 --- a/wifi/1.4/default/tests/mock_wifi_feature_flags.h +++ b/wifi/1.5/default/tests/mock_wifi_feature_flags.h @@ -25,7 +25,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace feature_flags { @@ -39,7 +39,7 @@ class MockWifiFeatureFlags : public WifiFeatureFlags { } // namespace feature_flags } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_iface_util.cpp b/wifi/1.5/default/tests/mock_wifi_iface_util.cpp index 0968569c56..fe6e9e2e57 100644 --- a/wifi/1.4/default/tests/mock_wifi_iface_util.cpp +++ b/wifi/1.5/default/tests/mock_wifi_iface_util.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace iface_util { @@ -33,7 +33,7 @@ MockWifiIfaceUtil::MockWifiIfaceUtil( : WifiIfaceUtil(iface_tool) {} } // namespace iface_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_iface_util.h b/wifi/1.5/default/tests/mock_wifi_iface_util.h index 8d77a7d9d0..a719fec878 100644 --- a/wifi/1.4/default/tests/mock_wifi_iface_util.h +++ b/wifi/1.5/default/tests/mock_wifi_iface_util.h @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace iface_util { @@ -45,7 +45,7 @@ class MockWifiIfaceUtil : public WifiIfaceUtil { }; } // namespace iface_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_legacy_hal.cpp b/wifi/1.5/default/tests/mock_wifi_legacy_hal.cpp index 8d65c59e25..501bd7f4cf 100644 --- a/wifi/1.4/default/tests/mock_wifi_legacy_hal.cpp +++ b/wifi/1.5/default/tests/mock_wifi_legacy_hal.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace legacy_hal { @@ -33,7 +33,7 @@ MockWifiLegacyHal::MockWifiLegacyHal( : WifiLegacyHal(iface_tool) {} } // namespace legacy_hal } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_legacy_hal.h b/wifi/1.5/default/tests/mock_wifi_legacy_hal.h index 3bb7b54760..f93834775c 100644 --- a/wifi/1.4/default/tests/mock_wifi_legacy_hal.h +++ b/wifi/1.5/default/tests/mock_wifi_legacy_hal.h @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace legacy_hal { @@ -64,7 +64,7 @@ class MockWifiLegacyHal : public WifiLegacyHal { }; } // namespace legacy_hal } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_mode_controller.cpp b/wifi/1.5/default/tests/mock_wifi_mode_controller.cpp index ee09029820..e7ab22a01b 100644 --- a/wifi/1.4/default/tests/mock_wifi_mode_controller.cpp +++ b/wifi/1.5/default/tests/mock_wifi_mode_controller.cpp @@ -24,14 +24,14 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace mode_controller { MockWifiModeController::MockWifiModeController() : WifiModeController() {} } // namespace mode_controller } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/mock_wifi_mode_controller.h b/wifi/1.5/default/tests/mock_wifi_mode_controller.h index 1e1ce696f0..b9151f18b4 100644 --- a/wifi/1.4/default/tests/mock_wifi_mode_controller.h +++ b/wifi/1.5/default/tests/mock_wifi_mode_controller.h @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace mode_controller { @@ -38,7 +38,7 @@ class MockWifiModeController : public WifiModeController { }; } // namespace mode_controller } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/ringbuffer_unit_tests.cpp b/wifi/1.5/default/tests/ringbuffer_unit_tests.cpp index a65347f7ac..6fd34ee29c 100644 --- a/wifi/1.4/default/tests/ringbuffer_unit_tests.cpp +++ b/wifi/1.5/default/tests/ringbuffer_unit_tests.cpp @@ -24,7 +24,7 @@ using testing::Test; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { class RingbufferTest : public Test { @@ -91,7 +91,7 @@ TEST_F(RingbufferTest, OversizedAppendDoesNotDropExistingData) { EXPECT_EQ(input, buffer_.getData().front()); } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/runtests.sh b/wifi/1.5/default/tests/runtests.sh index 6bce3ef8c4..6bce3ef8c4 100755 --- a/wifi/1.4/default/tests/runtests.sh +++ b/wifi/1.5/default/tests/runtests.sh diff --git a/wifi/1.4/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.5/default/tests/wifi_chip_unit_tests.cpp index 323d2ffa81..1d55e164d4 100644 --- a/wifi/1.4/default/tests/wifi_chip_unit_tests.cpp +++ b/wifi/1.5/default/tests/wifi_chip_unit_tests.cpp @@ -41,7 +41,7 @@ constexpr ChipId kFakeChipId = 5; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { class WifiChipTest : public Test { @@ -173,18 +173,18 @@ class WifiChipTest : public Test { std::string createIface(const IfaceType& type) { std::string iface_name; if (type == IfaceType::AP) { - chip_->createApIface([&iface_name]( - const WifiStatus& status, - const sp<V1_0::IWifiApIface>& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); + chip_->createApIface( + [&iface_name](const WifiStatus& status, + const sp<V1_0::IWifiApIface>& iface) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(iface.get(), nullptr); + iface->getName([&iface_name](const WifiStatus& status, + const hidl_string& name) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + iface_name = name.c_str(); + }); + } + }); } else if (type == IfaceType::NAN) { chip_->createNanIface( [&iface_name]( @@ -263,6 +263,8 @@ class WifiChipTest : public Test { return success; } + static void subsystemRestartHandler(const std::string& /*error*/) {} + sp<WifiChip> chip_; ChipId chip_id_ = kFakeChipId; std::shared_ptr<NiceMock<wifi_system::MockInterfaceTool>> iface_tool_{ @@ -278,8 +280,9 @@ class WifiChipTest : public Test { public: void SetUp() override { - chip_ = new WifiChip(chip_id_, legacy_hal_, mode_controller_, - iface_util_, feature_flags_); + chip_ = + new WifiChip(chip_id_, legacy_hal_, mode_controller_, iface_util_, + feature_flags_, subsystemRestartHandler); EXPECT_CALL(*mode_controller_, changeFirmwareMode(testing::_)) .WillRepeatedly(testing::Return(true)); @@ -894,7 +897,7 @@ TEST_F(WifiChip_MultiIfaceTest, CreateApStartsWithIdx1) { ASSERT_EQ(createIface(IfaceType::STA), "wlan3"); } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/wifi_iface_util_unit_tests.cpp b/wifi/1.5/default/tests/wifi_iface_util_unit_tests.cpp index 03394bc209..d70e42f80e 100644 --- a/wifi/1.4/default/tests/wifi_iface_util_unit_tests.cpp +++ b/wifi/1.5/default/tests/wifi_iface_util_unit_tests.cpp @@ -41,7 +41,7 @@ bool isValidUnicastLocallyAssignedMacAddress( namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace iface_util { class WifiIfaceUtilTest : public Test { @@ -90,7 +90,7 @@ TEST_F(WifiIfaceUtilTest, IfaceEventHandlers_SetMacAddress) { } } // namespace iface_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/1.5/default/tests/wifi_nan_iface_unit_tests.cpp index 70424db815..3e7026f1f8 100644 --- a/wifi/1.4/default/tests/wifi_nan_iface_unit_tests.cpp +++ b/wifi/1.5/default/tests/wifi_nan_iface_unit_tests.cpp @@ -38,7 +38,7 @@ constexpr char kIfaceName[] = "mockWlan0"; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using android::hardware::wifi::V1_2::IWifiNanIfaceEventCallback; @@ -151,7 +151,7 @@ TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi.cpp b/wifi/1.5/default/wifi.cpp index 9c6b0f0f16..c4e23337c8 100644 --- a/wifi/1.4/default/wifi.cpp +++ b/wifi/1.5/default/wifi.cpp @@ -28,7 +28,7 @@ static constexpr android::hardware::wifi::V1_0::ChipId kChipId = 0; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; using hidl_return_util::validateAndCallWithLock; @@ -107,9 +107,23 @@ WifiStatus Wifi::startInternal() { } WifiStatus wifi_status = initializeModeControllerAndLegacyHal(); if (wifi_status.code == WifiStatusCode::SUCCESS) { + // Register the callback for subsystem restart + const auto& on_subsystem_restart_callback = + [this](const std::string& error) { + WifiStatus wifi_status = + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onFailure(wifi_status).isOk()) { + LOG(ERROR) << "Failed to invoke onFailure callback"; + } + } + }; + // Create the chip instance once the HAL is started. - chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_, - iface_util_, feature_flags_); + // Need to consider the case of multiple chips TODO(156998862) + chip_ = + new WifiChip(kChipId, legacy_hal_, mode_controller_, iface_util_, + feature_flags_, on_subsystem_restart_callback); run_state_ = RunState::STARTED; for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onStart().isOk()) { @@ -173,7 +187,8 @@ std::pair<WifiStatus, std::vector<ChipId>> Wifi::getChipIdsInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)}; } -std::pair<WifiStatus, sp<IWifiChip>> Wifi::getChipInternal(ChipId chip_id) { +std::pair<WifiStatus, sp<V1_4::IWifiChip>> Wifi::getChipInternal( + ChipId chip_id) { if (!chip_.get()) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_STARTED), nullptr}; } @@ -214,7 +229,7 @@ WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController( return createWifiStatus(WifiStatusCode::SUCCESS); } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi.h b/wifi/1.5/default/wifi.h index 087d6f71e8..8de0ef4c28 100644 --- a/wifi/1.4/default/wifi.h +++ b/wifi/1.5/default/wifi.h @@ -20,7 +20,7 @@ #include <functional> #include <android-base/macros.h> -#include <android/hardware/wifi/1.4/IWifi.h> +#include <android/hardware/wifi/1.5/IWifi.h> #include <utils/Looper.h> #include "hidl_callback_util.h" @@ -32,13 +32,13 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { /** * Root HIDL interface object used to control the Wifi HAL. */ -class Wifi : public V1_4::IWifi { +class Wifi : public V1_5::IWifi { public: Wifi(const std::shared_ptr<wifi_system::InterfaceTool> iface_tool, const std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal, @@ -70,7 +70,7 @@ class Wifi : public V1_4::IWifi { WifiStatus startInternal(); WifiStatus stopInternal(std::unique_lock<std::recursive_mutex>* lock); std::pair<WifiStatus, std::vector<ChipId>> getChipIdsInternal(); - std::pair<WifiStatus, sp<IWifiChip>> getChipInternal(ChipId chip_id); + std::pair<WifiStatus, sp<V1_4::IWifiChip>> getChipInternal(ChipId chip_id); WifiStatus initializeModeControllerAndLegacyHal(); WifiStatus stopLegacyHalAndDeinitializeModeController( @@ -92,7 +92,7 @@ class Wifi : public V1_4::IWifi { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_ap_iface.cpp b/wifi/1.5/default/wifi_ap_iface.cpp index 8777a4cb9c..04e382a659 100644 --- a/wifi/1.4/default/wifi_ap_iface.cpp +++ b/wifi/1.5/default/wifi_ap_iface.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; @@ -131,7 +131,7 @@ WifiApIface::getFactoryMacAddressInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_ap_iface.h b/wifi/1.5/default/wifi_ap_iface.h index bf16d5eb85..48b444a66c 100644 --- a/wifi/1.4/default/wifi_ap_iface.h +++ b/wifi/1.5/default/wifi_ap_iface.h @@ -26,7 +26,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; @@ -76,7 +76,7 @@ class WifiApIface : public V1_4::IWifiApIface { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_chip.cpp b/wifi/1.5/default/wifi_chip.cpp index 8ac582580c..b5521ef0af 100644 --- a/wifi/1.4/default/wifi_chip.cpp +++ b/wifi/1.5/default/wifi_chip.cpp @@ -327,7 +327,7 @@ std::vector<char> makeCharVec(const std::string& str) { namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; using hidl_return_util::validateAndCallWithLock; @@ -336,7 +336,8 @@ WifiChip::WifiChip( ChipId chip_id, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, const std::weak_ptr<mode_controller::WifiModeController> mode_controller, const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util, - const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags) + const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags, + const std::function<void(const std::string&)>& handler) : chip_id_(chip_id), legacy_hal_(legacy_hal), mode_controller_(mode_controller), @@ -344,7 +345,8 @@ WifiChip::WifiChip( is_valid_(true), current_mode_id_(feature_flags::chip_mode_ids::kInvalid), modes_(feature_flags.lock()->getChipModes()), - debug_ring_buffer_cb_registered_(false) { + debug_ring_buffer_cb_registered_(false), + subsystemCallbackHandler_(handler) { setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); } @@ -361,7 +363,7 @@ void WifiChip::invalidate() { bool WifiChip::isValid() { return is_valid_; } -std::set<sp<IWifiChipEventCallback>> WifiChip::getEventCallbacks() { +std::set<sp<V1_4::IWifiChipEventCallback>> WifiChip::getEventCallbacks() { return event_cb_handler_.getCallbacks(); } @@ -625,6 +627,15 @@ Return<void> WifiChip::getCapabilities_1_3(getCapabilities_cb hidl_status_cb) { Return<void> WifiChip::debug(const hidl_handle& handle, const hidl_vec<hidl_string>&) { if (handle != nullptr && handle->numFds >= 1) { + { + std::unique_lock<std::mutex> lk(lock_t); + for (const auto& item : ringbuffer_map_) { + forceDumpToDebugRingBufferInternal(item.first); + } + // unique_lock unlocked here + } + usleep(100 * 1000); // sleep for 100 milliseconds to wait for + // ringbuffer updates. int fd = handle->data[0]; if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; @@ -649,7 +660,7 @@ Return<void> WifiChip::createRttController_1_4( } Return<void> WifiChip::registerEventCallback_1_4( - const sp<IWifiChipEventCallback>& event_callback, + const sp<V1_4::IWifiChipEventCallback>& event_callback, registerEventCallback_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::registerEventCallbackInternal_1_4, @@ -734,7 +745,7 @@ std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal() { return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; } -std::pair<WifiStatus, std::vector<IWifiChip::ChipMode>> +std::pair<WifiStatus, std::vector<V1_4::IWifiChip::ChipMode>> WifiChip::getAvailableModesInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), modes_}; } @@ -767,6 +778,10 @@ WifiStatus WifiChip::configureChipInternal( current_mode_id_ = mode_id; LOG(INFO) << "Configured chip in mode " << mode_id; setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + + legacy_hal_.lock()->registerSubsystemRestartCallbackHandler( + subsystemCallbackHandler_); + return status; } @@ -778,9 +793,9 @@ std::pair<WifiStatus, uint32_t> WifiChip::getModeInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), current_mode_id_}; } -std::pair<WifiStatus, IWifiChip::ChipDebugInfo> +std::pair<WifiStatus, V1_4::IWifiChip::ChipDebugInfo> WifiChip::requestChipDebugInfoInternal() { - IWifiChip::ChipDebugInfo result; + V1_4::IWifiChip::ChipDebugInfo result; legacy_hal::wifi_error legacy_status; std::string driver_desc; const auto ifname = getFirstActiveWlanIfaceName(); @@ -919,7 +934,8 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() { +std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> +WifiChip::createNanIfaceInternal() { if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::NAN)) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } @@ -950,7 +966,7 @@ WifiChip::getNanIfaceNamesInternal() { return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(nan_ifaces_)}; } -std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::getNanIfaceInternal( +std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> WifiChip::getNanIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(nan_ifaces_, ifname); if (!iface.get()) { @@ -1168,6 +1184,9 @@ WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() { legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deregisterRingBufferCallbackHandler( getFirstActiveWlanIfaceName()); + if (legacy_status == legacy_hal::WIFI_SUCCESS) { + debug_ring_buffer_cb_registered_ = false; + } return createWifiStatusFromLegacyError(legacy_status); } @@ -1275,7 +1294,7 @@ std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal_1_3() { return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; } -std::pair<WifiStatus, sp<IWifiRttController>> +std::pair<WifiStatus, sp<V1_4::IWifiRttController>> WifiChip::createRttControllerInternal_1_4(const sp<IWifiIface>& bound_iface) { if (sta_ifaces_.size() == 0 && !canCurrentModeSupportIfaceOfType(IfaceType::STA)) { @@ -1291,7 +1310,7 @@ WifiChip::createRttControllerInternal_1_4(const sp<IWifiIface>& bound_iface) { } WifiStatus WifiChip::registerEventCallbackInternal_1_4( - const sp<IWifiChipEventCallback>& event_callback) { + const sp<V1_4::IWifiChipEventCallback>& event_callback) { if (!event_cb_handler_.addCallback(event_callback)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } @@ -1339,7 +1358,7 @@ WifiStatus WifiChip::handleChipConfiguration( LOG(ERROR) << "Failed to register radio mode change callback"; } // Extract and save the version information into property. - std::pair<WifiStatus, IWifiChip::ChipDebugInfo> version_info; + std::pair<WifiStatus, V1_4::IWifiChip::ChipDebugInfo> version_info; version_info = WifiChip::requestChipDebugInfoInternal(); if (WifiStatusCode::SUCCESS == version_info.first.code) { property_set("vendor.wlan.firmware.version", @@ -1383,7 +1402,7 @@ WifiStatus WifiChip::registerDebugRingBufferCallback() { LOG(ERROR) << "Ringname " << name << " not found"; return; } - // unlock + // unique_lock unlocked here } }; legacy_hal::wifi_error legacy_status = @@ -1405,7 +1424,7 @@ WifiStatus WifiChip::registerRadioModeChangeCallback() { LOG(ERROR) << "Callback invoked on an invalid object"; return; } - std::vector<IWifiChipEventCallback::RadioModeInfo> + std::vector<V1_4::IWifiChipEventCallback::RadioModeInfo> hidl_radio_mode_infos; if (!hidl_struct_util::convertLegacyWifiMacInfosToHidl( mac_infos, &hidl_radio_mode_infos)) { @@ -1426,7 +1445,7 @@ WifiStatus WifiChip::registerRadioModeChangeCallback() { return createWifiStatusFromLegacyError(legacy_status); } -std::vector<IWifiChip::ChipIfaceCombination> +std::vector<V1_4::IWifiChip::ChipIfaceCombination> WifiChip::getCurrentModeIfaceCombinations() { if (!isValidModeId(current_mode_id_)) { LOG(ERROR) << "Chip not configured in a mode yet"; @@ -1457,7 +1476,7 @@ std::map<IfaceType, size_t> WifiChip::getCurrentIfaceCombination() { // of ifaces of each type in the combination. // This method is a port of HalDeviceManager.expandIfaceCombos() from framework. std::vector<std::map<IfaceType, size_t>> WifiChip::expandIfaceCombinations( - const IWifiChip::ChipIfaceCombination& combination) { + const V1_4::IWifiChip::ChipIfaceCombination& combination) { uint32_t num_expanded_combos = 1; for (const auto& limit : combination.limits) { for (uint32_t i = 0; i < limit.maxIfaces; i++) { @@ -1676,13 +1695,13 @@ bool WifiChip::writeRingbufferFilesInternal() { } } } - // unlock + // unique_lock unlocked here } return true; } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_chip.h b/wifi/1.5/default/wifi_chip.h index abe025c8f3..994ac77537 100644 --- a/wifi/1.4/default/wifi_chip.h +++ b/wifi/1.5/default/wifi_chip.h @@ -39,7 +39,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; @@ -50,13 +50,14 @@ using namespace android::hardware::wifi::V1_0; */ class WifiChip : public V1_4::IWifiChip { public: - WifiChip( - ChipId chip_id, - const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, - const std::weak_ptr<mode_controller::WifiModeController> - mode_controller, - const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util, - const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags); + WifiChip(ChipId chip_id, + const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, + const std::weak_ptr<mode_controller::WifiModeController> + mode_controller, + const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util, + const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags, + const std::function<void(const std::string&)>& + subsystemCallbackHandler); // HIDL does not provide a built-in mechanism to let the server invalidate // a HIDL interface object after creation. If any client process holds onto // a reference to the object in their context, any method calls on that @@ -72,7 +73,7 @@ class WifiChip : public V1_4::IWifiChip { // marked valid before processing them. void invalidate(); bool isValid(); - std::set<sp<IWifiChipEventCallback>> getEventCallbacks(); + std::set<sp<V1_4::IWifiChipEventCallback>> getEventCallbacks(); // HIDL methods exposed. Return<void> getId(getId_cb hidl_status_cb) override; @@ -158,7 +159,7 @@ class WifiChip : public V1_4::IWifiChip { const sp<IWifiIface>& bound_iface, createRttController_1_4_cb hidl_status_cb) override; Return<void> registerEventCallback_1_4( - const sp<IWifiChipEventCallback>& event_callback, + const sp<V1_4::IWifiChipEventCallback>& event_callback, registerEventCallback_1_4_cb hidl_status_cb) override; private: @@ -188,9 +189,9 @@ class WifiChip : public V1_4::IWifiChip { std::pair<WifiStatus, sp<IWifiApIface>> getApIfaceInternal( const std::string& ifname); WifiStatus removeApIfaceInternal(const std::string& ifname); - std::pair<WifiStatus, sp<IWifiNanIface>> createNanIfaceInternal(); + std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> createNanIfaceInternal(); std::pair<WifiStatus, std::vector<hidl_string>> getNanIfaceNamesInternal(); - std::pair<WifiStatus, sp<IWifiNanIface>> getNanIfaceInternal( + std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> getNanIfaceInternal( const std::string& ifname); WifiStatus removeNanIfaceInternal(const std::string& ifname); std::pair<WifiStatus, sp<IWifiP2pIface>> createP2pIfaceInternal(); @@ -225,21 +226,21 @@ class WifiChip : public V1_4::IWifiChip { const sp<V1_2::IWifiChipEventCallback>& event_callback); WifiStatus selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario); std::pair<WifiStatus, uint32_t> getCapabilitiesInternal_1_3(); - std::pair<WifiStatus, sp<IWifiRttController>> + std::pair<WifiStatus, sp<V1_4::IWifiRttController>> createRttControllerInternal_1_4(const sp<IWifiIface>& bound_iface); WifiStatus registerEventCallbackInternal_1_4( - const sp<IWifiChipEventCallback>& event_callback); + const sp<V1_4::IWifiChipEventCallback>& event_callback); WifiStatus handleChipConfiguration( std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id); WifiStatus registerDebugRingBufferCallback(); WifiStatus registerRadioModeChangeCallback(); - std::vector<IWifiChip::ChipIfaceCombination> + std::vector<V1_4::IWifiChip::ChipIfaceCombination> getCurrentModeIfaceCombinations(); std::map<IfaceType, size_t> getCurrentIfaceCombination(); std::vector<std::map<IfaceType, size_t>> expandIfaceCombinations( - const IWifiChip::ChipIfaceCombination& combination); + const V1_4::IWifiChip::ChipIfaceCombination& combination); bool canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces( const std::map<IfaceType, size_t>& expanded_combo, IfaceType requested_type); @@ -274,14 +275,16 @@ class WifiChip : public V1_4::IWifiChip { // Members pertaining to chip configuration. uint32_t current_mode_id_; std::mutex lock_t; - std::vector<IWifiChip::ChipMode> modes_; + std::vector<V1_4::IWifiChip::ChipMode> modes_; // The legacy ring buffer callback API has only a global callback // registration mechanism. Use this to check if we have already // registered a callback. bool debug_ring_buffer_cb_registered_; - hidl_callback_util::HidlCallbackHandler<IWifiChipEventCallback> + hidl_callback_util::HidlCallbackHandler<V1_4::IWifiChipEventCallback> event_cb_handler_; + const std::function<void(const std::string&)> subsystemCallbackHandler_; + std::vector<sp<WifiApIface>> created_ap_ifaces_; std::vector<sp<WifiStaIface>> created_sta_ifaces_; @@ -289,7 +292,7 @@ class WifiChip : public V1_4::IWifiChip { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_feature_flags.cpp b/wifi/1.5/default/wifi_feature_flags.cpp index f15ccb270d..ae7a0f55fc 100644 --- a/wifi/1.4/default/wifi_feature_flags.cpp +++ b/wifi/1.5/default/wifi_feature_flags.cpp @@ -19,7 +19,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace feature_flags { @@ -174,7 +174,7 @@ std::vector<IWifiChip::ChipMode> WifiFeatureFlags::getChipModes() { } // namespace feature_flags } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_feature_flags.h b/wifi/1.5/default/wifi_feature_flags.h index 292dedfe19..73d18eca35 100644 --- a/wifi/1.4/default/wifi_feature_flags.h +++ b/wifi/1.5/default/wifi_feature_flags.h @@ -22,7 +22,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace feature_flags { @@ -47,7 +47,7 @@ class WifiFeatureFlags { } // namespace feature_flags } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_iface_util.cpp b/wifi/1.5/default/wifi_iface_util.cpp index 104a49afa9..beca993404 100644 --- a/wifi/1.4/default/wifi_iface_util.cpp +++ b/wifi/1.5/default/wifi_iface_util.cpp @@ -36,7 +36,7 @@ constexpr uint8_t kMacAddressLocallyAssignedMask = 0x02; namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace iface_util { @@ -141,7 +141,7 @@ unsigned WifiIfaceUtil::ifNameToIndex(const std::string& iface_name) { } } // namespace iface_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_iface_util.h b/wifi/1.5/default/wifi_iface_util.h index 503c733c2a..5a95ff235b 100644 --- a/wifi/1.4/default/wifi_iface_util.h +++ b/wifi/1.5/default/wifi_iface_util.h @@ -26,7 +26,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace iface_util { @@ -74,7 +74,7 @@ class WifiIfaceUtil { } // namespace iface_util } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_legacy_hal.cpp b/wifi/1.5/default/wifi_legacy_hal.cpp index fe36b44a95..b6cd94ffb7 100644 --- a/wifi/1.4/default/wifi_legacy_hal.cpp +++ b/wifi/1.5/default/wifi_legacy_hal.cpp @@ -51,7 +51,7 @@ std::vector<char> makeCharVec(const std::string& str) { namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace legacy_hal { // Legacy HAL functions accept "C" style function pointers, so use global @@ -162,6 +162,15 @@ void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, } } +// Callback to be invoked to report subsystem restart +std::function<void(const char*)> on_subsystem_restart_internal_callback; +void onAsyncSubsystemRestart(const char* error) { + const auto lock = hidl_sync_util::acquireGlobalLock(); + if (on_subsystem_restart_internal_callback) { + on_subsystem_restart_internal_callback(error); + } +} + // Callback to be invoked for rtt results results. std::function<void(wifi_request_id, unsigned num_results, wifi_rtt_result* rtt_results[])> @@ -1049,6 +1058,23 @@ wifi_error WifiLegacyHal::registerRadioModeChangeCallbackHandler( return status; } +wifi_error WifiLegacyHal::registerSubsystemRestartCallbackHandler( + const on_subsystem_restart_callback& on_restart_callback) { + if (on_subsystem_restart_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_subsystem_restart_internal_callback = + [on_restart_callback](const char* error) { + on_restart_callback(error); + }; + wifi_error status = global_func_table_.wifi_set_subsystem_restart_handler( + global_handle_, {onAsyncSubsystemRestart}); + if (status != WIFI_SUCCESS) { + on_subsystem_restart_internal_callback = nullptr; + } + return status; +} + wifi_error WifiLegacyHal::startRttRangeRequest( const std::string& iface_name, wifi_request_id id, const std::vector<wifi_rtt_config>& rtt_configs, @@ -1471,6 +1497,7 @@ void WifiLegacyHal::invalidate() { on_ring_buffer_data_internal_callback = nullptr; on_error_alert_internal_callback = nullptr; on_radio_mode_change_internal_callback = nullptr; + on_subsystem_restart_internal_callback = nullptr; on_rtt_results_internal_callback = nullptr; on_nan_notify_response_user_callback = nullptr; on_nan_event_publish_terminated_user_callback = nullptr; @@ -1493,7 +1520,7 @@ void WifiLegacyHal::invalidate() { } // namespace legacy_hal } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_legacy_hal.h b/wifi/1.5/default/wifi_legacy_hal.h index 99644604cc..ae520a85bc 100644 --- a/wifi/1.4/default/wifi_legacy_hal.h +++ b/wifi/1.5/default/wifi_legacy_hal.h @@ -35,7 +35,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { // This is in a separate namespace to prevent typename conflicts between // the legacy HAL types and the HIDL interface types. @@ -142,6 +142,9 @@ using on_ring_buffer_data_callback = using on_error_alert_callback = std::function<void(int32_t, const std::vector<uint8_t>&)>; +// Callback for subsystem restart +using on_subsystem_restart_callback = std::function<void(const std::string&)>; + // Struct for the mac info from the legacy HAL. This is a cleaner version // of the |wifi_mac_info| & |wifi_iface_info|. typedef struct { @@ -277,6 +280,8 @@ class WifiLegacyHal { const on_ring_buffer_data_callback& on_data_callback); wifi_error deregisterRingBufferCallbackHandler( const std::string& iface_name); + wifi_error registerSubsystemRestartCallbackHandler( + const on_subsystem_restart_callback& on_restart_callback); std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> getRingBuffersStatus(const std::string& iface_name); wifi_error startRingBufferLogging(const std::string& iface_name, @@ -407,7 +412,7 @@ class WifiLegacyHal { } // namespace legacy_hal } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_legacy_hal_stubs.cpp b/wifi/1.5/default/wifi_legacy_hal_stubs.cpp index 153a68520f..73b58564f1 100644 --- a/wifi/1.4/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/1.5/default/wifi_legacy_hal_stubs.cpp @@ -20,7 +20,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace legacy_hal { template <typename> @@ -143,11 +143,12 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_virtual_interface_delete); populateStubFor(&hal_fn->wifi_map_dscp_access_category); populateStubFor(&hal_fn->wifi_reset_dscp_mapping); + populateStubFor(&hal_fn->wifi_set_subsystem_restart_handler); return true; } } // namespace legacy_hal } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_legacy_hal_stubs.h b/wifi/1.5/default/wifi_legacy_hal_stubs.h index 577a545b1d..7e4eb0a0fd 100644 --- a/wifi/1.4/default/wifi_legacy_hal_stubs.h +++ b/wifi/1.5/default/wifi_legacy_hal_stubs.h @@ -20,7 +20,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace legacy_hal { #include <hardware_legacy/wifi_hal.h> @@ -28,7 +28,7 @@ namespace legacy_hal { bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn); } // namespace legacy_hal } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_mode_controller.cpp b/wifi/1.5/default/wifi_mode_controller.cpp index 252121a5b4..b1db8b3725 100644 --- a/wifi/1.4/default/wifi_mode_controller.cpp +++ b/wifi/1.5/default/wifi_mode_controller.cpp @@ -48,7 +48,7 @@ int convertIfaceTypeToFirmwareMode(IfaceType type) { namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace mode_controller { @@ -85,7 +85,7 @@ bool WifiModeController::deinitialize() { } } // namespace mode_controller } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_mode_controller.h b/wifi/1.5/default/wifi_mode_controller.h index 45fa999b2a..2eeca78c8b 100644 --- a/wifi/1.4/default/wifi_mode_controller.h +++ b/wifi/1.5/default/wifi_mode_controller.h @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { namespace mode_controller { using namespace android::hardware::wifi::V1_0; @@ -55,7 +55,7 @@ class WifiModeController { } // namespace mode_controller } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_nan_iface.cpp b/wifi/1.5/default/wifi_nan_iface.cpp index 5764d35ec4..84fb558db9 100644 --- a/wifi/1.4/default/wifi_nan_iface.cpp +++ b/wifi/1.5/default/wifi_nan_iface.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; @@ -718,7 +718,7 @@ Return<void> WifiNanIface::configRequest_1_2( } Return<void> WifiNanIface::enableRequest_1_4( - uint16_t cmd_id, const NanEnableRequest& msg1, + uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2, enableRequest_1_4_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, @@ -727,7 +727,7 @@ Return<void> WifiNanIface::enableRequest_1_4( } Return<void> WifiNanIface::configRequest_1_4( - uint16_t cmd_id, const NanConfigRequest& msg1, + uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2, configRequest_1_4_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, @@ -898,7 +898,7 @@ WifiStatus WifiNanIface::configRequest_1_2Internal( } WifiStatus WifiNanIface::enableRequest_1_4Internal( - uint16_t cmd_id, const NanEnableRequest& msg1, + uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2) { legacy_hal::NanEnableRequest legacy_msg; if (!hidl_struct_util::convertHidlNanEnableRequest_1_4ToLegacy( @@ -911,7 +911,7 @@ WifiStatus WifiNanIface::enableRequest_1_4Internal( } WifiStatus WifiNanIface::configRequest_1_4Internal( - uint16_t cmd_id, const NanConfigRequest& msg1, + uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2) { legacy_hal::NanConfigRequest legacy_msg; if (!hidl_struct_util::convertHidlNanConfigRequest_1_4ToLegacy( @@ -924,7 +924,7 @@ WifiStatus WifiNanIface::configRequest_1_4Internal( } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_nan_iface.h b/wifi/1.5/default/wifi_nan_iface.h index 06edbf2609..efdb2da65e 100644 --- a/wifi/1.4/default/wifi_nan_iface.h +++ b/wifi/1.5/default/wifi_nan_iface.h @@ -28,7 +28,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; using namespace android::hardware::wifi::V1_2; @@ -105,13 +105,13 @@ class WifiNanIface : public V1_4::IWifiNanIface { const V1_2::NanConfigRequestSupplemental& msg2, configRequest_1_2_cb hidl_status_cb) override; Return<void> enableRequest_1_4( - uint16_t cmd_id, const NanEnableRequest& msg1, + uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_2_cb hidl_status_cb) override; + enableRequest_1_4_cb hidl_status_cb) override; Return<void> configRequest_1_4( - uint16_t cmd_id, const NanConfigRequest& msg1, + uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_2_cb hidl_status_cb) override; + configRequest_1_4_cb hidl_status_cb) override; private: // Corresponding worker functions for the HIDL methods. @@ -153,10 +153,10 @@ class WifiNanIface : public V1_4::IWifiNanIface { uint16_t cmd_id, const V1_0::NanConfigRequest& msg, const V1_2::NanConfigRequestSupplemental& msg2); WifiStatus enableRequest_1_4Internal( - uint16_t cmd_id, const NanEnableRequest& msg1, + uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, const V1_2::NanConfigRequestSupplemental& msg2); WifiStatus configRequest_1_4Internal( - uint16_t cmd_id, const NanConfigRequest& msg, + uint16_t cmd_id, const V1_4::NanConfigRequest& msg, const V1_2::NanConfigRequestSupplemental& msg2); // all 1_0 and descendant callbacks @@ -178,7 +178,7 @@ class WifiNanIface : public V1_4::IWifiNanIface { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_p2p_iface.cpp b/wifi/1.5/default/wifi_p2p_iface.cpp index 9e7341f248..b8893da153 100644 --- a/wifi/1.4/default/wifi_p2p_iface.cpp +++ b/wifi/1.5/default/wifi_p2p_iface.cpp @@ -23,7 +23,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; @@ -60,7 +60,7 @@ std::pair<WifiStatus, IfaceType> WifiP2pIface::getTypeInternal() { } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_p2p_iface.h b/wifi/1.5/default/wifi_p2p_iface.h index a6fc59d04b..c1adc50278 100644 --- a/wifi/1.4/default/wifi_p2p_iface.h +++ b/wifi/1.5/default/wifi_p2p_iface.h @@ -25,7 +25,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; @@ -58,7 +58,7 @@ class WifiP2pIface : public V1_0::IWifiP2pIface { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_rtt_controller.cpp b/wifi/1.5/default/wifi_rtt_controller.cpp index 594a11660f..a0f9969033 100644 --- a/wifi/1.4/default/wifi_rtt_controller.cpp +++ b/wifi/1.5/default/wifi_rtt_controller.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; @@ -44,7 +44,7 @@ void WifiRttController::invalidate() { bool WifiRttController::isValid() { return is_valid_; } -std::vector<sp<IWifiRttControllerEventCallback>> +std::vector<sp<V1_4::IWifiRttControllerEventCallback>> WifiRttController::getEventCallbacks() { return event_callbacks_; } @@ -131,7 +131,7 @@ Return<void> WifiRttController::disableResponder( } Return<void> WifiRttController::registerEventCallback_1_4( - const sp<IWifiRttControllerEventCallback>& callback, + const sp<V1_4::IWifiRttControllerEventCallback>& callback, registerEventCallback_1_4_cb hidl_status_cb) { return validateAndCall( this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, @@ -140,7 +140,7 @@ Return<void> WifiRttController::registerEventCallback_1_4( } Return<void> WifiRttController::rangeRequest_1_4( - uint32_t cmd_id, const hidl_vec<RttConfig>& rtt_configs, + uint32_t cmd_id, const hidl_vec<V1_4::RttConfig>& rtt_configs, rangeRequest_1_4_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, @@ -164,7 +164,7 @@ Return<void> WifiRttController::getResponderInfo_1_4( Return<void> WifiRttController::enableResponder_1_4( uint32_t cmd_id, const WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const RttResponder& info, + uint32_t max_duration_seconds, const V1_4::RttResponder& info, enableResponder_1_4_cb hidl_status_cb) { return validateAndCall( this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, @@ -252,14 +252,14 @@ WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) { } WifiStatus WifiRttController::registerEventCallbackInternal_1_4( - const sp<IWifiRttControllerEventCallback>& callback) { + const sp<V1_4::IWifiRttControllerEventCallback>& callback) { // TODO(b/31632518): remove the callback when the client is destroyed event_callbacks_.emplace_back(callback); return createWifiStatus(WifiStatusCode::SUCCESS); } WifiStatus WifiRttController::rangeRequestInternal_1_4( - uint32_t cmd_id, const std::vector<RttConfig>& rtt_configs) { + uint32_t cmd_id, const std::vector<V1_4::RttConfig>& rtt_configs) { std::vector<legacy_hal::wifi_rtt_config> legacy_configs; if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy( rtt_configs, &legacy_configs)) { @@ -275,7 +275,7 @@ WifiStatus WifiRttController::rangeRequestInternal_1_4( LOG(ERROR) << "Callback invoked on an invalid object"; return; } - std::vector<RttResult> hidl_results; + std::vector<V1_4::RttResult> hidl_results; if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl( results, &hidl_results)) { LOG(ERROR) << "Failed to convert rtt results to HIDL structs"; @@ -291,7 +291,7 @@ WifiStatus WifiRttController::rangeRequestInternal_1_4( return createWifiStatusFromLegacyError(legacy_status); } -std::pair<WifiStatus, RttCapabilities> +std::pair<WifiStatus, V1_4::RttCapabilities> WifiRttController::getCapabilitiesInternal_1_4() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_rtt_capabilities legacy_caps; @@ -300,7 +300,7 @@ WifiRttController::getCapabilitiesInternal_1_4() { if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {createWifiStatusFromLegacyError(legacy_status), {}}; } - RttCapabilities hidl_caps; + V1_4::RttCapabilities hidl_caps; if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps, &hidl_caps)) { return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; @@ -308,7 +308,7 @@ WifiRttController::getCapabilitiesInternal_1_4() { return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; } -std::pair<WifiStatus, RttResponder> +std::pair<WifiStatus, V1_4::RttResponder> WifiRttController::getResponderInfoInternal_1_4() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_rtt_responder legacy_responder; @@ -317,7 +317,7 @@ WifiRttController::getResponderInfoInternal_1_4() { if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {createWifiStatusFromLegacyError(legacy_status), {}}; } - RttResponder hidl_responder; + V1_4::RttResponder hidl_responder; if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder, &hidl_responder)) { return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; @@ -327,7 +327,7 @@ WifiRttController::getResponderInfoInternal_1_4() { WifiStatus WifiRttController::enableResponderInternal_1_4( uint32_t cmd_id, const WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const RttResponder& info) { + uint32_t max_duration_seconds, const V1_4::RttResponder& info) { legacy_hal::wifi_channel_info legacy_channel_info; if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy( channel_hint, &legacy_channel_info)) { @@ -345,7 +345,7 @@ WifiStatus WifiRttController::enableResponderInternal_1_4( return createWifiStatusFromLegacyError(legacy_status); } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_rtt_controller.h b/wifi/1.5/default/wifi_rtt_controller.h index 1f125555d0..9ac3e06fcc 100644 --- a/wifi/1.4/default/wifi_rtt_controller.h +++ b/wifi/1.5/default/wifi_rtt_controller.h @@ -27,7 +27,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { /** @@ -41,7 +41,7 @@ class WifiRttController : public V1_4::IWifiRttController { // Refer to |WifiChip::invalidate()|. void invalidate(); bool isValid(); - std::vector<sp<IWifiRttControllerEventCallback>> getEventCallbacks(); + std::vector<sp<V1_4::IWifiRttControllerEventCallback>> getEventCallbacks(); std::string getIfaceName(); // HIDL methods exposed. @@ -69,10 +69,10 @@ class WifiRttController : public V1_4::IWifiRttController { Return<void> disableResponder(uint32_t cmd_id, disableResponder_cb hidl_status_cb) override; Return<void> registerEventCallback_1_4( - const sp<IWifiRttControllerEventCallback>& callback, + const sp<V1_4::IWifiRttControllerEventCallback>& callback, registerEventCallback_1_4_cb hidl_status_cb) override; Return<void> rangeRequest_1_4(uint32_t cmd_id, - const hidl_vec<RttConfig>& rtt_configs, + const hidl_vec<V1_4::RttConfig>& rtt_configs, rangeRequest_1_4_cb hidl_status_cb) override; Return<void> getCapabilities_1_4( getCapabilities_1_4_cb hidl_status_cb) override; @@ -80,7 +80,7 @@ class WifiRttController : public V1_4::IWifiRttController { getResponderInfo_1_4_cb hidl_status_cb) override; Return<void> enableResponder_1_4( uint32_t cmd_id, const WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const RttResponder& info, + uint32_t max_duration_seconds, const V1_4::RttResponder& info, enableResponder_1_4_cb hidl_status_cb) override; private: @@ -102,27 +102,27 @@ class WifiRttController : public V1_4::IWifiRttController { const V1_0::RttResponder& info); WifiStatus disableResponderInternal(uint32_t cmd_id); WifiStatus registerEventCallbackInternal_1_4( - const sp<IWifiRttControllerEventCallback>& callback); + const sp<V1_4::IWifiRttControllerEventCallback>& callback); WifiStatus rangeRequestInternal_1_4( - uint32_t cmd_id, const std::vector<RttConfig>& rtt_configs); - std::pair<WifiStatus, RttCapabilities> getCapabilitiesInternal_1_4(); - std::pair<WifiStatus, RttResponder> getResponderInfoInternal_1_4(); + uint32_t cmd_id, const std::vector<V1_4::RttConfig>& rtt_configs); + std::pair<WifiStatus, V1_4::RttCapabilities> getCapabilitiesInternal_1_4(); + std::pair<WifiStatus, V1_4::RttResponder> getResponderInfoInternal_1_4(); WifiStatus enableResponderInternal_1_4(uint32_t cmd_id, const WifiChannelInfo& channel_hint, uint32_t max_duration_seconds, - const RttResponder& info); + const V1_4::RttResponder& info); std::string ifname_; sp<IWifiIface> bound_iface_; std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; - std::vector<sp<IWifiRttControllerEventCallback>> event_callbacks_; + std::vector<sp<V1_4::IWifiRttControllerEventCallback>> event_callbacks_; bool is_valid_; DISALLOW_COPY_AND_ASSIGN(WifiRttController); }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_sta_iface.cpp b/wifi/1.5/default/wifi_sta_iface.cpp index 49f383ae2f..04087fda7a 100644 --- a/wifi/1.4/default/wifi_sta_iface.cpp +++ b/wifi/1.5/default/wifi_sta_iface.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using hidl_return_util::validateAndCall; @@ -640,7 +640,7 @@ WifiStaIface::getFactoryMacAddressInternal() { } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_sta_iface.h b/wifi/1.5/default/wifi_sta_iface.h index dee04f2a69..7695f3c9f1 100644 --- a/wifi/1.4/default/wifi_sta_iface.h +++ b/wifi/1.5/default/wifi_sta_iface.h @@ -28,7 +28,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; @@ -172,7 +172,7 @@ class WifiStaIface : public V1_3::IWifiStaIface { }; } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_status_util.cpp b/wifi/1.5/default/wifi_status_util.cpp index 8ceb9265f1..eb8c8694db 100644 --- a/wifi/1.4/default/wifi_status_util.cpp +++ b/wifi/1.5/default/wifi_status_util.cpp @@ -19,7 +19,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { std::string legacyErrorToString(legacy_hal::wifi_error error) { @@ -106,7 +106,7 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { } } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.4/default/wifi_status_util.h b/wifi/1.5/default/wifi_status_util.h index 3ff58f0c0a..68f21689c5 100644 --- a/wifi/1.4/default/wifi_status_util.h +++ b/wifi/1.5/default/wifi_status_util.h @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_4 { +namespace V1_5 { namespace implementation { using namespace android::hardware::wifi::V1_0; @@ -37,7 +37,7 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); } // namespace implementation -} // namespace V1_4 +} // namespace V1_5 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/hostapd/1.0/Android.bp b/wifi/hostapd/1.0/Android.bp index cce1182af3..b736167f24 100644 --- a/wifi/hostapd/1.0/Android.bp +++ b/wifi/hostapd/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.hostapd@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHostapd.hal", diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp index 912d285fd4..75d6252cd2 100644 --- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp +++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp @@ -45,16 +45,24 @@ namespace { // Helper function to initialize the driver and firmware to AP mode // using the vendor HAL HIDL interface. void initilializeDriverAndFirmware(const std::string& wifi_instance_name) { - sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name); - ChipModeId mode_id; - EXPECT_TRUE(configureChipToSupportIfaceType( - wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &mode_id)); + if (getWifi(wifi_instance_name) != nullptr) { + sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name); + ChipModeId mode_id; + EXPECT_TRUE(configureChipToSupportIfaceType( + wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &mode_id)); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } } // Helper function to deinitialize the driver and firmware // using the vendor HAL HIDL interface. void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) { - stopWifi(wifi_instance_name); + if (getWifi(wifi_instance_name) != nullptr) { + stopWifi(wifi_instance_name); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } } } // namespace diff --git a/wifi/hostapd/1.1/Android.bp b/wifi/hostapd/1.1/Android.bp index 64fbc93791..bba065df08 100644 --- a/wifi/hostapd/1.1/Android.bp +++ b/wifi/hostapd/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.hostapd@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "IHostapd.hal", "IHostapdCallback.hal", diff --git a/wifi/hostapd/1.2/Android.bp b/wifi/hostapd/1.2/Android.bp index 3dcad71881..9b26ece6b2 100644 --- a/wifi/hostapd/1.2/Android.bp +++ b/wifi/hostapd/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.hostapd@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IHostapd.hal", diff --git a/wifi/offload/1.0/Android.bp b/wifi/offload/1.0/Android.bp index 110bb702d2..91ed476c62 100644 --- a/wifi/offload/1.0/Android.bp +++ b/wifi/offload/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.offload@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "IOffload.hal", diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp index d91512f7bd..d46e463ac9 100644 --- a/wifi/supplicant/1.0/Android.bp +++ b/wifi/supplicant/1.0/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.supplicant@1.0", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISupplicant.hal", diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp index 371cce99a3..5e7a371d67 100644 --- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp +++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp @@ -56,11 +56,14 @@ void initilializeDriverAndFirmware(const std::string& wifi_instance_name) { if (wifi_instance_name == "") { return; } - - sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name); - ChipModeId mode_id; - EXPECT_TRUE(configureChipToSupportIfaceType( - wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id)); + if (getWifi(wifi_instance_name) != nullptr) { + sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name); + ChipModeId mode_id; + EXPECT_TRUE(configureChipToSupportIfaceType( + wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::STA, &mode_id)); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } } // Helper function to deinitialize the driver and firmware @@ -70,8 +73,11 @@ void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) { if (wifi_instance_name == "") { return; } - - stopWifi(wifi_instance_name); + if (getWifi(wifi_instance_name) != nullptr) { + stopWifi(wifi_instance_name); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } } // Helper function to find any iface of the desired type exposed. diff --git a/wifi/supplicant/1.1/Android.bp b/wifi/supplicant/1.1/Android.bp index 6d940d17ed..bc20dca6db 100644 --- a/wifi/supplicant/1.1/Android.bp +++ b/wifi/supplicant/1.1/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.supplicant@1.1", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "ISupplicant.hal", "ISupplicantStaIface.hal", diff --git a/wifi/supplicant/1.2/Android.bp b/wifi/supplicant/1.2/Android.bp index 185d2b8df2..aa2fa7be60 100644 --- a/wifi/supplicant/1.2/Android.bp +++ b/wifi/supplicant/1.2/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.supplicant@1.2", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISupplicant.hal", diff --git a/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp index f38dda4caf..7377f780f2 100644 --- a/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp +++ b/wifi/supplicant/1.2/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -302,7 +302,8 @@ TEST_P(SupplicantStaIfaceHidlTest, AddDppPeerUriAndRomveUri) { } hidl_string uri = - "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" + "DPP:C:81/1,117/" + "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;"; uint32_t peer_id = 0; @@ -347,7 +348,8 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppEnrolleeInitiator) { } hidl_string uri = - "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" + "DPP:C:81/1,117/" + "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;"; uint32_t peer_id = 0; @@ -413,7 +415,8 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) { } hidl_string uri = - "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" + "DPP:C:81/1,117/" + "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;"; uint32_t peer_id = 0; diff --git a/wifi/supplicant/1.3/Android.bp b/wifi/supplicant/1.3/Android.bp index 15c72fed59..4268490f6a 100644 --- a/wifi/supplicant/1.3/Android.bp +++ b/wifi/supplicant/1.3/Android.bp @@ -3,9 +3,6 @@ hidl_interface { name: "android.hardware.wifi.supplicant@1.3", root: "android.hardware", - vndk: { - enabled: true, - }, srcs: [ "types.hal", "ISupplicant.hal", diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp index 40202980bc..12bd122b14 100644 --- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp +++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -419,7 +419,8 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppEnrolleeInitiator) { } hidl_string uri = - "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" + "DPP:C:81/1,117/" + "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;"; uint32_t peer_id = 0; @@ -470,7 +471,8 @@ TEST_P(SupplicantStaIfaceHidlTest, StartDppConfiguratorInitiator) { } hidl_string uri = - "DPP:C:81/1;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" + "DPP:C:81/1,117/" + "40;M:48d6d5bd1de1;I:G1197843;K:MDkwEwYHKoZIzj0CAQYIKoZIzj" "0DAQcDIgAD0edY4X3N//HhMFYsZfMbQJTiNFtNIWF/cIwMB/gzqOM=;;"; uint32_t peer_id = 0; |