Merge changes from topics \'cam-ndk-hidden-enum\', \'cam-ndk-enum-dco\', \'cam-ndk-hidden-keys\' into nyc-dev
am: b1379bd

* commit 'b1379bdb8fe4ddf1e052bff5e76703f70ec4afab':
  Camera: hide some enum values in NDK
  Camera: codegen NDK metadata enum value documents
  Camera: modify metadata visibility attributes

Change-Id: Ife5a241f013a3f4bac5b41fc2b358005c8cb6a7b
diff --git a/camera/docs/ACameraMetadata.mako b/camera/docs/ACameraMetadata.mako
index 7407603..b65efc1 100644
--- a/camera/docs/ACameraMetadata.mako
+++ b/camera/docs/ACameraMetadata.mako
@@ -20,19 +20,21 @@
 % for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
   % for section in outer_namespace.sections:
     % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == kind_name) and \
-         any_visible(section, kind_name, ('public','hidden') ):
+         any_visible(section, kind_name, ('public','ndk_public') ):
       % for inner_namespace in get_children_by_filtering_kind(section, kind_name, 'namespaces'):
 ## We only support 1 level of inner namespace, i.e. android.a.b and android.a.b.c works, but not android.a.b.c.d
 ## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
-        % for entry in filter_visibility(inner_namespace.merged_entries, ('hidden','public')):
+        % for entry in filter_visibility(inner_namespace.merged_entries, ('public','ndk_public')):
           % if not entry.synthetic:
         case ${ndk(entry.name) | csym}:
+          % else:
+            assert(False),"A synthetic key should not present in NDK!"
           % endif
        % endfor
     % endfor
     % for entry in filter_visibility( \
         get_children_by_filtering_kind(section, kind_name, 'merged_entries'), \
-                                         ('hidden', 'public')):
+                                         ('public','ndk_public')):
       % if not entry.synthetic:
         case ${ndk(entry.name) | csym}:
       % endif
diff --git a/camera/docs/CameraMetadataEnums.mako b/camera/docs/CameraMetadataEnums.mako
index eb4b1b0..b61fcc4 100644
--- a/camera/docs/CameraMetadataEnums.mako
+++ b/camera/docs/CameraMetadataEnums.mako
@@ -35,7 +35,7 @@
 ${value.notes | javadoc(metadata)}\
     % endif
      * @see ${target_class}#${entry.name | jkey_identifier}
-    % if entry.applied_visibility == 'hidden' or value.hidden:
+    % if entry.applied_visibility in ('hidden', 'ndk_public') or value.hidden:
      * @hide
     %endif
     % if value.deprecated:
@@ -52,11 +52,11 @@
 % for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
   % for section in outer_namespace.sections:
     % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \
-         any_visible(section, xml_name, ('public','hidden') ):
+         any_visible(section, xml_name, ('public','hidden', 'ndk_public', 'java_public') ):
       % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'):
 ## We only support 1 level of inner namespace, i.e. android.a.b and android.a.b.c works, but not android.a.b.c.d
 ## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
-        % for entry in filter_visibility(inner_namespace.entries, ('hidden','public')):
+        % for entry in filter_visibility(inner_namespace.entries, ('hidden','public', 'ndk_public', 'java_public')):
           % if entry.enum \
               and not (entry.typedef and entry.typedef.languages.get('java')) \
               and not entry.is_clone():
@@ -66,7 +66,7 @@
       % endfor
       % for entry in filter_visibility( \
           get_children_by_filtering_kind(section, xml_name, 'entries'), \
-                                         ('hidden', 'public')):
+                                         ('hidden', 'public', 'ndk_public', 'java_public')):
         % if entry.enum \
              and not (entry.typedef and entry.typedef.languages.get('java')) \
              and not entry.is_clone():
diff --git a/camera/docs/CameraMetadataKeys.mako b/camera/docs/CameraMetadataKeys.mako
index f9286fa..f9ce15e 100644
--- a/camera/docs/CameraMetadataKeys.mako
+++ b/camera/docs/CameraMetadataKeys.mako
@@ -53,14 +53,14 @@
   % if entry.deprecated:
      * @deprecated
   % endif
-  % if entry.applied_visibility == 'hidden':
+  % if entry.applied_visibility in ('hidden', 'ndk_public'):
      * @hide
   % endif
      */
   % if entry.deprecated:
     @Deprecated
   % endif
-  % if entry.applied_visibility == 'public':
+  % if entry.applied_visibility in ('public', 'java_public'):
     @PublicKey
   % endif
   % if entry.synthetic:
@@ -75,17 +75,17 @@
 % for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
   % for section in outer_namespace.sections:
     % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \
-         any_visible(section, xml_name, ('public','hidden') ):
+         any_visible(section, xml_name, ('public','hidden','ndk_public','java_public') ):
       % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'):
 ## We only support 1 level of inner namespace, i.e. android.a.b and android.a.b.c works, but not android.a.b.c.d
 ## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
-        % for entry in filter_visibility(inner_namespace.merged_entries, ('hidden','public')):
+        % for entry in filter_visibility(inner_namespace.merged_entries, ('hidden','public', 'ndk_public', 'java_public')):
 ${generate_key(entry)}
        % endfor
     % endfor
     % for entry in filter_visibility( \
         get_children_by_filtering_kind(section, xml_name, 'merged_entries'), \
-                                         ('hidden', 'public')):
+                                         ('hidden', 'public', 'ndk_public', 'java_public')):
 ${generate_key(entry)}
     % endfor
     % endif
diff --git a/camera/docs/CaptureResultTest.mako b/camera/docs/CaptureResultTest.mako
index 6fb4905..4878fd7 100644
--- a/camera/docs/CaptureResultTest.mako
+++ b/camera/docs/CaptureResultTest.mako
@@ -24,7 +24,7 @@
         ArrayList<CaptureResult.Key<?>> resultKeys = new ArrayList<CaptureResult.Key<?>>();
 % for sec in find_all_sections(metadata):
   % for entry in find_unique_entries(sec):
-    % if entry.kind == 'dynamic' and entry.visibility == "public":
+    % if entry.kind == 'dynamic' and entry.visibility in ("public", "java_public"):
         resultKeys.add(CaptureResult.${jkey_identifier(entry.name)});
     % endif
   % endfor
diff --git a/camera/docs/camera_device_info.mako b/camera/docs/camera_device_info.mako
index 2227adb..92b7ef2 100644
--- a/camera/docs/camera_device_info.mako
+++ b/camera/docs/camera_device_info.mako
@@ -84,7 +84,7 @@
   idx = section_idx * pow(2,16)
 %>\
 % for entry in find_unique_entries(sec):
