Loading src/java/com/android/internal/telephony/LocaleTracker.java +13 −1 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ public class LocaleTracker extends Handler { private final Phone mPhone; private final NitzStateMachine mNitzStateMachine; /** SIM card state. Must be one of TelephonyManager.SIM_STATE_XXX */ private int mSimState; Loading Loading @@ -172,11 +174,13 @@ public class LocaleTracker extends Handler { * Constructor * * @param phone The phone object * @param nitzStateMachine NITZ state machine * @param looper The looper message handler */ public LocaleTracker(Phone phone, Looper looper) { public LocaleTracker(Phone phone, NitzStateMachine nitzStateMachine, Looper looper) { super(looper); mPhone = phone; mNitzStateMachine = nitzStateMachine; mSimState = TelephonyManager.SIM_STATE_UNKNOWN; final IntentFilter filter = new IntentFilter(); Loading Loading @@ -391,6 +395,7 @@ public class LocaleTracker extends Handler { String msg = "updateLocale: mcc = " + mcc + ", country = " + countryIso; log(msg); mLocalLog.log(msg); boolean countryChanged = false; if (!Objects.equals(countryIso, mCurrentCountryIso)) { msg = "updateLocale: Change the current country to " + countryIso; log(msg); Loading @@ -405,6 +410,13 @@ public class LocaleTracker extends Handler { // broadcast on forbidden channels. ((WifiManager) mPhone.getContext().getSystemService(Context.WIFI_SERVICE)) .setCountryCode(countryIso); countryChanged = true; } if (TextUtils.isEmpty(countryIso)) { mNitzStateMachine.handleNetworkCountryCodeUnavailable(); } else { mNitzStateMachine.handleNetworkCountryCodeSet(countryChanged); } } Loading src/java/com/android/internal/telephony/NewNitzStateMachine.java +6 −6 Original line number Diff line number Diff line Loading @@ -72,10 +72,10 @@ public final class NewNitzStateMachine implements NitzStateMachine { /** * Boolean is {@code true} if NITZ has been used to determine a time zone (which may not * ultimately have been used due to user settings). Cleared by {@link #handleNetworkAvailable()} * and {@link #handleNetworkUnavailable()}. The flag can be used when historic NITZ data may no * longer be valid. {@code false} indicates it is reasonable to try to set the time zone using * less reliable algorithms than NITZ-based detection such as by just using network country * code. * and {@link #handleNetworkCountryCodeUnavailable()}. The flag can be used when historic NITZ * data may no longer be valid. {@code false} indicates it is reasonable to try to set the time * zone using less reliable algorithms than NITZ-based detection such as by just using network * country code. */ private boolean mNitzTimeZoneDetectionSuccessful = false; Loading Loading @@ -282,9 +282,9 @@ public final class NewNitzStateMachine implements NitzStateMachine { } @Override public void handleNetworkUnavailable() { public void handleNetworkCountryCodeUnavailable() { if (DBG) { Rlog.d(LOG_TAG, "handleNetworkUnavailable"); Rlog.d(LOG_TAG, "handleNetworkCountryCodeUnavailable"); } mGotCountryCode = false; Loading src/java/com/android/internal/telephony/NitzStateMachine.java +3 −2 Original line number Diff line number Diff line Loading @@ -48,9 +48,10 @@ public interface NitzStateMachine { void handleNetworkAvailable(); /** * Informs the {@link NitzStateMachine} that the network has become unavailable. * Informs the {@link NitzStateMachine} that the country code from network has become * unavailable. */ void handleNetworkUnavailable(); void handleNetworkCountryCodeUnavailable(); /** * Handle a new NITZ signal being received. Loading src/java/com/android/internal/telephony/OldNitzStateMachine.java +6 −6 Original line number Diff line number Diff line Loading @@ -73,10 +73,10 @@ public final class OldNitzStateMachine implements NitzStateMachine { /** * Boolean is {@code true} if NITZ has been used to determine a time zone (which may not * ultimately have been used due to user settings). Cleared by {@link #handleNetworkAvailable()} * and {@link #handleNetworkUnavailable()}. The flag can be used when historic NITZ data may no * longer be valid. {@code false} indicates it is reasonable to try to set the time zone using * less reliable algorithms than NITZ-based detection such as by just using network country * code. * and {@link #handleNetworkCountryCodeUnavailable()}. The flag can be used when historic NITZ * data may no longer be valid. {@code false} indicates it is reasonable to try to set the time * zone using less reliable algorithms than NITZ-based detection such as by just using network * country code. */ private boolean mNitzTimeZoneDetectionSuccessful = false; Loading Loading @@ -290,9 +290,9 @@ public final class OldNitzStateMachine implements NitzStateMachine { } @Override public void handleNetworkUnavailable() { public void handleNetworkCountryCodeUnavailable() { if (DBG) { Rlog.d(LOG_TAG, "handleNetworkUnavailable"); Rlog.d(LOG_TAG, "handleNetworkCountryCodeUnavailable"); } mGotCountryCode = false; Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +4 −29 Original line number Diff line number Diff line Loading @@ -76,7 +76,6 @@ import android.util.LocalLog; import android.util.Pair; import android.util.SparseArray; import android.util.StatsLog; import android.util.TimeUtils; import android.util.TimestampedValue; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -521,7 +520,7 @@ public class ServiceStateTracker extends Handler { } mLocaleTracker = TelephonyComponentFactory.getInstance().makeLocaleTracker( mPhone, getLooper()); mPhone, mNitzState, getLooper()); mCi.registerForImsNetworkStateChanged(this, EVENT_IMS_STATE_CHANGED, null); mCi.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null); Loading Loading @@ -608,7 +607,7 @@ public class ServiceStateTracker extends Handler { mMin = null; mPrlVersion = null; mIsMinInfoReady = false; mNitzState.handleNetworkUnavailable(); mNitzState.handleNetworkCountryCodeUnavailable(); mCellIdentity = null; mNewCellIdentity = null; Loading Loading @@ -2697,7 +2696,7 @@ public class ServiceStateTracker extends Handler { mNewSS.setStateOutOfService(); mNewCellIdentity = null; setSignalStrengthDefaultValues(); mNitzState.handleNetworkUnavailable(); mNitzState.handleNetworkCountryCodeUnavailable(); pollStateDone(); break; Loading @@ -2705,7 +2704,7 @@ public class ServiceStateTracker extends Handler { mNewSS.setStateOff(); mNewCellIdentity = null; setSignalStrengthDefaultValues(); mNitzState.handleNetworkUnavailable(); mNitzState.handleNetworkCountryCodeUnavailable(); // don't poll when device is shutting down or the poll was not modemTrigged // (they sent us new radio data) and current network is not IWLAN if (mDeviceShuttingDown || Loading Loading @@ -2950,7 +2949,6 @@ public class ServiceStateTracker extends Handler { if (hasDeregistered) { mNetworkDetachedRegistrants.notifyRegistrants(); mNitzState.handleNetworkUnavailable(); } if (hasRejectCauseChanged) { Loading Loading @@ -2982,7 +2980,6 @@ public class ServiceStateTracker extends Handler { // operator numeric in locale tracker is null. The async update will allow getting // cell info from the modem instead of using the cached one. mLocaleTracker.updateOperatorNumeric(""); mNitzState.handleNetworkUnavailable(); } else if (mSS.getRilDataRadioTechnology() != ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN) { // If the device is on IWLAN, modems manufacture a ServiceState with the MCC/MNC of // the SIM as if we were talking to towers. Telephony code then uses that with Loading @@ -2994,28 +2991,6 @@ public class ServiceStateTracker extends Handler { } mLocaleTracker.updateOperatorNumeric(operatorNumeric); String countryIsoCode = mLocaleTracker.getCurrentCountry(); // Update Time Zone. boolean iccCardExists = iccCardExists(); boolean networkIsoChanged = networkCountryIsoChanged(countryIsoCode, prevCountryIsoCode); // Determine countryChanged: networkIso is only reliable if there's an ICC card. boolean countryChanged = iccCardExists && networkIsoChanged; if (DBG) { long ctm = System.currentTimeMillis(); log("Before handleNetworkCountryCodeKnown:" + " countryChanged=" + countryChanged + " iccCardExist=" + iccCardExists + " countryIsoChanged=" + networkIsoChanged + " operatorNumeric=" + operatorNumeric + " prevOperatorNumeric=" + prevOperatorNumeric + " countryIsoCode=" + countryIsoCode + " prevCountryIsoCode=" + prevCountryIsoCode + " ltod=" + TimeUtils.logTimeOfDay(ctm)); } mNitzState.handleNetworkCountryCodeSet(countryChanged); } tm.setNetworkRoamingForPhone(mPhone.getPhoneId(), Loading Loading
src/java/com/android/internal/telephony/LocaleTracker.java +13 −1 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ public class LocaleTracker extends Handler { private final Phone mPhone; private final NitzStateMachine mNitzStateMachine; /** SIM card state. Must be one of TelephonyManager.SIM_STATE_XXX */ private int mSimState; Loading Loading @@ -172,11 +174,13 @@ public class LocaleTracker extends Handler { * Constructor * * @param phone The phone object * @param nitzStateMachine NITZ state machine * @param looper The looper message handler */ public LocaleTracker(Phone phone, Looper looper) { public LocaleTracker(Phone phone, NitzStateMachine nitzStateMachine, Looper looper) { super(looper); mPhone = phone; mNitzStateMachine = nitzStateMachine; mSimState = TelephonyManager.SIM_STATE_UNKNOWN; final IntentFilter filter = new IntentFilter(); Loading Loading @@ -391,6 +395,7 @@ public class LocaleTracker extends Handler { String msg = "updateLocale: mcc = " + mcc + ", country = " + countryIso; log(msg); mLocalLog.log(msg); boolean countryChanged = false; if (!Objects.equals(countryIso, mCurrentCountryIso)) { msg = "updateLocale: Change the current country to " + countryIso; log(msg); Loading @@ -405,6 +410,13 @@ public class LocaleTracker extends Handler { // broadcast on forbidden channels. ((WifiManager) mPhone.getContext().getSystemService(Context.WIFI_SERVICE)) .setCountryCode(countryIso); countryChanged = true; } if (TextUtils.isEmpty(countryIso)) { mNitzStateMachine.handleNetworkCountryCodeUnavailable(); } else { mNitzStateMachine.handleNetworkCountryCodeSet(countryChanged); } } Loading
src/java/com/android/internal/telephony/NewNitzStateMachine.java +6 −6 Original line number Diff line number Diff line Loading @@ -72,10 +72,10 @@ public final class NewNitzStateMachine implements NitzStateMachine { /** * Boolean is {@code true} if NITZ has been used to determine a time zone (which may not * ultimately have been used due to user settings). Cleared by {@link #handleNetworkAvailable()} * and {@link #handleNetworkUnavailable()}. The flag can be used when historic NITZ data may no * longer be valid. {@code false} indicates it is reasonable to try to set the time zone using * less reliable algorithms than NITZ-based detection such as by just using network country * code. * and {@link #handleNetworkCountryCodeUnavailable()}. The flag can be used when historic NITZ * data may no longer be valid. {@code false} indicates it is reasonable to try to set the time * zone using less reliable algorithms than NITZ-based detection such as by just using network * country code. */ private boolean mNitzTimeZoneDetectionSuccessful = false; Loading Loading @@ -282,9 +282,9 @@ public final class NewNitzStateMachine implements NitzStateMachine { } @Override public void handleNetworkUnavailable() { public void handleNetworkCountryCodeUnavailable() { if (DBG) { Rlog.d(LOG_TAG, "handleNetworkUnavailable"); Rlog.d(LOG_TAG, "handleNetworkCountryCodeUnavailable"); } mGotCountryCode = false; Loading
src/java/com/android/internal/telephony/NitzStateMachine.java +3 −2 Original line number Diff line number Diff line Loading @@ -48,9 +48,10 @@ public interface NitzStateMachine { void handleNetworkAvailable(); /** * Informs the {@link NitzStateMachine} that the network has become unavailable. * Informs the {@link NitzStateMachine} that the country code from network has become * unavailable. */ void handleNetworkUnavailable(); void handleNetworkCountryCodeUnavailable(); /** * Handle a new NITZ signal being received. Loading
src/java/com/android/internal/telephony/OldNitzStateMachine.java +6 −6 Original line number Diff line number Diff line Loading @@ -73,10 +73,10 @@ public final class OldNitzStateMachine implements NitzStateMachine { /** * Boolean is {@code true} if NITZ has been used to determine a time zone (which may not * ultimately have been used due to user settings). Cleared by {@link #handleNetworkAvailable()} * and {@link #handleNetworkUnavailable()}. The flag can be used when historic NITZ data may no * longer be valid. {@code false} indicates it is reasonable to try to set the time zone using * less reliable algorithms than NITZ-based detection such as by just using network country * code. * and {@link #handleNetworkCountryCodeUnavailable()}. The flag can be used when historic NITZ * data may no longer be valid. {@code false} indicates it is reasonable to try to set the time * zone using less reliable algorithms than NITZ-based detection such as by just using network * country code. */ private boolean mNitzTimeZoneDetectionSuccessful = false; Loading Loading @@ -290,9 +290,9 @@ public final class OldNitzStateMachine implements NitzStateMachine { } @Override public void handleNetworkUnavailable() { public void handleNetworkCountryCodeUnavailable() { if (DBG) { Rlog.d(LOG_TAG, "handleNetworkUnavailable"); Rlog.d(LOG_TAG, "handleNetworkCountryCodeUnavailable"); } mGotCountryCode = false; Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +4 −29 Original line number Diff line number Diff line Loading @@ -76,7 +76,6 @@ import android.util.LocalLog; import android.util.Pair; import android.util.SparseArray; import android.util.StatsLog; import android.util.TimeUtils; import android.util.TimestampedValue; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -521,7 +520,7 @@ public class ServiceStateTracker extends Handler { } mLocaleTracker = TelephonyComponentFactory.getInstance().makeLocaleTracker( mPhone, getLooper()); mPhone, mNitzState, getLooper()); mCi.registerForImsNetworkStateChanged(this, EVENT_IMS_STATE_CHANGED, null); mCi.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null); Loading Loading @@ -608,7 +607,7 @@ public class ServiceStateTracker extends Handler { mMin = null; mPrlVersion = null; mIsMinInfoReady = false; mNitzState.handleNetworkUnavailable(); mNitzState.handleNetworkCountryCodeUnavailable(); mCellIdentity = null; mNewCellIdentity = null; Loading Loading @@ -2697,7 +2696,7 @@ public class ServiceStateTracker extends Handler { mNewSS.setStateOutOfService(); mNewCellIdentity = null; setSignalStrengthDefaultValues(); mNitzState.handleNetworkUnavailable(); mNitzState.handleNetworkCountryCodeUnavailable(); pollStateDone(); break; Loading @@ -2705,7 +2704,7 @@ public class ServiceStateTracker extends Handler { mNewSS.setStateOff(); mNewCellIdentity = null; setSignalStrengthDefaultValues(); mNitzState.handleNetworkUnavailable(); mNitzState.handleNetworkCountryCodeUnavailable(); // don't poll when device is shutting down or the poll was not modemTrigged // (they sent us new radio data) and current network is not IWLAN if (mDeviceShuttingDown || Loading Loading @@ -2950,7 +2949,6 @@ public class ServiceStateTracker extends Handler { if (hasDeregistered) { mNetworkDetachedRegistrants.notifyRegistrants(); mNitzState.handleNetworkUnavailable(); } if (hasRejectCauseChanged) { Loading Loading @@ -2982,7 +2980,6 @@ public class ServiceStateTracker extends Handler { // operator numeric in locale tracker is null. The async update will allow getting // cell info from the modem instead of using the cached one. mLocaleTracker.updateOperatorNumeric(""); mNitzState.handleNetworkUnavailable(); } else if (mSS.getRilDataRadioTechnology() != ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN) { // If the device is on IWLAN, modems manufacture a ServiceState with the MCC/MNC of // the SIM as if we were talking to towers. Telephony code then uses that with Loading @@ -2994,28 +2991,6 @@ public class ServiceStateTracker extends Handler { } mLocaleTracker.updateOperatorNumeric(operatorNumeric); String countryIsoCode = mLocaleTracker.getCurrentCountry(); // Update Time Zone. boolean iccCardExists = iccCardExists(); boolean networkIsoChanged = networkCountryIsoChanged(countryIsoCode, prevCountryIsoCode); // Determine countryChanged: networkIso is only reliable if there's an ICC card. boolean countryChanged = iccCardExists && networkIsoChanged; if (DBG) { long ctm = System.currentTimeMillis(); log("Before handleNetworkCountryCodeKnown:" + " countryChanged=" + countryChanged + " iccCardExist=" + iccCardExists + " countryIsoChanged=" + networkIsoChanged + " operatorNumeric=" + operatorNumeric + " prevOperatorNumeric=" + prevOperatorNumeric + " countryIsoCode=" + countryIsoCode + " prevCountryIsoCode=" + prevCountryIsoCode + " ltod=" + TimeUtils.logTimeOfDay(ctm)); } mNitzState.handleNetworkCountryCodeSet(countryChanged); } tm.setNetworkRoamingForPhone(mPhone.getPhoneId(), Loading