Skip to content
Snippets Groups Projects
Commit c6ee9e69 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android Git Automerger
Browse files

am 183fe800: Small cleanup of RunInLocale

* commit '183fe800':
  Small cleanup of RunInLocale
parents f7dbd991 183fe800
No related branches found
No related tags found
No related merge requests found
...@@ -180,14 +180,15 @@ public final class LocaleUtils { ...@@ -180,14 +180,15 @@ public final class LocaleUtils {
synchronized (sLockForRunInLocale) { synchronized (sLockForRunInLocale) {
final Configuration conf = res.getConfiguration(); final Configuration conf = res.getConfiguration();
final Locale oldLocale = conf.locale; final Locale oldLocale = conf.locale;
final boolean needsChange = (newLocale != null && !newLocale.equals(oldLocale));
try { try {
if (newLocale != null && !newLocale.equals(oldLocale)) { if (needsChange) {
conf.locale = newLocale; conf.locale = newLocale;
res.updateConfiguration(conf, null); res.updateConfiguration(conf, null);
} }
return job(res); return job(res);
} finally { } finally {
if (newLocale != null && !newLocale.equals(oldLocale)) { if (needsChange) {
conf.locale = oldLocale; conf.locale = oldLocale;
res.updateConfiguration(conf, null); res.updateConfiguration(conf, null);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment