aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/android/internal
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2023-03-29 05:57:10 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-03-29 05:57:10 +0000
commit32f2c07ae4859f67a1525bff7ecb9bcceac9e72f (patch)
tree1cacb2efd6d39f493d9240c3818f89f81fd5c3e5 /src/java/com/android/internal
parenta8994214d5c69d0154c1404e3421537b401b091b (diff)
parent70c62bf1198a8bb675e7eadab015b9b0a3d63dd9 (diff)
downloadtelephony-32f2c07ae4859f67a1525bff7ecb9bcceac9e72f.tar.gz
Merge changes from topic "revert-2370228-legacy_iwlan_removal-UKSFKVXSIS"
* changes: [RESTRICT AUTOMERGE] Revert "Removed IWLAN legacy mode support" [RESTRICT AUTOMERGE] Revert "Fix to set transportType when creating DataServiceManager."
Diffstat (limited to 'src/java/com/android/internal')
-rwxr-xr-xsrc/java/com/android/internal/telephony/ServiceStateTracker.java65
-rw-r--r--src/java/com/android/internal/telephony/data/AccessNetworksManager.java103
-rw-r--r--src/java/com/android/internal/telephony/data/DataNetwork.java5
-rw-r--r--src/java/com/android/internal/telephony/data/DataNetworkController.java19
-rw-r--r--src/java/com/android/internal/telephony/data/DataRetryManager.java7
-rw-r--r--src/java/com/android/internal/telephony/imsphone/ImsPhone.java42
6 files changed, 198 insertions, 43 deletions
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
index 2d092deea2..85c4b31c46 100755
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -669,7 +669,7 @@ public class ServiceStateTracker extends Handler {
mAccessNetworksManager = mPhone.getAccessNetworksManager();
mOutOfServiceSS = new ServiceState();
- mOutOfServiceSS.setOutOfService(false);
+ mOutOfServiceSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
for (int transportType : mAccessNetworksManager.getAvailableTransports()) {
mRegStateManagers.append(transportType, new NetworkRegistrationManager(
@@ -771,9 +771,9 @@ public class ServiceStateTracker extends Handler {
}
mSS = new ServiceState();
- mSS.setOutOfService(false);
+ mSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
mNewSS = new ServiceState();
- mNewSS.setOutOfService(false);
+ mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
mLastCellInfoReqTime = 0;
mLastCellInfoList = null;
mStartedGprsRegCheck = false;
@@ -3341,7 +3341,7 @@ public class ServiceStateTracker extends Handler {
nri = mNewSS.getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS,
AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
- mNewSS.setOutOfService(false);
+ mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
// Add the IWLAN registration info back to service state.
if (nri != null) {
mNewSS.addNetworkRegistrationInfo(nri);
@@ -3358,7 +3358,7 @@ public class ServiceStateTracker extends Handler {
nri = mNewSS.getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS,
AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
- mNewSS.setOutOfService(true);
+ mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), true);
// Add the IWLAN registration info back to service state.
if (nri != null) {
mNewSS.addNetworkRegistrationInfo(nri);
@@ -3485,10 +3485,14 @@ public class ServiceStateTracker extends Handler {
mSS.getState() == ServiceState.STATE_POWER_OFF
&& mNewSS.getState() != ServiceState.STATE_POWER_OFF;
- SparseBooleanArray hasDataAttached = new SparseBooleanArray();
- SparseBooleanArray hasDataDetached = new SparseBooleanArray();
- SparseBooleanArray hasRilDataRadioTechnologyChanged = new SparseBooleanArray();
- SparseBooleanArray hasDataRegStateChanged = new SparseBooleanArray();
+ SparseBooleanArray hasDataAttached = new SparseBooleanArray(
+ mAccessNetworksManager.getAvailableTransports().length);
+ SparseBooleanArray hasDataDetached = new SparseBooleanArray(
+ mAccessNetworksManager.getAvailableTransports().length);
+ SparseBooleanArray hasRilDataRadioTechnologyChanged = new SparseBooleanArray(
+ mAccessNetworksManager.getAvailableTransports().length);
+ SparseBooleanArray hasDataRegStateChanged = new SparseBooleanArray(
+ mAccessNetworksManager.getAvailableTransports().length);
boolean anyDataRegChanged = false;
boolean anyDataRatChanged = false;
boolean hasAlphaRawChanged =
@@ -3678,7 +3682,7 @@ public class ServiceStateTracker extends Handler {
ServiceState oldMergedSS = new ServiceState(mPhone.getServiceState());
mSS = new ServiceState(mNewSS);
- mNewSS.setOutOfService(false);
+ mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), false);
mCellIdentity = primaryCellIdentity;
if (mSS.getState() == ServiceState.STATE_IN_SERVICE && primaryCellIdentity != null) {
@@ -5565,7 +5569,8 @@ public class ServiceStateTracker extends Handler {
/**
- * This method makes some adjustments when the device camps on IWLAN in airplane mode.
+ * This method adds IWLAN registration info for legacy mode devices camped on IWLAN. It also
+ * makes some adjustments when the device camps on IWLAN in airplane mode.
*/
private void processIwlanRegistrationInfo() {
if (mCi.getRadioState() == TelephonyManager.RADIO_POWER_OFF) {
@@ -5579,7 +5584,7 @@ public class ServiceStateTracker extends Handler {
}
// operator info should be kept in SS
String operator = mNewSS.getOperatorAlphaLong();
- mNewSS.setOutOfService(true);
+ mNewSS.setOutOfService(mAccessNetworksManager.isInLegacyMode(), true);
if (resetIwlanRatVal) {
mNewSS.setDataRegState(ServiceState.STATE_IN_SERVICE);
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
@@ -5589,6 +5594,17 @@ public class ServiceStateTracker extends Handler {
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
.build();
mNewSS.addNetworkRegistrationInfo(nri);
+ if (mAccessNetworksManager.isInLegacyMode()) {
+ // If in legacy mode, simulate the behavior that IWLAN registration info
+ // is reported through WWAN transport.
+ nri = new NetworkRegistrationInfo.Builder()
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
+ .build();
+ mNewSS.addNetworkRegistrationInfo(nri);
+ }
mNewSS.setOperatorAlphaLong(operator);
// Since it's in airplane mode, cellular must be out of service. The only possible
// transport for data to go through is the IWLAN transport. Setting this to true
@@ -5598,6 +5614,31 @@ public class ServiceStateTracker extends Handler {
}
return;
}
+
+ // If the device operates in legacy mode and camps on IWLAN, modem reports IWLAN as a RAT
+ // through WWAN registration info. To be consistent with the behavior with AP-assisted mode,
+ // we manually make a WLAN registration info for clients to consume. In this scenario,
+ // both WWAN and WLAN registration info are the IWLAN registration info and that's the
+ // unfortunate limitation we have when the device operates in legacy mode. In AP-assisted
+ // mode, the WWAN registration will correctly report the actual cellular registration info
+ // when the device camps on IWLAN.
+ if (mAccessNetworksManager.isInLegacyMode()) {
+ NetworkRegistrationInfo wwanNri = mNewSS.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (wwanNri != null && wwanNri.getAccessNetworkTechnology()
+ == TelephonyManager.NETWORK_TYPE_IWLAN) {
+ NetworkRegistrationInfo wlanNri = new NetworkRegistrationInfo.Builder()
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .setRegistrationState(wwanNri.getNetworkRegistrationState())
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
+ .setRejectCause(wwanNri.getRejectCause())
+ .setEmergencyOnly(wwanNri.isEmergencyEnabled())
+ .setAvailableServices(wwanNri.getAvailableServices())
+ .build();
+ mNewSS.addNetworkRegistrationInfo(wlanNri);
+ }
+ }
}
/**
diff --git a/src/java/com/android/internal/telephony/data/AccessNetworksManager.java b/src/java/com/android/internal/telephony/data/AccessNetworksManager.java
index d51f586932..d034abdf3a 100644
--- a/src/java/com/android/internal/telephony/data/AccessNetworksManager.java
+++ b/src/java/com/android/internal/telephony/data/AccessNetworksManager.java
@@ -19,6 +19,7 @@ package com.android.internal.telephony.data;
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.StringDef;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -33,6 +34,7 @@ import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RemoteException;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
@@ -54,11 +56,14 @@ import android.util.LocalLog;
import android.util.SparseArray;
import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.RIL;
import com.android.internal.telephony.SlidingWindowEventCounter;
import com.android.telephony.Rlog;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -76,6 +81,35 @@ import java.util.stream.Collectors;
*/
public class AccessNetworksManager extends Handler {
private static final boolean DBG = false;
+ public static final String SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE =
+ "ro.telephony.iwlan_operation_mode";
+
+ @Retention(RetentionPolicy.SOURCE)
+ @StringDef(prefix = {"IWLAN_OPERATION_MODE_"},
+ value = {
+ IWLAN_OPERATION_MODE_DEFAULT,
+ IWLAN_OPERATION_MODE_LEGACY,
+ IWLAN_OPERATION_MODE_AP_ASSISTED})
+ public @interface IwlanOperationMode {}
+
+ /**
+ * IWLAN default mode. On device that has IRadio 1.4 or above, it means
+ * {@link #IWLAN_OPERATION_MODE_AP_ASSISTED}. On device that has IRadio 1.3 or below, it means
+ * {@link #IWLAN_OPERATION_MODE_LEGACY}.
+ */
+ public static final String IWLAN_OPERATION_MODE_DEFAULT = "default";
+
+ /**
+ * IWLAN legacy mode. IWLAN is completely handled by the modem, and when the device is on
+ * IWLAN, modem reports IWLAN as a RAT.
+ */
+ public static final String IWLAN_OPERATION_MODE_LEGACY = "legacy";
+
+ /**
+ * IWLAN application processor assisted mode. IWLAN is handled by the bound IWLAN data service
+ * and network service separately.
+ */
+ public static final String IWLAN_OPERATION_MODE_AP_ASSISTED = "AP-assisted";
/**
* The counters to detect frequent QNS attempt to change preferred network transport by ApnType.
@@ -332,19 +366,28 @@ public class AccessNetworksManager extends Handler {
Context.CARRIER_CONFIG_SERVICE);
mLogTag = "ANM-" + mPhone.getPhoneId();
mApnTypeToQnsChangeNetworkCounter = new SparseArray<>();
- mAvailableTransports = new int[]{AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
- AccessNetworkConstants.TRANSPORT_TYPE_WLAN};
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
- try {
- Context contextAsUser = phone.getContext().createPackageContextAsUser(
- phone.getContext().getPackageName(), 0, UserHandle.ALL);
- contextAsUser.registerReceiver(mConfigChangedReceiver, intentFilter,
- null /* broadcastPermission */, null);
- } catch (PackageManager.NameNotFoundException e) {
- loge("Package name not found: ", e);
+
+ if (isInLegacyMode()) {
+ log("operates in legacy mode.");
+ // For legacy mode, WWAN is the only transport to handle all data connections, even
+ // the IWLAN ones.
+ mAvailableTransports = new int[]{AccessNetworkConstants.TRANSPORT_TYPE_WWAN};
+ } else {
+ log("operates in AP-assisted mode.");
+ mAvailableTransports = new int[]{AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
+ AccessNetworkConstants.TRANSPORT_TYPE_WLAN};
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
+ try {
+ Context contextAsUser = phone.getContext().createPackageContextAsUser(
+ phone.getContext().getPackageName(), 0, UserHandle.ALL);
+ contextAsUser.registerReceiver(mConfigChangedReceiver, intentFilter,
+ null /* broadcastPermission */, null);
+ } catch (PackageManager.NameNotFoundException e) {
+ loge("Package name not found: ", e);
+ }
+ bindQualifiedNetworksService();
}
- bindQualifiedNetworksService();
// Using post to delay the registering because data retry manager and data config
// manager instances are created later than access networks manager.
@@ -447,7 +490,8 @@ public class AccessNetworksManager extends Handler {
/**
* Get the qualified network service package.
*
- * @return package name of the qualified networks service package.
+ * @return package name of the qualified networks service package. Return empty string when in
+ * legacy mode (i.e. Dedicated IWLAN data/network service is not supported).
*/
private String getQualifiedNetworksServicePackageName() {
// Read package name from the resource
@@ -524,9 +568,30 @@ public class AccessNetworksManager extends Handler {
}
/**
- * @return The available transports.
+ * @return {@code true} if the device operates in legacy mode, otherwise {@code false}.
*/
- public @NonNull int[] getAvailableTransports() {
+ public boolean isInLegacyMode() {
+ // Get IWLAN operation mode from the system property. If the system property is configured
+ // to default or not configured, the mode is tied to IRadio version. For 1.4 or above, it's
+ // AP-assisted mode, for 1.3 or below, it's legacy mode.
+ String mode = SystemProperties.get(SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE);
+
+ if (mode.equals(IWLAN_OPERATION_MODE_AP_ASSISTED)) {
+ return false;
+ } else if (mode.equals(IWLAN_OPERATION_MODE_LEGACY)) {
+ return true;
+ }
+
+ return mPhone.getHalVersion().less(RIL.RADIO_HAL_VERSION_1_4);
+ }
+
+ /**
+ * @return The available transports. Note that on legacy devices, the only available transport
+ * would be WWAN only. If the device is configured as AP-assisted mode, the available transport
+ * will always be WWAN and WLAN (even if the device is not camped on IWLAN).
+ * See {@link #isInLegacyMode()} for mode details.
+ */
+ public synchronized @NonNull int[] getAvailableTransports() {
return mAvailableTransports;
}
@@ -561,6 +626,11 @@ public class AccessNetworksManager extends Handler {
* @return The preferred transport.
*/
public @TransportType int getPreferredTransport(@ApnType int apnType) {
+ // In legacy mode, always preferred on cellular.
+ if (isInLegacyMode()) {
+ return AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
+ }
+
return mPreferredTransports.get(apnType) == null
? AccessNetworkConstants.TRANSPORT_TYPE_WWAN : mPreferredTransports.get(apnType);
}
@@ -663,6 +733,9 @@ public class AccessNetworksManager extends Handler {
}
pw.decreaseIndent();
+ pw.println("isInLegacy=" + isInLegacyMode());
+ pw.println("IWLAN operation mode="
+ + SystemProperties.get(SYSTEM_PROPERTIES_IWLAN_OPERATION_MODE));
pw.println("Local logs=");
pw.increaseIndent();
mLocalLog.dump(fd, pw, args);
diff --git a/src/java/com/android/internal/telephony/data/DataNetwork.java b/src/java/com/android/internal/telephony/data/DataNetwork.java
index 7dee6dc7cb..7b1f6fb303 100644
--- a/src/java/com/android/internal/telephony/data/DataNetwork.java
+++ b/src/java/com/android/internal/telephony/data/DataNetwork.java
@@ -912,9 +912,8 @@ public class DataNetwork extends StateMachine {
mDataAllowedReason = dataAllowedReason;
dataProfile.setLastSetupTimestamp(SystemClock.elapsedRealtime());
mAttachedNetworkRequestList.addAll(networkRequestList);
- for (int transportType : mAccessNetworksManager.getAvailableTransports()) {
- mCid.put(transportType, INVALID_CID);
- }
+ mCid.put(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, INVALID_CID);
+ mCid.put(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, INVALID_CID);
mTelephonyDisplayInfo = mPhone.getDisplayInfoController().getTelephonyDisplayInfo();
mTcpBufferSizes = mDataConfigManager.getTcpConfigString(mTelephonyDisplayInfo);
diff --git a/src/java/com/android/internal/telephony/data/DataNetworkController.java b/src/java/com/android/internal/telephony/data/DataNetworkController.java
index d693885cf3..e45b88d435 100644
--- a/src/java/com/android/internal/telephony/data/DataNetworkController.java
+++ b/src/java/com/android/internal/telephony/data/DataNetworkController.java
@@ -781,10 +781,13 @@ public class DataNetworkController extends Handler {
log("DataNetworkController created.");
mAccessNetworksManager = phone.getAccessNetworksManager();
- for (int transport : mAccessNetworksManager.getAvailableTransports()) {
- mDataServiceManagers.put(transport, new DataServiceManager(mPhone, looper, transport));
+ mDataServiceManagers.put(AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
+ new DataServiceManager(mPhone, looper, AccessNetworkConstants.TRANSPORT_TYPE_WWAN));
+ if (!mAccessNetworksManager.isInLegacyMode()) {
+ mDataServiceManagers.put(AccessNetworkConstants.TRANSPORT_TYPE_WLAN,
+ new DataServiceManager(mPhone, looper,
+ AccessNetworkConstants.TRANSPORT_TYPE_WLAN));
}
-
mDataConfigManager = new DataConfigManager(mPhone, looper);
// ========== Anomaly counters ==========
@@ -988,10 +991,12 @@ public class DataNetworkController extends Handler {
mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
.registerForServiceBindingChanged(this, EVENT_DATA_SERVICE_BINDING_CHANGED);
- mPhone.getServiceStateTracker().registerForServiceStateChanged(this,
- EVENT_SERVICE_STATE_CHANGED, null);
- mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
- .registerForServiceBindingChanged(this, EVENT_DATA_SERVICE_BINDING_CHANGED);
+ if (!mAccessNetworksManager.isInLegacyMode()) {
+ mPhone.getServiceStateTracker().registerForServiceStateChanged(this,
+ EVENT_SERVICE_STATE_CHANGED, null);
+ mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
+ .registerForServiceBindingChanged(this, EVENT_DATA_SERVICE_BINDING_CHANGED);
+ }
mPhone.getContext().getSystemService(TelephonyRegistryManager.class)
.addOnSubscriptionsChangedListener(new OnSubscriptionsChangedListener() {
diff --git a/src/java/com/android/internal/telephony/data/DataRetryManager.java b/src/java/com/android/internal/telephony/data/DataRetryManager.java
index c2b3b9ae3b..0beea1fdb3 100644
--- a/src/java/com/android/internal/telephony/data/DataRetryManager.java
+++ b/src/java/com/android/internal/telephony/data/DataRetryManager.java
@@ -958,9 +958,10 @@ public class DataRetryManager extends Handler {
DataRetryManager.this.onCarrierConfigUpdated();
}
});
-
- for (int transport : mPhone.getAccessNetworksManager().getAvailableTransports()) {
- mDataServiceManagers.get(transport)
+ mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .registerForApnUnthrottled(this, EVENT_DATA_PROFILE_UNTHROTTLED);
+ if (!mPhone.getAccessNetworksManager().isInLegacyMode()) {
+ mDataServiceManagers.get(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
.registerForApnUnthrottled(this, EVENT_DATA_PROFILE_UNTHROTTLED);
}
mDataProfileManager.registerCallback(new DataProfileManagerCallback(this::post) {
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
index a986b6c2ce..5c14b0ebf5 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhone.java
@@ -458,7 +458,11 @@ public class ImsPhone extends ImsPhoneBase {
mCT.registerPhoneStateListener(mExternalCallTracker);
mExternalCallTracker.setCallPuller(mCT);
- mSS.setOutOfService(false);
+ boolean legacyMode = true;
+ if (mDefaultPhone.getAccessNetworksManager() != null) {
+ legacyMode = mDefaultPhone.getAccessNetworksManager().isInLegacyMode();
+ }
+ mSS.setOutOfService(legacyMode, false);
mPhoneId = mDefaultPhone.getPhoneId();
@@ -2367,7 +2371,7 @@ public class ImsPhone extends ImsPhoneBase {
/**
* Update roaming state and WFC mode in the following situations:
* 1) voice is in service.
- * 2) data is in service.
+ * 2) data is in service and it is not IWLAN (if in legacy mode).
* @param ss non-null ServiceState
*/
private void updateRoamingState(ServiceState ss) {
@@ -2388,7 +2392,15 @@ public class ImsPhone extends ImsPhoneBase {
logi("updateRoamingState: we are not IN_SERVICE, ignoring roaming change.");
return;
}
-
+ // We ignore roaming changes when moving to IWLAN because it always sets the roaming
+ // mode to home and masks the actual cellular roaming status if voice is not registered. If
+ // we just moved to IWLAN because WFC roaming mode is IWLAN preferred and WFC home mode is
+ // cell preferred, we can get into a condition where the modem keeps bouncing between
+ // IWLAN->cell->IWLAN->cell...
+ if (isCsNotInServiceAndPsWwanReportingWlan(ss)) {
+ logi("updateRoamingState: IWLAN masking roaming, ignore roaming change.");
+ return;
+ }
if (mCT.getState() == PhoneConstants.State.IDLE) {
if (DBG) logd("updateRoamingState now: " + newRoamingState);
mLastKnownRoamingState = newRoamingState;
@@ -2407,6 +2419,30 @@ public class ImsPhone extends ImsPhoneBase {
}
}
+ /**
+ * In legacy mode, data registration will report IWLAN when we are using WLAN for data,
+ * effectively masking the true roaming state of the device if voice is not registered.
+ *
+ * @return true if we are reporting not in service for CS domain over WWAN transport and WLAN
+ * for PS domain over WWAN transport.
+ */
+ private boolean isCsNotInServiceAndPsWwanReportingWlan(ServiceState ss) {
+ // We can not get into this condition if we are in AP-Assisted mode.
+ if (mDefaultPhone.getAccessNetworksManager() == null
+ || !mDefaultPhone.getAccessNetworksManager().isInLegacyMode()) {
+ return false;
+ }
+ NetworkRegistrationInfo csInfo = ss.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ NetworkRegistrationInfo psInfo = ss.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ // We will return roaming state correctly if the CS domain is in service because
+ // ss.getRoaming() returns isVoiceRoaming||isDataRoaming result and isDataRoaming==false
+ // when the modem reports IWLAN RAT.
+ return psInfo != null && csInfo != null && !csInfo.isInService()
+ && psInfo.getAccessNetworkTechnology() == TelephonyManager.NETWORK_TYPE_IWLAN;
+ }
+
public RegistrationManager.RegistrationCallback getImsMmTelRegistrationCallback() {
return mImsMmTelRegistrationHelper.getCallback();
}