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

Commit 7c94b7a9 authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Ensure displayId isn't translated

String.format() will also translate some strings. When the phone's
language is set to something that doesn't use the Western Arabic numeral
system, these numbers are translated as well, which means that the
display device config files cannot be found, as they are described by
their display id. This cl ensures the Locale is the same as the root locale when calling String.format() for the ddc path, meaning they won't get translated.

Bug: 241871531
Test: adb shell dumpsys display | grep DisplayDeviceConfig
Change-Id: I10b022c04c743f2eb287426a8a9026cc0c75c276
parent 83f3bbb8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;

import javax.xml.datatype.DatatypeConfigurationException;

@@ -669,8 +670,8 @@ public class DisplayDeviceConfig {
    private static DisplayDeviceConfig getConfigFromSuffix(Context context, File baseDirectory,
            String suffixFormat, long idNumber) {

        final String suffix = String.format(suffixFormat, idNumber);
        final String filename = String.format(CONFIG_FILE_FORMAT, suffix);
        final String suffix = String.format(Locale.ROOT, suffixFormat, idNumber);
        final String filename = String.format(Locale.ROOT, CONFIG_FILE_FORMAT, suffix);
        final File filePath = Environment.buildPath(
                baseDirectory, ETC_DIR, DISPLAY_CONFIG_DIR, filename);
        final DisplayDeviceConfig config = new DisplayDeviceConfig(context);