-% if entry.kind == 'static' and entry.visibility == "public":
+% if entry.kind == 'static' and entry.visibility in ("public", "java_public"):
     ${protobuf_type(entry)} ${protobuf_name(entry)} = ${idx};
 <%\
   idx += 1
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index 6ef2b94..4ae843c 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -4902,7 +4902,7 @@
                 <span class="entry_type_array">
                   3
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -4950,7 +4950,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -5010,7 +5010,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -5069,7 +5069,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -10466,7 +10466,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">byte</span>
 
-              <span class="entry_type_visibility"> [public as location]</span>
+              <span class="entry_type_visibility"> [java_public as location]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -10519,7 +10519,7 @@
                 <span class="entry_type_array">
                   3
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -10563,7 +10563,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">byte</span>
 
-              <span class="entry_type_visibility"> [hidden as string]</span>
+              <span class="entry_type_visibility"> [ndk_public as string]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -10606,7 +10606,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int64</span>
 
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -11078,7 +11078,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">byte</span>
 
-              <span class="entry_type_visibility"> [public as location]</span>
+              <span class="entry_type_visibility"> [java_public as location]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -11131,7 +11131,7 @@
                 <span class="entry_type_array">
                   3
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -11175,7 +11175,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">byte</span>
 
-              <span class="entry_type_visibility"> [hidden as string]</span>
+              <span class="entry_type_visibility"> [ndk_public as string]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -11218,7 +11218,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int64</span>
 
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -12317,7 +12317,7 @@
                 <span class="entry_type_array">
                   2
                 </span>
-              <span class="entry_type_visibility"> [hidden as size]</span>
+              <span class="entry_type_visibility"> [ndk_public as size]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -14926,7 +14926,7 @@
                 <span class="entry_type_array">
                   3
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -15000,7 +15000,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -15063,7 +15063,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -15131,7 +15131,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -15914,7 +15914,7 @@
                 <span class="entry_type_array">
                   n
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -15987,7 +15987,7 @@
                 <span class="entry_type_array">
                   n
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -16068,7 +16068,7 @@
                 <span class="entry_type_array">
                   n
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -17374,7 +17374,7 @@
                 <span class="entry_type_array">
                   n x 4
                 </span>
-              <span class="entry_type_visibility"> [hidden as streamConfiguration]</span>
+              <span class="entry_type_visibility"> [ndk_public as streamConfiguration]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -17561,7 +17561,7 @@
                 <span class="entry_type_array">
                   4 x n
                 </span>
-              <span class="entry_type_visibility"> [hidden as streamConfigurationDuration]</span>
+              <span class="entry_type_visibility"> [ndk_public as streamConfigurationDuration]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -17627,7 +17627,7 @@
                 <span class="entry_type_array">
                   4 x n
                 </span>
-              <span class="entry_type_visibility"> [hidden as streamConfigurationDuration]</span>
+              <span class="entry_type_visibility"> [ndk_public as streamConfigurationDuration]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -17743,7 +17743,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public as streamConfigurationMap]</span>
+              <span class="entry_type_visibility"> [java_public as streamConfigurationMap]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -23015,7 +23015,7 @@
                 <span class="entry_type_array">
                   n
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -23071,7 +23071,7 @@
                 <span class="entry_type_array">
                   n x 6
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -23128,7 +23128,7 @@
                 <span class="entry_type_array">
                   n x 4
                 </span>
-              <span class="entry_type_visibility"> [hidden as rectangle]</span>
+              <span class="entry_type_visibility"> [ndk_public as rectangle]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -23185,7 +23185,7 @@
                 <span class="entry_type_array">
                   n
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -23249,7 +23249,7 @@
                 <span class="entry_type_array">
                   n
                 </span>
-              <span class="entry_type_visibility"> [public as face]</span>
+              <span class="entry_type_visibility"> [java_public as face]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -23595,7 +23595,7 @@
                 <span class="entry_type_array">
                   4 x n x m
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -24149,7 +24149,7 @@
                 <span class="entry_type_array">
                   n x 2
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -24202,7 +24202,7 @@
                 <span class="entry_type_array">
                   n x 2
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -24255,7 +24255,7 @@
                 <span class="entry_type_array">
                   n x 2
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -24356,7 +24356,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">float</span>
 
-              <span class="entry_type_visibility"> [public as tonemapCurve]</span>
+              <span class="entry_type_visibility"> [java_public as tonemapCurve]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -24863,7 +24863,7 @@
                 <span class="entry_type_array">
                   n x 2
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -24916,7 +24916,7 @@
                 <span class="entry_type_array">
                   n x 2
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -24969,7 +24969,7 @@
                 <span class="entry_type_array">
                   n x 2
                 </span>
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[full] </span>
@@ -25070,7 +25070,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">float</span>
 
-              <span class="entry_type_visibility"> [public as tonemapCurve]</span>
+              <span class="entry_type_visibility"> [java_public as tonemapCurve]</span>
 
               <span class="entry_type_synthetic">[synthetic] </span>
 
@@ -26111,7 +26111,7 @@
             <td class="entry_type">
                 <span class="entry_type_name entry_type_name_enum">int64</span>
 
-              <span class="entry_type_visibility"> [hidden]</span>
+              <span class="entry_type_visibility"> [ndk_public]</span>
 
 
               <span class="entry_type_hwlevel">[legacy] </span>
@@ -26423,7 +26423,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">float</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
 
               <span class="entry_type_hwlevel">[limited] </span>
@@ -26531,7 +26531,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">float</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
 
               <span class="entry_type_hwlevel">[limited] </span>
@@ -26639,7 +26639,7 @@
             <td class="entry_type">
                 <span class="entry_type_name">int32</span>
 
-              <span class="entry_type_visibility"> [public]</span>
+              <span class="entry_type_visibility"> [java_public]</span>
 
 
               <span class="entry_type_hwlevel">[limited] </span>
@@ -26797,7 +26797,7 @@
                 <span class="entry_type_array">
                   n x 4
                 </span>
-              <span class="entry_type_visibility"> [hidden as streamConfiguration]</span>
+              <span class="entry_type_visibility"> [ndk_public as streamConfiguration]</span>
 
 
               <span class="entry_type_hwlevel">[limited] </span>
@@ -26870,7 +26870,7 @@
                 <span class="entry_type_array">
                   4 x n
                 </span>
-              <span class="entry_type_visibility"> [hidden as streamConfigurationDuration]</span>
+              <span class="entry_type_visibility"> [ndk_public as streamConfigurationDuration]</span>
 
 
               <span class="entry_type_hwlevel">[limited] </span>
@@ -26935,7 +26935,7 @@
                 <span class="entry_type_array">
                   4 x n
                 </span>
-              <span class="entry_type_visibility"> [hidden as streamConfigurationDuration]</span>
+              <span class="entry_type_visibility"> [ndk_public as streamConfigurationDuration]</span>
 
 
               <span class="entry_type_hwlevel">[limited] </span>
