ImsManager: check roaming status in setWfcSetting
Meng Wang [Tue, 15 Nov 2016 05:04:19 +0000 (21:04 -0800)]
In setWfcSetting(true), setWfcModeInternal(mode) is invoked.
The mode to be passed should be determined by current roaming status.

Bug: 32787997
Change-Id: I9e96de0a1db83adf50a8ba008a6b3741fe3c9b95

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

index 6d8cef6..0fc081a 100644 (file)
@@ -445,9 +445,12 @@ public class ImsManager {
                     imsManager.turnOffIms();
                 }
 
-                // Force IMS to register over LTE when turning off WFC
+                TelephonyManager tm = (TelephonyManager) context
+                        .getSystemService(Context.TELEPHONY_SERVICE);
                 setWfcModeInternal(context, enabled
-                        ? getWfcMode(context)
+                        // Choose wfc mode per current roaming preference
+                        ? getWfcMode(context, tm.isNetworkRoaming())
+                        // Force IMS to register over LTE when turning off WFC
                         : ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED);
             } catch (ImsException e) {
                 loge("setWfcSetting(): ", e);