diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LocaleUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LocaleUtils.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/LocaleUtils.java b/java/src/com/android/inputmethod/latin/LocaleUtils.java index feb1b2d0e..5fde8158a 100644 --- a/java/src/com/android/inputmethod/latin/LocaleUtils.java +++ b/java/src/com/android/inputmethod/latin/LocaleUtils.java @@ -1,17 +1,17 @@ /* * Copyright (C) 2011 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.android.inputmethod.latin; @@ -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); } |