diff --git a/camera/docs/metadata_helpers.py b/camera/docs/metadata_helpers.py
index 0e5855f..3ebaf26 100644
--- a/camera/docs/metadata_helpers.py
+++ b/camera/docs/metadata_helpers.py
@@ -834,7 +834,7 @@
     # Convert metadata entry "android.x.y.z" to form
     # "{@link CaptureRequest#X_Y_Z android.x.y.z}"
     def javadoc_crossref_filter(node):
-      if node.applied_visibility == 'public':
+      if node.applied_visibility in ('public', 'java_public'):
         return '{@link %s#%s %s}' % (kind_mapping[node.kind],
                                      jkey_identifier(node.name),
                                      node.name)
@@ -844,7 +844,7 @@
     # For each public tag "android.x.y.z" referenced, add a
     # "@see CaptureRequest#X_Y_Z"
     def javadoc_crossref_see_filter(node_set):
-      node_set = (x for x in node_set if x.applied_visibility == 'public')
+      node_set = (x for x in node_set if x.applied_visibility in ('public', 'java_public'))
 
       text = '\n'
       for node in node_set:
@@ -868,6 +868,81 @@
 
   return javadoc_formatter
 
+def ndkdoc(metadata, indent = 4):
+  """
+  Returns a function to format a markdown syntax text block as a
+  NDK camera API C/C++ comment section, given a set of metadata
+
+  Args:
+    metadata: A Metadata instance, representing the the top-level root
+      of the metadata for cross-referencing
+    indent: baseline level of indentation for comment block
+  Returns:
+    A function that transforms a String text block as follows:
+    - Indent and * for insertion into a comment block
+    - Trailing whitespace removed
+    - Entire body rendered via markdown
+    - All tag names converted to appropriate NDK tag name for each tag
+
+  Example:
+    "This is a comment for NDK\n" +
+    "     with multiple lines, that should be   \n" +
+    "     formatted better\n" +
+    "\n" +
+    "    That covers multiple lines as well\n"
+    "    And references android.control.mode\n"
+
+    transforms to
+    "    * This is a comment for NDK\n" +
+    "    * with multiple lines, that should be\n" +
+    "    * formatted better\n" +
+    "    * That covers multiple lines as well\n" +
+    "    * and references ACAMERA_CONTROL_MODE\n" +
+    "    *\n" +
+    "    * @see ACAMERA_CONTROL_MODE\n"
+  """
+  def ndkdoc_formatter(text):
+    # render with markdown => HTML
+    ndktext = md(text, JAVADOC_IMAGE_SRC_METADATA)
+
+    # Convert metadata entry "android.x.y.z" to form
+    # NDK tag format of "ACAMERA_X_Y_Z"
+    def ndkdoc_crossref_filter(node):
+      if node.applied_ndk_visible == 'true':
+        return csym(ndk(node.name))
+      else:
+        return node.name
+
+    # For each public tag "android.x.y.z" referenced, add a
+    # "@see ACAMERA_X_Y_Z"
+    def ndkdoc_crossref_see_filter(node_set):
+      node_set = (x for x in node_set if x.applied_ndk_visible == 'true')
+
+      text = '\n'
+      for node in node_set:
+        text = text + '\n@see %s' % (csym(ndk(node.name)))
+
+      return text if text != '\n' else ''
+
+    ndktext = filter_tags(ndktext, metadata, ndkdoc_crossref_filter, ndkdoc_crossref_see_filter)
+
+    ndktext = ndk_replace_tag_wildcards(ndktext, metadata)
+
+    comment_prefix = " " * indent + " * ";
+
+    def line_filter(line):
+      # Indent each line
+      # Add ' * ' to it for stylistic reasons
+      # Strip right side of trailing whitespace
+      return (comment_prefix + line).rstrip()
+
+    # Process each line with above filter
+    ndktext = "\n".join(line_filter(i) for i in ndktext.split("\n")) + "\n"
+
+    return ndktext
+
+  return ndkdoc_formatter
+
 def dedent(text):
   """
   Remove all common indentation from every line but the 0th.
@@ -1040,6 +1115,28 @@
     else:
       return text
 
+def ndk_replace_tag_wildcards(text, metadata):
+    """
+    Find all references to tags in the form android.xxx.* or android.xxx.yyy.*
+    in the provided text, and replace them by NDK format of "ACAMERA_XXX_*" or
+    "ACAMERA_XXX_YYY_*"
+
+    Args:
+      text: A string representing a block of text destined for output
+      metadata: A Metadata instance, the root of the metadata properties tree
+    """
+    tag_match = r"android\.([a-zA-Z0-9\n]+)\.\*"
+    tag_match_2 = r"android\.([a-zA-Z0-9\n]+)\.([a-zA-Z0-9\n]+)\*"
+
+    def filter_sub(match):
+      return "ACAMERA_" + match.group(1).upper() + "_*"
+    def filter_sub_2(match):
+      return "ACAMERA_" + match.group(1).upper() + match.group(2).upper() + "_*"
+
+    text = re.sub(tag_match, filter_sub, text)
+    text = re.sub(tag_match_2, filter_sub_2, text)
+    return text
+
 def filter_links(text, filter_function, summary_function = None):
     """
     Find all references to tags in the form {@link xxx#yyy [zzz]} in the
@@ -1133,6 +1230,18 @@
   """
   return (e for e in entries if not e.synthetic)
 
+def filter_ndk_visible(entries):
+  """
+  Filter the given entries by removing those that are not NDK visible.
+
+  Args:
+    entries: An iterable of Entry nodes
+
+  Yields:
+    An iterable of Entry nodes
+  """
+  return (e for e in entries if e.applied_ndk_visible == 'true')
+
 def wbr(text):
   """
   Insert word break hints for the browser in the form of <wbr> HTML tags.
diff --git a/camera/docs/metadata_model.py b/camera/docs/metadata_model.py
index 315c97c..84edeb7 100644
--- a/camera/docs/metadata_model.py
+++ b/camera/docs/metadata_model.py
@@ -946,15 +946,18 @@
     deprecated: A boolean, True if the enum should be deprecated.
     optional: A boolean
     hidden: A boolean, True if the enum should be hidden.
+    ndk_hidden: A boolean, True if the enum should be hidden in NDK
     notes: A string describing the notes, or None.
     parent: An edge to the parent, always an Enum instance.
   """
-  def __init__(self, name, parent, id=None, deprecated=False, optional=False, hidden=False, notes=None):
+  def __init__(self, name, parent,
+      id=None, deprecated=False, optional=False, hidden=False, notes=None, ndk_hidden=False):
     self._name = name                    # str, e.g. 'ON' or 'OFF'
     self._id = id                        # int, e.g. '0'
     self._deprecated = deprecated        # bool
     self._optional = optional            # bool
     self._hidden = hidden                # bool
+    self._ndk_hidden = ndk_hidden        # bool
     self._notes = notes                  # None or str
     self._parent = parent
 
@@ -975,6 +978,10 @@
     return self._hidden
 
   @property
+  def ndk_hidden(self):
+    return self._ndk_hidden
+
+  @property
   def notes(self):
     return self._notes
 
@@ -991,10 +998,11 @@
     has_values_with_id: A boolean representing if any of the children have a
         non-empty id property.
   """
-  def __init__(self, parent, values, ids={}, deprecateds=[], optionals=[], hiddens=[], notes={}):
+  def __init__(self, parent, values, ids={}, deprecateds=[],
+      optionals=[], hiddens=[], notes={}, ndk_hiddens=[]):
     self._values =                                                             \
       [ EnumValue(val, self, ids.get(val), val in deprecateds, val in optionals, val in hiddens,  \
-                  notes.get(val))                                              \
+                  notes.get(val), val in ndk_hiddens)                                              \
         for val in values ]
 
     self._parent = parent
