From 1d2cd434761c5fd4875502aff00b9d979b5f8048 Mon Sep 17 00:00:00 2001 From: Slava Shklyaev Date: Mon, 25 Feb 2019 18:23:03 +0000 Subject: [PATCH] Specify NNAPI extension name format Fix: 125376611 Test: mma Change-Id: I7d7fcb5d23b4c998c4cd6cd8c9b14ec932876a17 --- current.txt | 2 +- neuralnetworks/1.2/types.hal | 6 +++++- neuralnetworks/1.2/vts/functional/BasicTests.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/current.txt b/current.txt index b0e6896e89..e57182da75 100644 --- a/current.txt +++ b/current.txt @@ -449,7 +449,7 @@ dd1ec219f5d2e2b33c6c0bcb92e63bbedb36f7c716413462848f6b6ae74fc864 android.hardwar 92714960d1a53fc2ec557302b41c7cc93d2636d8364a44bd0f85be0c92927ff8 android.hardware.neuralnetworks@1.2::IExecutionCallback 83885d366f22ada42c00d8854f0b7e7ba4cf73ddf80bb0d8e168ce132cec57ea android.hardware.neuralnetworks@1.2::IPreparedModel e1c734d1545e1a4ae749ff1dd9704a8e594c59aea7c8363159dc258e93e0df3b android.hardware.neuralnetworks@1.2::IPreparedModelCallback -c752cff336d86762c26dc82e7e037f4962b815b1a068d2319d40a3d068e26f68 android.hardware.neuralnetworks@1.2::types +447dda9186280d119e95937d707e8ae4729af9a922d22a29f069952da269c8c1 android.hardware.neuralnetworks@1.2::types cf7a4ba516a638f9b82a249c91fb603042c2d9ca43fd5aad9cf6c0401ed2a5d7 android.hardware.nfc@1.2::INfc abf98c2ae08bf765db54edc8068e36d52eb558cff6706b6fd7c18c65a1f3fc18 android.hardware.nfc@1.2::types 4cb252dc6372a874aef666b92a6e9529915aa187521a700f0789065c3c702ead android.hardware.power.stats@1.0::IPowerStats diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal index 4a8664f2c8..bb5d7774d2 100644 --- a/neuralnetworks/1.2/types.hal +++ b/neuralnetworks/1.2/types.hal @@ -4844,7 +4844,7 @@ struct Model { /** * The extension name. * - * See {@link Extension::name}. + * See {@link Extension::name} for the format specification. */ string name; @@ -5128,7 +5128,11 @@ struct Extension { /** * The extension name. * + * The name must consist of lowercase latin letters, numbers, periods, and + * underscore signs. The name must contain at least one period. + * * The name must start with the reverse domain name of the vendor. + * * Example: com.google.test_extension */ string name; diff --git a/neuralnetworks/1.2/vts/functional/BasicTests.cpp b/neuralnetworks/1.2/vts/functional/BasicTests.cpp index 2b88edd0f6..365a750fdb 100644 --- a/neuralnetworks/1.2/vts/functional/BasicTests.cpp +++ b/neuralnetworks/1.2/vts/functional/BasicTests.cpp @@ -64,7 +64,12 @@ TEST_F(NeuralnetworksHidlTest, GetDeviceSupportedExtensionsTest) { for (auto& extension : extensions) { std::string extensionName = extension.name; EXPECT_FALSE(extensionName.empty()); - EXPECT_NE(extensionName.find("."), std::string::npos) + for (char c : extensionName) { + EXPECT_TRUE(('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_' || + c == '.') + << "Extension name contains an illegal character: " << c; + } + EXPECT_NE(extensionName.find('.'), std::string::npos) << "Extension name must start with the reverse domain name of the " "vendor"; }