Decouple WFC from Enhanced 4G LTE in settings
Pavel Zhamaitsiak [Tue, 24 Feb 2015 18:20:27 +0000 (10:20 -0800)]
TMo requires WFC and Enhanced 4G LTE mode to be enabled/disabled independently.
IMS used to be stopped when 4G LTE was disabled and started when it was
enabled. Now we need to take WFC into account when making decision about
starting/stopping IMS.

Change-Id: Icc92097a98e07994783b2ec3579d86b05315d0a2

src/java/com/android/ims/ImsManager.java

index 9f510cf..26389a1 100644 (file)
@@ -306,8 +306,18 @@ public class ImsManager {
                         TelephonyManager.NETWORK_TYPE_LTE,
                         enabled ? ImsConfig.FeatureValueConstants.ON
                                 : ImsConfig.FeatureValueConstants.OFF, null);
+
+                if (enabled) {
+                    imsManager.turnOnIms();
+                } else if (context.getResources().getBoolean(
+                        com.android.internal.R.bool.imsServiceAllowTurnOff)
+                        && (!isVolteEnabledByPlatform(context)
+                        || !isEnhanced4gLteModeSettingEnabledByUser(context))) {
+                    log("setWfcSetting() : imsServiceAllowTurnOff -> turnOffIms");
+                    imsManager.turnOffIms();
+                }
             } catch (ImsException e) {
-                // do nothing
+                loge("setWfcSetting(): " + e);
             }
         }
     }
@@ -888,7 +898,9 @@ public class ImsManager {
         if (turnOn) {
             turnOnIms();
         } else if (mContext.getResources().getBoolean(
-                com.android.internal.R.bool.imsServiceAllowTurnOff)) {
+                com.android.internal.R.bool.imsServiceAllowTurnOff)
+                && (!isWfcEnabledByPlatform(mContext)
+                || !isWfcEnabledByUser(mContext))) {
             log("setAdvanced4GMode() : imsServiceAllowTurnOff -> turnOffIms");
             turnOffIms();
         }