@@ -1031,6 +1039,9 @@
                 public entries are visible in the Android SDK.
     applied_visibility: As visibility, but always valid, defaulting to 'system'
                         if no visibility is given for an entry.
+    applied_ndk_visible: Always valid. Default is 'false'.
+                         Set to 'true' when the visibility implied entry is visible
+                         in NDK.
     synthetic: The C-level visibility of this entry ('false', 'true').
                Synthetic entries will not be generated into the native metadata
                list of entries (in C code). In general a synthetic entry is
@@ -1137,6 +1148,12 @@
     return self._visibility or 'system'
 
   @property
+  def applied_ndk_visible(self):
+    if self._visibility in ("public", "ndk_public"):
+      return "true"
+    return "false"
+
+  @property
   def synthetic(self):
     return self._synthetic
 
@@ -1246,6 +1263,7 @@
     enum_deprecateds = kwargs.get('enum_deprecateds')
     enum_optionals = kwargs.get('enum_optionals')
     enum_hiddens = kwargs.get('enum_hiddens')
+    enum_ndk_hiddens = kwargs.get('enum_ndk_hiddens')
     enum_notes = kwargs.get('enum_notes')  # { value => notes }
     enum_ids = kwargs.get('enum_ids')  # { value => notes }
     self._tuple_values = kwargs.get('tuple_values')
@@ -1265,7 +1283,7 @@
 
     if kwargs.get('enum', False):
       self._enum = Enum(self, enum_values, enum_ids, enum_deprecateds, enum_optionals,
-                        enum_hiddens, enum_notes)
+                        enum_hiddens, enum_notes, enum_ndk_hiddens)
     else:
       self._enum = None
 
@@ -1274,6 +1292,7 @@
     self._hwlevel = kwargs.get('hwlevel')
     self._deprecated = kwargs.get('deprecated', False)
     self._optional = kwargs.get('optional')
+    self._ndk_visible = kwargs.get('ndk_visible')
 
     self._property_keys = kwargs
 
@@ -1470,6 +1489,7 @@
                     'type',
                     'type_notes',
                     'visibility',
+                    'ndk_visible',
                     'synthetic',
                     'hwlevel',
                     'deprecated',
diff --git a/camera/docs/metadata_parser_xml.py b/camera/docs/metadata_parser_xml.py
index 57be227..6759306 100755
--- a/camera/docs/metadata_parser_xml.py
+++ b/camera/docs/metadata_parser_xml.py
@@ -208,6 +208,7 @@
       enum_deprecateds = []
       enum_optionals = []
       enum_hiddens = []
+      enum_ndk_hiddens = []
       enum_notes = {}
       enum_ids = {}
       for value in entry.enum.find_all('value'):
@@ -224,6 +225,9 @@
         if value.attrs.get('hidden', 'false') == 'true':
           enum_hiddens.append(value_body)
 
+        if value.attrs.get('ndk_hidden', 'false') == 'true':
+          enum_ndk_hiddens.append(value_body)
+
         notes = value.find('notes')
         if notes is not None:
           enum_notes[value_body] = notes.string
@@ -235,6 +239,7 @@
       d['enum_deprecateds'] = enum_deprecateds
       d['enum_optionals'] = enum_optionals
       d['enum_hiddens'] = enum_hiddens
+      d['enum_ndk_hiddens'] = enum_ndk_hiddens
       d['enum_notes'] = enum_notes
       d['enum_ids'] = enum_ids
       d['enum'] = True
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index bd1ab1c..4fe531f 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -2095,7 +2095,7 @@
           </details>
           <tag id="BC" />
         </entry>
-        <entry name="maxRegions" type="int32" visibility="hidden"
+        <entry name="maxRegions" type="int32" visibility="ndk_public"
                container="array" hwlevel="legacy">
           <array>
             <size>3</size>
@@ -2113,7 +2113,7 @@
           `(AE, AWB, AF)`.</range>
           <tag id="BC" />
         </entry>
-        <entry name="maxRegionsAe" type="int32" visibility="public"
+        <entry name="maxRegionsAe" type="int32" visibility="java_public"
                synthetic="true" hwlevel="legacy">
           <description>
           The maximum number of metering regions that can be used by the auto-exposure (AE)
@@ -2130,7 +2130,7 @@
           maxRegions to have this entry be automatically populated.
           </hal_details>
         </entry>
-        <entry name="maxRegionsAwb" type="int32" visibility="public"
+        <entry name="maxRegionsAwb" type="int32" visibility="java_public"
                synthetic="true" hwlevel="legacy">
           <description>
           The maximum number of metering regions that can be used by the auto-white balance (AWB)
@@ -2146,7 +2146,7 @@
           maxRegions to have this entry be automatically populated.
           </hal_details>
         </entry>
-        <entry name="maxRegionsAf" type="int32" visibility="public"
+        <entry name="maxRegionsAf" type="int32" visibility="java_public"
                synthetic="true" hwlevel="legacy">
           <description>
           The maximum number of metering regions that can be used by the auto-focus (AF) routine.
@@ -3151,7 +3151,7 @@
     </section>
     <section name="jpeg">
       <controls>
-        <entry name="gpsLocation" type="byte" visibility="public" synthetic="true"
+        <entry name="gpsLocation" type="byte" visibility="java_public" synthetic="true"
         typedef="location" hwlevel="legacy">
           <description>
           A location object to use when generating image GPS metadata.
@@ -3162,7 +3162,7 @@
           viewed by anyone who receives the JPEG image.
           </details>
         </entry>
-        <entry name="gpsCoordinates" type="double" visibility="hidden"
+        <entry name="gpsCoordinates" type="double" visibility="ndk_public"
         type_notes="latitude, longitude, altitude. First two in degrees, the third in meters"
         container="array" hwlevel="legacy">
           <array>
@@ -3173,14 +3173,14 @@
           <range>(-180 - 180], [-90,90], [-inf, inf]</range>
           <tag id="BC" />
         </entry>
