Specify NNAPI extension name format

am: 1d2cd43476

Change-Id: I4881c24997bbd9132f78b493e11dcf9a91bfeeb3
This commit is contained in:
Slava Shklyaev 2019-03-08 12:22:42 -08:00 committed by android-build-merger
commit f6bdc6a983
3 changed files with 12 additions and 3 deletions

View file

@ -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

View file

@ -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;

View file

@ -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";
}