From cb2c37f78f4a54c79d8a60f8e754ef0d3cfc637d Mon Sep 17 00:00:00 2001 From: Xusong Wang Date: Tue, 5 Oct 2021 10:07:12 -0700 Subject: [PATCH] Provide explicitly versioned NNAPI AIDL utils libs -- HAL. This CL modifies the AIDL utils libraries to be explicitly versioned. Currently, we only have two versions: v1 and "current". Specifically, the following changes are made: - Remove AIDL dependencies from neuralnetworks_utils_hal_common - Create explicitly versioned libs of neuralnetworks_utils_hal_aidl_* This is needed because it is not allowed for a build target to link against multiple versions of the same AIDL lirary. The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2. Bug: 202405342 Test: NNT_static Test: CtsNNAPITestCases Test: VtsHalNeuralnetworksTargetTest Change-Id: I74f1798e80a059949e43e0567d23e884a7f7c92d Merged-In: I74f1798e80a059949e43e0567d23e884a7f7c92d (cherry picked from commit 9763a9537df323c5d4446483d1375057582c6228) --- neuralnetworks/1.0/utils/Android.bp | 2 +- neuralnetworks/1.0/vts/functional/Android.bp | 4 +- neuralnetworks/1.1/utils/Android.bp | 2 +- neuralnetworks/1.1/vts/functional/Android.bp | 2 +- neuralnetworks/1.2/utils/Android.bp | 2 +- neuralnetworks/1.2/vts/functional/Android.bp | 2 +- neuralnetworks/1.3/utils/Android.bp | 2 +- neuralnetworks/1.3/vts/functional/Android.bp | 3 +- neuralnetworks/aidl/utils/Android.bp | 45 +++- .../utils/include/nnapi/hal/aidl/Device.h | 8 +- neuralnetworks/aidl/utils/src/Device.cpp | 13 +- neuralnetworks/aidl/utils/src/Service.cpp | 29 ++- neuralnetworks/aidl/utils/test/DeviceTest.cpp | 203 ++++++++++-------- neuralnetworks/aidl/vts/functional/Android.bp | 5 +- neuralnetworks/utils/common/Android.bp | 3 +- neuralnetworks/utils/service/Android.bp | 7 +- 16 files changed, 204 insertions(+), 128 deletions(-) diff --git a/neuralnetworks/1.0/utils/Android.bp b/neuralnetworks/1.0/utils/Android.bp index 8c51c67421..71a190e495 100644 --- a/neuralnetworks/1.0/utils/Android.bp +++ b/neuralnetworks/1.0/utils/Android.bp @@ -49,7 +49,7 @@ cc_test { static_libs: [ "android.hardware.neuralnetworks@1.0", "libgmock", - "libneuralnetworks_common", + "libneuralnetworks_common_hidl", "neuralnetworks_types", "neuralnetworks_utils_hal_common", "neuralnetworks_utils_hal_1_0", diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp index b33c581a34..ae9ff0a795 100644 --- a/neuralnetworks/1.0/vts/functional/Android.bp +++ b/neuralnetworks/1.0/vts/functional/Android.bp @@ -50,7 +50,7 @@ cc_library_static { "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", - "libneuralnetworks_utils", + "libneuralnetworks_common_hidl", ], header_libs: [ "libneuralnetworks_headers", @@ -81,7 +81,7 @@ cc_test { "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", - "libneuralnetworks_utils", + "libneuralnetworks_common_hidl", ], whole_static_libs: [ "neuralnetworks_generated_V1_0_example", diff --git a/neuralnetworks/1.1/utils/Android.bp b/neuralnetworks/1.1/utils/Android.bp index 737ff58159..478a7426d2 100644 --- a/neuralnetworks/1.1/utils/Android.bp +++ b/neuralnetworks/1.1/utils/Android.bp @@ -52,7 +52,7 @@ cc_test { "android.hardware.neuralnetworks@1.0", "android.hardware.neuralnetworks@1.1", "libgmock", - "libneuralnetworks_common", + "libneuralnetworks_common_hidl", "neuralnetworks_types", "neuralnetworks_utils_hal_common", "neuralnetworks_utils_hal_1_0", diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp index c0011121d6..4c577882a7 100644 --- a/neuralnetworks/1.1/vts/functional/Android.bp +++ b/neuralnetworks/1.1/vts/functional/Android.bp @@ -48,7 +48,7 @@ cc_test { "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", - "libneuralnetworks_utils", + "libneuralnetworks_common_hidl", ], whole_static_libs: [ "neuralnetworks_generated_V1_0_example", diff --git a/neuralnetworks/1.2/utils/Android.bp b/neuralnetworks/1.2/utils/Android.bp index 4eefb0f7dc..2a86a0011c 100644 --- a/neuralnetworks/1.2/utils/Android.bp +++ b/neuralnetworks/1.2/utils/Android.bp @@ -71,7 +71,7 @@ cc_test { "android.hardware.neuralnetworks@1.1", "android.hardware.neuralnetworks@1.2", "libgmock", - "libneuralnetworks_common", + "libneuralnetworks_common_hidl", "neuralnetworks_types", "neuralnetworks_utils_hal_common", "neuralnetworks_utils_hal_1_0", diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp index e313b47e1e..15a5d2fcc8 100644 --- a/neuralnetworks/1.2/vts/functional/Android.bp +++ b/neuralnetworks/1.2/vts/functional/Android.bp @@ -71,7 +71,7 @@ cc_test { "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", - "libneuralnetworks_utils", + "libneuralnetworks_common_hidl", ], whole_static_libs: [ "neuralnetworks_generated_V1_0_example", diff --git a/neuralnetworks/1.3/utils/Android.bp b/neuralnetworks/1.3/utils/Android.bp index 7acb4fcb30..8ae509f4d0 100644 --- a/neuralnetworks/1.3/utils/Android.bp +++ b/neuralnetworks/1.3/utils/Android.bp @@ -69,7 +69,7 @@ cc_test { "android.hardware.neuralnetworks@1.2", "android.hardware.neuralnetworks@1.3", "libgmock", - "libneuralnetworks_common", + "libneuralnetworks_common_hidl", "neuralnetworks_types", "neuralnetworks_utils_hal_common", "neuralnetworks_utils_hal_1_0", diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp index ab0a0184be..ca59cc20ec 100644 --- a/neuralnetworks/1.3/vts/functional/Android.bp +++ b/neuralnetworks/1.3/vts/functional/Android.bp @@ -66,7 +66,6 @@ cc_test { "VtsHalNeuralNetworksV1_0_utils", "VtsHalNeuralNetworksV1_2_utils", "VtsHalNeuralNetworksV1_3_utils", - "android.hardware.neuralnetworks-V2-ndk", "android.hardware.neuralnetworks@1.0", "android.hardware.neuralnetworks@1.1", "android.hardware.neuralnetworks@1.2", @@ -76,7 +75,7 @@ cc_test { "libgmock", "libhidlmemory", "libneuralnetworks_generated_test_harness", - "libneuralnetworks_utils", + "libneuralnetworks_common_hidl", "libsync", ], whole_static_libs: [ diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp index cb67b84bf2..64e0378c55 100644 --- a/neuralnetworks/aidl/utils/Android.bp +++ b/neuralnetworks/aidl/utils/Android.bp @@ -23,8 +23,8 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -cc_library_static { - name: "neuralnetworks_utils_hal_aidl", +cc_defaults { + name: "neuralnetworks_utils_hal_aidl_defaults", defaults: ["neuralnetworks_utils_defaults"], srcs: ["src/*"], local_include_dirs: ["include/nnapi/hal/aidl/"], @@ -38,7 +38,6 @@ cc_library_static { "neuralnetworks_utils_hal_common", ], shared_libs: [ - "android.hardware.neuralnetworks-V2-ndk", "libbinder_ndk", "libhidlbase", ], @@ -49,21 +48,49 @@ cc_library_static { }, } -cc_test { - name: "neuralnetworks_utils_hal_aidl_test", - defaults: ["neuralnetworks_utils_defaults"], - srcs: [ - "test/*.cpp", +cc_library_static { + name: "neuralnetworks_utils_hal_aidl_v1", + defaults: ["neuralnetworks_utils_hal_aidl_defaults"], + shared_libs: [ + "android.hardware.neuralnetworks-V1-ndk", ], +} + +cc_library_static { + name: "neuralnetworks_utils_hal_aidl_v2", + defaults: ["neuralnetworks_utils_hal_aidl_defaults"], + shared_libs: [ + "android.hardware.neuralnetworks-V2-ndk", + ], +} + +// A cc_defaults that includes the latest non-experimental AIDL utilities and other AIDL libraries +// that are commonly used together. Modules that always depend on the latest non-experimental +// AIDL features can include this cc_defaults to avoid managing dependency versions explicitly. +cc_defaults { + name: "neuralnetworks_use_latest_utils_hal_aidl", static_libs: [ "android.hardware.common-V2-ndk", "android.hardware.graphics.common-V2-ndk", "android.hardware.neuralnetworks-V2-ndk", + "neuralnetworks_utils_hal_aidl_v2", + ], +} + +cc_test { + name: "neuralnetworks_utils_hal_aidl_test", + defaults: [ + "neuralnetworks_use_latest_utils_hal_aidl", + "neuralnetworks_utils_defaults", + ], + srcs: [ + "test/*.cpp", + ], + static_libs: [ "libaidlcommonsupport", "libgmock", "libneuralnetworks_common", "neuralnetworks_types", - "neuralnetworks_utils_hal_aidl", "neuralnetworks_utils_hal_common", ], shared_libs: [ diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h index 14576468e1..d558f66b6b 100644 --- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h +++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h @@ -43,11 +43,12 @@ class Device final : public nn::IDevice { public: static nn::GeneralResult> create( - std::string name, std::shared_ptr device); + std::string name, std::shared_ptr device, nn::Version featureLevel); Device(PrivateConstructorTag tag, std::string name, std::string versionString, - nn::DeviceType deviceType, std::vector extensions, - nn::Capabilities capabilities, std::pair numberOfCacheFilesNeeded, + nn::Version featureLevel, nn::DeviceType deviceType, + std::vector extensions, nn::Capabilities capabilities, + std::pair numberOfCacheFilesNeeded, std::shared_ptr device, DeathHandler deathHandler); const std::string& getName() const override; @@ -84,6 +85,7 @@ class Device final : public nn::IDevice { private: const std::string kName; const std::string kVersionString; + const nn::Version kFeatureLevel; const nn::DeviceType kDeviceType; const std::vector kExtensions; const nn::Capabilities kCapabilities; diff --git a/neuralnetworks/aidl/utils/src/Device.cpp b/neuralnetworks/aidl/utils/src/Device.cpp index e80de0be76..5b7ec4ebd7 100644 --- a/neuralnetworks/aidl/utils/src/Device.cpp +++ b/neuralnetworks/aidl/utils/src/Device.cpp @@ -125,7 +125,7 @@ nn::GeneralResult> getNumberOfCacheFilesNeededFrom } // namespace nn::GeneralResult> Device::create( - std::string name, std::shared_ptr device) { + std::string name, std::shared_ptr device, nn::Version featureLevel) { if (name.empty()) { return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT) << "aidl_hal::utils::Device::create must have non-empty name"; @@ -143,18 +143,19 @@ nn::GeneralResult> Device::create( auto deathHandler = NN_TRY(DeathHandler::create(device)); return std::make_shared( - PrivateConstructorTag{}, std::move(name), std::move(versionString), deviceType, - std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded, + PrivateConstructorTag{}, std::move(name), std::move(versionString), featureLevel, + deviceType, std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded, std::move(device), std::move(deathHandler)); } Device::Device(PrivateConstructorTag /*tag*/, std::string name, std::string versionString, - nn::DeviceType deviceType, std::vector extensions, - nn::Capabilities capabilities, + nn::Version featureLevel, nn::DeviceType deviceType, + std::vector extensions, nn::Capabilities capabilities, std::pair numberOfCacheFilesNeeded, std::shared_ptr device, DeathHandler deathHandler) : kName(std::move(name)), kVersionString(std::move(versionString)), + kFeatureLevel(featureLevel), kDeviceType(deviceType), kExtensions(std::move(extensions)), kCapabilities(std::move(capabilities)), @@ -171,7 +172,7 @@ const std::string& Device::getVersionString() const { } nn::Version Device::getFeatureLevel() const { - return nn::Version::ANDROID_S; + return kFeatureLevel; } nn::DeviceType Device::getType() const { diff --git a/neuralnetworks/aidl/utils/src/Service.cpp b/neuralnetworks/aidl/utils/src/Service.cpp index ac182a205e..01772eed53 100644 --- a/neuralnetworks/aidl/utils/src/Service.cpp +++ b/neuralnetworks/aidl/utils/src/Service.cpp @@ -17,6 +17,7 @@ #include "Service.h" #include +#include #include #include #include @@ -28,8 +29,33 @@ #include #include "Device.h" +#include "Utils.h" namespace aidl::android::hardware::neuralnetworks::utils { +namespace { + +// Map the AIDL version of an IDevice to NNAPI canonical feature level. +nn::GeneralResult getAidlServiceFeatureLevel(IDevice* service) { + CHECK(service != nullptr); + int aidlVersion; + const auto ret = service->getInterfaceVersion(&aidlVersion); + HANDLE_ASTATUS(ret) << "getInterfaceVersion failed"; + + // For service AIDL versions greater than or equal to the AIDL library version that the runtime + // was built against, clamp it to the runtime AIDL library version. + aidlVersion = std::min(aidlVersion, IDevice::version); + + // Map stable AIDL versions to canonical versions. + switch (aidlVersion) { + case 1: + return nn::Version::ANDROID_S; + case 2: + return nn::Version::FEATURE_LEVEL_6; + } + return NN_ERROR() << "Unknown AIDL service version: " << aidlVersion; +} + +} // namespace nn::GeneralResult getDevice(const std::string& instanceName) { auto fullName = std::string(IDevice::descriptor) + "/" + instanceName; @@ -55,7 +81,8 @@ nn::GeneralResult getDevice(const std::string& instanceName) { << " returned nullptr"; } ABinderProcess_startThreadPool(); - return Device::create(instanceName, std::move(service)); + const auto featureLevel = NN_TRY(getAidlServiceFeatureLevel(service.get())); + return Device::create(instanceName, std::move(service), featureLevel); }; return hal::utils::ResilientDevice::create(std::move(makeDevice)); diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp index f121acaf7b..79abe1b19b 100644 --- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp +++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp @@ -146,28 +146,45 @@ constexpr auto makeDeadObjectFailure = [] { return ndk::ScopedAStatus::fromStatus(STATUS_DEAD_OBJECT); }; +class DeviceTest : public ::testing::TestWithParam { + protected: + const nn::Version kVersion = GetParam(); +}; + +std::string printDeviceTest(const testing::TestParamInfo& info) { + switch (info.param) { + case nn::Version::ANDROID_S: + return "v1"; + case nn::Version::FEATURE_LEVEL_6: + return "v2"; + default: + LOG(FATAL) << "Invalid AIDL version: " << info.param; + return "invalid"; + } +} + } // namespace -TEST(DeviceTest, invalidName) { +TEST_P(DeviceTest, invalidName) { // run test const auto device = MockDevice::create(); - const auto result = Device::create(kInvalidName, device); + const auto result = Device::create(kInvalidName, device, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::INVALID_ARGUMENT); } -TEST(DeviceTest, invalidDevice) { +TEST_P(DeviceTest, invalidDevice) { // run test - const auto result = Device::create(kName, kInvalidDevice); + const auto result = Device::create(kName, kInvalidDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::INVALID_ARGUMENT); } -TEST(DeviceTest, getVersionStringError) { +TEST_P(DeviceTest, getVersionStringError) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getVersionString(_)) @@ -175,14 +192,14 @@ TEST(DeviceTest, getVersionStringError) { .WillOnce(InvokeWithoutArgs(makeGeneralFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getVersionStringTransportFailure) { +TEST_P(DeviceTest, getVersionStringTransportFailure) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getVersionString(_)) @@ -190,14 +207,14 @@ TEST(DeviceTest, getVersionStringTransportFailure) { .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getVersionStringDeadObject) { +TEST_P(DeviceTest, getVersionStringDeadObject) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getVersionString(_)) @@ -205,27 +222,27 @@ TEST(DeviceTest, getVersionStringDeadObject) { .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, getTypeError) { +TEST_P(DeviceTest, getTypeError) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getType(_)).Times(1).WillOnce(InvokeWithoutArgs(makeGeneralFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getTypeTransportFailure) { +TEST_P(DeviceTest, getTypeTransportFailure) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getType(_)) @@ -233,14 +250,14 @@ TEST(DeviceTest, getTypeTransportFailure) { .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getTypeDeadObject) { +TEST_P(DeviceTest, getTypeDeadObject) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getType(_)) @@ -248,14 +265,14 @@ TEST(DeviceTest, getTypeDeadObject) { .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, getSupportedExtensionsError) { +TEST_P(DeviceTest, getSupportedExtensionsError) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getSupportedExtensions(_)) @@ -263,14 +280,14 @@ TEST(DeviceTest, getSupportedExtensionsError) { .WillOnce(InvokeWithoutArgs(makeGeneralFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getSupportedExtensionsTransportFailure) { +TEST_P(DeviceTest, getSupportedExtensionsTransportFailure) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getSupportedExtensions(_)) @@ -278,14 +295,14 @@ TEST(DeviceTest, getSupportedExtensionsTransportFailure) { .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getSupportedExtensionsDeadObject) { +TEST_P(DeviceTest, getSupportedExtensionsDeadObject) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getSupportedExtensions(_)) @@ -293,20 +310,20 @@ TEST(DeviceTest, getSupportedExtensionsDeadObject) { .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, getNumberOfCacheFilesNeeded) { +TEST_P(DeviceTest, getNumberOfCacheFilesNeeded) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)).Times(1); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_TRUE(result.has_value()); @@ -315,7 +332,7 @@ TEST(DeviceTest, getNumberOfCacheFilesNeeded) { EXPECT_EQ(result.value()->getNumberOfCacheFilesNeeded(), kNumberOfCacheFilesPair); } -TEST(DeviceTest, getNumberOfCacheFilesNeededError) { +TEST_P(DeviceTest, getNumberOfCacheFilesNeededError) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)) @@ -323,14 +340,14 @@ TEST(DeviceTest, getNumberOfCacheFilesNeededError) { .WillOnce(InvokeWithoutArgs(makeGeneralFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, dataCacheFilesExceedsSpecifiedMax) { +TEST_P(DeviceTest, dataCacheFilesExceedsSpecifiedMax) { // setup test const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)) @@ -341,14 +358,14 @@ TEST(DeviceTest, dataCacheFilesExceedsSpecifiedMax) { InvokeWithoutArgs(makeStatusOk))); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, modelCacheFilesExceedsSpecifiedMax) { +TEST_P(DeviceTest, modelCacheFilesExceedsSpecifiedMax) { // setup test const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)) @@ -359,14 +376,14 @@ TEST(DeviceTest, modelCacheFilesExceedsSpecifiedMax) { InvokeWithoutArgs(makeStatusOk))); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getNumberOfCacheFilesNeededTransportFailure) { +TEST_P(DeviceTest, getNumberOfCacheFilesNeededTransportFailure) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)) @@ -374,14 +391,14 @@ TEST(DeviceTest, getNumberOfCacheFilesNeededTransportFailure) { .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getNumberOfCacheFilesNeededDeadObject) { +TEST_P(DeviceTest, getNumberOfCacheFilesNeededDeadObject) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)) @@ -389,14 +406,14 @@ TEST(DeviceTest, getNumberOfCacheFilesNeededDeadObject) { .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, getCapabilitiesError) { +TEST_P(DeviceTest, getCapabilitiesError) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getCapabilities(_)) @@ -404,14 +421,14 @@ TEST(DeviceTest, getCapabilitiesError) { .WillOnce(InvokeWithoutArgs(makeGeneralFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getCapabilitiesTransportFailure) { +TEST_P(DeviceTest, getCapabilitiesTransportFailure) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getCapabilities(_)) @@ -419,14 +436,14 @@ TEST(DeviceTest, getCapabilitiesTransportFailure) { .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getCapabilitiesDeadObject) { +TEST_P(DeviceTest, getCapabilitiesDeadObject) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getCapabilities(_)) @@ -434,17 +451,17 @@ TEST(DeviceTest, getCapabilitiesDeadObject) { .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); // run test - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); // verify result ASSERT_FALSE(result.has_value()); EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, getName) { +TEST_P(DeviceTest, getName) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); // run test const auto& name = device->getName(); @@ -453,19 +470,19 @@ TEST(DeviceTest, getName) { EXPECT_EQ(name, kName); } -TEST(DeviceTest, getFeatureLevel) { +TEST_P(DeviceTest, getFeatureLevel) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); // run test const auto featureLevel = device->getFeatureLevel(); // verify result - EXPECT_EQ(featureLevel, nn::Version::ANDROID_S); + EXPECT_EQ(featureLevel, kVersion); } -TEST(DeviceTest, getCachedData) { +TEST_P(DeviceTest, getCachedData) { // setup call const auto mockDevice = createMockDevice(); EXPECT_CALL(*mockDevice, getVersionString(_)).Times(1); @@ -474,7 +491,7 @@ TEST(DeviceTest, getCachedData) { EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)).Times(1); EXPECT_CALL(*mockDevice, getCapabilities(_)).Times(1); - const auto result = Device::create(kName, mockDevice); + const auto result = Device::create(kName, mockDevice, kVersion); ASSERT_TRUE(result.has_value()) << "Failed with " << result.error().code << ": " << result.error().message; const auto& device = result.value(); @@ -487,10 +504,10 @@ TEST(DeviceTest, getCachedData) { EXPECT_EQ(device->getCapabilities(), device->getCapabilities()); } -TEST(DeviceTest, getSupportedOperations) { +TEST_P(DeviceTest, getSupportedOperations) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, getSupportedOperations(_, _)) .Times(1) .WillOnce(DoAll( @@ -508,10 +525,10 @@ TEST(DeviceTest, getSupportedOperations) { EXPECT_THAT(supportedOperations, Each(testing::IsTrue())); } -TEST(DeviceTest, getSupportedOperationsError) { +TEST_P(DeviceTest, getSupportedOperationsError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, getSupportedOperations(_, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeGeneralFailure)); @@ -524,10 +541,10 @@ TEST(DeviceTest, getSupportedOperationsError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getSupportedOperationsTransportFailure) { +TEST_P(DeviceTest, getSupportedOperationsTransportFailure) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, getSupportedOperations(_, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); @@ -540,10 +557,10 @@ TEST(DeviceTest, getSupportedOperationsTransportFailure) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, getSupportedOperationsDeadObject) { +TEST_P(DeviceTest, getSupportedOperationsDeadObject) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, getSupportedOperations(_, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); @@ -556,10 +573,10 @@ TEST(DeviceTest, getSupportedOperationsDeadObject) { EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, prepareModel) { +TEST_P(DeviceTest, prepareModel) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto mockPreparedModel = MockPreparedModel::create(); EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) .Times(1) @@ -576,10 +593,10 @@ TEST(DeviceTest, prepareModel) { EXPECT_NE(result.value(), nullptr); } -TEST(DeviceTest, prepareModelLaunchError) { +TEST_P(DeviceTest, prepareModelLaunchError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) .Times(1) .WillOnce(Invoke(makePreparedModelReturn(ErrorStatus::GENERAL_FAILURE, @@ -594,10 +611,10 @@ TEST(DeviceTest, prepareModelLaunchError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelReturnError) { +TEST_P(DeviceTest, prepareModelReturnError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) .Times(1) .WillOnce(Invoke(makePreparedModelReturn(ErrorStatus::NONE, @@ -612,10 +629,10 @@ TEST(DeviceTest, prepareModelReturnError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelNullptrError) { +TEST_P(DeviceTest, prepareModelNullptrError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) .Times(1) .WillOnce( @@ -630,10 +647,10 @@ TEST(DeviceTest, prepareModelNullptrError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelTransportFailure) { +TEST_P(DeviceTest, prepareModelTransportFailure) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); @@ -647,10 +664,10 @@ TEST(DeviceTest, prepareModelTransportFailure) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelDeadObject) { +TEST_P(DeviceTest, prepareModelDeadObject) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); @@ -664,10 +681,10 @@ TEST(DeviceTest, prepareModelDeadObject) { EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, prepareModelAsyncCrash) { +TEST_P(DeviceTest, prepareModelAsyncCrash) { // setup test const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { DeathMonitor::serviceDied(device->getDeathMonitor()); return ndk::ScopedAStatus::ok(); @@ -685,10 +702,10 @@ TEST(DeviceTest, prepareModelAsyncCrash) { EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, prepareModelFromCache) { +TEST_P(DeviceTest, prepareModelFromCache) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto mockPreparedModel = MockPreparedModel::create(); EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) .Times(1) @@ -704,10 +721,10 @@ TEST(DeviceTest, prepareModelFromCache) { EXPECT_NE(result.value(), nullptr); } -TEST(DeviceTest, prepareModelFromCacheLaunchError) { +TEST_P(DeviceTest, prepareModelFromCacheLaunchError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) .Times(1) .WillOnce(Invoke(makePreparedModelFromCacheReturn( @@ -721,10 +738,10 @@ TEST(DeviceTest, prepareModelFromCacheLaunchError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelFromCacheReturnError) { +TEST_P(DeviceTest, prepareModelFromCacheReturnError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) .Times(1) .WillOnce(Invoke(makePreparedModelFromCacheReturn( @@ -738,10 +755,10 @@ TEST(DeviceTest, prepareModelFromCacheReturnError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelFromCacheNullptrError) { +TEST_P(DeviceTest, prepareModelFromCacheNullptrError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) .Times(1) .WillOnce(Invoke(makePreparedModelFromCacheReturn(ErrorStatus::NONE, ErrorStatus::NONE, @@ -755,10 +772,10 @@ TEST(DeviceTest, prepareModelFromCacheNullptrError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelFromCacheTransportFailure) { +TEST_P(DeviceTest, prepareModelFromCacheTransportFailure) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); @@ -771,10 +788,10 @@ TEST(DeviceTest, prepareModelFromCacheTransportFailure) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, prepareModelFromCacheDeadObject) { +TEST_P(DeviceTest, prepareModelFromCacheDeadObject) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); @@ -787,10 +804,10 @@ TEST(DeviceTest, prepareModelFromCacheDeadObject) { EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, prepareModelFromCacheAsyncCrash) { +TEST_P(DeviceTest, prepareModelFromCacheAsyncCrash) { // setup test const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto ret = [&device]() { DeathMonitor::serviceDied(device->getDeathMonitor()); return ndk::ScopedAStatus::ok(); @@ -807,10 +824,10 @@ TEST(DeviceTest, prepareModelFromCacheAsyncCrash) { EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } -TEST(DeviceTest, allocate) { +TEST_P(DeviceTest, allocate) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); const auto mockBuffer = DeviceBuffer{.buffer = MockBuffer::create(), .token = 1}; EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _)) .Times(1) @@ -825,10 +842,10 @@ TEST(DeviceTest, allocate) { EXPECT_NE(result.value(), nullptr); } -TEST(DeviceTest, allocateError) { +TEST_P(DeviceTest, allocateError) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeGeneralFailure)); @@ -841,10 +858,10 @@ TEST(DeviceTest, allocateError) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, allocateTransportFailure) { +TEST_P(DeviceTest, allocateTransportFailure) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure)); @@ -857,10 +874,10 @@ TEST(DeviceTest, allocateTransportFailure) { EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE); } -TEST(DeviceTest, allocateDeadObject) { +TEST_P(DeviceTest, allocateDeadObject) { // setup call const auto mockDevice = createMockDevice(); - const auto device = Device::create(kName, mockDevice).value(); + const auto device = Device::create(kName, mockDevice, kVersion).value(); EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _)) .Times(1) .WillOnce(InvokeWithoutArgs(makeDeadObjectFailure)); @@ -873,4 +890,8 @@ TEST(DeviceTest, allocateDeadObject) { EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT); } +INSTANTIATE_TEST_SUITE_P(TestDevice, DeviceTest, + ::testing::Values(nn::Version::ANDROID_S, nn::Version::FEATURE_LEVEL_6), + printDeviceTest); + } // namespace aidl::android::hardware::neuralnetworks::utils diff --git a/neuralnetworks/aidl/vts/functional/Android.bp b/neuralnetworks/aidl/vts/functional/Android.bp index 4dc2ed0f8c..a09cdab36f 100644 --- a/neuralnetworks/aidl/vts/functional/Android.bp +++ b/neuralnetworks/aidl/vts/functional/Android.bp @@ -26,6 +26,7 @@ package { cc_test { name: "VtsHalNeuralnetworksTargetTest", defaults: [ + "neuralnetworks_use_latest_utils_hal_aidl", "neuralnetworks_vts_functional_defaults", "use_libaidlvintf_gtest_helper_static", ], @@ -51,16 +52,14 @@ cc_test { static_libs: [ "android.hardware.common-V2-ndk", "android.hardware.graphics.common-V2-ndk", - "android.hardware.neuralnetworks-V2-ndk", "android.hidl.allocator@1.0", "android.hidl.memory@1.0", "libaidlcommonsupport", "libgmock", "libhidlmemory", + "libneuralnetworks_common", "libneuralnetworks_generated_test_harness", - "libneuralnetworks_utils", "libsync", - "neuralnetworks_utils_hal_aidl", ], whole_static_libs: [ "neuralnetworks_generated_V1_0_example", diff --git a/neuralnetworks/utils/common/Android.bp b/neuralnetworks/utils/common/Android.bp index f88e407923..c0645b0257 100644 --- a/neuralnetworks/utils/common/Android.bp +++ b/neuralnetworks/utils/common/Android.bp @@ -35,7 +35,6 @@ cc_library_static { "neuralnetworks_types", ], shared_libs: [ - "android.hardware.neuralnetworks-V2-ndk", "libhidlbase", "libbinder_ndk", ], @@ -53,7 +52,7 @@ cc_test { static_libs: [ "android.hardware.neuralnetworks@1.0", "libgmock", - "libneuralnetworks_common", + "libneuralnetworks_common_hidl", "neuralnetworks_types", "neuralnetworks_utils_hal_common", ], diff --git a/neuralnetworks/utils/service/Android.bp b/neuralnetworks/utils/service/Android.bp index fbb8679508..3288d05145 100644 --- a/neuralnetworks/utils/service/Android.bp +++ b/neuralnetworks/utils/service/Android.bp @@ -25,7 +25,10 @@ package { cc_library_static { name: "neuralnetworks_utils_hal_service", - defaults: ["neuralnetworks_utils_defaults"], + defaults: [ + "neuralnetworks_use_latest_utils_hal_aidl", + "neuralnetworks_utils_defaults", + ], srcs: ["src/*"], local_include_dirs: ["include/nnapi/hal"], export_include_dirs: ["include"], @@ -35,11 +38,9 @@ cc_library_static { "neuralnetworks_utils_hal_1_1", "neuralnetworks_utils_hal_1_2", "neuralnetworks_utils_hal_1_3", - "neuralnetworks_utils_hal_aidl", "neuralnetworks_utils_hal_common", ], shared_libs: [ - "android.hardware.neuralnetworks-V2-ndk", "android.hardware.neuralnetworks@1.0", "android.hardware.neuralnetworks@1.1", "android.hardware.neuralnetworks@1.2",