Dynamic default metadata based on templates

Instead of controls picking their own defaults,
a delegate taking a mapping of template : desired default
is taken instead. These defaults are honored if able.

BUG: b/31017806
TEST: unit tests pass, multiple CTS tests fixed, test app runs.
Change-Id: I8212580c9aee1d7fe223fa6b3ff17a6cfb97552f
diff --git a/modules/camera/3_4/metadata/control.h b/modules/camera/3_4/metadata/control.h
index ed86d39..ad3f87b 100644
--- a/modules/camera/3_4/metadata/control.h
+++ b/modules/camera/3_4/metadata/control.h
@@ -69,7 +69,7 @@
 template <typename T>
 std::vector<int32_t> Control<T>::StaticTags() const {
   std::vector<int32_t> result;
-  if (options_) {
+  if (options_ && options_->tag() != DO_NOT_REPORT_OPTIONS) {
     result.push_back(options_->tag());
   }
   return result;
@@ -88,7 +88,14 @@
 template <typename T>
 int Control<T>::PopulateStaticFields(android::CameraMetadata* metadata) const {
   if (!options_) {
-    HAL_LOGV("No options for control, nothing to populate.");
+    HAL_LOGV("No options for control %d, nothing to populate.",
+             delegate_->tag());
+    return 0;
+  } else if (options_->tag() == DO_NOT_REPORT_OPTIONS) {
+    HAL_LOGV(
+        "Options for control %d are not reported, "
+        "probably are set values defined and already known by the API.",
+        delegate_->tag());
     return 0;
   }