Sync libdynamic_depth to CL #247448495

Brief description of the changes included:
- Remove <Device> root entry from XMP writing
- Remove unused image test files
- Remove unused visibility specs
- Qualify calls to certain functions from the cmath library
- C++17 update for device_test due to order-independent containers

Bug: 132382410
Test: Camera CTS
Change-Id: I5ad27f6d33b5e73f494f6885d226086fecf59f2a
diff --git a/internal/dynamic_depth/container.cc b/internal/dynamic_depth/container.cc
index e7a35dd..ff84a40 100644
--- a/internal/dynamic_depth/container.cc
+++ b/internal/dynamic_depth/container.cc
@@ -2,15 +2,18 @@
 
 #include "android-base/logging.h"
 #include "dynamic_depth/const.h"
+#include "xmpmeta/xml/const.h"
 
 using ::dynamic_depth::xmpmeta::xml::Deserializer;
 using ::dynamic_depth::xmpmeta::xml::Serializer;
+using ::dynamic_depth::xmpmeta::xml::XmlConst;
 
 namespace dynamic_depth {
 
 constexpr char kNamespaceHref[] =
     "http://ns.google.com/photos/dd/1.0/container/";
 constexpr char kDirectory[] = "Directory";
+constexpr char kResourceType[] = "Resource";
 
 // Private constructor.
 Container::Container() {}
@@ -92,6 +95,12 @@
       serializer->CreateSerializer(
           DynamicDepthConst::Namespace(DynamicDepthConst::Container()),
           DynamicDepthConst::Container());
+  if (!container_serializer->WriteProperty(XmlConst::RdfPrefix(),
+                                           XmlConst::RdfParseType(),
+                                           kResourceType)) {
+    return false;
+  }
+
   std::unique_ptr<Serializer> directory_serializer =
       container_serializer->CreateListSerializer(DynamicDepthConst::Container(),
                                                  kDirectory);
diff --git a/internal/dynamic_depth/device.cc b/internal/dynamic_depth/device.cc
index 399ea74..84b1720 100644
--- a/internal/dynamic_depth/device.cc
+++ b/internal/dynamic_depth/device.cc
@@ -35,14 +35,14 @@
   // Find and parse the Device node.
   // Only these two fields are required to be present; the rest are optional.
   // TODO(miraleung): Search for Device by namespace.
-  xmlNodePtr device_node =
-      DepthFirstSearch(xmlDoc, DynamicDepthConst::Device());
-  if (device_node == nullptr) {
-    LOG(ERROR) << "No device node found";
+  xmlNodePtr description_node =
+      DepthFirstSearch(xmlDoc, XmlConst::RdfDescription());
+  if (description_node == nullptr) {
+    LOG(ERROR) << "No rdf description found";
     return nullptr;
   }
 
-  const DeserializerImpl deserializer(device_node);
+  const DeserializerImpl deserializer(description_node);
   auto cameras = Cameras::FromDeserializer(deserializer);
   if (cameras == nullptr) {
     LOG(ERROR) << "No cameras found";
@@ -186,12 +186,6 @@
     return false;
   }
 
-  // Create a node here instead of through a new deserializer, otherwise
-  // an extraneous prefix will be written to the node name.
-  xmlNodePtr device_node =
-      xmlNewNode(nullptr, ToXmlChar(DynamicDepthConst::Device()));
-  xmlAddChild(root_node, device_node);
-
   PopulateNamespaces();
   xmlNsPtr prev_ns = root_node->ns;
   for (const auto& entry : namespaces_) {
@@ -202,7 +196,7 @@
   }
 
   // Set up serialization on the first description node in the extended section.
-  SerializerImpl device_serializer(namespaces_, device_node);
+  SerializerImpl device_serializer(namespaces_, root_node);
 
   // Serialize elements.
   if (params_->container &&
diff --git a/internal/dynamic_depth/earth_pose.cc b/internal/dynamic_depth/earth_pose.cc
index cd5e0a7..db9e2b3 100644
--- a/internal/dynamic_depth/earth_pose.cc
+++ b/internal/dynamic_depth/earth_pose.cc
@@ -2,6 +2,8 @@
 
 #include <math.h>
 
+#include <cmath>
+
 #include "android-base/logging.h"
 #include "dynamic_depth/const.h"
 
@@ -25,9 +27,9 @@
   if (quat.size() < 4) {
     return std::vector<float>();
   }
-  float length =
-      sqrt((quat[0] * quat[0]) + (quat[1] * quat[1]) + (quat[2] * quat[2])) +
-      (quat[3] * quat[3]);
+  float length = std::sqrt((quat[0] * quat[0]) + (quat[1] * quat[1]) +
+                           (quat[2] * quat[2])) +
+                 (quat[3] * quat[3]);
   const std::vector<float> normalized = {quat[0] / length, quat[1] / length,
                                          quat[2] / length, quat[3] / length};
   return normalized;
diff --git a/internal/dynamic_depth/pose.cc b/internal/dynamic_depth/pose.cc
index 63c0740..ae9a1c9 100644
--- a/internal/dynamic_depth/pose.cc
+++ b/internal/dynamic_depth/pose.cc
@@ -2,6 +2,8 @@
 
 #include <math.h>
 
+#include <cmath>
+
 #include "android-base/logging.h"
 #include "dynamic_depth/const.h"
 
@@ -25,8 +27,8 @@
   if (quat.size() < 4) {
     return std::vector<float>();
   }
-  float length = sqrt((quat[0] * quat[0]) + (quat[1] * quat[1]) +
-                      (quat[2] * quat[2]) + (quat[3] * quat[3]));
+  float length = std::sqrt((quat[0] * quat[0]) + (quat[1] * quat[1]) +
+                           (quat[2] * quat[2]) + (quat[3] * quat[3]));
   const std::vector<float> normalized = {quat[0] / length, quat[1] / length,
                                          quat[2] / length, quat[3] / length};
   return normalized;
diff --git a/internal/xmpmeta/xml/const.cc b/internal/xmpmeta/xml/const.cc
index 5af3c16..4a20f1d 100644
--- a/internal/xmpmeta/xml/const.cc
+++ b/internal/xmpmeta/xml/const.cc
@@ -23,6 +23,8 @@
 
 const char* XmlConst::RdfLi() { return "li"; }
 
+const char* XmlConst::RdfParseType() { return "parseType"; }
+
 // XML metadata constants.
 const char* XmlConst::NsAttrName() { return "xmlns"; }
 
diff --git a/internal/xmpmeta/xml/const.h b/internal/xmpmeta/xml/const.h
index 8a1998a..e540b07 100644
--- a/internal/xmpmeta/xml/const.h
+++ b/internal/xmpmeta/xml/const.h
@@ -17,6 +17,7 @@
   static const char* RdfPrefix();
   static const char* RdfSeq();
   static const char* RdfLi();
+  static const char* RdfParseType();
 
   // XML metadata.
   static const char* NsAttrName();