Merge "Prevent unnecessary building APN candidates"
diff --git a/proto/src/telephony.proto b/proto/src/telephony.proto
index e9a564e..ec2acf4 100644
--- a/proto/src/telephony.proto
+++ b/proto/src/telephony.proto
@@ -331,6 +331,10 @@
RAT_IWLAN = 18;
RAT_LTE_CA = 19;
+
+ RAT_NR_NSA = 20;
+
+ RAT_NR_SA = 21;
}
// The information about IMS errors
diff --git a/src/java/com/android/internal/telephony/InboundSmsHandler.java b/src/java/com/android/internal/telephony/InboundSmsHandler.java
index 7a3d81e..3d66b60 100644
--- a/src/java/com/android/internal/telephony/InboundSmsHandler.java
+++ b/src/java/com/android/internal/telephony/InboundSmsHandler.java
@@ -35,7 +35,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.IPackageManager;
import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
@@ -47,7 +46,6 @@
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Telephony;
@@ -664,18 +662,18 @@
return Intents.RESULT_SMS_HANDLED;
}
- // onlyCore indicates if the device is in cryptkeeper
- boolean onlyCore = false;
- try {
- onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService("package")).
- isOnlyCoreApps();
- } catch (RemoteException e) {
- }
- if (onlyCore) {
- // Device is unable to receive SMS in encrypted state
- log("Received a short message in encrypted state. Rejecting.");
- return Intents.RESULT_SMS_GENERIC_ERROR;
- }
+// // onlyCore indicates if the device is in cryptkeeper
+// boolean onlyCore = false;
+// try {
+// onlyCore = IPackageManager.Stub.asInterface(ServiceManager.getService("package")).
+// isOnlyCoreApps();
+// } catch (RemoteException e) {
+// }
+// if (onlyCore) {
+// // Device is unable to receive SMS in encrypted state
+// log("Received a short message in encrypted state. Rejecting.");
+// return Intents.RESULT_SMS_GENERIC_ERROR;
+// }
int result = dispatchMessageRadioSpecific(smsb);
diff --git a/src/java/com/android/internal/telephony/LocaleTracker.java b/src/java/com/android/internal/telephony/LocaleTracker.java
index b284799..1c9a7e0 100755
--- a/src/java/com/android/internal/telephony/LocaleTracker.java
+++ b/src/java/com/android/internal/telephony/LocaleTracker.java
@@ -454,41 +454,41 @@
*/
private synchronized void updateLocale() {
// If MCC is available from network service state, use it first.
- String mcc = null;
String countryIso = getCarrierCountry();
- boolean isBogusMcc = false;
+ String countryIsoDebugInfo = "getCarrierCountry()";
if (!TextUtils.isEmpty(mOperatorNumeric)) {
try {
- mcc = mOperatorNumeric.substring(0, 3);
+ String mcc = mOperatorNumeric.substring(0, 3);
countryIso = MccTable.countryCodeForMcc(mcc);
- if (!TextUtils.isEmpty(mcc) && TextUtils.isEmpty(countryIso)) {
- isBogusMcc = true;
- }
+ countryIsoDebugInfo = "OperatorNumeric(" + mOperatorNumeric
+ + "): MccTable.countryCodeForMcc(\"" + mcc + "\")";
} catch (StringIndexOutOfBoundsException ex) {
- loge("updateLocale: Can't get country from operator numeric. mcc = "
- + mcc + ". ex=" + ex);
+ loge("updateLocale: Can't get country from operator numeric. mOperatorNumeric = "
+ + mOperatorNumeric + ". ex=" + ex);
}
}
// If for any reason we can't get country from operator numeric, try to get it from cell
// info.
if (TextUtils.isEmpty(countryIso)) {
- mcc = getMccFromCellInfo();
+ String mcc = getMccFromCellInfo();
countryIso = MccTable.countryCodeForMcc(mcc);
+ countryIsoDebugInfo = "CellInfo: MccTable.countryCodeForMcc(\"" + mcc + "\")";
}
if (mCountryOverride != null) {
countryIso = mCountryOverride;
+ countryIsoDebugInfo = "mCountryOverride = \"" + mCountryOverride + "\"";
log("Override current country to " + mCountryOverride);
}
- log("updateLocale: mcc = " + mcc + ", country = " + countryIso
- + ", isBogusMcc = " + isBogusMcc);
- boolean countryChanged = false;
+ log("updateLocale: countryIso = " + countryIso
+ + ", countryIsoDebugInfo = " + countryIsoDebugInfo);
if (!Objects.equals(countryIso, mCurrentCountryIso)) {
String msg = "updateLocale: Change the current country to \"" + countryIso
- + "\", mcc = " + mcc + ", mCellInfoList = " + mCellInfoList;
+ + "\", countryIsoDebugInfo = " + countryIsoDebugInfo
+ + ", mCellInfoList = " + mCellInfoList;
log(msg);
mLocalLog.log(msg);
mCurrentCountryIso = countryIso;
@@ -500,15 +500,21 @@
intent.putExtra(TelephonyManager.EXTRA_NETWORK_COUNTRY, countryIso);
SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
mPhone.getContext().sendBroadcast(intent);
-
- countryChanged = true;
}
- // For bogus mcc, the countryIso is always empty, it should be marked as available.
- if (TextUtils.isEmpty(countryIso) && !isBogusMcc) {
- mNitzStateMachine.handleNetworkCountryCodeUnavailable();
+ // For a test cell, the NitzStateMachine requires handleCountryDetected("") to pass
+ // compliance tests. http://b/142840879
+ boolean isTestMcc = false;
+ if (!TextUtils.isEmpty(mOperatorNumeric)) {
+ if (mOperatorNumeric.startsWith("001")) {
+ isTestMcc = true;
+ countryIso = "";
+ }
+ }
+ if (TextUtils.isEmpty(countryIso) && !isTestMcc) {
+ mNitzStateMachine.handleCountryUnavailable();
} else {
- mNitzStateMachine.handleNetworkCountryCodeSet(countryChanged);
+ mNitzStateMachine.handleCountryDetected(countryIso);
}
}
diff --git a/src/java/com/android/internal/telephony/NitzStateMachine.java b/src/java/com/android/internal/telephony/NitzStateMachine.java
index 9e98cae..ec5aaa6 100644
--- a/src/java/com/android/internal/telephony/NitzStateMachine.java
+++ b/src/java/com/android/internal/telephony/NitzStateMachine.java
@@ -17,13 +17,11 @@
package com.android.internal.telephony;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.content.ContentResolver;
import android.content.Context;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
-import android.telephony.TelephonyManager;
import android.util.TimestampedValue;
import com.android.internal.util.IndentingPrintWriter;
@@ -40,13 +38,12 @@
public interface NitzStateMachine {
/**
- * Called when the network country is set on the Phone. Although set, the network country code
- * may be invalid.
+ * Called when the country suitable for time zone detection is detected.
*
- * @param countryChanged true when the country code is known to have changed, false if it
- * probably hasn't
+ * @param countryIsoCode the countryIsoCode to use for time zone detection, may be "" for test
+ * cells only, otherwise {@link #handleCountryUnavailable()} should be called
*/
- void handleNetworkCountryCodeSet(boolean countryChanged);
+ void handleCountryDetected(@NonNull String countryIsoCode);
/**
* Informs the {@link NitzStateMachine} that the network has become available.
@@ -59,10 +56,10 @@
void handleNetworkUnavailable();
/**
- * Informs the {@link NitzStateMachine} that the country code from network has become
- * unavailable.
+ * Informs the {@link NitzStateMachine} that any previously detected country supplied via
+ * {@link #handleCountryDetected(String)} is no longer valid.
*/
- void handleNetworkCountryCodeUnavailable();
+ void handleCountryUnavailable();
/**
* Handle a new NITZ signal being received.
@@ -108,8 +105,6 @@
*/
boolean getIgnoreNitz();
- @Nullable String getNetworkCountryIsoForPhone();
-
/**
* Returns the same value as {@link SystemClock#elapsedRealtime()}.
*/
@@ -133,16 +128,10 @@
private static final int NITZ_UPDATE_DIFF_DEFAULT = 2000;
private final int mNitzUpdateDiff;
- private final Phone mPhone;
- private final TelephonyManager mTelephonyManager;
private final ContentResolver mCr;
public DeviceStateImpl(Phone phone) {
- mPhone = phone;
-
Context context = phone.getContext();
- mTelephonyManager =
- (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
mCr = context.getContentResolver();
mNitzUpdateSpacing =
SystemProperties.getInt("ro.nitz_update_spacing", NITZ_UPDATE_SPACING_DEFAULT);
@@ -168,12 +157,6 @@
}
@Override
- @Nullable
- public String getNetworkCountryIsoForPhone() {
- return mTelephonyManager.getNetworkCountryIso(mPhone.getPhoneId());
- }
-
- @Override
public long elapsedRealtime() {
return SystemClock.elapsedRealtime();
}
diff --git a/src/java/com/android/internal/telephony/NitzStateMachineImpl.java b/src/java/com/android/internal/telephony/NitzStateMachineImpl.java
index ffcb33d..23152ac 100644
--- a/src/java/com/android/internal/telephony/NitzStateMachineImpl.java
+++ b/src/java/com/android/internal/telephony/NitzStateMachineImpl.java
@@ -56,13 +56,11 @@
private TimestampedValue<NitzData> mLatestNitzSignal;
/**
- * Records whether the device should have a country code available via
- * {@link DeviceState#getNetworkCountryIsoForPhone()}. Before this an NITZ signal
- * received is (almost always) not enough to determine time zone. On test networks the country
- * code should be available but can still be an empty string but this flag indicates that the
- * information available is unlikely to improve.
+ * Records the country to use for time zone detection. It can be a valid ISO 3166 alpha-2 code
+ * (lower case), empty (test network) or null (no country detected). A country code is required
+ * to determine time zone except when on a test network.
*/
- private boolean mGotCountryCode = false;
+ private String mCountryIsoCode;
/**
* The last time zone ID that has been determined. It may not have been set as the device time
@@ -82,7 +80,7 @@
/**
* 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()}, {@link #handleNetworkCountryCodeUnavailable()},
+ * #handleNetworkAvailable()}, {@link #handleCountryUnavailable()},
* {@link #handleNetworkUnavailable()}, and {@link #handleAirplaneModeChanged(boolean)}. 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
@@ -132,16 +130,16 @@
}
@Override
- public void handleNetworkCountryCodeSet(boolean countryChanged) {
- boolean hadCountryCode = mGotCountryCode;
- mGotCountryCode = true;
+ public void handleCountryDetected(String countryIsoCode) {
+ String oldCountryIsoCode = mCountryIsoCode;
+ mCountryIsoCode = Objects.requireNonNull(countryIsoCode);
- String isoCountryCode = mDeviceState.getNetworkCountryIsoForPhone();
- if (!TextUtils.isEmpty(isoCountryCode) && !mNitzTimeZoneDetectionSuccessful) {
- updateTimeZoneFromNetworkCountryCode(isoCountryCode);
+ if (!TextUtils.isEmpty(countryIsoCode) && !mNitzTimeZoneDetectionSuccessful) {
+ updateTimeZoneFromNetworkCountryCode(countryIsoCode);
}
- if (mLatestNitzSignal != null && (countryChanged || !hadCountryCode)) {
+ boolean countryChanged = Objects.equals(oldCountryIsoCode, countryIsoCode);
+ if (mLatestNitzSignal != null && (countryChanged || oldCountryIsoCode == null)) {
updateTimeZoneFromCountryAndNitz();
}
}
@@ -150,7 +148,7 @@
// This method must only be called after mLatestNitzSignal has been set to a non-null
// value.
TimestampedValue<NitzData> nitzSignal = Objects.requireNonNull(mLatestNitzSignal);
- String isoCountryCode = mDeviceState.getNetworkCountryIsoForPhone();
+ String isoCountryCode = mCountryIsoCode;
// TimeZone.getDefault() returns a default zone (GMT) even when time zone have never
// been set which makes it difficult to tell if it's what the user / time zone detection
@@ -172,7 +170,7 @@
String zoneId;
if (nitzData.getEmulatorHostTimeZone() != null) {
zoneId = nitzData.getEmulatorHostTimeZone().getID();
- } else if (!mGotCountryCode) {
+ } else if (isoCountryCode == null) {
// We don't have a country code so we won't try to look up the time zone.
zoneId = null;
} else if (TextUtils.isEmpty(isoCountryCode)) {
@@ -328,8 +326,8 @@
// mSavedTimeZoneId has been cleared but it might be sufficient to detect the time zone
// using only the country information that is left.
- if (mGotCountryCode) {
- String isoCountryCode = mDeviceState.getNetworkCountryIsoForPhone();
+ String isoCountryCode = mCountryIsoCode;
+ if (isoCountryCode != null) {
if (!TextUtils.isEmpty(isoCountryCode)) {
updateTimeZoneFromNetworkCountryCode(isoCountryCode);
}
@@ -337,13 +335,13 @@
}
@Override
- public void handleNetworkCountryCodeUnavailable() {
+ public void handleCountryUnavailable() {
if (DBG) {
Rlog.d(LOG_TAG, "handleNetworkCountryCodeUnavailable");
}
mSavedTimeZoneId = null;
- mGotCountryCode = false;
+ mCountryIsoCode = null;
mNitzTimeZoneDetectionSuccessful = false;
}
@@ -377,7 +375,7 @@
mSavedNitzTime = null;
mTimeLog.log("handleAirplaneModeChanged(" + on + "): Time state cleared.");
- mGotCountryCode = false;
+ mCountryIsoCode = null;
mLatestNitzSignal = null;
mNitzTimeZoneDetectionSuccessful = false;
mSavedTimeZoneId = null;
@@ -521,7 +519,7 @@
// Time Zone Detection State
pw.println(" mLatestNitzSignal=" + mLatestNitzSignal);
- pw.println(" mGotCountryCode=" + mGotCountryCode);
+ pw.println(" mCountryIsoCode=" + mCountryIsoCode);
pw.println(" mSavedTimeZoneId=" + mSavedTimeZoneId);
pw.println(" mNitzTimeZoneDetectionSuccessful=" + mNitzTimeZoneDetectionSuccessful);
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
index bcfceff..30391ca 100755
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -728,7 +728,7 @@
mMin = null;
mPrlVersion = null;
mIsMinInfoReady = false;
- mNitzState.handleNetworkCountryCodeUnavailable();
+ mNitzState.handleCountryUnavailable();
mCellIdentity = null;
mNewCellIdentity = null;
mSignalStrengthUpdatedTime = System.currentTimeMillis();
@@ -3014,7 +3014,7 @@
mNewSS.setStateOutOfService();
mNewCellIdentity = null;
setSignalStrengthDefaultValues();
- mNitzState.handleNetworkCountryCodeUnavailable();
+ mNitzState.handleCountryUnavailable();
pollStateDone();
break;
@@ -3022,7 +3022,7 @@
mNewSS.setStateOff();
mNewCellIdentity = null;
setSignalStrengthDefaultValues();
- mNitzState.handleNetworkCountryCodeUnavailable();
+ mNitzState.handleCountryUnavailable();
// 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 ||
diff --git a/src/java/com/android/internal/telephony/nitz/NewNitzStateMachineImpl.java b/src/java/com/android/internal/telephony/nitz/NewNitzStateMachineImpl.java
index aef2535..5b41d8e 100644
--- a/src/java/com/android/internal/telephony/nitz/NewNitzStateMachineImpl.java
+++ b/src/java/com/android/internal/telephony/nitz/NewNitzStateMachineImpl.java
@@ -100,8 +100,6 @@
// Miscellaneous dependencies and helpers not related to detection state.
private final int mPhoneId;
- /** Accesses global information about the device. */
- private final DeviceState mDeviceState;
/** Applied to NITZ signals during input filtering. */
private final NitzSignalInputFilterPredicate mNitzSignalInputFilter;
/** Creates {@link PhoneTimeZoneSuggestion} for passing to the time zone detection service. */
@@ -122,13 +120,11 @@
// Time Zone detection state.
/**
- * Records whether the device should have a country code available via
- * {@link DeviceState#getNetworkCountryIsoForPhone()}. Before this an NITZ signal
- * received is (almost always) not enough to determine time zone. On test networks the country
- * code should be available but can still be an empty string but this flag indicates that the
- * information available is unlikely to improve.
+ * Records the country to use for time zone detection. It can be a valid ISO 3166 alpha-2 code
+ * (lower case), empty (test network) or null (no country detected). A country code is required
+ * to determine time zone except when on a test network.
*/
- private boolean mGotCountryCode = false;
+ private String mCountryIsoCode;
/**
* Creates an instance for the supplied {@link Phone}.
@@ -145,7 +141,7 @@
NitzSignalInputFilterPredicate nitzSignalFilter =
NitzSignalInputFilterPredicateFactory.create(phone.getContext(), deviceState);
return new NewNitzStateMachineImpl(
- phoneId, nitzSignalFilter, timeZoneSuggester, newTimeServiceHelper, deviceState);
+ phoneId, nitzSignalFilter, timeZoneSuggester, newTimeServiceHelper);
}
/**
@@ -156,11 +152,10 @@
public NewNitzStateMachineImpl(int phoneId,
@NonNull NitzSignalInputFilterPredicate nitzSignalInputFilter,
@NonNull TimeZoneSuggester timeZoneSuggester,
- @NonNull NewTimeServiceHelper newTimeServiceHelper, @NonNull DeviceState deviceState) {
+ @NonNull NewTimeServiceHelper newTimeServiceHelper) {
mPhoneId = phoneId;
mTimeZoneSuggester = Objects.requireNonNull(timeZoneSuggester);
mNewTimeServiceHelper = Objects.requireNonNull(newTimeServiceHelper);
- mDeviceState = Objects.requireNonNull(deviceState);
mNitzSignalInputFilter = Objects.requireNonNull(nitzSignalInputFilter);
}
@@ -180,8 +175,7 @@
// Assume any previous NITZ signals received are now invalid.
mLatestNitzSignal = null;
- String countryIsoCode =
- mGotCountryCode ? mDeviceState.getNetworkCountryIsoForPhone() : null;
+ String countryIsoCode = mCountryIsoCode;
if (DBG) {
Rlog.d(LOG_TAG, reason + ": countryIsoCode=" + countryIsoCode);
@@ -195,30 +189,32 @@
}
@Override
- public void handleNetworkCountryCodeSet(boolean countryChanged) {
+ public void handleCountryDetected(@NonNull String countryIsoCode) {
if (DBG) {
- Rlog.d(LOG_TAG, "handleNetworkCountryCodeSet: countryChanged=" + countryChanged
+ Rlog.d(LOG_TAG, "handleCountryDetected: countryIsoCode=" + countryIsoCode
+ ", mLatestNitzSignal=" + mLatestNitzSignal);
}
- mGotCountryCode = true;
- // Generate a new time zone suggestion and update the service as needed.
- String countryIsoCode = mDeviceState.getNetworkCountryIsoForPhone();
- doTimeZoneDetection(countryIsoCode, mLatestNitzSignal,
- "handleNetworkCountryCodeSet(" + countryChanged + ")");
+ String oldCountryIsoCode = mCountryIsoCode;
+ mCountryIsoCode = Objects.requireNonNull(countryIsoCode);
+ if (!Objects.equals(oldCountryIsoCode, mCountryIsoCode)) {
+ // Generate a new time zone suggestion and update the service as needed.
+ doTimeZoneDetection(countryIsoCode, mLatestNitzSignal,
+ "handleCountryDetected(\"" + countryIsoCode + "\")");
+ }
}
@Override
- public void handleNetworkCountryCodeUnavailable() {
+ public void handleCountryUnavailable() {
if (DBG) {
- Rlog.d(LOG_TAG, "handleNetworkCountryCodeUnavailable:"
+ Rlog.d(LOG_TAG, "handleCountryUnavailable:"
+ " mLatestNitzSignal=" + mLatestNitzSignal);
}
- mGotCountryCode = false;
+ mCountryIsoCode = null;
// Generate a new time zone suggestion and update the service as needed.
doTimeZoneDetection(null /* countryIsoCode */, mLatestNitzSignal,
- "handleNetworkCountryCodeUnavailable()");
+ "handleCountryUnavailable()");
}
@Override
@@ -240,8 +236,7 @@
String reason = "handleNitzReceived(" + nitzSignal + ")";
// Generate a new time zone suggestion and update the service as needed.
- String countryIsoCode =
- mGotCountryCode ? mDeviceState.getNetworkCountryIsoForPhone() : null;
+ String countryIsoCode = mCountryIsoCode;
doTimeZoneDetection(countryIsoCode, nitzSignal, reason);
// Generate a new time suggestion and update the service as needed.
@@ -264,7 +259,7 @@
// connectivity.
// Clear time zone detection state.
- mGotCountryCode = false;
+ mCountryIsoCode = null;
String reason = "handleAirplaneModeChanged(" + on + ")";
clearNetworkStateAndRerunDetection(reason);
@@ -334,7 +329,7 @@
@Override
public void dumpState(PrintWriter pw) {
pw.println(" NewNitzStateMachineImpl.mLatestNitzSignal=" + mLatestNitzSignal);
- pw.println(" NewNitzStateMachineImpl.mGotCountryCode=" + mGotCountryCode);
+ pw.println(" NewNitzStateMachineImpl.mCountryIsoCode=" + mCountryIsoCode);
mNewTimeServiceHelper.dumpState(pw);
pw.flush();
}
diff --git a/src/java/com/android/internal/telephony/uicc/UiccSlot.java b/src/java/com/android/internal/telephony/uicc/UiccSlot.java
index 11478e6..77278d1 100644
--- a/src/java/com/android/internal/telephony/uicc/UiccSlot.java
+++ b/src/java/com/android/internal/telephony/uicc/UiccSlot.java
@@ -105,9 +105,9 @@
// 2. The latest mCardState is not ABSENT, but there is no UiccCard instance.
} else if ((oldState == null || oldState == CardState.CARDSTATE_ABSENT
|| mUiccCard == null) && mCardState != CardState.CARDSTATE_ABSENT) {
- // No notifications while radio is off or we just powering up
- if (radioState == TelephonyManager.RADIO_POWER_ON
- && mLastRadioState == TelephonyManager.RADIO_POWER_ON) {
+ // No notification while we are just powering up
+ if (radioState != TelephonyManager.RADIO_POWER_UNAVAILABLE
+ && mLastRadioState != TelephonyManager.RADIO_POWER_UNAVAILABLE) {
if (DBG) log("update: notify card added");
sendMessage(obtainMessage(EVENT_CARD_ADDED, null));
}
@@ -183,9 +183,9 @@
private void updateCardStateAbsent() {
int radioState =
(mCi == null) ? TelephonyManager.RADIO_POWER_UNAVAILABLE : mCi.getRadioState();
- // No notifications while radio is off or we just powering up
- if (radioState == TelephonyManager.RADIO_POWER_ON
- && mLastRadioState == TelephonyManager.RADIO_POWER_ON) {
+ // No notification while we are just powering up
+ if (radioState != TelephonyManager.RADIO_POWER_UNAVAILABLE
+ && mLastRadioState != TelephonyManager.RADIO_POWER_UNAVAILABLE) {
if (DBG) log("update: notify card removed");
sendMessage(obtainMessage(EVENT_CARD_REMOVED, null));
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java
index 51aa5d0..5d69ab6 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java
@@ -20,7 +20,6 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -55,7 +54,7 @@
private static final String US_MCC = "310";
private static final String LIECHTENSTEIN_MCC = "295";
- private static final String BOGUS_MCC = "001";
+ private static final String TEST_CELL_MCC = "001";
private static final String FAKE_MNC = "123";
@@ -284,14 +283,14 @@
throws Exception {
mLocaleTracker.updateOperatorNumeric("");
sendOperatorLost();
- verify(mNitzStateMachine, times(1)).handleNetworkCountryCodeUnavailable();
+ verify(mNitzStateMachine, times(1)).handleCountryUnavailable();
}
@Test
@SmallTest
- public void updateOperatorNumeric_BogusNetwork_shouldHandleNetworkCountryCodeSet()
+ public void updateOperatorNumeric_TestNetwork_shouldHandleNetworkCountryCodeSet()
throws Exception {
- mLocaleTracker.updateOperatorNumeric(BOGUS_MCC + FAKE_MNC);
- verify(mNitzStateMachine, times(1)).handleNetworkCountryCodeSet(anyBoolean());
+ mLocaleTracker.updateOperatorNumeric(TEST_CELL_MCC + FAKE_MNC);
+ verify(mNitzStateMachine, times(1)).handleCountryDetected("");
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java b/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java
index 1b74a6b..3702d3e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java
@@ -1146,8 +1146,7 @@
}
Script countryReceived(String countryIsoCode) {
- mFakeDeviceState.networkCountryIsoForPhone = countryIsoCode;
- mNitzStateMachine.handleNetworkCountryCodeSet(true);
+ mNitzStateMachine.handleCountryDetected(countryIsoCode);
return this;
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineTestSupport.java b/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineTestSupport.java
index 02a0cc9..6621c03 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineTestSupport.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineTestSupport.java
@@ -214,7 +214,6 @@
public boolean ignoreNitz;
public int nitzUpdateDiffMillis;
public int nitzUpdateSpacingMillis;
- public String networkCountryIsoForPhone;
public long elapsedRealtime;
public long currentTimeMillis;
@@ -242,11 +241,6 @@
}
@Override
- public String getNetworkCountryIsoForPhone() {
- return networkCountryIsoForPhone;
- }
-
- @Override
public long elapsedRealtime() {
return elapsedRealtime;
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/nitz/NewNitzStateMachineImplTest.java b/tests/telephonytests/src/com/android/internal/telephony/nitz/NewNitzStateMachineImplTest.java
index 01acf08..01efb40 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/nitz/NewNitzStateMachineImplTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/nitz/NewNitzStateMachineImplTest.java
@@ -85,7 +85,7 @@
mNitzStateMachineImpl = new NewNitzStateMachineImpl(
PHONE_ID, mFakeNitzSignalInputFilter, mRealTimeZoneSuggester,
- mFakeNewTimeServiceHelper, mFakeDeviceState);
+ mFakeNewTimeServiceHelper);
TelephonyTest.logd("NewNitzStateMachineImplTest -Setup!");
}
@@ -496,8 +496,6 @@
mFakeDeviceState.ignoreNitz = false;
mFakeDeviceState.nitzUpdateDiffMillis = 2000;
mFakeDeviceState.nitzUpdateSpacingMillis = 1000 * 60 * 10;
-
- mFakeDeviceState.networkCountryIsoForPhone = "";
}
// Initialization methods for setting simulated device state, usually before simulation.
@@ -530,13 +528,12 @@
}
Script countryUnavailable() {
- mNitzStateMachineImpl.handleNetworkCountryCodeUnavailable();
+ mNitzStateMachineImpl.handleCountryUnavailable();
return this;
}
Script countryReceived(String countryIsoCode) {
- mFakeDeviceState.networkCountryIsoForPhone = countryIsoCode;
- mNitzStateMachineImpl.handleNetworkCountryCodeSet(true);
+ mNitzStateMachineImpl.handleCountryDetected(countryIsoCode);
return this;
}