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

Commit bb5edc8d authored by Jeremy Meyer's avatar Jeremy Meyer
Browse files

Remove some locale logging

The logging was added to help with a bug that is now resolved and
negatively affected performance.

Bug: 398541237
Test: automated
Flag: EXEMPT bugfix
Change-Id: I8f3db8ecf609c31c8f7ac0ed20a29ebe6a291759
parent a2ec91ad
Loading
Loading
Loading
Loading
+0 −47
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
#include <map>
#include <set>
#include <span>
#include <sstream>
#include <utility>

#include "android-base/logging.h"
@@ -445,24 +444,6 @@ bool AssetManager2::ContainsAllocatedTable() const {
  return false;
}

static std::string ConfigVecToString(std::span<const ResTable_config> configurations) {
  std::stringstream ss;
  ss << "[";
  bool first = true;
  for (const auto& config : configurations) {
    if (!first) {
      ss << ",";
    }
    char out[RESTABLE_MAX_LOCALE_LEN] = {};
    config.getBcp47Locale(out);
    ss << out;
    first = false;
  }
  ss << "]";
  return ss.str();
}


void AssetManager2::SetConfigurations(std::span<const ResTable_config> configurations,
                                      bool force_refresh) {
  int diff = 0;
@@ -478,16 +459,6 @@ void AssetManager2::SetConfigurations(std::span<const ResTable_config> configura
    }
  }

  // Log the locale list change to investigate b/392255526
  if (diff & ConfigDescription::CONFIG_LOCALE) {
    auto oldstr = ConfigVecToString(configurations_);
    auto newstr = ConfigVecToString(configurations);
    if (oldstr != newstr) {
      LOG(INFO) << "AssetManager2(" << this << ") locale list changing from "
                << oldstr << " to " << newstr;
    }
  }

  configurations_.clear();
  for (auto&& config : configurations) {
    configurations_.emplace_back(config);
@@ -499,24 +470,6 @@ void AssetManager2::SetConfigurations(std::span<const ResTable_config> configura
}

void AssetManager2::SetDefaultLocale(std::optional<ResTable_config> default_locale) {
  int diff = 0;
  if (default_locale_ && default_locale) {
    diff = default_locale_->diff(default_locale.value());
  } else if (default_locale_ || default_locale) {
    diff = -1;
  }
  if (diff & ConfigDescription::CONFIG_LOCALE) {
    char old_loc[RESTABLE_MAX_LOCALE_LEN] = {};
    char new_loc[RESTABLE_MAX_LOCALE_LEN] = {};
    if (default_locale_) {
      default_locale_->getBcp47Locale(old_loc);
    }
    if (default_locale) {
      default_locale->getBcp47Locale(new_loc);
    }
    LOG(INFO) << "AssetManager2(" << this << ") default locale changing from '"
              << old_loc << "' to '" << new_loc << "'";
  }
  default_locale_ = default_locale;
}