Loading src/java/com/android/internal/telephony/LocaleTracker.java +13 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; Loading Loading @@ -206,6 +207,17 @@ public class LocaleTracker extends Handler { mPhone.registerForCellInfo(this, EVENT_UNSOL_CELL_INFO, null); } private @NonNull String getCarrierCountry() { // The locale from the "ro.carrier" system property or R.array.carrier_properties. // This will be overwritten by the Locale from the SIM language settings (EF-PL, EF-LI) // if applicable. final Locale carrierLocale = mPhone.getLocaleFromCarrierProperties(); if (carrierLocale != null && !TextUtils.isEmpty(carrierLocale.getCountry())) { return carrierLocale.getCountry(); } return ""; } /** * Get the device's current country. * Loading Loading @@ -398,7 +410,7 @@ public class LocaleTracker extends Handler { private synchronized void updateLocale() { // If MCC is available from network service state, use it first. String mcc = null; String countryIso = ""; String countryIso = getCarrierCountry(); if (!TextUtils.isEmpty(mOperatorNumeric)) { try { mcc = mOperatorNumeric.substring(0, 3); Loading src/java/com/android/internal/telephony/Phone.java +4 −22 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import android.net.LinkProperties; import android.net.NetworkCapabilities; import android.net.NetworkStats; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Build; import android.os.Handler; Loading @@ -41,7 +40,6 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.WorkSource; import android.preference.PreferenceManager; import android.provider.Settings; import android.telecom.VideoProfile; import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; Loading Loading @@ -567,23 +565,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return; } // The locale from the "ro.carrier" system property or R.array.carrier_properties. // This will be overwritten by the Locale from the SIM language settings (EF-PL, EF-LI) // if applicable. final Locale carrierLocale = getLocaleFromCarrierProperties(mContext); if (carrierLocale != null && !TextUtils.isEmpty(carrierLocale.getCountry())) { final String country = carrierLocale.getCountry(); try { Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.WIFI_COUNTRY_CODE); } catch (Settings.SettingNotFoundException e) { // note this is not persisting WifiManager wM = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); wM.setCountryCode(country); } } // Initialize device storage and outgoing SMS usage monitors for SMSDispatchers. mTelephonyComponentFactory = telephonyComponentFactory; mSmsStorageMonitor = mTelephonyComponentFactory.inject(SmsStorageMonitor.class.getName()) Loading Loading @@ -1716,14 +1697,15 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * Set the properties by matching the carrier string in * a string-array resource */ private static Locale getLocaleFromCarrierProperties(Context ctx) { @Nullable Locale getLocaleFromCarrierProperties() { String carrier = SystemProperties.get("ro.carrier"); if (null == carrier || 0 == carrier.length() || "unknown".equals(carrier)) { return null; } CharSequence[] carrierLocales = ctx.getResources().getTextArray(R.array.carrier_properties); CharSequence[] carrierLocales = mContext.getResources().getTextArray( R.array.carrier_properties); for (int i = 0; i < carrierLocales.length; i+=3) { String c = carrierLocales[i].toString(); Loading Loading @@ -3900,7 +3882,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return new Locale(records.getSimLanguage()); } return getLocaleFromCarrierProperties(mContext); return getLocaleFromCarrierProperties(); } public void updateDataConnectionTracker() { Loading Loading
src/java/com/android/internal/telephony/LocaleTracker.java +13 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; Loading Loading @@ -206,6 +207,17 @@ public class LocaleTracker extends Handler { mPhone.registerForCellInfo(this, EVENT_UNSOL_CELL_INFO, null); } private @NonNull String getCarrierCountry() { // The locale from the "ro.carrier" system property or R.array.carrier_properties. // This will be overwritten by the Locale from the SIM language settings (EF-PL, EF-LI) // if applicable. final Locale carrierLocale = mPhone.getLocaleFromCarrierProperties(); if (carrierLocale != null && !TextUtils.isEmpty(carrierLocale.getCountry())) { return carrierLocale.getCountry(); } return ""; } /** * Get the device's current country. * Loading Loading @@ -398,7 +410,7 @@ public class LocaleTracker extends Handler { private synchronized void updateLocale() { // If MCC is available from network service state, use it first. String mcc = null; String countryIso = ""; String countryIso = getCarrierCountry(); if (!TextUtils.isEmpty(mOperatorNumeric)) { try { mcc = mOperatorNumeric.substring(0, 3); Loading
src/java/com/android/internal/telephony/Phone.java +4 −22 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ import android.net.LinkProperties; import android.net.NetworkCapabilities; import android.net.NetworkStats; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Build; import android.os.Handler; Loading @@ -41,7 +40,6 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.WorkSource; import android.preference.PreferenceManager; import android.provider.Settings; import android.telecom.VideoProfile; import android.telephony.AccessNetworkConstants; import android.telephony.CarrierConfigManager; Loading Loading @@ -567,23 +565,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return; } // The locale from the "ro.carrier" system property or R.array.carrier_properties. // This will be overwritten by the Locale from the SIM language settings (EF-PL, EF-LI) // if applicable. final Locale carrierLocale = getLocaleFromCarrierProperties(mContext); if (carrierLocale != null && !TextUtils.isEmpty(carrierLocale.getCountry())) { final String country = carrierLocale.getCountry(); try { Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.WIFI_COUNTRY_CODE); } catch (Settings.SettingNotFoundException e) { // note this is not persisting WifiManager wM = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); wM.setCountryCode(country); } } // Initialize device storage and outgoing SMS usage monitors for SMSDispatchers. mTelephonyComponentFactory = telephonyComponentFactory; mSmsStorageMonitor = mTelephonyComponentFactory.inject(SmsStorageMonitor.class.getName()) Loading Loading @@ -1716,14 +1697,15 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * Set the properties by matching the carrier string in * a string-array resource */ private static Locale getLocaleFromCarrierProperties(Context ctx) { @Nullable Locale getLocaleFromCarrierProperties() { String carrier = SystemProperties.get("ro.carrier"); if (null == carrier || 0 == carrier.length() || "unknown".equals(carrier)) { return null; } CharSequence[] carrierLocales = ctx.getResources().getTextArray(R.array.carrier_properties); CharSequence[] carrierLocales = mContext.getResources().getTextArray( R.array.carrier_properties); for (int i = 0; i < carrierLocales.length; i+=3) { String c = carrierLocales[i].toString(); Loading Loading @@ -3900,7 +3882,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return new Locale(records.getSimLanguage()); } return getLocaleFromCarrierProperties(mContext); return getLocaleFromCarrierProperties(); } public void updateDataConnectionTracker() { Loading