camera: Add a hwlevel attribute, annotate each metadata's hardware level

* Set each metadata key to one of full,legacy,limited.
* All keys present on the lower level must also be present on higher
  levels (i.e. all legacy keys present on limited/full devices, all limited
  keys present on full devices.)
* If a key is not annotated, it is assumed to be optional even on full.
  This is usually the case only for future, deprecated, or system keys.

Bug: 17788234
Change-Id: Ie88f3750cc06d889c6750f2099598d53ccb601b7
diff --git a/camera/docs/metadata_model.py b/camera/docs/metadata_model.py
index b546517..e4e1810 100644
--- a/camera/docs/metadata_model.py
+++ b/camera/docs/metadata_model.py
@@ -1030,6 +1030,10 @@
                list of entries (in C code). In general a synthetic entry is
                glued together at the Java layer from multiple visibiltity=hidden
                entries.
+    hwlevel: The lowest hardware level at which the entry is guaranteed
+             to be supported by the camera device. All devices with higher
+             hwlevels will also include this entry. None means that the
+             entry is optional on any hardware level.
     deprecated: Marks an entry as @Deprecated in the Java layer; if within an
                unreleased version this needs to be removed altogether. If applied
                to an entry from an older release, then this means the entry
@@ -1090,6 +1094,7 @@
                   'public'
       synthetic: A bool to mark whether this entry is visible only at the Java
                  layer (True), or at both layers (False = default).
+      hwlevel: A string of the HW level (one of 'legacy', 'limited', 'full')
       deprecated: A bool to mark whether this is @Deprecated at the Java layer
                  (default = False).
       optional: A bool to mark whether optional for non-full hardware devices
@@ -1130,9 +1135,14 @@
     return self._synthetic
 
   @property
+  def hwlevel(self):
+    return self._hwlevel
+
+  @property
   def deprecated(self):
     return self._deprecated
 
+  # TODO: optional should just return hwlevel is None
   @property
   def optional(self):
     return self._optional
@@ -1254,6 +1264,7 @@
 
     self._visibility = kwargs.get('visibility')
     self._synthetic = kwargs.get('synthetic', False)
+    self._hwlevel = kwargs.get('hwlevel')
     self._deprecated = kwargs.get('deprecated', False)
     self._optional = kwargs.get('optional')
 
@@ -1453,6 +1464,7 @@
                     'type_notes',
                     'visibility',
                     'synthetic',
+                    'hwlevel',
                     'deprecated',
                     'optional',
                     'typedef'