-        <entry name="gpsProcessingMethod" type="byte" visibility="hidden"
+        <entry name="gpsProcessingMethod" type="byte" visibility="ndk_public"
                typedef="string" hwlevel="legacy">
           <description>32 characters describing GPS algorithm to
           include in EXIF.</description>
           <units>UTF-8 null-terminated string</units>
           <tag id="BC" />
         </entry>
-        <entry name="gpsTimestamp" type="int64" visibility="hidden" hwlevel="legacy">
+        <entry name="gpsTimestamp" type="int64" visibility="ndk_public" hwlevel="legacy">
           <description>Time GPS fix was made to include in
           EXIF.</description>
           <units>UTC in seconds since January 1, 1970</units>
@@ -3588,7 +3588,7 @@
             the MANUAL_SENSOR capability.</hal_details>
             <tag id="V1" />
           </entry>
-          <entry name="shadingMapSize" type="int32" visibility="hidden"
+          <entry name="shadingMapSize" type="int32" visibility="ndk_public"
                  type_notes="width and height (N, M) of lens shading map provided by the camera device."
                  container="array" typedef="size" hwlevel="full">
             <array>
@@ -4297,8 +4297,8 @@
         </entry>
       </controls>
       <static>
-        <entry name="maxNumOutputStreams" type="int32" visibility="hidden"
-        container="array" hwlevel="legacy">
+        <entry name="maxNumOutputStreams" type="int32" visibility="ndk_public"
+               container="array" hwlevel="legacy">
           <array>
             <size>3</size>
           </array>
@@ -4340,7 +4340,8 @@
           </details>
           <tag id="BC" />
         </entry>
-        <entry name="maxNumOutputRaw" type="int32" visibility="public" synthetic="true" hwlevel="legacy">
+        <entry name="maxNumOutputRaw" type="int32" visibility="java_public" synthetic="true"
+               hwlevel="legacy">
           <description>The maximum numbers of different types of output streams
           that can be configured and used simultaneously by a camera device
           for any `RAW` formats.
@@ -4367,7 +4368,8 @@
           never support raw streams.
           </details>
         </entry>
-        <entry name="maxNumOutputProc" type="int32" visibility="public" synthetic="true" hwlevel="legacy">
+        <entry name="maxNumOutputProc" type="int32" visibility="java_public" synthetic="true"
+               hwlevel="legacy">
           <description>The maximum numbers of different types of output streams
           that can be configured and used simultaneously by a camera device
           for any processed (but not-stalling) formats.
@@ -4402,7 +4404,8 @@
           LEGACY devices will support at least 2 processing/non-stalling streams.
           </details>
         </entry>
-        <entry name="maxNumOutputProcStalling" type="int32" visibility="public" synthetic="true" hwlevel="legacy">
+        <entry name="maxNumOutputProcStalling" type="int32" visibility="java_public" synthetic="true"
+               hwlevel="legacy">
           <description>The maximum numbers of different types of output streams
           that can be configured and used simultaneously by a camera device
           for any processed (and stalling) formats.
@@ -4664,7 +4667,7 @@
                 by the camera device.
               </notes>
             </value>
-            <value optional="true">PRIVATE_REPROCESSING
+            <value optional="true" ndk_hidden="true">PRIVATE_REPROCESSING
               <notes>
               The camera device supports the Zero Shutter Lag reprocessing use case.
 
@@ -4759,7 +4762,7 @@
               consistent image output.
               </notes>
             </value>
-            <value optional="true">YUV_REPROCESSING
+            <value optional="true" ndk_hidden="true">YUV_REPROCESSING
               <notes>
               The camera device supports the YUV_420_888 reprocessing use case, similar as
               PRIVATE_REPROCESSING, This capability requires the camera device to support the
@@ -4833,7 +4836,7 @@
               rate, including depth stall time.
               </notes>
             </value>
-            <value optional="true">CONSTRAINED_HIGH_SPEED_VIDEO
+            <value optional="true" ndk_hidden="true">CONSTRAINED_HIGH_SPEED_VIDEO
               <notes>
               The device supports constrained high speed video recording (frame rate >=120fps)
               use case. The camera device will support high speed capture session created by
@@ -4981,8 +4984,8 @@
           DEPTH).
           </hal_details>
         </entry>
-        <entry name="availableRequestKeys" type="int32" visibility="hidden"
-          container="array" hwlevel="legacy">
+        <entry name="availableRequestKeys" type="int32" visibility="ndk_public"
+               container="array" hwlevel="legacy">
           <array>
             <size>n</size>
           </array>
@@ -5013,8 +5016,8 @@
           {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureRequestKeys}.
           </hal_details>
         </entry>
-        <entry name="availableResultKeys" type="int32" visibility="hidden"
-          container="array" hwlevel="legacy">
+        <entry name="availableResultKeys" type="int32" visibility="ndk_public"
+               container="array" hwlevel="legacy">
           <array>
             <size>n</size>
           </array>
@@ -5056,8 +5059,8 @@
           android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys}.
           </hal_details>
         </entry>
-        <entry name="availableCharacteristicsKeys" type="int32" visibility="hidden"
-          container="array" hwlevel="legacy">
+        <entry name="availableCharacteristicsKeys" type="int32" visibility="ndk_public"
+               container="array" hwlevel="legacy">
           <array>
             <size>n</size>
           </array>
@@ -5518,9 +5521,8 @@
           </hal_details>
           <tag id="REPROC" />
         </entry>
-        <entry name="availableStreamConfigurations" type="int32" visibility="hidden"
-          enum="true" container="array"
-          typedef="streamConfiguration" hwlevel="legacy">
+        <entry name="availableStreamConfigurations" type="int32" visibility="ndk_public"
+               enum="true" container="array" typedef="streamConfiguration" hwlevel="legacy">
           <array>
             <size>n</size>
             <size>4</size>
@@ -5620,9 +5622,8 @@
           * available[Processed,Raw,Jpeg]Sizes
           </hal_details>
         </entry>
-        <entry name="availableMinFrameDurations" type="int64" visibility="hidden"
-               container="array"
-               typedef="streamConfigurationDuration" hwlevel="legacy">
+        <entry name="availableMinFrameDurations" type="int64" visibility="ndk_public"
+               container="array" typedef="streamConfigurationDuration" hwlevel="legacy">
           <array>
             <size>4</size>
             <size>n</size>
@@ -5651,7 +5652,7 @@
           </details>
           <tag id="V1" />
         </entry>
-        <entry name="availableStallDurations" type="int64" visibility="hidden"
+        <entry name="availableStallDurations" type="int64" visibility="ndk_public"
                container="array" typedef="streamConfigurationDuration" hwlevel="legacy">
           <array>
             <size>4</size>
@@ -5735,7 +5736,7 @@
           </hal_details>
           <tag id="V1" />
         </entry>
-        <entry name="streamConfigurationMap" type="int32" visibility="public"
+        <entry name="streamConfigurationMap" type="int32" visibility="java_public"
                synthetic="true" typedef="streamConfigurationMap"
                hwlevel="legacy">
           <description>The available stream configurations that this
