| Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PwsClientImpl.java
 | 
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PwsClientImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PwsClientImpl.java
 | 
| index 86cb7c43a271e42fa198afd2d116d7c5d678c0b0..cdc5f90e3ec9d8a6e6519319f4b4193be1cd901e 100644
 | 
| --- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PwsClientImpl.java
 | 
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PwsClientImpl.java
 | 
| @@ -27,7 +27,6 @@ import org.chromium.chrome.browser.physicalweb.PwsClient.ResolveScanCallback;
 | 
|  import java.net.MalformedURLException;
 | 
|  import java.util.ArrayList;
 | 
|  import java.util.Collection;
 | 
| -import java.util.Collections;
 | 
|  import java.util.Formatter;
 | 
|  import java.util.HashSet;
 | 
|  import java.util.Locale;
 | 
| @@ -252,38 +251,17 @@ class PwsClientImpl implements PwsClient {
 | 
|          String localeStrings = locales + "," + acceptLanguages;
 | 
|          String[] localeList = localeStrings.split(",");
 | 
|  
 | 
| -        ArrayList<Locale> uniqueList = new ArrayList<>();
 | 
| +        HashSet<Locale> seenLocales = new HashSet<>();
 | 
| +        ArrayList<String> uniqueList = new ArrayList<>();
 | 
|          for (String localeString : localeList) {
 | 
|              Locale locale = LocaleUtils.forLanguageTag(localeString);
 | 
| -            if (uniqueList.contains(locale) || locale.getLanguage().isEmpty()) {
 | 
| +            if (seenLocales.contains(locale) || locale.getLanguage().isEmpty()) {
 | 
|                  continue;
 | 
|              }
 | 
| -            uniqueList.add(locale);
 | 
| +            seenLocales.add(locale);
 | 
| +            uniqueList.add(LocaleUtils.toLanguageTag(locale));
 | 
|          }
 | 
| -
 | 
| -        // If language is not in the accept languages list, also add language code.
 | 
| -        // A language code should only be inserted after the last languageTag that
 | 
| -        // contains that language.
 | 
| -        // This will work with the IDS_ACCEPT_LANGUAGE localized strings bundled
 | 
| -        // with Chrome but may fail on arbitrary lists of language tags due to
 | 
| -        // differences in case and whitespace.
 | 
| -        HashSet<String> seenLanguages = new HashSet<>();
 | 
| -        ArrayList<String> outputList = new ArrayList<>();
 | 
| -        for (int i = uniqueList.size() - 1; i >= 0; i--) {
 | 
| -            Locale localeAdd = uniqueList.get(i);
 | 
| -            String languageAdd = localeAdd.getLanguage();
 | 
| -            String countryAdd = localeAdd.getCountry();
 | 
| -
 | 
| -            if (!seenLanguages.contains(languageAdd)) {
 | 
| -                seenLanguages.add(languageAdd);
 | 
| -                outputList.add(languageAdd);
 | 
| -            }
 | 
| -            if (!countryAdd.isEmpty()) {
 | 
| -                outputList.add(LocaleUtils.toLanguageTag(localeAdd));
 | 
| -            }
 | 
| -        }
 | 
| -        Collections.reverse(outputList);
 | 
| -        return TextUtils.join(",", outputList);
 | 
| +        return TextUtils.join(",", uniqueList);
 | 
|      }
 | 
|  
 | 
|      /**
 | 
| 
 |