Set CDMA data roaming based on TSB58 roaming indicator if voice is not in service
Jayachandran C [Sun, 7 May 2017 19:55:51 +0000 (12:55 -0700)]
Existing implementation:
1. CDMA voiceRoaming is set based on regState and roaming indicator.
2. CDMA dataRoaming is set based on regState only.
3. CDMA dataRoaming is overwritten with voiceRoaming if voice is
   in service.

Issue:
If voice is not in service then the CDMA dataRoaming set based on
regState alone could be incorrect because it didn't use roaming
indicator from modem.

Fix:
This change sets CDMA dataRoaming based on TSB58 roaming indicator
(similar to setting voiceRoaming) if voice is not service.

Note: As per VoiceRegStateResult from radio types.hal the TSB58
roaming indicator shall be sent if device is registered on a
CDMA or EVDO system.

Test: Forced device to Evdo only and verified roaming state
Bug: 37917767
Change-Id: I3cc7fff61cea296afe17215a33b1b4c80972db13

src/java/com/android/internal/telephony/ServiceStateTracker.java

index 8ae78d2..0b4187c 100644 (file)
@@ -1637,12 +1637,27 @@ public class ServiceStateTracker extends Handler {
                 if (mIsSubscriptionFromRuim) {
                     mNewSS.setVoiceRoaming(isRoamingBetweenOperators(mNewSS.getVoiceRoaming(), mNewSS));
                 }
-                // For CDMA, voice and data should have the same roaming status
-                final boolean isVoiceInService =
-                        (mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE);
-                final int dataRegType = mNewSS.getRilDataRadioTechnology();
-                if (isVoiceInService && ServiceState.isCdma(dataRegType)) {
-                    mNewSS.setDataRoaming(mNewSS.getVoiceRoaming());
+                /**
+                 * For CDMA, voice and data should have the same roaming status.
+                 * If voice is not in service, use TSB58 roaming indicator to set
+                 * data roaming status. If TSB58 roaming indicator is not in the
+                 * carrier-specified list of ERIs for home system then set roaming.
+                 */
+                final int dataRat = mNewSS.getRilDataRadioTechnology();
+                if (ServiceState.isCdma(dataRat)) {
+                    final boolean isVoiceInService =
+                            (mNewSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE);
+                    if (isVoiceInService) {
+                        mNewSS.setDataRoaming(mNewSS.getVoiceRoaming());
+                    } else {
+                        /**
+                         * As per VoiceRegStateResult from radio types.hal the TSB58
+                         * Roaming Indicator shall be sent if device is registered
+                         * on a CDMA or EVDO system.
+                         */
+                        mNewSS.setDataRoaming(
+                                !isRoamIndForHomeSystem(Integer.toString(mRoamingIndicator)));
+                    }
                 }
 
                 // Setting SS CdmaRoamingIndicator and CdmaDefaultRoamingIndicator