Hide/show Telephony video setting according to if IMS is enabled.
+ Add utility function get this value in ImsUtil.
+ Check this value to show/hide setting in Call Settings.
+ Include flag to override behavior and always hide VT, since it's
not shipping in MR1.
+ Take this account when reporting when the phone interface manager
reports whether we can make video calls.
Bug: 16014284
Change-Id: I31a13da61820988cdb53159126c6be9478b6a583
diff --git a/src/com/android/phone/ImsUtil.java b/src/com/android/phone/ImsUtil.java
index 23ddf7d..48276b7 100644
--- a/src/com/android/phone/ImsUtil.java
+++ b/src/com/android/phone/ImsUtil.java
@@ -19,14 +19,20 @@
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
+import android.provider.Settings.SettingNotFoundException;
+import android.util.Log;
+import com.android.internal.telephony.Phone;
import com.android.phone.PhoneGlobals;
public class ImsUtil {
+
+ private static final String TAG = ImsUtil.class.getSimpleName();
+ private static boolean sImsPhoneSupported = false;
+
private ImsUtil() {
}
- private static boolean sImsPhoneSupported = false;
static {
PhoneGlobals app = PhoneGlobals.getInstance();
sImsPhoneSupported = true;
@@ -37,5 +43,32 @@
*/
static boolean isImsPhoneSupported() {
return sImsPhoneSupported;
+
+ }
+
+ /**
+ * @see MobileNetworkSettings#setIMS
+ * @param context The context to get the content resolver from.
+ * @return Whether IMS is turned on by the user system setting.
+ */
+ static boolean isImsEnabled(Context context) {
+ int value = 0;
+ try {
+ value = android.provider.Settings.Global.getInt(
+ context.getContentResolver(),
+ android.provider.Settings.Global.VOLTE_VT_ENABLED);
+ } catch (SettingNotFoundException e) {
+ return false;
+ }
+
+ switch (value) {
+ case 0:
+ return false;
+ case 1:
+ return true;
+ default:
+ Log.wtf(TAG,"Unexpected value for VOLTE_VT_ENABLED: " + value);
+ return false;
+ }
}
}