From 6148d0f446d331f9e76f3efe6554e3f2cb1907aa Mon Sep 17 00:00:00 2001 From: Slava Shklyaev Date: Tue, 20 Nov 2018 15:29:01 +0000 Subject: [PATCH] Add getSupportedExtensions to NNAPI IDevice Bug: 118603011 Test: mma Change-Id: I5bd1cf2dfd8c4700819d52a87931df2959ef6929 --- neuralnetworks/1.2/IDevice.hal | 15 +++++++++++++++ .../1.2/vts/functional/BasicTests.cpp | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/neuralnetworks/1.2/IDevice.hal b/neuralnetworks/1.2/IDevice.hal index de249b0e08..b9fa38870e 100644 --- a/neuralnetworks/1.2/IDevice.hal +++ b/neuralnetworks/1.2/IDevice.hal @@ -75,6 +75,21 @@ interface IDevice extends @1.1::IDevice { */ getType() generates (ErrorStatus status, DeviceType type); + /** + * Gets information about extensions supported by the driver implementation. + * + * All extension operations and operands must be fully supported for the + * extension to appear in the list of supported extensions. + * + * @return status Error status of the call, must be: + * - NONE if successful + * - DEVICE_UNAVAILABLE if driver is offline or busy + * - GENERAL_FAILURE if there is an unspecified error + * @return extensions A list of supported extensions. + */ + getSupportedExtensions() + generates (ErrorStatus status, vec extensions); + /** * Gets the supported operations in a model. * diff --git a/neuralnetworks/1.2/vts/functional/BasicTests.cpp b/neuralnetworks/1.2/vts/functional/BasicTests.cpp index 8c3ad15e2a..0eec3656e7 100644 --- a/neuralnetworks/1.2/vts/functional/BasicTests.cpp +++ b/neuralnetworks/1.2/vts/functional/BasicTests.cpp @@ -55,6 +55,23 @@ TEST_F(NeuralnetworksHidlTest, GetDeviceTypeTest) { }); EXPECT_TRUE(ret.isOk()); } + +// device supported extensions test +TEST_F(NeuralnetworksHidlTest, GetDeviceSupportedExtensionsTest) { + Return ret = device->getSupportedExtensions( + [](ErrorStatus status, const hidl_vec& extensions) { + EXPECT_EQ(ErrorStatus::NONE, status); + for (auto& extension : extensions) { + std::string extensionName = extension.name; + EXPECT_FALSE(extensionName.empty()); + EXPECT_NE(extensionName.find("."), std::string::npos) + << "Extension name must start with the reverse domain name of the " + "vendor"; + } + }); + EXPECT_TRUE(ret.isOk()); +} + } // namespace functional } // namespace vts } // namespace V1_2