Specify NNAPI extension name format

Fix: 125376611
Test: mma
Change-Id: I7d7fcb5d23b4c998c4cd6cd8c9b14ec932876a17
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index 4a8664f..bb5d777 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -4844,7 +4844,7 @@
         /**
          * The extension name.
          *
-         * See {@link Extension::name}.
+         * See {@link Extension::name} for the format specification.
          */
         string name;
 
@@ -5128,7 +5128,11 @@
     /**
      * 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 2b88edd..365a750 100644
--- a/neuralnetworks/1.2/vts/functional/BasicTests.cpp
+++ b/neuralnetworks/1.2/vts/functional/BasicTests.cpp
@@ -64,7 +64,12 @@
                 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";
                 }