Send notifyDataConnection on changes to data connection.
Wink Saville [Fri, 10 May 2013 19:01:58 +0000 (12:01 -0700)]
Previously notification was sent only when voice radio technology
changed, but it needs to be when data RAT changed. Also send it with
there is a data registration changes.

Bug: 8786016
Change-Id: I5a53e13821efde4ebd3dbe5f062e7729f321497b

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

index 43b0614..0cba267 100644 (file)
@@ -338,7 +338,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
 
         mNewSS.setStateOutOfService(); // clean slate for next time
 
-        if (hasVoiceRadioTechnologyChanged) {
+        if (hasDataRadioTechnologyChanged) {
             mPhone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
                     ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology()));
         }
index 3936e9e..93fba28 100644 (file)
@@ -985,8 +985,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
         boolean hasCdmaDataConnectionChanged =
                        mSS.getDataRegState() != mNewSS.getDataRegState();
 
-        boolean hasRadioTechnologyChanged =
-                mSS.getRilVoiceRadioTechnology() != mNewSS.getRilVoiceRadioTechnology();
+        boolean hasRilDataRadioTechnologyChanged =
+                mSS.getRilDataRadioTechnology() != mNewSS.getRilDataRadioTechnology();
 
         boolean hasChanged = !mNewSS.equals(mSS);
 
@@ -1017,9 +1017,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
 
         mNewSS.setStateOutOfService(); // clean slate for next time
 
-        if (hasRadioTechnologyChanged) {
+        if (hasRilDataRadioTechnologyChanged) {
             mPhone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
-                    ServiceState.rilRadioTechnologyToString(mSS.getRilVoiceRadioTechnology()));
+                    ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology()));
         }
 
         if (hasRegistered) {
@@ -1092,7 +1092,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
             mDetachedRegistrants.notifyRegistrants();
         }
 
-        if (hasCdmaDataConnectionChanged || hasRadioTechnologyChanged) {
+        if (hasCdmaDataConnectionChanged || hasRilDataRadioTechnologyChanged) {
             mPhone.notifyDataConnection(null);
         }
 
index 99512f4..534c736 100644 (file)
@@ -824,9 +824,18 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
                 mSS.getDataRegState() == ServiceState.STATE_IN_SERVICE
                 && mNewSS.getDataRegState() != ServiceState.STATE_IN_SERVICE;
 
+        boolean hasDataRegStateChanged =
+                mSS.getDataRegState() != mNewSS.getDataRegState();
+
+        boolean hasVoiceRegStateChanged =
+                mSS.getVoiceRegState() != mNewSS.getVoiceRegState();
+
         boolean hasRilVoiceRadioTechnologyChanged =
                 mSS.getRilVoiceRadioTechnology() != mNewSS.getRilVoiceRadioTechnology();
 
+        boolean hasRilDataRadioTechnologyChanged =
+                mSS.getRilDataRadioTechnology() != mNewSS.getRilDataRadioTechnology();
+
         boolean hasChanged = !mNewSS.equals(mSS);
 
         boolean hasRoamingOn = !mSS.getRoaming() && mNewSS.getRoaming();
@@ -836,8 +845,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
         boolean hasLocationChanged = !mNewCellLoc.equals(mCellLoc);
 
         // Add an event log when connection state changes
-        if (mSS.getVoiceRegState() != mNewSS.getVoiceRegState()
-                || mSS.getDataRegState() != mNewSS.getDataRegState()) {
+        if (hasVoiceRegStateChanged || hasDataRegStateChanged) {
             EventLog.writeEvent(EventLogTags.GSM_SERVICE_STATE_CHANGE,
                 mSS.getVoiceRegState(), mSS.getDataRegState(),
                 mNewSS.getVoiceRegState(), mNewSS.getDataRegState());
@@ -877,7 +885,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
 
         mNewSS.setStateOutOfService(); // clean slate for next time
 
-        if (hasRilVoiceRadioTechnologyChanged) {
+        if (hasRilDataRadioTechnologyChanged) {
             mPhone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
                     ServiceState.rilRadioTechnologyToString(mSS.getRilVoiceRadioTechnology()));
         }
@@ -1035,8 +1043,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
             mDetachedRegistrants.notifyRegistrants();
         }
 
-        if (hasRilVoiceRadioTechnologyChanged) {
-            mPhone.notifyDataConnection(Phone.REASON_NW_TYPE_CHANGED);
+        if (hasDataRegStateChanged || hasRilDataRadioTechnologyChanged) {
+            mPhone.notifyDataConnection(null);
         }
 
         if (hasRoamingOn) {