@@ -7512,8 +7513,8 @@
       <dynamic>
         <clone entry="android.statistics.faceDetectMode"
                kind="controls"></clone>
-        <entry name="faceIds" type="int32" visibility="hidden" container="array"
-               hwlevel="legacy">
+        <entry name="faceIds" type="int32" visibility="ndk_public"
+               container="array" hwlevel="legacy">
           <array>
             <size>n</size>
           </array>
@@ -7526,9 +7527,9 @@
           Only available if android.statistics.faceDetectMode == FULL</details>
           <tag id="BC" />
         </entry>
-        <entry name="faceLandmarks" type="int32" visibility="hidden"
-        type_notes="(leftEyeX, leftEyeY, rightEyeX, rightEyeY, mouthX, mouthY)"
-        container="array" hwlevel="legacy">
+        <entry name="faceLandmarks" type="int32" visibility="ndk_public"
+               type_notes="(leftEyeX, leftEyeY, rightEyeX, rightEyeY, mouthX, mouthY)"
+               container="array" hwlevel="legacy">
           <array>
             <size>n</size>
             <size>6</size>
@@ -7542,9 +7543,9 @@
             Only available if android.statistics.faceDetectMode == FULL</details>
           <tag id="BC" />
         </entry>
-        <entry name="faceRectangles" type="int32" visibility="hidden"
-        type_notes="(xmin, ymin, xmax, ymax). (0,0) is top-left of active pixel area"
-        container="array" typedef="rectangle" hwlevel="legacy">
+        <entry name="faceRectangles" type="int32" visibility="ndk_public"
+               type_notes="(xmin, ymin, xmax, ymax). (0,0) is top-left of active pixel area"
+               container="array" typedef="rectangle" hwlevel="legacy">
           <array>
             <size>n</size>
             <size>4</size>
@@ -7558,8 +7559,8 @@
             Only available if android.statistics.faceDetectMode != OFF</details>
           <tag id="BC" />
         </entry>
-        <entry name="faceScores" type="byte" visibility="hidden" container="array"
-               hwlevel="legacy">
+        <entry name="faceScores" type="byte" visibility="ndk_public"
+               container="array" hwlevel="legacy">
           <array>
             <size>n</size>
           </array>
@@ -7573,7 +7574,7 @@
           all times is illegal).</hal_details>
           <tag id="BC" />
         </entry>
-        <entry name="faces" type="int32" visibility="public" synthetic="true"
+        <entry name="faces" type="int32" visibility="java_public" synthetic="true"
                container="array" typedef="face" hwlevel="legacy">
           <array>
             <size>n</size>
@@ -7670,7 +7671,7 @@
           ![Image of a uniform white wall (inverse shading map)](android.statistics.lensShadingMap/inv_shading.png)
           </details>
         </entry>
-        <entry name="lensShadingMap" type="float" visibility="hidden"
+        <entry name="lensShadingMap" type="float" visibility="ndk_public"
                type_notes="2D array of float gain factors per channel to correct lens shading"
                container="array" hwlevel="full">
           <array>
@@ -7907,7 +7908,7 @@
     </section>
     <section name="tonemap">
       <controls>
-        <entry name="curveBlue" type="float" visibility="hidden"
+        <entry name="curveBlue" type="float" visibility="ndk_public"
         type_notes="1D array of float pairs (P_IN, P_OUT). The maximum number of pairs is specified by android.tonemap.maxCurvePoints."
         container="array" hwlevel="full">
           <array>
@@ -7919,7 +7920,7 @@
           CONTRAST_CURVE.</description>
           <details>See android.tonemap.curveRed for more details.</details>
         </entry>
-        <entry name="curveGreen" type="float" visibility="hidden"
+        <entry name="curveGreen" type="float" visibility="ndk_public"
         type_notes="1D array of float pairs (P_IN, P_OUT). The maximum number of pairs is specified by android.tonemap.maxCurvePoints."
         container="array" hwlevel="full">
           <array>
@@ -7931,7 +7932,7 @@
           CONTRAST_CURVE.</description>
           <details>See android.tonemap.curveRed for more details.</details>
         </entry>
-        <entry name="curveRed" type="float" visibility="hidden"
+        <entry name="curveRed" type="float" visibility="ndk_public"
         type_notes="1D array of float pairs (P_IN, P_OUT). The maximum number of pairs is specified by android.tonemap.maxCurvePoints."
         container="array" hwlevel="full">
           <array>
@@ -8006,7 +8007,7 @@
           control points used as are available.
         </hal_details>
         </entry>
-        <entry name="curve" type="float" visibility="public" synthetic="true"
+        <entry name="curve" type="float" visibility="java_public" synthetic="true"
                typedef="tonemapCurve"
                hwlevel="full">
           <description>Tonemapping / contrast / gamma curve to use when android.tonemap.mode
@@ -8550,8 +8551,8 @@
     </section>
     <section name="sync">
       <dynamic>
-        <entry name="frameNumber" type="int64" visibility="hidden" enum="true"
-               hwlevel="legacy">
+        <entry name="frameNumber" type="int64" visibility="ndk_public"
+               enum="true" hwlevel="legacy">
           <enum>
             <value id="-1">CONVERGING
               <notes>
@@ -8742,7 +8743,7 @@
     </section>
     <section name="reprocess">
       <controls>
-        <entry name="effectiveExposureFactor" type="float" visibility="public" hwlevel="limited">
+        <entry name="effectiveExposureFactor" type="float" visibility="java_public" hwlevel="limited">
             <description>
             The amount of exposure time increase factor applied to the original output
             frame by the application processing before sending for reprocessing.
@@ -8793,7 +8794,7 @@
       </clone>
       </dynamic>
       <static>
-        <entry name="maxCaptureStall" type="int32" visibility="public" hwlevel="limited">
+        <entry name="maxCaptureStall" type="int32" visibility="java_public" hwlevel="limited">
           <description>
           The maximal camera capture pipeline stall (in unit of frame count) introduced by a
           reprocess capture request.
@@ -8842,9 +8843,8 @@
           </details>
           <tag id="DEPTH" />
         </entry>
-        <entry name="availableDepthStreamConfigurations" type="int32" visibility="hidden"
-          enum="true" container="array"
-          typedef="streamConfiguration" hwlevel="limited">
+        <entry name="availableDepthStreamConfigurations" type="int32" visibility="ndk_public"
+               enum="true" container="array" typedef="streamConfiguration" hwlevel="limited">
           <array>
             <size>n</size>
             <size>4</size>
@@ -8874,9 +8874,8 @@
           </details>
           <tag id="DEPTH" />
         </entry>
-        <entry name="availableDepthMinFrameDurations" type="int64" visibility="hidden"
-               container="array"
-               typedef="streamConfigurationDuration" hwlevel="limited">
+        <entry name="availableDepthMinFrameDurations" type="int64" visibility="ndk_public"
+               container="array" typedef="streamConfigurationDuration" hwlevel="limited">
           <array>
             <size>4</size>
             <size>n</size>
