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

Commit 87e1db35 authored by Roozbeh Pournader's avatar Roozbeh Pournader Committed by Android (Google) Code Review
Browse files

Merge "Use the full locale list in resourceQualifierString()."

parents 6023a99a 47f71a69
Loading
Loading
Loading
Loading
+22 −17
Original line number Diff line number Diff line
@@ -1505,14 +1505,19 @@ public final class Configuration implements Parcelable, Comparable<Configuration
     *
     * @hide
     */
    public static String localeToResourceQualifier(Locale loc) {
    public static String localesToResourceQualifier(LocaleList locs) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < locs.size(); i++) {
            Locale loc = locs.get(i);
            boolean l = (loc.getLanguage().length() != 0);
            boolean c = (loc.getCountry().length() != 0);
            boolean s = (loc.getScript().length() != 0);
            boolean v = (loc.getVariant().length() != 0);
            // TODO: take script and extensions into account
            if (l) {
                if (sb.length() != 0) {
                    sb.append(",");
                }
                sb.append(loc.getLanguage());
                if (c) {
                    sb.append("-r").append(loc.getCountry());
@@ -1524,6 +1529,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
                    }
                }
            }
        }
        return sb.toString();
    }

@@ -1544,9 +1550,8 @@ public final class Configuration implements Parcelable, Comparable<Configuration
            }
        }

        // TODO: send the whole locale list
        if (config.locale != null && !config.locale.getLanguage().isEmpty()) {
            parts.add(localeToResourceQualifier(config.locale));
        if (!config.mLocaleList.isEmpty()) {
            parts.add(localesToResourceQualifier(config.mLocaleList));
        }

        switch (config.screenLayout & Configuration.SCREENLAYOUT_LAYOUTDIR_MASK) {