Only check sibling config values to dedupe

Currently more config values are being kept than necessesary. For
example, given config values for a string resource:

Config: default     Value: "keep"
Config: ldrtl       Value: "dedupe"
Config: ldrtl-night Value: "dedupe"
Config: land        Value: "keep2"

The ldrtl-night config value will fail to be removed despite being
equivalent to the ldrtl value. This is because the value for the land
configuration is not equivalent to the ldrtl-night value. Instead of
checking that every compatible config value not related by dominance
should have quivalent values, only check sibling config values within
the dominator tree.

Bug: 137230022
Test: aapt2_tests
Change-Id: I965365d1a9433ae595eab48d82837ac102148334
diff --git a/tools/aapt2/optimize/ResourceDeduper.cpp b/tools/aapt2/optimize/ResourceDeduper.cpp
index 78ebcb9..0278b43 100644
--- a/tools/aapt2/optimize/ResourceDeduper.cpp
+++ b/tools/aapt2/optimize/ResourceDeduper.cpp
@@ -63,13 +63,14 @@
     // Compare compatible configs for this entry and ensure the values are
     // equivalent.
     const ConfigDescription& node_configuration = node_value->config;
-    for (const auto& sibling : entry_->values) {
-      if (!sibling->value) {
+    for (const auto& sibling : parent->children()) {
+      ResourceConfigValue* sibling_value = sibling->value();
+      if (!sibling_value->value) {
         // Sibling was already removed.
         continue;
       }
-      if (node_configuration.IsCompatibleWith(sibling->config) &&
-          !node_value->value->Equals(sibling->value.get())) {
+      if (node_configuration.IsCompatibleWith(sibling_value->config) &&
+          !node_value->value->Equals(sibling_value->value.get())) {
         // The configurations are compatible, but the value is
         // different, so we can't remove this value.
         return;