Small cleanup of RunInLocale
Change-Id: Ib588e67da2c88345fc4eb51587b07ebfa434e0bbmain
parent
0f3c05cd6b
commit
183fe80031
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue