Use device and carrier configuration to determine whether phone supports VoLTE.
Etan Cohen [Fri, 5 Sep 2014 05:34:41 +0000 (22:34 -0700)]
Additionally, provide a debug override system property.

Bug: 17365969
Change-Id: I07ebaeddc3f37b41b819d43be221f70f6363000c

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

index 362f6b8..24609d0 100644 (file)
@@ -25,6 +25,7 @@ import android.os.Message;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.ServiceManager;
+import android.os.SystemProperties;
 import android.telephony.Rlog;
 import android.telephony.TelephonyManager;
 
@@ -55,6 +56,12 @@ public class ImsManager {
     public static final String KEY_IMS_ON = "IMS";
     public static final boolean IMS_DEFAULT_SETTING = true;
 
+    /*
+     * Debug flag to override configuration flag
+     */
+    public static final String PROPERTY_DBG_VOLTE_VT_AVAIL_OVERRIDE = "persist.dbg.volte_avail_ovr";
+    public static final int PROPERTY_DBG_VOLTE_VT_AVAIL_OVERRIDE_DEFAULT = 0;
+
     /**
      * For accessing the IMS related service.
      * Internal use only.
@@ -173,8 +180,16 @@ public class ImsManager {
      * Returns a platform configuration which may override the user setting.
      */
     public static boolean isEnhanced4gLteModeSettingEnabledByPlatform(Context context) {
-        return context.getResources().getBoolean(
-                com.android.internal.R.bool.config_mobile_allow_volte_vt);
+        if (SystemProperties.getInt(PROPERTY_DBG_VOLTE_VT_AVAIL_OVERRIDE,
+                PROPERTY_DBG_VOLTE_VT_AVAIL_OVERRIDE_DEFAULT) == 1) {
+            return true;
+        }
+
+        return
+                context.getResources().getBoolean(
+                        com.android.internal.R.bool.config_device_volte_vt_available) &&
+                context.getResources().getBoolean(
+                        com.android.internal.R.bool.config_carrier_volte_vt_available);
     }
 
     private ImsManager(Context context, long subId) {