blob: 48276b774b21ea5020bc3d3eed53807b477c2b35 [file] [log] [blame]
Etan Cohen0ca1c802014-07-07 15:35:48 -07001/*
2 * Copyright 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.phone;
18
19import android.app.PendingIntent;
20import android.content.Context;
21import android.content.Intent;
Andrew Lee77527ac2014-10-21 16:57:39 -070022import android.provider.Settings.SettingNotFoundException;
23import android.util.Log;
Etan Cohen0ca1c802014-07-07 15:35:48 -070024
Andrew Lee77527ac2014-10-21 16:57:39 -070025import com.android.internal.telephony.Phone;
Etan Cohen0ca1c802014-07-07 15:35:48 -070026import com.android.phone.PhoneGlobals;
27
28public class ImsUtil {
Andrew Lee77527ac2014-10-21 16:57:39 -070029
30 private static final String TAG = ImsUtil.class.getSimpleName();
31 private static boolean sImsPhoneSupported = false;
32
Etan Cohen0ca1c802014-07-07 15:35:48 -070033 private ImsUtil() {
34 }
35
Etan Cohen0ca1c802014-07-07 15:35:48 -070036 static {
37 PhoneGlobals app = PhoneGlobals.getInstance();
38 sImsPhoneSupported = true;
39 }
40
41 /**
42 * @return true if this device supports voice calls using the built-in SIP stack.
43 */
44 static boolean isImsPhoneSupported() {
45 return sImsPhoneSupported;
Andrew Lee77527ac2014-10-21 16:57:39 -070046
47 }
48
49 /**
50 * @see MobileNetworkSettings#setIMS
51 * @param context The context to get the content resolver from.
52 * @return Whether IMS is turned on by the user system setting.
53 */
54 static boolean isImsEnabled(Context context) {
55 int value = 0;
56 try {
57 value = android.provider.Settings.Global.getInt(
58 context.getContentResolver(),
59 android.provider.Settings.Global.VOLTE_VT_ENABLED);
60 } catch (SettingNotFoundException e) {
61 return false;
62 }
63
64 switch (value) {
65 case 0:
66 return false;
67 case 1:
68 return true;
69 default:
70 Log.wtf(TAG,"Unexpected value for VOLTE_VT_ENABLED: " + value);
71 return false;
72 }
Etan Cohen0ca1c802014-07-07 15:35:48 -070073 }
74}