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
diff --git a/telephony/java/com/android/internal/telephony/MccTable.java b/telephony/java/com/android/internal/telephony/MccTable.java
index 0d11f8c..1bd6a1a 100644
--- a/telephony/java/com/android/internal/telephony/MccTable.java
+++ b/telephony/java/com/android/internal/telephony/MccTable.java
@@ -572,7 +572,6 @@
* @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 @@
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);