From 70e1f7a6b773ae3e9c72730fd78e8095b7904cee Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 5 Nov 2009 18:19:37 -0800 Subject: [PATCH] Fix the selection of locale from SIM mcc. Two issues - getting config then setting locale by mcc and then setting the config (to set mcc/mnc) would overwrite the locale set in the middle. Also, using a "new Configuration()" instead of asking the ActivityManager.getConfiguration gets different values than the current ones, and would also overwrite our change. bug: 2241461 bug: 2239810 --- .../com/android/internal/telephony/MccTable.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/telephony/java/com/android/internal/telephony/MccTable.java b/telephony/java/com/android/internal/telephony/MccTable.java index 0d11f8c5f8da0..1bd6a1acfe347 100644 --- a/telephony/java/com/android/internal/telephony/MccTable.java +++ b/telephony/java/com/android/internal/telephony/MccTable.java @@ -572,7 +572,6 @@ public final class MccTable * @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end */ public static void updateMccMncConfiguration(PhoneBase phone, String mccmnc) { - Configuration config = new Configuration(); int mcc, mnc; try { @@ -586,15 +585,18 @@ public final class MccTable Log.d(LOG_TAG, "updateMccMncConfiguration: mcc=" + mcc + ", mnc=" + mnc); if (mcc != 0) { - config.mcc = mcc; setTimezoneFromMccIfNeeded(phone, mcc); setLocaleFromMccIfNeeded(phone, mcc); setWifiChannelsFromMccIfNeeded(phone, mcc); } - if (mnc != 0) { - config.mnc = mnc; - } try { + Configuration config = ActivityManagerNative.getDefault().getConfiguration(); + if (mcc != 0) { + config.mcc = mcc; + } + if (mnc != 0) { + config.mnc = mnc; + } ActivityManagerNative.getDefault().updateConfiguration(config); } catch (RemoteException e) { Log.e(LOG_TAG, "Can't update configuration", e);