@@ -8905,7 +8904,7 @@
           </details>
           <tag id="DEPTH" />
         </entry>
-        <entry name="availableDepthStallDurations" type="int64" visibility="hidden"
+        <entry name="availableDepthStallDurations" type="int64" visibility="ndk_public"
                container="array" typedef="streamConfigurationDuration" hwlevel="limited">
           <array>
             <size>4</size>
diff --git a/camera/docs/metadata_properties.xsd b/camera/docs/metadata_properties.xsd
index a71a6c9..b4661d8 100644
--- a/camera/docs/metadata_properties.xsd
+++ b/camera/docs/metadata_properties.xsd
@@ -194,9 +194,11 @@
         <attribute name="visibility">
             <simpleType>
                 <restriction base="string">
-                    <enumeration value="system" /> <!-- do not expose to java -->
-                    <enumeration value="hidden" /> <!-- java as @hide -->
-                    <enumeration value="public" /> <!-- java as public SDK -->
+                    <enumeration value="system" /> <!-- do not expose to java/NDK API -->
+                    <enumeration value="java_public" /> <!-- java as public SDK. Not included in NDK -->
+                    <enumeration value="ndk_public" /> <!-- public in NDK. @hide in java -->
+                    <enumeration value="hidden" /> <!-- java as @hide. Not included in NDK -->
+                    <enumeration value="public" /> <!-- public to both java and NDK -->
                 </restriction>
             </simpleType>
         </attribute>
@@ -284,6 +286,14 @@
                 </restriction>
             </simpleType>
         </attribute>
+        <attribute name="ndk_hidden">
+            <simpleType>
+                <restriction base="string">
+                    <enumeration value="true"></enumeration>
+                    <enumeration value="false"></enumeration>
+                </restriction>
+            </simpleType>
+        </attribute>
         <attribute name="id" type="string" />
     </complexType>
 
diff --git a/camera/docs/metadata_template.mako b/camera/docs/metadata_template.mako
index 360e1e4..3022abb 100644
--- a/camera/docs/metadata_template.mako
+++ b/camera/docs/metadata_template.mako
@@ -143,6 +143,9 @@
                     % if value.hidden:
                              hidden="true"
                     % endif:
+                    % if value.ndk_hidden:
+                             ndk_hidden="true"
+                    % endif:
                     % if value.id is not None:
                              id="${value.id}"
                     % endif
diff --git a/camera/docs/ndk_camera_metadata_tags.mako b/camera/docs/ndk_camera_metadata_tags.mako
index 9612317..f60f0cb 100644
--- a/camera/docs/ndk_camera_metadata_tags.mako
+++ b/camera/docs/ndk_camera_metadata_tags.mako
@@ -65,12 +65,12 @@
     % for sec in find_all_sections(metadata):
 <%
       entries = remove_synthetic(find_unique_entries(sec))
-      skip_sec = all(e.applied_visibility == "system" for e in entries)
+      skip_sec = all(e.applied_ndk_visible == "false" for e in entries)
       if skip_sec:
         continue
 %>\
       % for idx,entry in enumerate(remove_synthetic(find_unique_entries(sec))):
-        % if entry.applied_visibility != "system":
+        % if entry.applied_ndk_visible == "true":
           % if entry.deprecated:
     ${ndk(entry.name) + " = " | csym,ljust(60)}// Deprecated! DO NOT USE
           % else:
@@ -93,7 +93,7 @@
  */
 
 % for sec in find_all_sections(metadata):
-  % for entry in filter_visibility(remove_synthetic(find_unique_entries(sec)), ("public", "hidden")):
+  % for entry in filter_ndk_visible(remove_synthetic(find_unique_entries(sec))):
     % if entry.enum:
 // ${ndk(entry.name) | csym}
 typedef enum acamera_metadata_enum_${csym(ndk(entry.name)).lower()} {
@@ -101,23 +101,54 @@
       i = 0
 %>\
       % for val in entry.enum.values:
-        % if val.id is None and not val.hidden:
-    ${'%s_%s'%(csym(ndk(entry.name)), val.name) | pad(70)} = ${i},
-        % elif not val.hidden:
+        % if val.ndk_hidden:
+<%
+          print "  WARNING: {}_{} is marked as hidden".format(csym(ndk(entry.name)), val.name) + \
+                " enum in NDK. Please double check this value is properly hidden" +  \
+                " in NDK API implementation"
+%>\
+        % endif
+        % if val.hidden or val.ndk_hidden:
+          % if val.id:
+<%
+            i = int(val.id, 0) + 1
+            continue
+%>\
+          % else:
+<%
+            i += 1
+            continue
+%>\
+          % endif
+        % endif
+        % if (val.notes or val.deprecated):
+    /*
+          % if val.notes:
+${val.notes | ndkdoc(metadata)}\
+          % endif
+          % if val.deprecated:
+     *
+     * <b>Deprecated</b>: please refer to this API documentation to find the alternatives
+          % endif
+     */
+        % endif
+        % if val.id:
     ${'%s_%s'%(csym(ndk(entry.name)), val.name) | pad(70)} = ${val.id},
 <%
           i = int(val.id, 0)
 %>\
+        % else:
+    ${'%s_%s'%(csym(ndk(entry.name)), val.name) | pad(70)} = ${i},
         % endif
 <%
         i += 1
-%>\
+%>
       % endfor
 } acamera_metadata_enum_${csym(entry.name).lower()}_t;
 
     % endif
   % endfor
 
-%endfor
+% endfor
 
 #endif //_NDK_CAMERA_METADATA_TAGS_H
diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h
index a8c4c2a..443af40 100644
--- a/camera/include/system/camera_metadata_tags.h
+++ b/camera/include/system/camera_metadata_tags.h
@@ -146,7 +146,7 @@
     ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,
                                                       // byte[]       | public
     ANDROID_CONTROL_AWB_AVAILABLE_MODES,              // byte[]       | public
-    ANDROID_CONTROL_MAX_REGIONS,                      // int32[]      | hidden
+    ANDROID_CONTROL_MAX_REGIONS,                      // int32[]      | ndk_public
     ANDROID_CONTROL_SCENE_MODE_OVERRIDES,             // byte[]       | system
     ANDROID_CONTROL_AE_PRECAPTURE_ID,                 // int32        | system
     ANDROID_CONTROL_AE_STATE,                         // enum         | public
@@ -191,10 +191,10 @@
     ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES,      // byte[]       | public
     ANDROID_HOT_PIXEL_END,
 
-    ANDROID_JPEG_GPS_COORDINATES =                    // double[]     | hidden
+    ANDROID_JPEG_GPS_COORDINATES =                    // double[]     | ndk_public
             ANDROID_JPEG_START,
