Loading src/java/com/android/internal/telephony/MccTable.java +40 −30 Original line number Diff line number Diff line Loading @@ -173,8 +173,10 @@ public final class MccTable * correct version of resources. If MCC is 0, MCC and MNC will be ignored (not set). * @param context Context to act on. * @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end * @param fromServiceState true if coming from the radio service state, false if from SIM */ public static void updateMccMncConfiguration(Context context, String mccmnc) { public static void updateMccMncConfiguration(Context context, String mccmnc, boolean fromServiceState) { if (!TextUtils.isEmpty(mccmnc)) { int mcc, mnc; Loading @@ -201,8 +203,11 @@ public final class MccTable if (mcc != 0) { setTimezoneFromMccIfNeeded(context, mcc); locale = getLocaleFromMcc(context, mcc); setWifiCountryCodeFromMcc(context, mcc); } if (fromServiceState) { setWifiCountryCodeFromMcc(context, mcc); } else { // from SIM try { Configuration config = new Configuration(); boolean updateConfig = false; Loading @@ -225,6 +230,12 @@ public final class MccTable Slog.e(LOG_TAG, "Can't update configuration", e); } } } else { if (fromServiceState) { // an empty mccmnc means no signal - tell wifi we don't know setWifiCountryCodeFromMcc(context, 0); } } } /** Loading Loading @@ -354,20 +365,19 @@ public final class MccTable } /** * If the number of allowed wifi channels has not been set, set it based on * the MCC of the SIM. * Set the country code for wifi. This sets allowed wifi channels based on the * country of the carrier we see. If we can't see any, reset to 0 so we don't * broadcast on forbidden channels. * @param context Context to act on. * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA) * @param mcc Mobile Country Code of the operator. 0 if not known */ private static void setWifiCountryCodeFromMcc(Context context, int mcc) { String country = MccTable.countryCodeForMcc(mcc); if (!country.isEmpty()) { Slog.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country); WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); //persist wM.setCountryCode(country, true); } } static { sTable = new ArrayList<MccEntry>(240); Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +11 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.content.Context; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; Loading @@ -25,6 +26,7 @@ import android.os.SystemClock; import android.telephony.CellInfo; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.text.TextUtils; import android.util.Pair; import android.util.TimeUtils; import android.net.ConnectivityManager; Loading Loading @@ -818,6 +820,14 @@ public abstract class ServiceStateTracker extends Handler { } } protected void updateCarrierMccMncConfiguration(String newOp, String oldOp, Context context) { // if we have a change in operator, notify wifi (even to/from none) if (((newOp == null) && (TextUtils.isEmpty(oldOp) == false)) || ((newOp != null) && (newOp.equals(oldOp) == false))) { MccTable.updateMccMncConfiguration(context, newOp, true); } } protected boolean isCallerOnDifferentThread() { boolean value = Thread.currentThread() != getLooper().getThread(); if (VDBG) log("isCallerOnDifferentThread: " + value); Loading src/java/com/android/internal/telephony/cdma/CDMAPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -1595,7 +1595,7 @@ public class CDMAPhone extends PhoneBase { getContext().getContentResolver().insert(uri, map); // Updates MCC MNC device configuration information MccTable.updateMccMncConfiguration(mContext, operatorNumeric); MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false); return true; } catch (SQLException e) { Loading src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java +2 −0 Original line number Diff line number Diff line Loading @@ -434,6 +434,8 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); updateCarrierMccMncConfiguration(operatorNumeric, prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); Loading src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +2 −1 Original line number Diff line number Diff line Loading @@ -1086,7 +1086,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); updateCarrierMccMncConfiguration(operatorNumeric, prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); Loading Loading
src/java/com/android/internal/telephony/MccTable.java +40 −30 Original line number Diff line number Diff line Loading @@ -173,8 +173,10 @@ public final class MccTable * correct version of resources. If MCC is 0, MCC and MNC will be ignored (not set). * @param context Context to act on. * @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end * @param fromServiceState true if coming from the radio service state, false if from SIM */ public static void updateMccMncConfiguration(Context context, String mccmnc) { public static void updateMccMncConfiguration(Context context, String mccmnc, boolean fromServiceState) { if (!TextUtils.isEmpty(mccmnc)) { int mcc, mnc; Loading @@ -201,8 +203,11 @@ public final class MccTable if (mcc != 0) { setTimezoneFromMccIfNeeded(context, mcc); locale = getLocaleFromMcc(context, mcc); setWifiCountryCodeFromMcc(context, mcc); } if (fromServiceState) { setWifiCountryCodeFromMcc(context, mcc); } else { // from SIM try { Configuration config = new Configuration(); boolean updateConfig = false; Loading @@ -225,6 +230,12 @@ public final class MccTable Slog.e(LOG_TAG, "Can't update configuration", e); } } } else { if (fromServiceState) { // an empty mccmnc means no signal - tell wifi we don't know setWifiCountryCodeFromMcc(context, 0); } } } /** Loading Loading @@ -354,20 +365,19 @@ public final class MccTable } /** * If the number of allowed wifi channels has not been set, set it based on * the MCC of the SIM. * Set the country code for wifi. This sets allowed wifi channels based on the * country of the carrier we see. If we can't see any, reset to 0 so we don't * broadcast on forbidden channels. * @param context Context to act on. * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA) * @param mcc Mobile Country Code of the operator. 0 if not known */ private static void setWifiCountryCodeFromMcc(Context context, int mcc) { String country = MccTable.countryCodeForMcc(mcc); if (!country.isEmpty()) { Slog.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country); WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); //persist wM.setCountryCode(country, true); } } static { sTable = new ArrayList<MccEntry>(240); Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +11 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.content.Context; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; Loading @@ -25,6 +26,7 @@ import android.os.SystemClock; import android.telephony.CellInfo; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.text.TextUtils; import android.util.Pair; import android.util.TimeUtils; import android.net.ConnectivityManager; Loading Loading @@ -818,6 +820,14 @@ public abstract class ServiceStateTracker extends Handler { } } protected void updateCarrierMccMncConfiguration(String newOp, String oldOp, Context context) { // if we have a change in operator, notify wifi (even to/from none) if (((newOp == null) && (TextUtils.isEmpty(oldOp) == false)) || ((newOp != null) && (newOp.equals(oldOp) == false))) { MccTable.updateMccMncConfiguration(context, newOp, true); } } protected boolean isCallerOnDifferentThread() { boolean value = Thread.currentThread() != getLooper().getThread(); if (VDBG) log("isCallerOnDifferentThread: " + value); Loading
src/java/com/android/internal/telephony/cdma/CDMAPhone.java +1 −1 Original line number Diff line number Diff line Loading @@ -1595,7 +1595,7 @@ public class CDMAPhone extends PhoneBase { getContext().getContentResolver().insert(uri, map); // Updates MCC MNC device configuration information MccTable.updateMccMncConfiguration(mContext, operatorNumeric); MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false); return true; } catch (SQLException e) { Loading
src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java +2 −0 Original line number Diff line number Diff line Loading @@ -434,6 +434,8 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); updateCarrierMccMncConfiguration(operatorNumeric, prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); Loading
src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +2 −1 Original line number Diff line number Diff line Loading @@ -1086,7 +1086,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); updateCarrierMccMncConfiguration(operatorNumeric, prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); Loading