Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b96f837 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix badging meta-data value"

parents d7c13437 2250c93f
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -1326,29 +1326,29 @@ class MetaData : public ManifestExtractor::Element {
 public:
 public:
  MetaData() = default;
  MetaData() = default;
  std::string name;
  std::string name;
  const std::string* value;
  std::string value;
  const int* value_int;
  const int* value_int;
  const std::string* resource;
  std::string resource;
  const int* resource_int;
  const int* resource_int;


  void Extract(xml::Element* element) override {
  void Extract(xml::Element* element) override {
    name = GetAttributeStringDefault(FindAttribute(element, NAME_ATTR), "");
    name = GetAttributeStringDefault(FindAttribute(element, NAME_ATTR), "");
    value = GetAttributeString(FindAttribute(element, VALUE_ATTR));
    value = GetAttributeStringDefault(FindAttribute(element, VALUE_ATTR), "");
    value_int = GetAttributeInteger(FindAttribute(element, VALUE_ATTR));
    value_int = GetAttributeInteger(FindAttribute(element, VALUE_ATTR));
    resource = GetAttributeString(FindAttribute(element, RESOURCE_ATTR));
    resource = GetAttributeStringDefault(FindAttribute(element, RESOURCE_ATTR), "");
    resource_int = GetAttributeInteger(FindAttribute(element, RESOURCE_ATTR));
    resource_int = GetAttributeInteger(FindAttribute(element, RESOURCE_ATTR));
  }
  }


  void Print(text::Printer& printer) override {
  void Print(text::Printer& printer) override {
    if (extractor()->options_.include_meta_data && !name.empty()) {
    if (extractor()->options_.include_meta_data && !name.empty()) {
      printer.Print(StringPrintf("meta-data: name='%s' ", name.data()));
      printer.Print(StringPrintf("meta-data: name='%s' ", name.data()));
      if (value) {
      if (!value.empty()) {
        printer.Print(StringPrintf("value='%s' ", value->data()));
        printer.Print(StringPrintf("value='%s' ", value.data()));
      } else if (value_int) {
      } else if (value_int) {
        printer.Print(StringPrintf("value='%d' ", *value_int));
        printer.Print(StringPrintf("value='%d' ", *value_int));
      } else {
      } else {
        if (resource) {
        if (!resource.empty()) {
          printer.Print(StringPrintf("resource='%s' ", resource->data()));
          printer.Print(StringPrintf("resource='%s' ", resource.data()));
        } else if (resource_int) {
        } else if (resource_int) {
          printer.Print(StringPrintf("resource='%d' ", *resource_int));
          printer.Print(StringPrintf("resource='%d' ", *resource_int));
        }
        }
@@ -1837,10 +1837,10 @@ bool ManifestExtractor::Dump(text::Printer& printer, IDiagnostics* diag) {
                  && offhost_apdu_action)) {
                  && offhost_apdu_action)) {


            // Attempt to load the resource file
            // Attempt to load the resource file
            if (!meta_data->resource) {
            if (!meta_data->resource.empty()) {
              return;
              return;
            }
            }
            auto resource = apk->LoadXml(*meta_data->resource, diag);
            auto resource = apk->LoadXml(meta_data->resource, diag);
            if (!resource) {
            if (!resource) {
              return;
              return;
            }
            }