camera_metadata: add non-full hw level optional tag

Bug: 10838063
Change-Id: If6d1ef5bd58aca3a9a722e4317f5ce6804dd6680
diff --git a/camera/docs/metadata_model.py b/camera/docs/metadata_model.py
index 66fe9d6..7db5ffe 100644
--- a/camera/docs/metadata_model.py
+++ b/camera/docs/metadata_model.py
@@ -1018,6 +1018,11 @@
                 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.
+    optional: a bool representing the optional attribute, which denotes the entry
+              is required for hardware level full devices, but optional for other
+              hardware levels.  None if not present.
+    applied_optional: As optional but always valid, defaulting to False if no
+                      optional attribute is present.
     tuple_values: A sequence of strings describing the tuple values,
                   None if container is not 'tuple'.
     description: A string description, or None.
@@ -1066,6 +1071,7 @@
       type_notes: A string with the notes for the type
       visibility: A string describing the visibility, eg 'system', 'hidden',
                   'public'
+      optional: A bool to mark whether optional for non-full hardware devices
       typedef: A string corresponding to a typedef's name attribute.
     """
 
@@ -1099,6 +1105,14 @@
     return self._visibility or 'system'
 
   @property
+  def optional(self):
+    return self._optional
+
+  @property
+  def applied_optional(self):
+    return self._optional or False
+
+  @property
   def name_short(self):
     return self.get_name_minimal()
 
@@ -1203,6 +1217,7 @@
       self._enum = None
 
     self._visibility = kwargs.get('visibility')
+    self._optional = kwargs.get('optional')
 
     self._property_keys = kwargs
 
@@ -1397,6 +1412,7 @@
                     'type',
                     'type_notes',
                     'visibility',
+                    'optional',
                     'typedef'
                    ]