Save data registration roaming state
Chris Manton [Fri, 7 Aug 2015 23:40:54 +0000 (16:40 -0700)]
Some carriers require different APNs based upon
the roaming state returned in a previous registration
call.  The carrier config has the option to override
roaming state.  This change saves the proper roaming
state before the carrier config may override in order
to select the proper APN when setting up a data connection.

bug: 22990977
Change-Id: Id22a60efcbea9637018cc47e6d97f68eb053deb0

src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
src/java/com/android/internal/telephony/dataconnection/DataConnection.java
src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java

index 9f7947e..91c5126 100644 (file)
@@ -1113,6 +1113,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
      * for roaming or not roaming for the current service state.
      */
     protected void updateRoamingState() {
+        // Save the roaming state before carrier config possibly overrides it.
+        mNewSS.setDataRoamingFromRegistration(mNewSS.getDataRoaming());
+
         ICarrierConfigLoader configLoader =
             (ICarrierConfigLoader) ServiceManager.getService(Context.CARRIER_CONFIG_SERVICE);
         if (configLoader != null) {
index 959c98a..4a84b6d 100644 (file)
@@ -561,7 +561,7 @@ public final class DataConnection extends StateMachine {
         }
 
         String protocol;
-        if (mPhone.getServiceState().getDataRoaming()) {
+        if (mPhone.getServiceState().getDataRoamingFromRegistration()) {
             protocol = mApnSetting.roamingProtocol;
         } else {
             protocol = mApnSetting.protocol;
index 23f1df2..113c8f2 100755 (executable)
@@ -874,6 +874,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
             roaming = false;
         }
 
+        // Save the roaming state before carrier config possibly overrides it.
+        mNewSS.setDataRoamingFromRegistration(roaming);
+
         ICarrierConfigLoader configLoader =
             (ICarrierConfigLoader) ServiceManager.getService(Context.CARRIER_CONFIG_SERVICE);
         if (configLoader != null) {