From 183fe8003163702a0ba9487d6fde2a7c025ab91a Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 26 Feb 2013 19:11:49 +0900 Subject: [PATCH] Small cleanup of RunInLocale Change-Id: Ib588e67da2c88345fc4eb51587b07ebfa434e0bb --- java/src/com/android/inputmethod/latin/LocaleUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LocaleUtils.java b/java/src/com/android/inputmethod/latin/LocaleUtils.java index fcf727041..5fde8158a 100644 --- a/java/src/com/android/inputmethod/latin/LocaleUtils.java +++ b/java/src/com/android/inputmethod/latin/LocaleUtils.java @@ -180,14 +180,15 @@ public final class LocaleUtils { synchronized (sLockForRunInLocale) { final Configuration conf = res.getConfiguration(); final Locale oldLocale = conf.locale; + final boolean needsChange = (newLocale != null && !newLocale.equals(oldLocale)); try { - if (newLocale != null && !newLocale.equals(oldLocale)) { + if (needsChange) { conf.locale = newLocale; res.updateConfiguration(conf, null); } return job(res); } finally { - if (newLocale != null && !newLocale.equals(oldLocale)) { + if (needsChange) { conf.locale = oldLocale; res.updateConfiguration(conf, null); }