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

Commit 801c1f81 authored by Jeremy Meyer's avatar Jeremy Meyer
Browse files

Stop getting locale config overrides

Previously for multilocale ContextImpl would load locale config with
overrides. This caused performance problems and actually changes the
behavior from when the user only has one preferred locale.

Test: automated
Change-Id: I7d5809b5f8403e966640f1743f41861ec361d366
parent 9de275a2
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -3485,20 +3485,7 @@ class ContextImpl extends Context {
            // only do this if the user already has more than one preferred locale
            if (android.content.res.Flags.defaultLocale()
                    && r.getConfiguration().getLocales().size() > 1) {
                LocaleConfig lc;
                if (getUserId() < 0) {
                    lc = LocaleConfig.fromContextIgnoringOverride(this);
                } else {
                    // This is needed because the app might have locale config overrides that need
                    // to be read from disk in order for resources to correctly choose which values
                    // to load.
                    StrictMode.ThreadPolicy policy = StrictMode.allowThreadDiskReads();
                    try {
                        lc = new LocaleConfig(this);
                    } finally {
                        StrictMode.setThreadPolicy(policy);
                    }
                }
                LocaleConfig lc = LocaleConfig.fromContextIgnoringOverride(this);
                mResourcesManager.setLocaleConfig(lc);
            }
        }