-    ANDROID_JPEG_GPS_PROCESSING_METHOD,               // byte         | hidden
-    ANDROID_JPEG_GPS_TIMESTAMP,                       // int64        | hidden
+    ANDROID_JPEG_GPS_PROCESSING_METHOD,               // byte         | ndk_public
+    ANDROID_JPEG_GPS_TIMESTAMP,                       // int64        | ndk_public
     ANDROID_JPEG_ORIENTATION,                         // int32        | public
     ANDROID_JPEG_QUALITY,                             // byte         | public
     ANDROID_JPEG_THUMBNAIL_QUALITY,                   // byte         | public
@@ -226,7 +226,7 @@
     ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION,// byte[]       | public
     ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE,            // float        | public
     ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE,         // float        | public
-    ANDROID_LENS_INFO_SHADING_MAP_SIZE,               // int32[]      | hidden
+    ANDROID_LENS_INFO_SHADING_MAP_SIZE,               // int32[]      | ndk_public
     ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION,     // enum         | public
     ANDROID_LENS_INFO_END,
 
@@ -252,16 +252,16 @@
     ANDROID_REQUEST_METADATA_MODE,                    // enum         | system
     ANDROID_REQUEST_OUTPUT_STREAMS,                   // int32[]      | system
     ANDROID_REQUEST_TYPE,                             // enum         | system
-    ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,           // int32[]      | hidden
+    ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,           // int32[]      | ndk_public
     ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS,        // int32[]      | system
     ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,            // int32        | public
     ANDROID_REQUEST_PIPELINE_DEPTH,                   // byte         | public
     ANDROID_REQUEST_PIPELINE_MAX_DEPTH,               // byte         | public
     ANDROID_REQUEST_PARTIAL_RESULT_COUNT,             // int32        | public
     ANDROID_REQUEST_AVAILABLE_CAPABILITIES,           // enum[]       | public
-    ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,           // int32[]      | hidden
-    ANDROID_REQUEST_AVAILABLE_RESULT_KEYS,            // int32[]      | hidden
-    ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,   // int32[]      | hidden
+    ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,           // int32[]      | ndk_public
+    ANDROID_REQUEST_AVAILABLE_RESULT_KEYS,            // int32[]      | ndk_public
+    ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,   // int32[]      | ndk_public
     ANDROID_REQUEST_END,
 
     ANDROID_SCALER_CROP_REGION =                      // int32[]      | public
@@ -275,9 +275,9 @@
     ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS,       // int64[]      | system
     ANDROID_SCALER_AVAILABLE_RAW_SIZES,               // int32[]      | system
     ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP,// int32        | hidden
-    ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,   // enum[]       | hidden
-    ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,     // int64[]      | hidden
-    ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,         // int64[]      | hidden
+    ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,   // enum[]       | ndk_public
+    ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,     // int64[]      | ndk_public
+    ANDROID_SCALER_AVAILABLE_STALL_DURATIONS,         // int64[]      | ndk_public
     ANDROID_SCALER_CROPPING_TYPE,                     // enum         | public
     ANDROID_SCALER_END,
 
@@ -341,14 +341,14 @@
     ANDROID_STATISTICS_HISTOGRAM_MODE,                // enum         | system
     ANDROID_STATISTICS_SHARPNESS_MAP_MODE,            // enum         | system
     ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE,            // enum         | public
-    ANDROID_STATISTICS_FACE_IDS,                      // int32[]      | hidden
-    ANDROID_STATISTICS_FACE_LANDMARKS,                // int32[]      | hidden
-    ANDROID_STATISTICS_FACE_RECTANGLES,               // int32[]      | hidden
-    ANDROID_STATISTICS_FACE_SCORES,                   // byte[]       | hidden
+    ANDROID_STATISTICS_FACE_IDS,                      // int32[]      | ndk_public
+    ANDROID_STATISTICS_FACE_LANDMARKS,                // int32[]      | ndk_public
+    ANDROID_STATISTICS_FACE_RECTANGLES,               // int32[]      | ndk_public
+    ANDROID_STATISTICS_FACE_SCORES,                   // byte[]       | ndk_public
     ANDROID_STATISTICS_HISTOGRAM,                     // int32[]      | system
     ANDROID_STATISTICS_SHARPNESS_MAP,                 // int32[]      | system
     ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP,   // byte         | public
-    ANDROID_STATISTICS_LENS_SHADING_MAP,              // float[]      | hidden
+    ANDROID_STATISTICS_LENS_SHADING_MAP,              // float[]      | ndk_public
     ANDROID_STATISTICS_PREDICTED_COLOR_GAINS,         // float[]      | hidden
     ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM,     // rational[]   | hidden
     ANDROID_STATISTICS_SCENE_FLICKER,                 // enum         | public
@@ -370,10 +370,10 @@
                                                       // byte[]       | public
     ANDROID_STATISTICS_INFO_END,
 
-    ANDROID_TONEMAP_CURVE_BLUE =                      // float[]      | hidden
+    ANDROID_TONEMAP_CURVE_BLUE =                      // float[]      | ndk_public
             ANDROID_TONEMAP_START,
-    ANDROID_TONEMAP_CURVE_GREEN,                      // float[]      | hidden
-    ANDROID_TONEMAP_CURVE_RED,                        // float[]      | hidden
+    ANDROID_TONEMAP_CURVE_GREEN,                      // float[]      | ndk_public
+    ANDROID_TONEMAP_CURVE_RED,                        // float[]      | ndk_public
     ANDROID_TONEMAP_MODE,                             // enum         | public
     ANDROID_TONEMAP_MAX_CURVE_POINTS,                 // int32        | public
     ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES,         // byte[]       | public
@@ -394,22 +394,22 @@
             ANDROID_BLACK_LEVEL_START,
     ANDROID_BLACK_LEVEL_END,
 
-    ANDROID_SYNC_FRAME_NUMBER =                       // enum         | hidden
+    ANDROID_SYNC_FRAME_NUMBER =                       // enum         | ndk_public
             ANDROID_SYNC_START,
     ANDROID_SYNC_MAX_LATENCY,                         // enum         | public
     ANDROID_SYNC_END,
 
-    ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =     // float        | public
+    ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR =     // float        | java_public
             ANDROID_REPROCESS_START,
-    ANDROID_REPROCESS_MAX_CAPTURE_STALL,              // int32        | public
+    ANDROID_REPROCESS_MAX_CAPTURE_STALL,              // int32        | java_public
     ANDROID_REPROCESS_END,
 
     ANDROID_DEPTH_MAX_DEPTH_SAMPLES =                 // int32        | system
             ANDROID_DEPTH_START,
     ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS,
-                                                      // enum[]       | hidden
-    ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS,// int64[]      | hidden
-    ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS,    // int64[]      | hidden
+                                                      // enum[]       | ndk_public
+    ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS,// int64[]      | ndk_public
+    ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS,    // int64[]      | ndk_public
     ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE,                 // enum         | public
     ANDROID_DEPTH_END,