Loading src/java/com/android/internal/telephony/LocaleTracker.java +10 −19 Original line number Original line Diff line number Diff line Loading @@ -485,20 +485,12 @@ public class LocaleTracker extends Handler { String countryIso = ""; String countryIso = ""; String countryIsoDebugInfo = "empty as default"; String countryIsoDebugInfo = "empty as default"; // For time zone detection we want the best geographical match we can get, which may differ // from the countryIso. String timeZoneCountryIso = null; String timeZoneCountryIsoDebugInfo = null; if (!TextUtils.isEmpty(mOperatorNumeric)) { if (!TextUtils.isEmpty(mOperatorNumeric)) { MccMnc mccMnc = MccMnc.fromOperatorNumeric(mOperatorNumeric); MccMnc mccMnc = MccMnc.fromOperatorNumeric(mOperatorNumeric); if (mccMnc != null) { if (mccMnc != null) { countryIso = MccTable.countryCodeForMcc(mccMnc.mcc); countryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); countryIsoDebugInfo = "OperatorNumeric(" + mOperatorNumeric countryIsoDebugInfo = "OperatorNumeric(" + mOperatorNumeric + "): MccTable.countryCodeForMcc(\"" + mccMnc.mcc + "\")"; + "): MccTable.geoCountryCodeForMccMnc(\"" + mccMnc + "\")"; timeZoneCountryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); timeZoneCountryIsoDebugInfo = "OperatorNumeric: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")"; } else { } else { loge("updateLocale: Can't get country from operator numeric. mOperatorNumeric = " loge("updateLocale: Can't get country from operator numeric. mOperatorNumeric = " + mOperatorNumeric); + mOperatorNumeric); Loading @@ -508,15 +500,19 @@ public class LocaleTracker extends Handler { // If for any reason we can't get country from operator numeric, try to get it from cell // If for any reason we can't get country from operator numeric, try to get it from cell // info. // info. if (TextUtils.isEmpty(countryIso)) { if (TextUtils.isEmpty(countryIso)) { // Find the most prevalent MCC from surrounding cell towers. String mcc = getMccFromCellInfo(); String mcc = getMccFromCellInfo(); if (mcc != null) { if (mcc != null) { countryIso = MccTable.countryCodeForMcc(mcc); countryIso = MccTable.countryCodeForMcc(mcc); countryIsoDebugInfo = "CellInfo: MccTable.countryCodeForMcc(\"" + mcc + "\")"; countryIsoDebugInfo = "CellInfo: MccTable.countryCodeForMcc(\"" + mcc + "\")"; // Some MCC+MNC combinations are known to be used in countries other than those // that the MCC alone would suggest. Do a second pass of nearby cells that match // the most frequently observed MCC to see if this could be one of those cases. MccMnc mccMnc = getMccMncFromCellInfo(mcc); MccMnc mccMnc = getMccMncFromCellInfo(mcc); if (mccMnc != null) { if (mccMnc != null) { timeZoneCountryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); countryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); timeZoneCountryIsoDebugInfo = countryIsoDebugInfo = "CellInfo: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")"; "CellInfo: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")"; } } } } Loading @@ -525,8 +521,6 @@ public class LocaleTracker extends Handler { if (mCountryOverride != null) { if (mCountryOverride != null) { countryIso = mCountryOverride; countryIso = mCountryOverride; countryIsoDebugInfo = "mCountryOverride = \"" + mCountryOverride + "\""; countryIsoDebugInfo = "mCountryOverride = \"" + mCountryOverride + "\""; timeZoneCountryIso = countryIso; timeZoneCountryIsoDebugInfo = countryIsoDebugInfo; } } if (!mPhone.isRadioOn()) { if (!mPhone.isRadioOn()) { Loading Loading @@ -568,6 +562,8 @@ public class LocaleTracker extends Handler { // Pass the geographical country information to the telephony time zone detection code. // Pass the geographical country information to the telephony time zone detection code. String timeZoneCountryIso = countryIso; String timeZoneCountryIsoDebugInfo = countryIsoDebugInfo; boolean isTestMcc = false; boolean isTestMcc = false; if (!TextUtils.isEmpty(mOperatorNumeric)) { if (!TextUtils.isEmpty(mOperatorNumeric)) { // For a test cell (MCC 001), the NitzStateMachine requires handleCountryDetected("") in // For a test cell (MCC 001), the NitzStateMachine requires handleCountryDetected("") in Loading @@ -578,11 +574,6 @@ public class LocaleTracker extends Handler { timeZoneCountryIsoDebugInfo = "Test cell: " + mOperatorNumeric; timeZoneCountryIsoDebugInfo = "Test cell: " + mOperatorNumeric; } } } } if (timeZoneCountryIso == null) { // After this timeZoneCountryIso may still be null. timeZoneCountryIso = countryIso; timeZoneCountryIsoDebugInfo = "Defaulted: " + countryIsoDebugInfo; } log("updateLocale: timeZoneCountryIso = " + timeZoneCountryIso log("updateLocale: timeZoneCountryIso = " + timeZoneCountryIso + ", timeZoneCountryIsoDebugInfo = " + timeZoneCountryIsoDebugInfo); + ", timeZoneCountryIsoDebugInfo = " + timeZoneCountryIsoDebugInfo); Loading Loading
src/java/com/android/internal/telephony/LocaleTracker.java +10 −19 Original line number Original line Diff line number Diff line Loading @@ -485,20 +485,12 @@ public class LocaleTracker extends Handler { String countryIso = ""; String countryIso = ""; String countryIsoDebugInfo = "empty as default"; String countryIsoDebugInfo = "empty as default"; // For time zone detection we want the best geographical match we can get, which may differ // from the countryIso. String timeZoneCountryIso = null; String timeZoneCountryIsoDebugInfo = null; if (!TextUtils.isEmpty(mOperatorNumeric)) { if (!TextUtils.isEmpty(mOperatorNumeric)) { MccMnc mccMnc = MccMnc.fromOperatorNumeric(mOperatorNumeric); MccMnc mccMnc = MccMnc.fromOperatorNumeric(mOperatorNumeric); if (mccMnc != null) { if (mccMnc != null) { countryIso = MccTable.countryCodeForMcc(mccMnc.mcc); countryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); countryIsoDebugInfo = "OperatorNumeric(" + mOperatorNumeric countryIsoDebugInfo = "OperatorNumeric(" + mOperatorNumeric + "): MccTable.countryCodeForMcc(\"" + mccMnc.mcc + "\")"; + "): MccTable.geoCountryCodeForMccMnc(\"" + mccMnc + "\")"; timeZoneCountryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); timeZoneCountryIsoDebugInfo = "OperatorNumeric: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")"; } else { } else { loge("updateLocale: Can't get country from operator numeric. mOperatorNumeric = " loge("updateLocale: Can't get country from operator numeric. mOperatorNumeric = " + mOperatorNumeric); + mOperatorNumeric); Loading @@ -508,15 +500,19 @@ public class LocaleTracker extends Handler { // If for any reason we can't get country from operator numeric, try to get it from cell // If for any reason we can't get country from operator numeric, try to get it from cell // info. // info. if (TextUtils.isEmpty(countryIso)) { if (TextUtils.isEmpty(countryIso)) { // Find the most prevalent MCC from surrounding cell towers. String mcc = getMccFromCellInfo(); String mcc = getMccFromCellInfo(); if (mcc != null) { if (mcc != null) { countryIso = MccTable.countryCodeForMcc(mcc); countryIso = MccTable.countryCodeForMcc(mcc); countryIsoDebugInfo = "CellInfo: MccTable.countryCodeForMcc(\"" + mcc + "\")"; countryIsoDebugInfo = "CellInfo: MccTable.countryCodeForMcc(\"" + mcc + "\")"; // Some MCC+MNC combinations are known to be used in countries other than those // that the MCC alone would suggest. Do a second pass of nearby cells that match // the most frequently observed MCC to see if this could be one of those cases. MccMnc mccMnc = getMccMncFromCellInfo(mcc); MccMnc mccMnc = getMccMncFromCellInfo(mcc); if (mccMnc != null) { if (mccMnc != null) { timeZoneCountryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); countryIso = MccTable.geoCountryCodeForMccMnc(mccMnc); timeZoneCountryIsoDebugInfo = countryIsoDebugInfo = "CellInfo: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")"; "CellInfo: MccTable.geoCountryCodeForMccMnc(" + mccMnc + ")"; } } } } Loading @@ -525,8 +521,6 @@ public class LocaleTracker extends Handler { if (mCountryOverride != null) { if (mCountryOverride != null) { countryIso = mCountryOverride; countryIso = mCountryOverride; countryIsoDebugInfo = "mCountryOverride = \"" + mCountryOverride + "\""; countryIsoDebugInfo = "mCountryOverride = \"" + mCountryOverride + "\""; timeZoneCountryIso = countryIso; timeZoneCountryIsoDebugInfo = countryIsoDebugInfo; } } if (!mPhone.isRadioOn()) { if (!mPhone.isRadioOn()) { Loading Loading @@ -568,6 +562,8 @@ public class LocaleTracker extends Handler { // Pass the geographical country information to the telephony time zone detection code. // Pass the geographical country information to the telephony time zone detection code. String timeZoneCountryIso = countryIso; String timeZoneCountryIsoDebugInfo = countryIsoDebugInfo; boolean isTestMcc = false; boolean isTestMcc = false; if (!TextUtils.isEmpty(mOperatorNumeric)) { if (!TextUtils.isEmpty(mOperatorNumeric)) { // For a test cell (MCC 001), the NitzStateMachine requires handleCountryDetected("") in // For a test cell (MCC 001), the NitzStateMachine requires handleCountryDetected("") in Loading @@ -578,11 +574,6 @@ public class LocaleTracker extends Handler { timeZoneCountryIsoDebugInfo = "Test cell: " + mOperatorNumeric; timeZoneCountryIsoDebugInfo = "Test cell: " + mOperatorNumeric; } } } } if (timeZoneCountryIso == null) { // After this timeZoneCountryIso may still be null. timeZoneCountryIso = countryIso; timeZoneCountryIsoDebugInfo = "Defaulted: " + countryIsoDebugInfo; } log("updateLocale: timeZoneCountryIso = " + timeZoneCountryIso log("updateLocale: timeZoneCountryIso = " + timeZoneCountryIso + ", timeZoneCountryIsoDebugInfo = " + timeZoneCountryIsoDebugInfo); + ", timeZoneCountryIsoDebugInfo = " + timeZoneCountryIsoDebugInfo); Loading