Trigger phone switch based on config
Sukanya Rajkhowa [Mon, 15 Sep 2014 23:03:43 +0000 (16:03 -0700)]
When VOICE_REGISTRATION_STATE changes, phone switch
may not be needed as a previous switch would have
happened on receiving UNSOL_VOICE_RADIO_TECH_CHANGED.
Do a phone switch only if the config is true.

Bug: 17394282
Change-Id: I4a4aa98bd0af9eaca46b0d09458a126313e97611

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

index aed4881..ad1b922 100644 (file)
@@ -292,7 +292,10 @@ public abstract class ServiceStateTracker extends Handler {
     }
 
     protected void updatePhoneObject() {
-        mPhoneBase.updatePhoneObject(mSS.getRilVoiceRadioTechnology());
+        if (mPhoneBase.getContext().getResources().
+                getBoolean(com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change)) {
+            mPhoneBase.updatePhoneObject(mSS.getRilVoiceRadioTechnology());
+        }
     }
 
     /**
index c25357b..75286fb 100644 (file)
@@ -670,20 +670,23 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
     @Override
     protected void updatePhoneObject() {
         int voiceRat = mSS.getRilVoiceRadioTechnology();
-        // For CDMA-LTE phone don't update phone to GSM
-        // if replacement RAT is unknown
-        // If there is a  real need to switch to LTE, then it will be done via
-        // RIL_UNSOL_VOICE_RADIO_TECH_CHANGED from RIL.
-
-        int volteReplacementRat = mPhoneBase.getContext().getResources().getInteger(
-                com.android.internal.R.integer.config_volte_replacement_rat);
-        Rlog.d(LOG_TAG, "updatePhoneObject: volteReplacementRat=" + volteReplacementRat);
-
-        if (voiceRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE &&
-                volteReplacementRat == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
-            voiceRat = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
+        if (mPhone.getContext().getResources().
+                getBoolean(com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change)) {
+            // For CDMA-LTE phone don't update phone to GSM
+            // if replacement RAT is unknown
+            // If there is a  real need to switch to LTE, then it will be done via
+            // RIL_UNSOL_VOICE_RADIO_TECH_CHANGED from RIL.
+
+            int volteReplacementRat = mPhoneBase.getContext().getResources().getInteger(
+                    com.android.internal.R.integer.config_volte_replacement_rat);
+            Rlog.d(LOG_TAG, "updatePhoneObject: volteReplacementRat=" + volteReplacementRat);
+
+            if (voiceRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE &&
+                    volteReplacementRat == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
+                voiceRat = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
+            }
+            mPhoneBase.updatePhoneObject(voiceRat);
         }
-        mPhoneBase.updatePhoneObject(voiceRat);
     }
 
     @Override