Add Exception Handling To setAdvanced4GMode API
Omkar Kolangade [Fri, 24 Oct 2014 18:10:52 +0000 (11:10 -0700)]
Added a try-catch block to handle ImsException.

Bug: 21800429
Change-Id: I335e2db69348cd617100b65184ee1b970e7bc11c

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

index d6b5d35..1f8ef5d 100644 (file)
@@ -955,18 +955,21 @@ public class ImsManager {
     private void setAdvanced4GMode(boolean turnOn) throws ImsException {
         checkAndThrowExceptionIfServiceUnavailable();
 
-        ImsConfig config = getConfigInterface();
-        if (config != null) {
-            config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE,
-                    TelephonyManager.NETWORK_TYPE_LTE, turnOn ? 1 : 0, null);
-            if (isVtEnabledByPlatform(mContext)) {
-                // TODO: once VT is available on platform replace the '1' with the current
-                // user configuration of VT.
-                config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_LTE,
+        try {
+            ImsConfig config = getConfigInterface();
+            if (config != null) {
+                config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE,
                         TelephonyManager.NETWORK_TYPE_LTE, turnOn ? 1 : 0, null);
+                if (isVtEnabledByPlatform(mContext)) {
+                    // TODO: once VT is available on platform replace the '1' with the current
+                    // user configuration of VT.
+                    config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_LTE,
+                            TelephonyManager.NETWORK_TYPE_LTE, turnOn ? 1 : 0, null);
+                }
             }
+        } catch (ImsException e) {
+            log("setAdvanced4GMode() : " + e);
         }
-
         if (turnOn) {
             turnOnIms();
         } else if (mContext.getResources().getBoolean(