Add V4L2 Format Metadata Factory.

This factory queries the device for the properties detailing
what formats it supports. Since this may fail, Metadata/V4L2Metadata
was moved from the weird inheritance/constructor stuff it was doing
to Metadata having a better constructor and V4L2Metadata being a
factory.

BUG: 30140438
TEST: unit tests pass

Change-Id: Id4bcb27fbd8b517e3a9a8e9fb8a984af139254b3
diff --git a/modules/camera/3_4/metadata/metadata.h b/modules/camera/3_4/metadata/metadata.h
index 36e238b..0683df2 100644
--- a/modules/camera/3_4/metadata/metadata.h
+++ b/modules/camera/3_4/metadata/metadata.h
@@ -17,16 +17,18 @@
 #ifndef V4L2_CAMERA_HAL_METADATA_H_
 #define V4L2_CAMERA_HAL_METADATA_H_
 
+#include <set>
+
 #include <camera/CameraMetadata.h>
 #include <hardware/camera3.h>
 
 #include "../common.h"
-#include "partial_metadata_interface.h"
+#include "metadata_common.h"
 
 namespace v4l2_camera_hal {
 class Metadata {
  public:
-  Metadata();
+  Metadata(PartialMetadataSet components);
   virtual ~Metadata();
 
   int FillStaticMetadata(android::CameraMetadata* metadata);
@@ -34,16 +36,10 @@
   int SetRequestSettings(const android::CameraMetadata& metadata);
   int FillResultMetadata(android::CameraMetadata* metadata);
 
- protected:
-  // Helper for the child constructors to fill in metadata components.
-  void AddComponent(std::unique_ptr<PartialMetadataInterface> component);
-
  private:
   // The overall metadata is broken down into several distinct pieces.
   // Note: it is undefined behavior if multiple components share tags.
-  std::vector<std::unique_ptr<PartialMetadataInterface>> components_;
-
-  friend class MetadataTest;
+  PartialMetadataSet components_;
 
   DISALLOW_COPY_AND_ASSIGN(Metadata);
 };