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

Commit 543d3d24 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Stop using Configuration.setLocale

The call for method Configuration.setLocale that is introduce by
If60877b29b should be remove to be compatible with API 14 and later.

Bug: 14239862
Change-Id: I3815c2b56bd9c655b8bde6f93143adf3ff08c35d
parent a685fc17
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -35,18 +35,18 @@ public abstract class RunInLocale<T> {
     */
    public T runInLocale(final Resources res, final Locale newLocale) {
        synchronized (sLockForRunInLocale) {
            final Configuration savedConf = res.getConfiguration();
            if (newLocale == null || newLocale.equals(savedConf.locale)) {
            final Configuration conf = res.getConfiguration();
            if (newLocale == null || newLocale.equals(conf.locale)) {
                return job(res);
            }
            final Configuration newConf = new Configuration();
            newConf.setTo(savedConf);
            newConf.setLocale(newLocale);
            final Locale savedLocale = conf.locale;
            try {
                res.updateConfiguration(newConf, null);
                conf.locale = newLocale;
                res.updateConfiguration(conf, null);
                return job(res);
            } finally {
                res.updateConfiguration(savedConf, null);
                conf.locale = savedLocale;
                res.updateConfiguration(conf, null);
            }
        }
    }