Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 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 | |
| 17 | package com.android.ims; |
| 18 | |
| 19 | import android.app.PendingIntent; |
| 20 | import android.content.Context; |
| 21 | import android.content.Intent; |
Pavel Zhamaitsiak | 4de9cbb | 2016-02-11 17:21:05 -0800 | [diff] [blame] | 22 | import android.net.Uri; |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 23 | import android.os.AsyncTask; |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 24 | import android.os.Handler; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 25 | import android.os.IBinder; |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 26 | import android.os.Looper; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 27 | import android.os.Message; |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 28 | import android.os.Parcel; |
Jonathan Basseri | 2acea6f | 2015-07-01 15:00:38 -0700 | [diff] [blame] | 29 | import android.os.PersistableBundle; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 30 | import android.os.RemoteException; |
Etan Cohen | af55a40 | 2014-09-04 22:34:41 -0700 | [diff] [blame] | 31 | import android.os.SystemProperties; |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 32 | import android.provider.Settings; |
| 33 | import android.telecom.TelecomManager; |
Junda Liu | e7663c0 | 2015-06-23 11:16:26 -0700 | [diff] [blame] | 34 | import android.telephony.CarrierConfigManager; |
Mohamed Abdalkader | 415e6de | 2018-01-19 19:48:31 -0800 | [diff] [blame] | 35 | import android.telephony.ims.internal.feature.ImsFeature; |
| 36 | import android.telephony.ims.stub.ImsRegistrationImplBase; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 37 | import android.telephony.Rlog; |
Meng Wang | bb98b9b | 2016-12-07 16:27:15 -0800 | [diff] [blame] | 38 | import android.telephony.ServiceState; |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 39 | import android.telephony.SubscriptionManager; |
Etan Cohen | cfc784d | 2014-08-07 18:40:31 -0700 | [diff] [blame] | 40 | import android.telephony.TelephonyManager; |
Hall Liu | e511a20 | 2017-08-17 15:49:58 -0700 | [diff] [blame] | 41 | import android.util.Log; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 42 | |
| 43 | import com.android.ims.internal.IImsCallSession; |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 44 | import com.android.ims.internal.IImsConfig; |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 45 | import com.android.ims.internal.IImsEcbm; |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 46 | import com.android.ims.internal.IImsMultiEndpoint; |
Brad Ebinger | 3418c13 | 2018-01-18 12:03:33 -0800 | [diff] [blame] | 47 | import com.android.ims.internal.IImsRegistration; |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 48 | import com.android.ims.internal.IImsRegistrationCallback; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 49 | import com.android.ims.internal.IImsRegistrationListener; |
Mohamed Abdalkader | f8800da | 2018-01-10 13:29:26 -0800 | [diff] [blame] | 50 | import com.android.ims.internal.IImsServiceController; |
| 51 | import com.android.ims.internal.IImsSmsListener; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 52 | import com.android.ims.internal.IImsUt; |
| 53 | import com.android.ims.internal.ImsCallSession; |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 54 | import com.android.internal.annotations.VisibleForTesting; |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 55 | import com.android.internal.telephony.ExponentialBackoff; |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 56 | |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 57 | import java.io.FileDescriptor; |
| 58 | import java.io.PrintWriter; |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 59 | import java.util.ArrayList; |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 60 | import java.util.HashMap; |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 61 | import java.util.concurrent.ConcurrentLinkedDeque; |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 62 | import java.util.HashSet; |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 63 | import java.util.Set; |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 64 | import java.util.concurrent.CopyOnWriteArraySet; |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 65 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 66 | /** |
| 67 | * Provides APIs for IMS services, such as initiating IMS calls, and provides access to |
| 68 | * the operator's IMS network. This class is the starting point for any IMS actions. |
| 69 | * You can acquire an instance of it with {@link #getInstance getInstance()}.</p> |
| 70 | * <p>The APIs in this class allows you to:</p> |
| 71 | * |
| 72 | * @hide |
| 73 | */ |
| 74 | public class ImsManager { |
Etan Cohen | 19604c0 | 2014-08-11 14:32:57 -0700 | [diff] [blame] | 75 | |
Etan Cohen | af55a40 | 2014-09-04 22:34:41 -0700 | [diff] [blame] | 76 | /* |
| 77 | * Debug flag to override configuration flag |
| 78 | */ |
Etan Cohen | b651fa5 | 2014-10-22 10:51:29 -0700 | [diff] [blame] | 79 | public static final String PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE = "persist.dbg.volte_avail_ovr"; |
| 80 | public static final int PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE_DEFAULT = 0; |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 81 | public static final String PROPERTY_DBG_VT_AVAIL_OVERRIDE = "persist.dbg.vt_avail_ovr"; |
| 82 | public static final int PROPERTY_DBG_VT_AVAIL_OVERRIDE_DEFAULT = 0; |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 83 | public static final String PROPERTY_DBG_WFC_AVAIL_OVERRIDE = "persist.dbg.wfc_avail_ovr"; |
| 84 | public static final int PROPERTY_DBG_WFC_AVAIL_OVERRIDE_DEFAULT = 0; |
Meng Wang | 9352c43 | 2016-06-08 14:22:20 -0700 | [diff] [blame] | 85 | public static final String PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE = "persist.dbg.allow_ims_off"; |
| 86 | public static final int PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE_DEFAULT = 0; |
Etan Cohen | af55a40 | 2014-09-04 22:34:41 -0700 | [diff] [blame] | 87 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 88 | /** |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 89 | * The result code to be sent back with the incoming call {@link PendingIntent}. |
| 90 | * @see #open(PendingIntent, ImsConnectionStateListener) |
| 91 | */ |
| 92 | public static final int INCOMING_CALL_RESULT_CODE = 101; |
| 93 | |
| 94 | /** |
| 95 | * Key to retrieve the call ID from an incoming call intent. |
| 96 | * @see #open(PendingIntent, ImsConnectionStateListener) |
| 97 | */ |
| 98 | public static final String EXTRA_CALL_ID = "android:imsCallID"; |
| 99 | |
| 100 | /** |
| 101 | * Action to broadcast when ImsService is up. |
| 102 | * Internal use only. |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 103 | * @deprecated |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 104 | * @hide |
| 105 | */ |
| 106 | public static final String ACTION_IMS_SERVICE_UP = |
| 107 | "com.android.ims.IMS_SERVICE_UP"; |
| 108 | |
| 109 | /** |
| 110 | * Action to broadcast when ImsService is down. |
| 111 | * Internal use only. |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 112 | * @deprecated |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 113 | * @hide |
| 114 | */ |
| 115 | public static final String ACTION_IMS_SERVICE_DOWN = |
| 116 | "com.android.ims.IMS_SERVICE_DOWN"; |
| 117 | |
| 118 | /** |
Pavel Zhamaitsiak | 0c2f15c | 2015-03-12 15:37:54 -0700 | [diff] [blame] | 119 | * Action to broadcast when ImsService registration fails. |
| 120 | * Internal use only. |
| 121 | * @hide |
| 122 | */ |
| 123 | public static final String ACTION_IMS_REGISTRATION_ERROR = |
| 124 | "com.android.ims.REGISTRATION_ERROR"; |
| 125 | |
| 126 | /** |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 127 | * Part of the ACTION_IMS_SERVICE_UP or _DOWN intents. |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 128 | * A long value; the phone ID corresponding to the IMS service coming up or down. |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 129 | * Internal use only. |
| 130 | * @hide |
| 131 | */ |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 132 | public static final String EXTRA_PHONE_ID = "android:phone_id"; |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 133 | |
| 134 | /** |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 135 | * Action for the incoming call intent for the Phone app. |
| 136 | * Internal use only. |
| 137 | * @hide |
| 138 | */ |
| 139 | public static final String ACTION_IMS_INCOMING_CALL = |
| 140 | "com.android.ims.IMS_INCOMING_CALL"; |
| 141 | |
| 142 | /** |
| 143 | * Part of the ACTION_IMS_INCOMING_CALL intents. |
| 144 | * An integer value; service identifier obtained from {@link ImsManager#open}. |
| 145 | * Internal use only. |
| 146 | * @hide |
| 147 | */ |
| 148 | public static final String EXTRA_SERVICE_ID = "android:imsServiceId"; |
| 149 | |
| 150 | /** |
| 151 | * Part of the ACTION_IMS_INCOMING_CALL intents. |
| 152 | * An boolean value; Flag to indicate that the incoming call is a normal call or call for USSD. |
| 153 | * The value "true" indicates that the incoming call is for USSD. |
| 154 | * Internal use only. |
| 155 | * @hide |
| 156 | */ |
| 157 | public static final String EXTRA_USSD = "android:ussd"; |
| 158 | |
Shriram Ganesh | d3adfad | 2015-05-31 10:06:15 -0700 | [diff] [blame] | 159 | /** |
| 160 | * Part of the ACTION_IMS_INCOMING_CALL intents. |
| 161 | * A boolean value; Flag to indicate whether the call is an unknown |
| 162 | * dialing call. Such calls are originated by sending commands (like |
| 163 | * AT commands) directly to modem without Android involvement. |
| 164 | * Even though they are not incoming calls, they are propagated |
| 165 | * to Phone app using same ACTION_IMS_INCOMING_CALL intent. |
| 166 | * Internal use only. |
| 167 | * @hide |
| 168 | */ |
Anju Mathapati | 9c03379 | 2015-06-16 16:33:16 -0700 | [diff] [blame] | 169 | public static final String EXTRA_IS_UNKNOWN_CALL = "android:isUnknown"; |
Shriram Ganesh | d3adfad | 2015-05-31 10:06:15 -0700 | [diff] [blame] | 170 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 171 | private static final String TAG = "ImsManager"; |
| 172 | private static final boolean DBG = true; |
| 173 | |
Wink Saville | 1e5a38a | 2014-10-23 10:24:46 -0700 | [diff] [blame] | 174 | private static HashMap<Integer, ImsManager> sImsManagerInstances = |
| 175 | new HashMap<Integer, ImsManager>(); |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 176 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 177 | private Context mContext; |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 178 | private CarrierConfigManager mConfigManager; |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 179 | private int mPhoneId; |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 180 | private final boolean mConfigDynamicBind; |
Brad Ebinger | a7c3243 | 2017-11-06 15:19:27 -0800 | [diff] [blame] | 181 | private ImsServiceProxy mImsServiceProxy = null; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 182 | private ImsServiceDeathRecipient mDeathRecipient = new ImsServiceDeathRecipient(); |
| 183 | // Ut interface for the supplementary service configuration |
| 184 | private ImsUt mUt = null; |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 185 | // Interface to get/set ims config items |
| 186 | private ImsConfig mConfig = null; |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 187 | private boolean mConfigUpdated = false; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 188 | |
Pavel Zhamaitsiak | f4b9032 | 2016-01-26 14:34:09 -0800 | [diff] [blame] | 189 | private ImsConfigListener mImsConfigListener; |
| 190 | |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 191 | // ECBM interface |
| 192 | private ImsEcbm mEcbm = null; |
| 193 | |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 194 | private ImsMultiEndpoint mMultiEndpoint = null; |
| 195 | |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 196 | private Set<ImsServiceProxy.IFeatureUpdate> mStatusCallbacks = new CopyOnWriteArraySet<>(); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 197 | |
| 198 | // Keep track of the ImsRegistrationListenerProxys that have been created so that we can |
| 199 | // remove them from the ImsService. |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 200 | private final Set<ImsConnectionStateListener> mRegistrationListeners = new HashSet<>(); |
| 201 | |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 202 | |
| 203 | // Used for compatibility with the old Registration method |
| 204 | // TODO: Remove once the compat layer is in place |
| 205 | private final ImsRegistrationListenerProxy mImsRegistrationListenerProxy = |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 206 | new ImsRegistrationListenerProxy(); |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 207 | // New API for registration to the ImsService. |
| 208 | private final ImsRegistrationCallback mRegistrationCallback = new ImsRegistrationCallback(); |
| 209 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 210 | |
| 211 | // When true, we have registered the mRegistrationListenerProxy with the ImsService. Don't do |
| 212 | // it again. |
| 213 | private boolean mHasRegisteredForProxy = false; |
| 214 | private final Object mHasRegisteredLock = new Object(); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 215 | |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 216 | // SystemProperties used as cache |
| 217 | private static final String VOLTE_PROVISIONED_PROP = "net.lte.ims.volte.provisioned"; |
| 218 | private static final String WFC_PROVISIONED_PROP = "net.lte.ims.wfc.provisioned"; |
| 219 | private static final String VT_PROVISIONED_PROP = "net.lte.ims.vt.provisioned"; |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 220 | // Flag indicating data enabled or not. This flag should be in sync with |
| 221 | // DcTracker.isDataEnabled(). The flag will be set later during boot up. |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 222 | private static final String DATA_ENABLED_PROP = "net.lte.ims.data.enabled"; |
| 223 | |
| 224 | public static final String TRUE = "true"; |
| 225 | public static final String FALSE = "false"; |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 226 | |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 227 | // mRecentDisconnectReasons stores the last 16 disconnect reasons |
| 228 | private static final int MAX_RECENT_DISCONNECT_REASONS = 16; |
| 229 | private ConcurrentLinkedDeque<ImsReasonInfo> mRecentDisconnectReasons = |
| 230 | new ConcurrentLinkedDeque<>(); |
| 231 | |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 232 | // Exponential backoff for provisioning cache update. May be null for instances of ImsManager |
| 233 | // that are not on a thread supporting a looper. |
| 234 | private ExponentialBackoff mProvisionBackoff; |
| 235 | // Initial Provisioning check delay in ms |
| 236 | private static final long BACKOFF_INITIAL_DELAY_MS = 500; |
| 237 | // Max Provisioning check delay in ms (5 Minutes) |
| 238 | private static final long BACKOFF_MAX_DELAY_MS = 300000; |
| 239 | // Multiplier for exponential delay |
| 240 | private static final int BACKOFF_MULTIPLIER = 2; |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 241 | // -1 indicates a subscriptionProperty value that is never set. |
| 242 | private static final int SUB_PROPERTY_NOT_INITIALIZED = -1; |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 243 | |
| 244 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 245 | /** |
| 246 | * Gets a manager instance. |
| 247 | * |
| 248 | * @param context application context for creating the manager object |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 249 | * @param phoneId the phone ID for the IMS Service |
| 250 | * @return the manager instance corresponding to the phoneId |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 251 | */ |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 252 | public static ImsManager getInstance(Context context, int phoneId) { |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 253 | synchronized (sImsManagerInstances) { |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 254 | if (sImsManagerInstances.containsKey(phoneId)) { |
Brad Ebinger | ff09792 | 2017-06-19 15:43:08 -0700 | [diff] [blame] | 255 | ImsManager m = sImsManagerInstances.get(phoneId); |
| 256 | // May be null for some tests |
| 257 | if (m != null) { |
| 258 | m.connectIfServiceIsAvailable(); |
| 259 | } |
| 260 | return m; |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 261 | } |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 262 | |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 263 | ImsManager mgr = new ImsManager(context, phoneId); |
| 264 | sImsManagerInstances.put(phoneId, mgr); |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 265 | |
| 266 | return mgr; |
| 267 | } |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 268 | } |
| 269 | |
Etan Cohen | 45b5f31 | 2014-08-19 15:55:08 -0700 | [diff] [blame] | 270 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 271 | * Returns the user configuration of Enhanced 4G LTE Mode setting. |
| 272 | * |
| 273 | * @deprecated Doesn't support MSIM devices. Use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 274 | * {@link #isEnhanced4gLteModeSettingEnabledByUser()} instead. |
Etan Cohen | 45b5f31 | 2014-08-19 15:55:08 -0700 | [diff] [blame] | 275 | */ |
| 276 | public static boolean isEnhanced4gLteModeSettingEnabledByUser(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 277 | ImsManager mgr = ImsManager.getInstance(context, |
| 278 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 279 | if (mgr != null) { |
| 280 | return mgr.isEnhanced4gLteModeSettingEnabledByUser(); |
Sungmin Choi | 2f1af95 | 2016-02-01 17:15:35 +0900 | [diff] [blame] | 281 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 282 | loge("isEnhanced4gLteModeSettingEnabledByUser: ImsManager null, returning default value."); |
| 283 | return false; |
Etan Cohen | 45b5f31 | 2014-08-19 15:55:08 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | /** |
manabu, shimoda | 2335b70 | 2017-10-06 15:39:36 +0900 | [diff] [blame] | 287 | * Returns the user configuration of Enhanced 4G LTE Mode setting for slot. If the option is |
| 288 | * not editable ({@link CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL} is false), |
| 289 | * this method will return default value specified by |
| 290 | * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 291 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 292 | public boolean isEnhanced4gLteModeSettingEnabledByUser() { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 293 | int setting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 294 | getSubId(), SubscriptionManager.ENHANCED_4G_MODE_ENABLED, |
| 295 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
| 296 | boolean onByDefault = getBooleanCarrierConfig( |
| 297 | CarrierConfigManager.KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL); |
| 298 | |
| 299 | // If Enhanced 4G LTE Mode is uneditable or not initialized, we use the default value |
| 300 | if (!getBooleanCarrierConfig(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL) |
| 301 | || setting == SUB_PROPERTY_NOT_INITIALIZED) { |
| 302 | return onByDefault; |
| 303 | } else { |
| 304 | return (setting == ImsConfig.FeatureValueConstants.ON); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 305 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | /** |
| 309 | * Change persistent Enhanced 4G LTE Mode setting. |
| 310 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 311 | * @deprecated Doesn't support MSIM devices. Use {@link #setEnhanced4gLteModeSetting(boolean)} |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 312 | * instead. |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 313 | */ |
| 314 | public static void setEnhanced4gLteModeSetting(Context context, boolean enabled) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 315 | ImsManager mgr = ImsManager.getInstance(context, |
| 316 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 317 | if (mgr != null) { |
| 318 | mgr.setEnhanced4gLteModeSetting(enabled); |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 319 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 320 | loge("setEnhanced4gLteModeSetting: ImsManager null, value not set."); |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | /** |
manabu, shimoda | 2335b70 | 2017-10-06 15:39:36 +0900 | [diff] [blame] | 324 | * Change persistent Enhanced 4G LTE Mode setting. If the option is not editable |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 325 | * ({@link CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL} is false), this method will |
manabu, shimoda | 2335b70 | 2017-10-06 15:39:36 +0900 | [diff] [blame] | 326 | * set the setting to the default value specified by |
| 327 | * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 328 | * |
| 329 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 330 | public void setEnhanced4gLteModeSetting(boolean enabled) { |
manabu, shimoda | 2335b70 | 2017-10-06 15:39:36 +0900 | [diff] [blame] | 331 | // If editable=false, we must keep default advanced 4G mode. |
| 332 | if (!getBooleanCarrierConfig(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL)) { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 333 | enabled = getBooleanCarrierConfig( |
| 334 | CarrierConfigManager.KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL); |
manabu, shimoda | 2335b70 | 2017-10-06 15:39:36 +0900 | [diff] [blame] | 335 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 336 | |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 337 | int prevSetting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 338 | getSubId(), SubscriptionManager.ENHANCED_4G_MODE_ENABLED, |
| 339 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 340 | |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 341 | if (prevSetting != (enabled ? |
| 342 | ImsConfig.FeatureValueConstants.ON : |
| 343 | ImsConfig.FeatureValueConstants.OFF)) { |
| 344 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 345 | SubscriptionManager.ENHANCED_4G_MODE_ENABLED, booleanToPropertyString(enabled)); |
| 346 | if (isNonTtyOrTtyOnVolteEnabled()) { |
| 347 | try { |
| 348 | setAdvanced4GMode(enabled); |
| 349 | } catch (ImsException ie) { |
| 350 | // do nothing |
| 351 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | /** |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 357 | * Indicates whether the call is non-TTY or if TTY - whether TTY on VoLTE is |
| 358 | * supported. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 359 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 360 | * {@link #isNonTtyOrTtyOnVolteEnabled()} instead. |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 361 | */ |
| 362 | public static boolean isNonTtyOrTtyOnVolteEnabled(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 363 | ImsManager mgr = ImsManager.getInstance(context, |
| 364 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 365 | if (mgr != null) { |
| 366 | return mgr.isNonTtyOrTtyOnVolteEnabled(); |
| 367 | } |
| 368 | loge("isNonTtyOrTtyOnVolteEnabled: ImsManager null, returning default value."); |
| 369 | return false; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Indicates whether the call is non-TTY or if TTY - whether TTY on VoLTE is |
| 374 | * supported on a per slot basis. |
| 375 | */ |
| 376 | public boolean isNonTtyOrTtyOnVolteEnabled() { |
| 377 | if (getBooleanCarrierConfig( |
fionaxu | 5803ef0 | 2016-03-08 11:48:48 -0800 | [diff] [blame] | 378 | CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL)) { |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 379 | return true; |
| 380 | } |
| 381 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 382 | TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE); |
Hall Liu | e511a20 | 2017-08-17 15:49:58 -0700 | [diff] [blame] | 383 | if (tm == null) { |
| 384 | Log.w(TAG, "isNonTtyOrTtyOnVolteEnabled: telecom not available"); |
| 385 | return true; |
| 386 | } |
| 387 | return tm.getCurrentTtyMode() == TelecomManager.TTY_MODE_OFF; |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | /** |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 391 | * Returns a platform configuration for VoLTE which may override the user setting. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 392 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 393 | * {@link #isVolteEnabledByPlatform()} instead. |
Etan Cohen | 45b5f31 | 2014-08-19 15:55:08 -0700 | [diff] [blame] | 394 | */ |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 395 | public static boolean isVolteEnabledByPlatform(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 396 | ImsManager mgr = ImsManager.getInstance(context, |
| 397 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 398 | if (mgr != null) { |
| 399 | return mgr.isVolteEnabledByPlatform(); |
Etan Cohen | af55a40 | 2014-09-04 22:34:41 -0700 | [diff] [blame] | 400 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 401 | loge("isVolteEnabledByPlatform: ImsManager null, returning default value."); |
| 402 | return false; |
Etan Cohen | b5388a3 | 2014-11-26 11:57:47 -0800 | [diff] [blame] | 403 | } |
| 404 | |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 405 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 406 | * Returns a platform configuration for VoLTE which may override the user setting on a per Slot |
| 407 | * basis. |
| 408 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 409 | public boolean isVolteEnabledByPlatform() { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 410 | if (SystemProperties.getInt(PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE, |
| 411 | PROPERTY_DBG_VOLTE_AVAIL_OVERRIDE_DEFAULT) == 1) { |
| 412 | return true; |
| 413 | } |
| 414 | |
| 415 | return mContext.getResources().getBoolean( |
| 416 | com.android.internal.R.bool.config_device_volte_available) |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 417 | && getBooleanCarrierConfig(CarrierConfigManager.KEY_CARRIER_VOLTE_AVAILABLE_BOOL) |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 418 | && isGbaValid(); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | /** |
| 422 | * Indicates whether VoLTE is provisioned on device. |
| 423 | * |
| 424 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 425 | * {@link #isVolteProvisionedOnDevice()} instead. |
Etan Cohen | b5388a3 | 2014-11-26 11:57:47 -0800 | [diff] [blame] | 426 | */ |
| 427 | public static boolean isVolteProvisionedOnDevice(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 428 | ImsManager mgr = ImsManager.getInstance(context, |
| 429 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 430 | if (mgr != null) { |
| 431 | return mgr.isVolteProvisionedOnDevice(); |
Etan Cohen | b5388a3 | 2014-11-26 11:57:47 -0800 | [diff] [blame] | 432 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 433 | loge("isVolteProvisionedOnDevice: ImsManager null, returning default value."); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 434 | return true; |
| 435 | } |
| 436 | |
| 437 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 438 | * Indicates whether VoLTE is provisioned on this slot. |
| 439 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 440 | public boolean isVolteProvisionedOnDevice() { |
| 441 | if (getBooleanCarrierConfig( |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 442 | CarrierConfigManager.KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL)) { |
| 443 | return isVolteProvisioned(); |
| 444 | } |
| 445 | |
| 446 | return true; |
| 447 | } |
| 448 | |
| 449 | /** |
Meng Wang | 54fd41a | 2017-04-12 11:44:47 -0700 | [diff] [blame] | 450 | * Indicates whether VoWifi is provisioned on device. |
| 451 | * |
| 452 | * When CarrierConfig KEY_CARRIER_VOLTE_OVERRIDE_WFC_PROVISIONING_BOOL is true, and VoLTE is not |
| 453 | * provisioned on device, this method returns false. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 454 | * |
| 455 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 456 | * {@link #isWfcProvisionedOnDevice()} instead. |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 457 | */ |
| 458 | public static boolean isWfcProvisionedOnDevice(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 459 | ImsManager mgr = ImsManager.getInstance(context, |
| 460 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 461 | if (mgr != null) { |
| 462 | return mgr.isWfcProvisionedOnDevice(); |
Meng Wang | 54fd41a | 2017-04-12 11:44:47 -0700 | [diff] [blame] | 463 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 464 | loge("isWfcProvisionedOnDevice: ImsManager null, returning default value."); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 465 | return true; |
| 466 | } |
| 467 | |
| 468 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 469 | * Indicates whether VoWifi is provisioned on slot. |
Meng Wang | 54fd41a | 2017-04-12 11:44:47 -0700 | [diff] [blame] | 470 | * |
| 471 | * When CarrierConfig KEY_CARRIER_VOLTE_OVERRIDE_WFC_PROVISIONING_BOOL is true, and VoLTE is not |
| 472 | * provisioned on device, this method returns false. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 473 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 474 | public boolean isWfcProvisionedOnDevice() { |
| 475 | if (getBooleanCarrierConfig( |
Meng Wang | 54fd41a | 2017-04-12 11:44:47 -0700 | [diff] [blame] | 476 | CarrierConfigManager.KEY_CARRIER_VOLTE_OVERRIDE_WFC_PROVISIONING_BOOL)) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 477 | if (!isVolteProvisionedOnDevice()) { |
Meng Wang | 54fd41a | 2017-04-12 11:44:47 -0700 | [diff] [blame] | 478 | return false; |
| 479 | } |
| 480 | } |
| 481 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 482 | if (getBooleanCarrierConfig( |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 483 | CarrierConfigManager.KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL)) { |
Meng Wang | 54fd41a | 2017-04-12 11:44:47 -0700 | [diff] [blame] | 484 | return isWfcProvisioned(); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | return true; |
| 488 | } |
| 489 | |
| 490 | /** |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 491 | * Indicates whether VT is provisioned on device |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 492 | * |
| 493 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 494 | * {@link #isVtProvisionedOnDevice()} instead. |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 495 | */ |
| 496 | public static boolean isVtProvisionedOnDevice(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 497 | ImsManager mgr = ImsManager.getInstance(context, |
| 498 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 499 | if (mgr != null) { |
| 500 | return mgr.isVtProvisionedOnDevice(); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 501 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 502 | loge("isVtProvisionedOnDevice: ImsManager null, returning default value."); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 503 | return true; |
Etan Cohen | b651fa5 | 2014-10-22 10:51:29 -0700 | [diff] [blame] | 504 | } |
| 505 | |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 506 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 507 | * Indicates whether VT is provisioned on slot. |
| 508 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 509 | public boolean isVtProvisionedOnDevice() { |
| 510 | if (getBooleanCarrierConfig( |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 511 | CarrierConfigManager.KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL)) { |
| 512 | return isVtProvisioned(); |
| 513 | } |
| 514 | |
| 515 | return true; |
| 516 | } |
| 517 | |
| 518 | /** |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 519 | * Returns a platform configuration for VT which may override the user setting. |
| 520 | * |
| 521 | * Note: VT presumes that VoLTE is enabled (these are configuration settings |
| 522 | * which must be done correctly). |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 523 | * |
| 524 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 525 | * {@link #isVtEnabledByPlatform()} instead. |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 526 | */ |
Etan Cohen | b651fa5 | 2014-10-22 10:51:29 -0700 | [diff] [blame] | 527 | public static boolean isVtEnabledByPlatform(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 528 | ImsManager mgr = ImsManager.getInstance(context, |
| 529 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 530 | if (mgr != null) { |
| 531 | return mgr.isVtEnabledByPlatform(); |
Etan Cohen | ea2b583 | 2014-10-23 18:50:35 -0700 | [diff] [blame] | 532 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 533 | loge("isVtEnabledByPlatform: ImsManager null, returning default value."); |
| 534 | return false; |
Etan Cohen | 45b5f31 | 2014-08-19 15:55:08 -0700 | [diff] [blame] | 535 | } |
| 536 | |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 537 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 538 | * Returns a platform configuration for VT which may override the user setting. |
| 539 | * |
| 540 | * Note: VT presumes that VoLTE is enabled (these are configuration settings |
| 541 | * which must be done correctly). |
| 542 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 543 | public boolean isVtEnabledByPlatform() { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 544 | if (SystemProperties.getInt(PROPERTY_DBG_VT_AVAIL_OVERRIDE, |
| 545 | PROPERTY_DBG_VT_AVAIL_OVERRIDE_DEFAULT) == 1) { |
| 546 | return true; |
| 547 | } |
| 548 | |
| 549 | return mContext.getResources().getBoolean( |
| 550 | com.android.internal.R.bool.config_device_vt_available) && |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 551 | getBooleanCarrierConfig(CarrierConfigManager.KEY_CARRIER_VT_AVAILABLE_BOOL) && |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 552 | isGbaValid(); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 553 | } |
| 554 | |
| 555 | /** |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 556 | * Returns the user configuration of VT setting |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 557 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 558 | * {@link #isVtEnabledByUser()} instead. |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 559 | */ |
| 560 | public static boolean isVtEnabledByUser(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 561 | ImsManager mgr = ImsManager.getInstance(context, |
| 562 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 563 | if (mgr != null) { |
| 564 | return mgr.isVtEnabledByUser(); |
| 565 | } |
| 566 | loge("isVtEnabledByUser: ImsManager null, returning default value."); |
| 567 | return false; |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | /** |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 571 | * Returns the user configuration of VT setting per slot. If not set, it |
| 572 | * returns true as default value. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 573 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 574 | public boolean isVtEnabledByUser() { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 575 | int setting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 576 | getSubId(), SubscriptionManager.VT_IMS_ENABLED, |
| 577 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
| 578 | |
| 579 | // If it's never set, by default we return true. |
| 580 | return (setting == SUB_PROPERTY_NOT_INITIALIZED || setting == 1); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | /** |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 584 | * Change persistent VT enabled setting |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 585 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 586 | * @deprecated Does not support MSIM devices. Please use {@link #setVtSetting(boolean)} instead. |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 587 | */ |
| 588 | public static void setVtSetting(Context context, boolean enabled) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 589 | ImsManager mgr = ImsManager.getInstance(context, |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 590 | SubscriptionManager.getDefaultVoicePhoneId()); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 591 | if (mgr != null) { |
| 592 | mgr.setVtSetting(enabled); |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 593 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 594 | loge("setVtSetting: ImsManager null, can not set value."); |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 595 | } |
| 596 | |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 597 | /** |
| 598 | * Change persistent VT enabled setting for slot. |
| 599 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 600 | public void setVtSetting(boolean enabled) { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 601 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 602 | SubscriptionManager.VT_IMS_ENABLED, |
| 603 | booleanToPropertyString(enabled)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 604 | try { |
| 605 | ImsConfig config = getConfigInterface(); |
| 606 | config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_LTE, |
| 607 | TelephonyManager.NETWORK_TYPE_LTE, |
| 608 | enabled ? ImsConfig.FeatureValueConstants.ON |
| 609 | : ImsConfig.FeatureValueConstants.OFF, |
| 610 | mImsConfigListener); |
| 611 | |
| 612 | if (enabled) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 613 | log("setVtSetting(b) : turnOnIms"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 614 | turnOnIms(); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 615 | } else if (isVolteEnabledByPlatform() |
| 616 | && (!isVolteEnabledByPlatform() |
| 617 | || !isEnhanced4gLteModeSettingEnabledByUser())) { |
| 618 | log("setVtSetting(b) : imsServiceAllowTurnOff -> turnOffIms"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 619 | turnOffIms(); |
| 620 | } |
| 621 | } catch (ImsException e) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 622 | loge("setVtSetting(b): ", e); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 623 | } |
| 624 | } |
| 625 | |
| 626 | /** |
Meng Wang | 9352c43 | 2016-06-08 14:22:20 -0700 | [diff] [blame] | 627 | * Returns whether turning off ims is allowed by platform. |
| 628 | * The platform property may override the carrier config. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 629 | * |
| 630 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 631 | * {@link #isTurnOffImsAllowedByPlatform()} instead. |
Meng Wang | 9352c43 | 2016-06-08 14:22:20 -0700 | [diff] [blame] | 632 | */ |
| 633 | private static boolean isTurnOffImsAllowedByPlatform(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 634 | ImsManager mgr = ImsManager.getInstance(context, |
| 635 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 636 | if (mgr != null) { |
| 637 | return mgr.isTurnOffImsAllowedByPlatform(); |
Meng Wang | 9352c43 | 2016-06-08 14:22:20 -0700 | [diff] [blame] | 638 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 639 | loge("isTurnOffImsAllowedByPlatform: ImsManager null, returning default value."); |
| 640 | return true; |
Meng Wang | 9352c43 | 2016-06-08 14:22:20 -0700 | [diff] [blame] | 641 | } |
| 642 | |
Etan Cohen | a7d32e8 | 2015-05-04 18:02:09 -0700 | [diff] [blame] | 643 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 644 | * Returns whether turning off ims is allowed by platform. |
| 645 | * The platform property may override the carrier config. |
| 646 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 647 | private boolean isTurnOffImsAllowedByPlatform() { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 648 | if (SystemProperties.getInt(PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE, |
| 649 | PROPERTY_DBG_ALLOW_IMS_OFF_OVERRIDE_DEFAULT) == 1) { |
| 650 | return true; |
| 651 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 652 | return getBooleanCarrierConfig( |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 653 | CarrierConfigManager.KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL); |
| 654 | } |
| 655 | |
| 656 | /** |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 657 | * Returns the user configuration of WFC setting |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 658 | * |
| 659 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 660 | * {@link #isWfcEnabledByUser()} instead. |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 661 | */ |
| 662 | public static boolean isWfcEnabledByUser(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 663 | ImsManager mgr = ImsManager.getInstance(context, |
| 664 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 665 | if (mgr != null) { |
| 666 | return mgr.isWfcEnabledByUser(); |
| 667 | } |
| 668 | loge("isWfcEnabledByUser: ImsManager null, returning default value."); |
| 669 | return true; |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 670 | } |
| 671 | |
| 672 | /** |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 673 | * Returns the user configuration of WFC setting for slot. If not set, it |
| 674 | * queries CarrierConfig value as default. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 675 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 676 | public boolean isWfcEnabledByUser() { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 677 | int setting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 678 | getSubId(), SubscriptionManager.WFC_IMS_ENABLED, |
| 679 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
| 680 | |
| 681 | // SUB_PROPERTY_NOT_INITIALIZED indicates it's never set in sub db. |
| 682 | if (setting == SUB_PROPERTY_NOT_INITIALIZED) { |
| 683 | return getBooleanCarrierConfig( |
| 684 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL); |
| 685 | } else { |
| 686 | return setting == 1; |
| 687 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 688 | } |
| 689 | |
| 690 | /** |
| 691 | * Change persistent WFC enabled setting. |
| 692 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 693 | * {@link #setWfcSetting} instead. |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 694 | */ |
| 695 | public static void setWfcSetting(Context context, boolean enabled) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 696 | ImsManager mgr = ImsManager.getInstance(context, |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 697 | SubscriptionManager.getDefaultVoicePhoneId()); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 698 | if (mgr != null) { |
| 699 | mgr.setWfcSetting(enabled); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 700 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 701 | loge("setWfcSetting: ImsManager null, can not set value."); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 702 | } |
| 703 | |
| 704 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 705 | * Change persistent WFC enabled setting for slot. |
| 706 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 707 | public void setWfcSetting(boolean enabled) { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 708 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 709 | SubscriptionManager.WFC_IMS_ENABLED, booleanToPropertyString(enabled)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 710 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 711 | setWfcNonPersistent(enabled, getWfcMode()); |
Meng Wang | 51c0907 | 2017-03-27 10:47:45 -0700 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | /** |
| 715 | * Non-persistently change WFC enabled setting and WFC mode for slot |
| 716 | * |
| 717 | * @param wfcMode The WFC preference if WFC is enabled |
| 718 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 719 | public void setWfcNonPersistent(boolean enabled, int wfcMode) { |
Meng Wang | 51c0907 | 2017-03-27 10:47:45 -0700 | [diff] [blame] | 720 | int imsFeatureValue = |
| 721 | enabled ? ImsConfig.FeatureValueConstants.ON : ImsConfig.FeatureValueConstants.OFF; |
| 722 | // Force IMS to register over LTE when turning off WFC |
| 723 | int imsWfcModeFeatureValue = |
| 724 | enabled ? wfcMode : ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED; |
| 725 | |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 726 | try { |
| 727 | ImsConfig config = getConfigInterface(); |
| 728 | config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_WIFI, |
| 729 | TelephonyManager.NETWORK_TYPE_IWLAN, |
Meng Wang | 51c0907 | 2017-03-27 10:47:45 -0700 | [diff] [blame] | 730 | imsFeatureValue, |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 731 | mImsConfigListener); |
| 732 | |
| 733 | if (enabled) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 734 | log("setWfcSetting() : turnOnIms"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 735 | turnOnIms(); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 736 | } else if (isTurnOffImsAllowedByPlatform() |
| 737 | && (!isVolteEnabledByPlatform() |
| 738 | || !isEnhanced4gLteModeSettingEnabledByUser())) { |
| 739 | log("setWfcSetting() : imsServiceAllowTurnOff -> turnOffIms"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 740 | turnOffIms(); |
| 741 | } |
| 742 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 743 | setWfcModeInternal(imsWfcModeFeatureValue); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 744 | } catch (ImsException e) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 745 | loge("setWfcSetting(): ", e); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 746 | } |
| 747 | } |
| 748 | |
| 749 | /** |
| 750 | * Returns the user configuration of WFC preference setting. |
| 751 | * |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 752 | * @deprecated Doesn't support MSIM devices. Use {@link #getWfcMode(boolean roaming)} instead. |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 753 | */ |
| 754 | public static int getWfcMode(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 755 | ImsManager mgr = ImsManager.getInstance(context, |
| 756 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 757 | if (mgr != null) { |
| 758 | return mgr.getWfcMode(); |
| 759 | } |
| 760 | loge("getWfcMode: ImsManager null, returning default value."); |
| 761 | return ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY; |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 765 | * Returns the user configuration of WFC preference setting |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 766 | * @deprecated. Use {@link #getWfcMode(boolean roaming)} instead. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 767 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 768 | public int getWfcMode() { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 769 | return getWfcMode(false); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 770 | } |
| 771 | |
| 772 | /** |
| 773 | * Change persistent WFC preference setting. |
| 774 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 775 | * @deprecated Doesn't support MSIM devices. Use {@link #setWfcMode(int)} instead. |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 776 | */ |
| 777 | public static void setWfcMode(Context context, int wfcMode) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 778 | ImsManager mgr = ImsManager.getInstance(context, |
| 779 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 780 | if (mgr != null) { |
| 781 | mgr.setWfcMode(wfcMode); |
| 782 | } |
| 783 | loge("setWfcMode: ImsManager null, can not set value."); |
Pavel Zhamaitsiak | 9e6eca2 | 2015-03-16 15:30:53 -0700 | [diff] [blame] | 784 | } |
| 785 | |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 786 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 787 | * Change persistent WFC preference setting for slot. |
| 788 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 789 | public void setWfcMode(int wfcMode) { |
| 790 | if (DBG) log("setWfcMode(i) - setting=" + wfcMode); |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 791 | |
| 792 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 793 | SubscriptionManager.WFC_IMS_MODE, Integer.toString(wfcMode)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 794 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 795 | setWfcModeInternal(wfcMode); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 796 | } |
| 797 | |
| 798 | /** |
Suresh Koleti | 7649108 | 2017-04-21 18:39:50 +0530 | [diff] [blame] | 799 | * Changes the WFC mode to its default value for Carriers with non-editable WFC settings. |
| 800 | */ |
| 801 | private void updateDefaultWfcMode() { |
| 802 | if (DBG) log("updateDefaultWfcMode"); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 803 | if (!getBooleanCarrierConfig(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL)) { |
| 804 | setWfcMode(getIntCarrierConfig( |
Suresh Koleti | 7649108 | 2017-04-21 18:39:50 +0530 | [diff] [blame] | 805 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT)); |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | /** |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 810 | * Returns the user configuration of WFC preference setting |
| 811 | * |
| 812 | * @param roaming {@code false} for home network setting, {@code true} for roaming setting |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 813 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 814 | * @deprecated Doesn't support MSIM devices. Use {@link #getWfcMode(boolean)} instead. |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 815 | */ |
| 816 | public static int getWfcMode(Context context, boolean roaming) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 817 | ImsManager mgr = ImsManager.getInstance(context, |
| 818 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 819 | if (mgr != null) { |
| 820 | return mgr.getWfcMode(roaming); |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 821 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 822 | loge("getWfcMode: ImsManager null, returning default value."); |
| 823 | return ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY; |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 824 | } |
| 825 | |
| 826 | /** |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 827 | * Returns the user configuration of WFC preference setting for slot. If not set, it |
| 828 | * queries CarrierConfig value as default. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 829 | * |
| 830 | * @param roaming {@code false} for home network setting, {@code true} for roaming setting |
| 831 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 832 | public int getWfcMode(boolean roaming) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 833 | int setting = 0; |
| 834 | if (!roaming) { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 835 | setting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 836 | getSubId(), SubscriptionManager.WFC_IMS_MODE, |
| 837 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
| 838 | |
| 839 | // SUB_PROPERTY_NOT_INITIALIZED indicates it's never set in sub db. |
| 840 | if (setting == SUB_PROPERTY_NOT_INITIALIZED) { |
| 841 | setting = getIntCarrierConfig( |
| 842 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT); |
| 843 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 844 | if (DBG) log("getWfcMode - setting=" + setting); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 845 | } else { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 846 | setting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 847 | getSubId(), SubscriptionManager.WFC_IMS_ROAMING_MODE, |
| 848 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
| 849 | |
| 850 | // SUB_PROPERTY_NOT_INITIALIZED indicates it's never set in sub db. |
| 851 | if (setting == SUB_PROPERTY_NOT_INITIALIZED) { |
| 852 | setting = getIntCarrierConfig( |
| 853 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_MODE_INT); |
| 854 | } |
| 855 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 856 | if (DBG) log("getWfcMode (roaming) - setting=" + setting); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 857 | } |
| 858 | return setting; |
| 859 | } |
| 860 | |
| 861 | /** |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 862 | * Change persistent WFC preference setting |
| 863 | * |
| 864 | * @param roaming {@code false} for home network setting, {@code true} for roaming setting |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 865 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 866 | * @deprecated Doesn't support MSIM devices. Please use {@link #setWfcMode(int, boolean)} |
| 867 | * instead. |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 868 | */ |
| 869 | public static void setWfcMode(Context context, int wfcMode, boolean roaming) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 870 | ImsManager mgr = ImsManager.getInstance(context, |
| 871 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 872 | if (mgr != null) { |
| 873 | mgr.setWfcMode(wfcMode, roaming); |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 874 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 875 | loge("setWfcMode: ImsManager null, can not set value."); |
Meng Wang | 3747701 | 2016-09-20 09:59:56 -0700 | [diff] [blame] | 876 | } |
| 877 | |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 878 | /** |
| 879 | * Change persistent WFC preference setting |
| 880 | * |
| 881 | * @param roaming {@code false} for home network setting, {@code true} for roaming setting |
| 882 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 883 | public void setWfcMode(int wfcMode, boolean roaming) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 884 | if (!roaming) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 885 | if (DBG) log("setWfcMode(i,b) - setting=" + wfcMode); |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 886 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 887 | SubscriptionManager.WFC_IMS_MODE, Integer.toString(wfcMode)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 888 | } else { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 889 | if (DBG) log("setWfcMode(i,b) (roaming) - setting=" + wfcMode); |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 890 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 891 | SubscriptionManager.WFC_IMS_ROAMING_MODE, Integer.toString(wfcMode)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 892 | } |
| 893 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 894 | TelephonyManager tm = (TelephonyManager) |
| 895 | mContext.getSystemService(Context.TELEPHONY_SERVICE); |
| 896 | if (roaming == tm.isNetworkRoaming(getSubId())) { |
| 897 | setWfcModeInternal(wfcMode); |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | private int getSubId() { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 902 | int[] subIds = SubscriptionManager.getSubId(mPhoneId); |
| 903 | int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; |
| 904 | if (subIds != null && subIds.length >= 1) { |
| 905 | subId = subIds[0]; |
| 906 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 907 | return subId; |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 908 | } |
| 909 | |
Pavel Zhamaitsiak | 9e6eca2 | 2015-03-16 15:30:53 -0700 | [diff] [blame] | 910 | private static void setWfcModeInternal(Context context, int wfcMode) { |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 911 | final ImsManager imsManager = ImsManager.getInstance(context, |
| 912 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 913 | if (imsManager != null) { |
| 914 | final int value = wfcMode; |
Pavel Zhamaitsiak | 47aeacf | 2016-03-30 18:54:55 -0700 | [diff] [blame] | 915 | Thread thread = new Thread(new Runnable() { |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 916 | public void run() { |
| 917 | try { |
| 918 | imsManager.getConfigInterface().setProvisionedValue( |
| 919 | ImsConfig.ConfigConstants.VOICE_OVER_WIFI_MODE, |
| 920 | value); |
| 921 | } catch (ImsException e) { |
| 922 | // do nothing |
| 923 | } |
| 924 | } |
| 925 | }); |
Pavel Zhamaitsiak | 47aeacf | 2016-03-30 18:54:55 -0700 | [diff] [blame] | 926 | thread.start(); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 927 | } |
| 928 | } |
| 929 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 930 | private void setWfcModeInternal(int wfcMode) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 931 | final int value = wfcMode; |
| 932 | Thread thread = new Thread(() -> { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 933 | try { |
| 934 | getConfigInterface().setProvisionedValue( |
| 935 | ImsConfig.ConfigConstants.VOICE_OVER_WIFI_MODE, value); |
| 936 | } catch (ImsException e) { |
| 937 | // do nothing |
| 938 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 939 | }); |
| 940 | thread.start(); |
| 941 | } |
| 942 | |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 943 | /** |
| 944 | * Returns the user configuration of WFC roaming setting |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 945 | * |
| 946 | * @deprecated Does not support MSIM devices. Please use |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 947 | * {@link #isWfcRoamingEnabledByUser()} instead. |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 948 | */ |
| 949 | public static boolean isWfcRoamingEnabledByUser(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 950 | ImsManager mgr = ImsManager.getInstance(context, |
| 951 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 952 | if (mgr != null) { |
| 953 | return mgr.isWfcRoamingEnabledByUser(); |
| 954 | } |
| 955 | loge("isWfcRoamingEnabledByUser: ImsManager null, returning default value."); |
| 956 | return false; |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 957 | } |
| 958 | |
| 959 | /** |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 960 | * Returns the user configuration of WFC roaming setting for slot. If not set, it |
| 961 | * queries CarrierConfig value as default. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 962 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 963 | public boolean isWfcRoamingEnabledByUser() { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 964 | int setting = SubscriptionManager.getIntegerSubscriptionProperty( |
| 965 | getSubId(), SubscriptionManager.WFC_IMS_ROAMING_ENABLED, |
| 966 | SUB_PROPERTY_NOT_INITIALIZED, mContext); |
| 967 | if (setting == SUB_PROPERTY_NOT_INITIALIZED) { |
| 968 | return getBooleanCarrierConfig( |
| 969 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL); |
| 970 | } else { |
| 971 | return (setting == 1); |
| 972 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | /** |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 976 | * Change persistent WFC roaming enabled setting |
| 977 | */ |
| 978 | public static void setWfcRoamingSetting(Context context, boolean enabled) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 979 | ImsManager mgr = ImsManager.getInstance(context, |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 980 | SubscriptionManager.getDefaultVoicePhoneId()); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 981 | if (mgr != null) { |
| 982 | mgr.setWfcRoamingSetting(enabled); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 983 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 984 | loge("setWfcRoamingSetting: ImsManager null, value not set."); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 985 | } |
| 986 | |
| 987 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 988 | * Change persistent WFC roaming enabled setting |
| 989 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 990 | public void setWfcRoamingSetting(boolean enabled) { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 991 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 992 | SubscriptionManager.WFC_IMS_ROAMING_ENABLED, booleanToPropertyString(enabled) |
| 993 | ); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 994 | |
| 995 | setWfcRoamingSettingInternal(enabled); |
| 996 | } |
| 997 | |
| 998 | private void setWfcRoamingSettingInternal(boolean enabled) { |
| 999 | final int value = enabled |
| 1000 | ? ImsConfig.FeatureValueConstants.ON |
| 1001 | : ImsConfig.FeatureValueConstants.OFF; |
| 1002 | Thread thread = new Thread(() -> { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 1003 | try { |
| 1004 | getConfigInterface().setProvisionedValue( |
| 1005 | ImsConfig.ConfigConstants.VOICE_OVER_WIFI_ROAMING, value); |
| 1006 | } catch (ImsException e) { |
| 1007 | // do nothing |
| 1008 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1009 | }); |
| 1010 | thread.start(); |
| 1011 | } |
| 1012 | |
| 1013 | /** |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 1014 | * Returns a platform configuration for WFC which may override the user |
| 1015 | * setting. Note: WFC presumes that VoLTE is enabled (these are |
| 1016 | * configuration settings which must be done correctly). |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1017 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1018 | * @deprecated Doesn't work for MSIM devices. Use {@link #isWfcEnabledByPlatform()} |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1019 | * instead. |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 1020 | */ |
| 1021 | public static boolean isWfcEnabledByPlatform(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1022 | ImsManager mgr = ImsManager.getInstance(context, |
| 1023 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 1024 | if (mgr != null) { |
| 1025 | return mgr.isWfcEnabledByPlatform(); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 1026 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1027 | loge("isWfcEnabledByPlatform: ImsManager null, returning default value."); |
| 1028 | return false; |
Pavel Zhamaitsiak | 57911d1 | 2015-10-20 14:26:34 -0700 | [diff] [blame] | 1029 | } |
| 1030 | |
| 1031 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1032 | * Returns a platform configuration for WFC which may override the user |
| 1033 | * setting per slot. Note: WFC presumes that VoLTE is enabled (these are |
| 1034 | * configuration settings which must be done correctly). |
| 1035 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1036 | public boolean isWfcEnabledByPlatform() { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1037 | if (SystemProperties.getInt(PROPERTY_DBG_WFC_AVAIL_OVERRIDE, |
| 1038 | PROPERTY_DBG_WFC_AVAIL_OVERRIDE_DEFAULT) == 1) { |
| 1039 | return true; |
| 1040 | } |
| 1041 | |
| 1042 | return mContext.getResources().getBoolean( |
| 1043 | com.android.internal.R.bool.config_device_wfc_ims_available) && |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1044 | getBooleanCarrierConfig( |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1045 | CarrierConfigManager.KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL) && |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1046 | isGbaValid(); |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 1047 | } |
| 1048 | |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1049 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1050 | * If carrier requires that IMS is only available if GBA capable SIM is used, |
| 1051 | * then this function checks GBA bit in EF IST. |
| 1052 | * |
| 1053 | * Format of EF IST is defined in 3GPP TS 31.103 (Section 4.2.7). |
| 1054 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1055 | private boolean isGbaValid() { |
| 1056 | if (getBooleanCarrierConfig( |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1057 | CarrierConfigManager.KEY_CARRIER_IMS_GBA_REQUIRED_BOOL)) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1058 | final TelephonyManager telephonyManager = new TelephonyManager(mContext, getSubId()); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1059 | String efIst = telephonyManager.getIsimIst(); |
| 1060 | if (efIst == null) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1061 | loge("isGbaValid - ISF is NULL"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1062 | return true; |
| 1063 | } |
| 1064 | boolean result = efIst != null && efIst.length() > 1 && |
| 1065 | (0x02 & (byte)efIst.charAt(1)) != 0; |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1066 | if (DBG) log("isGbaValid - GBA capable=" + result + ", ISF=" + efIst); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1067 | return result; |
| 1068 | } |
| 1069 | return true; |
| 1070 | } |
| 1071 | |
| 1072 | /** |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1073 | * This function should be called when ImsConfig.ACTION_IMS_CONFIG_CHANGED is received. |
| 1074 | * |
| 1075 | * We cannot register receiver in ImsManager because this would lead to resource leak. |
| 1076 | * ImsManager can be created in different processes and it is not notified when that process |
| 1077 | * is about to be terminated. |
| 1078 | * |
| 1079 | * @hide |
| 1080 | * */ |
| 1081 | public static void onProvisionedValueChanged(Context context, int item, String value) { |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1082 | if (DBG) Rlog.d(TAG, "onProvisionedValueChanged: item=" + item + " val=" + value); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1083 | ImsManager mgr = ImsManager.getInstance(context, |
| 1084 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 1085 | |
| 1086 | switch (item) { |
| 1087 | case ImsConfig.ConfigConstants.VLT_SETTING_ENABLED: |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1088 | mgr.setVolteProvisionedProperty(value.equals("1")); |
| 1089 | if (DBG) Rlog.d(TAG,"isVoLteProvisioned = " + mgr.isVolteProvisioned()); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1090 | break; |
| 1091 | |
| 1092 | case ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED: |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1093 | mgr.setWfcProvisionedProperty(value.equals("1")); |
| 1094 | if (DBG) Rlog.d(TAG,"isWfcProvisioned = " + mgr.isWfcProvisioned()); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1095 | break; |
| 1096 | |
Nathan Harold | a9fc7f1 | 2016-06-30 16:12:14 -0700 | [diff] [blame] | 1097 | case ImsConfig.ConfigConstants.LVC_SETTING_ENABLED: |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1098 | mgr.setVtProvisionedProperty(value.equals("1")); |
| 1099 | if (DBG) Rlog.d(TAG,"isVtProvisioned = " + mgr.isVtProvisioned()); |
Nathan Harold | a9fc7f1 | 2016-06-30 16:12:14 -0700 | [diff] [blame] | 1100 | break; |
| 1101 | |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1102 | } |
| 1103 | } |
| 1104 | |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1105 | private class AsyncUpdateProvisionedValues extends AsyncTask<Void, Void, Boolean> { |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1106 | @Override |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1107 | protected Boolean doInBackground(Void... params) { |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1108 | // disable on any error |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1109 | setVolteProvisionedProperty(false); |
| 1110 | setWfcProvisionedProperty(false); |
| 1111 | setVtProvisionedProperty(false); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1112 | |
| 1113 | try { |
| 1114 | ImsConfig config = getConfigInterface(); |
| 1115 | if (config != null) { |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1116 | setVolteProvisionedProperty(getProvisionedBool(config, |
| 1117 | ImsConfig.ConfigConstants.VLT_SETTING_ENABLED)); |
| 1118 | if (DBG) Rlog.d(TAG, "isVoLteProvisioned = " + isVolteProvisioned()); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1119 | |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1120 | setWfcProvisionedProperty(getProvisionedBool(config, |
| 1121 | ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED)); |
| 1122 | if (DBG) Rlog.d(TAG, "isWfcProvisioned = " + isWfcProvisioned()); |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1123 | |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1124 | setVtProvisionedProperty(getProvisionedBool(config, |
| 1125 | ImsConfig.ConfigConstants.LVC_SETTING_ENABLED)); |
| 1126 | if (DBG) Rlog.d(TAG, "isVtProvisioned = " + isVtProvisioned()); |
Nathan Harold | a9fc7f1 | 2016-06-30 16:12:14 -0700 | [diff] [blame] | 1127 | |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1128 | } |
| 1129 | } catch (ImsException ie) { |
Meng Wang | ca7d4c4 | 2016-06-30 22:05:24 -0700 | [diff] [blame] | 1130 | Rlog.e(TAG, "AsyncUpdateProvisionedValues error: ", ie); |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1131 | return false; |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1132 | } |
| 1133 | |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1134 | return true; |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1135 | } |
| 1136 | |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1137 | @Override |
| 1138 | protected void onPostExecute(Boolean completed) { |
| 1139 | if (mProvisionBackoff == null) { |
| 1140 | return; |
| 1141 | } |
| 1142 | if (!completed) { |
| 1143 | mProvisionBackoff.notifyFailed(); |
| 1144 | } else { |
| 1145 | mProvisionBackoff.stop(); |
| 1146 | } |
| 1147 | } |
| 1148 | |
| 1149 | /** |
| 1150 | * Will return with config value or throw an ImsException if we receive an error from |
| 1151 | * ImsConfig for that value. |
| 1152 | */ |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1153 | private boolean getProvisionedBool(ImsConfig config, int item) throws ImsException { |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1154 | int value = config.getProvisionedValue(item); |
| 1155 | if (value == ImsConfig.FeatureValueConstants.ERROR) { |
| 1156 | throw new ImsException("getProvisionedBool failed with error for item: " + item, |
| 1157 | ImsReasonInfo.CODE_LOCAL_INTERNAL_ERROR); |
| 1158 | } |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1159 | return config.getProvisionedValue(item) == ImsConfig.FeatureValueConstants.ON; |
| 1160 | } |
| 1161 | } |
| 1162 | |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1163 | // used internally only, use #updateProvisionedValues instead. |
| 1164 | private void handleUpdateProvisionedValues() { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1165 | if (getBooleanCarrierConfig( |
Pavel Zhamaitsiak | 002b204 | 2016-06-03 16:05:31 -0700 | [diff] [blame] | 1166 | CarrierConfigManager.KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL)) { |
| 1167 | |
| 1168 | new AsyncUpdateProvisionedValues().execute(); |
| 1169 | } |
| 1170 | } |
| 1171 | |
| 1172 | /** |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1173 | * Asynchronously get VoLTE, WFC, VT provisioning statuses. If ImsConfig is not available, we |
| 1174 | * will retry with exponential backoff. |
| 1175 | */ |
| 1176 | private void updateProvisionedValues() { |
| 1177 | // Start trying to receive provisioning status after BACKOFF_INITIAL_DELAY_MS. |
| 1178 | if (mProvisionBackoff != null) { |
| 1179 | mProvisionBackoff.start(); |
| 1180 | } else { |
| 1181 | // bypass and launch async thread once without backoff. |
| 1182 | handleUpdateProvisionedValues(); |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | /** |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1187 | * Sync carrier config and user settings with ImsConfig. |
| 1188 | * |
| 1189 | * @param context for the manager object |
| 1190 | * @param phoneId phone id |
| 1191 | * @param force update |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1192 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1193 | * @deprecated Doesn't support MSIM devices. Use {@link #updateImsServiceConfig(boolean)} |
| 1194 | * instead. |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1195 | */ |
| 1196 | public static void updateImsServiceConfig(Context context, int phoneId, boolean force) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1197 | ImsManager mgr = ImsManager.getInstance(context, phoneId); |
| 1198 | if (mgr != null) { |
| 1199 | mgr.updateImsServiceConfig(force); |
Pavel Zhamaitsiak | fc20299 | 2016-03-29 18:07:38 -0700 | [diff] [blame] | 1200 | } |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1201 | loge("updateImsServiceConfig: ImsManager null, returning without update."); |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1202 | } |
| 1203 | |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1204 | /** |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1205 | * Sync carrier config and user settings with ImsConfig. |
| 1206 | * |
| 1207 | * @param context for the manager object |
| 1208 | * @param phoneId phone id |
| 1209 | * @param force update |
| 1210 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1211 | public void updateImsServiceConfig(boolean force) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1212 | if (!force) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1213 | TelephonyManager tm = new TelephonyManager(mContext, getSubId()); |
| 1214 | if (tm.getSimState() != TelephonyManager.SIM_STATE_READY) { |
| 1215 | log("updateImsServiceConfig: SIM not ready"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1216 | // Don't disable IMS if SIM is not ready |
| 1217 | return; |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | if (!mConfigUpdated || force) { |
| 1222 | try { |
| 1223 | updateProvisionedValues(); |
| 1224 | |
| 1225 | // TODO: Extend ImsConfig API and set all feature values in single function call. |
| 1226 | |
| 1227 | // Note: currently the order of updates is set to produce different order of |
| 1228 | // setFeatureValue() function calls from setAdvanced4GMode(). This is done to |
| 1229 | // differentiate this code path from vendor code perspective. |
| 1230 | boolean isImsUsed = updateVolteFeatureValue(); |
| 1231 | isImsUsed |= updateWfcFeatureAndProvisionedValues(); |
| 1232 | isImsUsed |= updateVideoCallFeatureValue(); |
| 1233 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1234 | if (isImsUsed || !isTurnOffImsAllowedByPlatform()) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1235 | // Turn on IMS if it is used. |
| 1236 | // Also, if turning off is not allowed for current carrier, |
| 1237 | // we need to turn IMS on because it might be turned off before |
| 1238 | // phone switched to current carrier. |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1239 | log("updateImsServiceConfig: turnOnIms"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1240 | turnOnIms(); |
| 1241 | } else { |
| 1242 | // Turn off IMS if it is not used AND turning off is allowed for carrier. |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1243 | log("updateImsServiceConfig: turnOffIms"); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1244 | turnOffIms(); |
| 1245 | } |
| 1246 | |
| 1247 | mConfigUpdated = true; |
| 1248 | } catch (ImsException e) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1249 | loge("updateImsServiceConfig: ", e); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1250 | mConfigUpdated = false; |
| 1251 | } |
| 1252 | } |
| 1253 | } |
| 1254 | |
| 1255 | /** |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1256 | * Update VoLTE config |
| 1257 | * @return whether feature is On |
| 1258 | * @throws ImsException |
| 1259 | */ |
| 1260 | private boolean updateVolteFeatureValue() throws ImsException { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1261 | boolean available = isVolteEnabledByPlatform(); |
| 1262 | boolean enabled = isEnhanced4gLteModeSettingEnabledByUser(); |
| 1263 | boolean isNonTty = isNonTtyOrTtyOnVolteEnabled(); |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1264 | boolean isFeatureOn = available && enabled && isNonTty; |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1265 | |
| 1266 | log("updateVolteFeatureValue: available = " + available |
| 1267 | + ", enabled = " + enabled |
| 1268 | + ", nonTTY = " + isNonTty); |
| 1269 | |
| 1270 | getConfigInterface().setFeatureValue( |
| 1271 | ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE, |
| 1272 | TelephonyManager.NETWORK_TYPE_LTE, |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1273 | isFeatureOn ? |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1274 | ImsConfig.FeatureValueConstants.ON : |
| 1275 | ImsConfig.FeatureValueConstants.OFF, |
Pavel Zhamaitsiak | f4b9032 | 2016-01-26 14:34:09 -0800 | [diff] [blame] | 1276 | mImsConfigListener); |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1277 | |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1278 | return isFeatureOn; |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1279 | } |
| 1280 | |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1281 | /** |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 1282 | * Update video call over LTE config |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1283 | * @return whether feature is On |
| 1284 | * @throws ImsException |
| 1285 | */ |
| 1286 | private boolean updateVideoCallFeatureValue() throws ImsException { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1287 | boolean available = isVtEnabledByPlatform(); |
| 1288 | boolean enabled = isVtEnabledByUser(); |
| 1289 | boolean isNonTty = isNonTtyOrTtyOnVolteEnabled(); |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1290 | boolean isDataEnabled = isDataEnabled(); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1291 | boolean ignoreDataEnabledChanged = getBooleanCarrierConfig( |
Jack Yu | 5778185 | 2016-11-16 17:20:38 -0800 | [diff] [blame] | 1292 | CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS); |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 1293 | |
Jack Yu | 5778185 | 2016-11-16 17:20:38 -0800 | [diff] [blame] | 1294 | boolean isFeatureOn = available && enabled && isNonTty |
| 1295 | && (ignoreDataEnabledChanged || isDataEnabled); |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1296 | |
| 1297 | log("updateVideoCallFeatureValue: available = " + available |
| 1298 | + ", enabled = " + enabled |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 1299 | + ", nonTTY = " + isNonTty |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 1300 | + ", data enabled = " + isDataEnabled); |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1301 | |
| 1302 | getConfigInterface().setFeatureValue( |
| 1303 | ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_LTE, |
| 1304 | TelephonyManager.NETWORK_TYPE_LTE, |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1305 | isFeatureOn ? |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1306 | ImsConfig.FeatureValueConstants.ON : |
| 1307 | ImsConfig.FeatureValueConstants.OFF, |
Pavel Zhamaitsiak | f4b9032 | 2016-01-26 14:34:09 -0800 | [diff] [blame] | 1308 | mImsConfigListener); |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1309 | |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1310 | return isFeatureOn; |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1311 | } |
| 1312 | |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1313 | /** |
| 1314 | * Update WFC config |
| 1315 | * @return whether feature is On |
| 1316 | * @throws ImsException |
| 1317 | */ |
| 1318 | private boolean updateWfcFeatureAndProvisionedValues() throws ImsException { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1319 | TelephonyManager tm = new TelephonyManager(mContext, getSubId()); |
| 1320 | boolean isNetworkRoaming = tm.isNetworkRoaming(); |
| 1321 | boolean available = isWfcEnabledByPlatform(); |
| 1322 | boolean enabled = isWfcEnabledByUser(); |
Suresh Koleti | 7649108 | 2017-04-21 18:39:50 +0530 | [diff] [blame] | 1323 | updateDefaultWfcMode(); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1324 | int mode = getWfcMode(isNetworkRoaming); |
| 1325 | boolean roaming = isWfcRoamingEnabledByUser(); |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1326 | boolean isFeatureOn = available && enabled; |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1327 | |
| 1328 | log("updateWfcFeatureAndProvisionedValues: available = " + available |
| 1329 | + ", enabled = " + enabled |
| 1330 | + ", mode = " + mode |
| 1331 | + ", roaming = " + roaming); |
| 1332 | |
| 1333 | getConfigInterface().setFeatureValue( |
Pavel Zhamaitsiak | e6f9943 | 2015-09-11 10:29:30 -0700 | [diff] [blame] | 1334 | ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_WIFI, |
| 1335 | TelephonyManager.NETWORK_TYPE_IWLAN, |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1336 | isFeatureOn ? |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1337 | ImsConfig.FeatureValueConstants.ON : |
| 1338 | ImsConfig.FeatureValueConstants.OFF, |
Pavel Zhamaitsiak | f4b9032 | 2016-01-26 14:34:09 -0800 | [diff] [blame] | 1339 | mImsConfigListener); |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1340 | |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1341 | if (!isFeatureOn) { |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1342 | mode = ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED; |
| 1343 | roaming = false; |
| 1344 | } |
| 1345 | setWfcModeInternal(mContext, mode); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1346 | setWfcRoamingSettingInternal(roaming); |
Pavel Zhamaitsiak | dc16e45 | 2015-09-08 17:12:06 -0700 | [diff] [blame] | 1347 | |
Pavel Zhamaitsiak | 9510b1c | 2015-12-18 11:30:49 -0800 | [diff] [blame] | 1348 | return isFeatureOn; |
Pavel Zhamaitsiak | 8ca52ff | 2015-09-04 17:08:35 -0700 | [diff] [blame] | 1349 | } |
| 1350 | |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1351 | /** |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1352 | * Do NOT use this directly, instead use {@link #getInstance(Context, int)}. |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1353 | */ |
| 1354 | @VisibleForTesting |
| 1355 | public ImsManager(Context context, int phoneId) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1356 | mContext = context; |
Etan Cohen | abbd788 | 2014-09-26 22:35:35 -0700 | [diff] [blame] | 1357 | mPhoneId = phoneId; |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1358 | mConfigDynamicBind = mContext.getResources().getBoolean( |
| 1359 | com.android.internal.R.bool.config_dynamic_bind_ims); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1360 | mConfigManager = (CarrierConfigManager) context.getSystemService( |
| 1361 | Context.CARRIER_CONFIG_SERVICE); |
Brad Ebinger | be6cb67 | 2017-08-25 14:55:00 -0700 | [diff] [blame] | 1362 | if (Looper.getMainLooper() != null) { |
| 1363 | mProvisionBackoff = new ExponentialBackoff(BACKOFF_INITIAL_DELAY_MS, |
| 1364 | BACKOFF_MAX_DELAY_MS, BACKOFF_MULTIPLIER, |
| 1365 | new Handler(Looper.getMainLooper()), this::handleUpdateProvisionedValues); |
| 1366 | } |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1367 | createImsService(); |
| 1368 | } |
| 1369 | |
| 1370 | /** |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1371 | * @return Whether or not ImsManager is configured to Dynamically bind or not to support legacy |
| 1372 | * devices. |
| 1373 | */ |
| 1374 | public boolean isDynamicBinding() { |
| 1375 | return mConfigDynamicBind; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1376 | } |
| 1377 | |
Etan Cohen | f431112 | 2015-02-26 17:47:13 -0800 | [diff] [blame] | 1378 | /* |
Brad Ebinger | ff09792 | 2017-06-19 15:43:08 -0700 | [diff] [blame] | 1379 | * Returns a flag indicating whether the IMS service is available. If it is not available, |
| 1380 | * it will try to connect before reporting failure. |
Etan Cohen | f431112 | 2015-02-26 17:47:13 -0800 | [diff] [blame] | 1381 | */ |
| 1382 | public boolean isServiceAvailable() { |
Brad Ebinger | ff09792 | 2017-06-19 15:43:08 -0700 | [diff] [blame] | 1383 | connectIfServiceIsAvailable(); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1384 | // mImsServiceProxy will always create an ImsServiceProxy. |
| 1385 | return mImsServiceProxy.isBinderAlive(); |
Etan Cohen | f431112 | 2015-02-26 17:47:13 -0800 | [diff] [blame] | 1386 | } |
| 1387 | |
Suresh Koleti | cc3139c | 2017-11-03 18:23:57 +0530 | [diff] [blame] | 1388 | /* |
| 1389 | * Returns a flag indicating whether the IMS service is ready to send requests to lower layers. |
| 1390 | */ |
| 1391 | public boolean isServiceReady() { |
| 1392 | connectIfServiceIsAvailable(); |
| 1393 | return mImsServiceProxy.isBinderReady(); |
| 1394 | } |
| 1395 | |
Brad Ebinger | ff09792 | 2017-06-19 15:43:08 -0700 | [diff] [blame] | 1396 | /** |
| 1397 | * If the service is available, try to reconnect. |
| 1398 | */ |
| 1399 | public void connectIfServiceIsAvailable() { |
| 1400 | if (mImsServiceProxy == null || !mImsServiceProxy.isBinderAlive()) { |
| 1401 | createImsService(); |
| 1402 | } |
| 1403 | } |
| 1404 | |
Pavel Zhamaitsiak | f4b9032 | 2016-01-26 14:34:09 -0800 | [diff] [blame] | 1405 | public void setImsConfigListener(ImsConfigListener listener) { |
| 1406 | mImsConfigListener = listener; |
| 1407 | } |
| 1408 | |
Brad Ebinger | b10b61e | 2017-04-18 11:45:26 -0700 | [diff] [blame] | 1409 | |
| 1410 | /** |
| 1411 | * Adds a callback for status changed events if the binder is already available. If it is not, |
| 1412 | * this method will throw an ImsException. |
| 1413 | */ |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1414 | public void addNotifyStatusChangedCallbackIfAvailable(ImsServiceProxy.IFeatureUpdate c) |
Brad Ebinger | b10b61e | 2017-04-18 11:45:26 -0700 | [diff] [blame] | 1415 | throws ImsException { |
| 1416 | if (!mImsServiceProxy.isBinderAlive()) { |
| 1417 | throw new ImsException("Binder is not active!", |
| 1418 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1419 | } |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1420 | if (c != null) { |
| 1421 | mStatusCallbacks.add(c); |
| 1422 | } |
| 1423 | } |
| 1424 | |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1425 | public void removeNotifyStatusChangedCallback(ImsServiceProxy.IFeatureUpdate c) { |
| 1426 | if (c != null) { |
| 1427 | mStatusCallbacks.remove(c); |
| 1428 | } else { |
| 1429 | Log.w(TAG, "removeNotifyStatusChangedCallback: callback is null!"); |
| 1430 | } |
| 1431 | } |
| 1432 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1433 | /** |
| 1434 | * Opens the IMS service for making calls and/or receiving generic IMS calls. |
| 1435 | * The caller may make subsquent calls through {@link #makeCall}. |
| 1436 | * The IMS service will register the device to the operator's network with the credentials |
| 1437 | * (from ISIM) periodically in order to receive calls from the operator's network. |
| 1438 | * When the IMS service receives a new call, it will send out an intent with |
| 1439 | * the provided action string. |
| 1440 | * The intent contains a call ID extra {@link getCallId} and it can be used to take a call. |
| 1441 | * |
| 1442 | * @param serviceClass a service class specified in {@link ImsServiceClass} |
| 1443 | * For VoLTE service, it MUST be a {@link ImsServiceClass#MMTEL}. |
| 1444 | * @param incomingCallPendingIntent When an incoming call is received, |
| 1445 | * the IMS service will call {@link PendingIntent#send(Context, int, Intent)} to |
| 1446 | * send back the intent to the caller with {@link #INCOMING_CALL_RESULT_CODE} |
| 1447 | * as the result code and the intent to fill in the call ID; It cannot be null |
| 1448 | * @param listener To listen to IMS registration events; It cannot be null |
| 1449 | * @return identifier (greater than 0) for the specified service |
| 1450 | * @throws NullPointerException if {@code incomingCallPendingIntent} |
| 1451 | * or {@code listener} is null |
| 1452 | * @throws ImsException if calling the IMS service results in an error |
| 1453 | * @see #getCallId |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1454 | * @see #getImsSessionId |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1455 | */ |
| 1456 | public int open(int serviceClass, PendingIntent incomingCallPendingIntent, |
| 1457 | ImsConnectionStateListener listener) throws ImsException { |
| 1458 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1459 | |
| 1460 | if (incomingCallPendingIntent == null) { |
| 1461 | throw new NullPointerException("incomingCallPendingIntent can't be null"); |
| 1462 | } |
| 1463 | |
| 1464 | if (listener == null) { |
| 1465 | throw new NullPointerException("listener can't be null"); |
| 1466 | } |
| 1467 | |
| 1468 | int result = 0; |
| 1469 | |
| 1470 | try { |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 1471 | // Register a stub implementation of the ImsRegistrationListener. There is the |
| 1472 | // possibility that if we use the real implementation of the ImsRegistrationListener, |
| 1473 | // it will be added twice. |
| 1474 | // TODO: Remove ImsRegistrationListener from startSession API (b/62588776) |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1475 | result = mImsServiceProxy.startSession(incomingCallPendingIntent, |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 1476 | new ImsRegistrationListenerBase()); |
| 1477 | addRegistrationListener(listener); |
| 1478 | log("open: Session started and registration listener added."); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1479 | } catch (RemoteException e) { |
| 1480 | throw new ImsException("open()", e, |
| 1481 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1482 | } |
| 1483 | |
| 1484 | if (result <= 0) { |
| 1485 | // If the return value is a minus value, |
| 1486 | // it means that an error occurred in the service. |
| 1487 | // So, it needs to convert to the reason code specified in ImsReasonInfo. |
| 1488 | throw new ImsException("open()", (result * (-1))); |
| 1489 | } |
| 1490 | |
| 1491 | return result; |
| 1492 | } |
| 1493 | |
| 1494 | /** |
Pavel Zhamaitsiak | ce41017 | 2016-04-15 10:55:56 -0700 | [diff] [blame] | 1495 | * Adds registration listener to the IMS service. |
| 1496 | * |
| 1497 | * @param serviceClass a service class specified in {@link ImsServiceClass} |
| 1498 | * For VoLTE service, it MUST be a {@link ImsServiceClass#MMTEL}. |
| 1499 | * @param listener To listen to IMS registration events; It cannot be null |
| 1500 | * @throws NullPointerException if {@code listener} is null |
| 1501 | * @throws ImsException if calling the IMS service results in an error |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1502 | * |
| 1503 | * @deprecated Use {@link #addRegistrationListener(ImsConnectionStateListener)} instead. |
Pavel Zhamaitsiak | ce41017 | 2016-04-15 10:55:56 -0700 | [diff] [blame] | 1504 | */ |
| 1505 | public void addRegistrationListener(int serviceClass, ImsConnectionStateListener listener) |
| 1506 | throws ImsException { |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1507 | addRegistrationListener(listener); |
| 1508 | } |
| 1509 | |
| 1510 | /** |
| 1511 | * Adds registration listener to the IMS service. |
| 1512 | * |
| 1513 | * @param listener To listen to IMS registration events; It cannot be null |
| 1514 | * @throws NullPointerException if {@code listener} is null |
| 1515 | * @throws ImsException if calling the IMS service results in an error |
| 1516 | */ |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1517 | public void addRegistrationListener(ImsConnectionStateListener listener) throws ImsException { |
Pavel Zhamaitsiak | ce41017 | 2016-04-15 10:55:56 -0700 | [diff] [blame] | 1518 | if (listener == null) { |
| 1519 | throw new NullPointerException("listener can't be null"); |
| 1520 | } |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 1521 | // We only want this Proxy registered once. |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1522 | synchronized (mHasRegisteredLock) { |
| 1523 | if (!mHasRegisteredForProxy) { |
| 1524 | try { |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 1525 | checkAndThrowExceptionIfServiceUnavailable(); |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1526 | // TODO: Remove once new MmTelFeature is merged in |
| 1527 | mImsServiceProxy.addRegistrationListener(mImsRegistrationListenerProxy); |
Brad Ebinger | 3418c13 | 2018-01-18 12:03:33 -0800 | [diff] [blame] | 1528 | IImsRegistration regBinder = mImsServiceProxy.getRegistration(); |
| 1529 | if (regBinder != null) { |
| 1530 | regBinder.addRegistrationCallback(mRegistrationCallback); |
| 1531 | } |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1532 | log("Registration Callback/Listener registered."); |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1533 | // Only record if there isn't a RemoteException. |
| 1534 | mHasRegisteredForProxy = true; |
| 1535 | } catch (RemoteException e) { |
| 1536 | throw new ImsException("addRegistrationListener()", e, |
| 1537 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1538 | } |
| 1539 | } |
| 1540 | } |
| 1541 | synchronized (mRegistrationListeners) { |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 1542 | log("Local registration listener added: " + listener); |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1543 | mRegistrationListeners.add(listener); |
Pavel Zhamaitsiak | ce41017 | 2016-04-15 10:55:56 -0700 | [diff] [blame] | 1544 | } |
| 1545 | } |
| 1546 | |
| 1547 | /** |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1548 | * Removes the registration listener from the IMS service. |
| 1549 | * |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1550 | * @param listener Previously registered listener that will be removed. Can not be null. |
| 1551 | * @throws NullPointerException if {@code listener} is null |
| 1552 | * @throws ImsException if calling the IMS service results in an error |
| 1553 | * instead. |
| 1554 | */ |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1555 | public void removeRegistrationListener(ImsConnectionStateListener listener) |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1556 | throws ImsException { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1557 | if (listener == null) { |
| 1558 | throw new NullPointerException("listener can't be null"); |
| 1559 | } |
| 1560 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1561 | synchronized (mRegistrationListeners) { |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 1562 | log("Local registration listener removed: " + listener); |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1563 | mRegistrationListeners.remove(listener); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1564 | } |
| 1565 | } |
| 1566 | |
| 1567 | /** |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1568 | * Closes the specified service ({@link ImsServiceClass}) not to make/receive calls. |
| 1569 | * All the resources that were allocated to the service are also released. |
| 1570 | * |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1571 | * @param sessionId a session id to be closed which is obtained from {@link ImsManager#open} |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1572 | * @throws ImsException if calling the IMS service results in an error |
| 1573 | */ |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1574 | public void close(int sessionId) throws ImsException { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1575 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1576 | |
| 1577 | try { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1578 | mImsServiceProxy.endSession(sessionId); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1579 | } catch (RemoteException e) { |
| 1580 | throw new ImsException("close()", e, |
| 1581 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1582 | } finally { |
| 1583 | mUt = null; |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 1584 | mConfig = null; |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 1585 | mEcbm = null; |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 1586 | mMultiEndpoint = null; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1587 | } |
| 1588 | } |
| 1589 | |
| 1590 | /** |
| 1591 | * Gets the configuration interface to provision / withdraw the supplementary service settings. |
| 1592 | * |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1593 | * @return the Ut interface instance |
| 1594 | * @throws ImsException if getting the Ut interface results in an error |
| 1595 | */ |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1596 | public ImsUtInterface getSupplementaryServiceConfiguration() |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1597 | throws ImsException { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1598 | // FIXME: manage the multiple Ut interfaces based on the session id |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 1599 | if (mUt != null && mUt.isBinderAlive()) { |
| 1600 | return mUt; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1601 | } |
| 1602 | |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 1603 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1604 | try { |
| 1605 | IImsUt iUt = mImsServiceProxy.getUtInterface(); |
| 1606 | |
| 1607 | if (iUt == null) { |
| 1608 | throw new ImsException("getSupplementaryServiceConfiguration()", |
| 1609 | ImsReasonInfo.CODE_UT_NOT_SUPPORTED); |
| 1610 | } |
| 1611 | |
| 1612 | mUt = new ImsUt(iUt); |
| 1613 | } catch (RemoteException e) { |
| 1614 | throw new ImsException("getSupplementaryServiceConfiguration()", e, |
| 1615 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1616 | } |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1617 | return mUt; |
| 1618 | } |
| 1619 | |
| 1620 | /** |
| 1621 | * Checks if the IMS service has successfully registered to the IMS network |
| 1622 | * with the specified service & call type. |
| 1623 | * |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1624 | * @param serviceType a service type that is specified in {@link ImsCallProfile} |
| 1625 | * {@link ImsCallProfile#SERVICE_TYPE_NORMAL} |
| 1626 | * {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY} |
| 1627 | * @param callType a call type that is specified in {@link ImsCallProfile} |
| 1628 | * {@link ImsCallProfile#CALL_TYPE_VOICE_N_VIDEO} |
| 1629 | * {@link ImsCallProfile#CALL_TYPE_VOICE} |
| 1630 | * {@link ImsCallProfile#CALL_TYPE_VT} |
| 1631 | * {@link ImsCallProfile#CALL_TYPE_VS} |
| 1632 | * @return true if the specified service id is connected to the IMS network; |
| 1633 | * false otherwise |
| 1634 | * @throws ImsException if calling the IMS service results in an error |
| 1635 | */ |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1636 | public boolean isConnected(int serviceType, int callType) |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1637 | throws ImsException { |
| 1638 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1639 | |
| 1640 | try { |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1641 | return mImsServiceProxy.isConnected(serviceType, callType); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1642 | } catch (RemoteException e) { |
| 1643 | throw new ImsException("isServiceConnected()", e, |
| 1644 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1645 | } |
| 1646 | } |
| 1647 | |
| 1648 | /** |
| 1649 | * Checks if the specified IMS service is opend. |
| 1650 | * |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1651 | * @return true if the specified service id is opened; false otherwise |
| 1652 | * @throws ImsException if calling the IMS service results in an error |
| 1653 | */ |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1654 | public boolean isOpened() throws ImsException { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1655 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1656 | |
| 1657 | try { |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1658 | return mImsServiceProxy.isOpened(); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1659 | } catch (RemoteException e) { |
| 1660 | throw new ImsException("isOpened()", e, |
| 1661 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1662 | } |
| 1663 | } |
| 1664 | |
| 1665 | /** |
| 1666 | * Creates a {@link ImsCallProfile} from the service capabilities & IMS registration state. |
| 1667 | * |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1668 | * @param sessionId a session id which is obtained from {@link ImsManager#open} |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1669 | * @param serviceType a service type that is specified in {@link ImsCallProfile} |
| 1670 | * {@link ImsCallProfile#SERVICE_TYPE_NONE} |
| 1671 | * {@link ImsCallProfile#SERVICE_TYPE_NORMAL} |
| 1672 | * {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY} |
| 1673 | * @param callType a call type that is specified in {@link ImsCallProfile} |
| 1674 | * {@link ImsCallProfile#CALL_TYPE_VOICE} |
| 1675 | * {@link ImsCallProfile#CALL_TYPE_VT} |
| 1676 | * {@link ImsCallProfile#CALL_TYPE_VT_TX} |
| 1677 | * {@link ImsCallProfile#CALL_TYPE_VT_RX} |
| 1678 | * {@link ImsCallProfile#CALL_TYPE_VT_NODIR} |
| 1679 | * {@link ImsCallProfile#CALL_TYPE_VS} |
| 1680 | * {@link ImsCallProfile#CALL_TYPE_VS_TX} |
| 1681 | * {@link ImsCallProfile#CALL_TYPE_VS_RX} |
| 1682 | * @return a {@link ImsCallProfile} object |
| 1683 | * @throws ImsException if calling the IMS service results in an error |
| 1684 | */ |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1685 | public ImsCallProfile createCallProfile(int sessionId, int serviceType, int callType) |
| 1686 | throws ImsException { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1687 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1688 | |
| 1689 | try { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1690 | return mImsServiceProxy.createCallProfile(sessionId, serviceType, callType); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1691 | } catch (RemoteException e) { |
| 1692 | throw new ImsException("createCallProfile()", e, |
| 1693 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1694 | } |
| 1695 | } |
| 1696 | |
| 1697 | /** |
| 1698 | * Creates a {@link ImsCall} to make a call. |
| 1699 | * |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1700 | * @param sessionId a session id which is obtained from {@link ImsManager#open} |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1701 | * @param profile a call profile to make the call |
| 1702 | * (it contains service type, call type, media information, etc.) |
| 1703 | * @param participants participants to invite the conference call |
| 1704 | * @param listener listen to the call events from {@link ImsCall} |
| 1705 | * @return a {@link ImsCall} object |
| 1706 | * @throws ImsException if calling the IMS service results in an error |
| 1707 | */ |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1708 | public ImsCall makeCall(int sessionId, ImsCallProfile profile, String[] callees, |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1709 | ImsCall.Listener listener) throws ImsException { |
| 1710 | if (DBG) { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1711 | log("makeCall :: sessionId=" + sessionId |
fionaxu | 7b3107c | 2016-07-06 14:04:06 -0700 | [diff] [blame] | 1712 | + ", profile=" + profile); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1713 | } |
| 1714 | |
| 1715 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1716 | |
| 1717 | ImsCall call = new ImsCall(mContext, profile); |
| 1718 | |
| 1719 | call.setListener(listener); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1720 | ImsCallSession session = createCallSession(sessionId, profile); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1721 | |
| 1722 | if ((callees != null) && (callees.length == 1)) { |
| 1723 | call.start(session, callees[0]); |
| 1724 | } else { |
| 1725 | call.start(session, callees); |
| 1726 | } |
| 1727 | |
| 1728 | return call; |
| 1729 | } |
| 1730 | |
| 1731 | /** |
| 1732 | * Creates a {@link ImsCall} to take an incoming call. |
| 1733 | * |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1734 | * @param sessionId a session id which is obtained from {@link ImsManager#open} |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1735 | * @param incomingCallIntent the incoming call broadcast intent |
| 1736 | * @param listener to listen to the call events from {@link ImsCall} |
| 1737 | * @return a {@link ImsCall} object |
| 1738 | * @throws ImsException if calling the IMS service results in an error |
| 1739 | */ |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1740 | public ImsCall takeCall(int sessionId, Intent incomingCallIntent, |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1741 | ImsCall.Listener listener) throws ImsException { |
| 1742 | if (DBG) { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1743 | log("takeCall :: sessionId=" + sessionId |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1744 | + ", incomingCall=" + incomingCallIntent); |
| 1745 | } |
| 1746 | |
| 1747 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1748 | |
| 1749 | if (incomingCallIntent == null) { |
| 1750 | throw new ImsException("Can't retrieve session with null intent", |
| 1751 | ImsReasonInfo.CODE_LOCAL_ILLEGAL_ARGUMENT); |
| 1752 | } |
| 1753 | |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1754 | int incomingServiceId = getImsSessionId(incomingCallIntent); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1755 | |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1756 | if (sessionId != incomingServiceId) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1757 | throw new ImsException("Service id is mismatched in the incoming call intent", |
| 1758 | ImsReasonInfo.CODE_LOCAL_ILLEGAL_ARGUMENT); |
| 1759 | } |
| 1760 | |
| 1761 | String callId = getCallId(incomingCallIntent); |
| 1762 | |
| 1763 | if (callId == null) { |
| 1764 | throw new ImsException("Call ID missing in the incoming call intent", |
| 1765 | ImsReasonInfo.CODE_LOCAL_ILLEGAL_ARGUMENT); |
| 1766 | } |
| 1767 | |
| 1768 | try { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1769 | IImsCallSession session = mImsServiceProxy.getPendingCallSession(sessionId, callId); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1770 | |
| 1771 | if (session == null) { |
| 1772 | throw new ImsException("No pending session for the call", |
| 1773 | ImsReasonInfo.CODE_LOCAL_NO_PENDING_CALL); |
| 1774 | } |
| 1775 | |
| 1776 | ImsCall call = new ImsCall(mContext, session.getCallProfile()); |
| 1777 | |
| 1778 | call.attachSession(new ImsCallSession(session)); |
| 1779 | call.setListener(listener); |
| 1780 | |
| 1781 | return call; |
| 1782 | } catch (Throwable t) { |
| 1783 | throw new ImsException("takeCall()", t, ImsReasonInfo.CODE_UNSPECIFIED); |
| 1784 | } |
| 1785 | } |
| 1786 | |
| 1787 | /** |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 1788 | * Gets the config interface to get/set service/capability parameters. |
| 1789 | * |
| 1790 | * @return the ImsConfig instance. |
| 1791 | * @throws ImsException if getting the setting interface results in an error. |
| 1792 | */ |
| 1793 | public ImsConfig getConfigInterface() throws ImsException { |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 1794 | if (mConfig != null && mConfig.isBinderAlive()) { |
| 1795 | return mConfig; |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 1796 | } |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 1797 | |
| 1798 | checkAndThrowExceptionIfServiceUnavailable(); |
| 1799 | try { |
| 1800 | IImsConfig config = mImsServiceProxy.getConfigInterface(); |
| 1801 | if (config == null) { |
| 1802 | throw new ImsException("getConfigInterface()", |
| 1803 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 1804 | } |
| 1805 | mConfig = new ImsConfig(config, mContext); |
| 1806 | } catch (RemoteException e) { |
| 1807 | throw new ImsException("getConfigInterface()", e, |
| 1808 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1809 | } |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 1810 | return mConfig; |
| 1811 | } |
| 1812 | |
Hall Liu | e511a20 | 2017-08-17 15:49:58 -0700 | [diff] [blame] | 1813 | /** |
| 1814 | * Set the TTY mode. This is the actual tty mode (varies depending on peripheral status) |
| 1815 | */ |
| 1816 | public void setTtyMode(int ttyMode) throws ImsException { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1817 | if (!getBooleanCarrierConfig( |
Hall Liu | e511a20 | 2017-08-17 15:49:58 -0700 | [diff] [blame] | 1818 | CarrierConfigManager.KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL)) { |
| 1819 | setAdvanced4GMode((ttyMode == TelecomManager.TTY_MODE_OFF) && |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1820 | isEnhanced4gLteModeSettingEnabledByUser()); |
Hall Liu | e511a20 | 2017-08-17 15:49:58 -0700 | [diff] [blame] | 1821 | } |
| 1822 | } |
| 1823 | |
| 1824 | /** |
| 1825 | * Sets the UI TTY mode. This is the preferred TTY mode that the user sets in the call |
| 1826 | * settings screen. |
| 1827 | */ |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1828 | public void setUiTTYMode(Context context, int uiTtyMode, Message onComplete) |
Shriram Ganesh | c403b7b | 2014-08-14 14:18:57 +0530 | [diff] [blame] | 1829 | throws ImsException { |
| 1830 | |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 1831 | checkAndThrowExceptionIfServiceUnavailable(); |
Shriram Ganesh | c403b7b | 2014-08-14 14:18:57 +0530 | [diff] [blame] | 1832 | |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 1833 | try { |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 1834 | mImsServiceProxy.setUiTTYMode(uiTtyMode, onComplete); |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 1835 | } catch (RemoteException e) { |
| 1836 | throw new ImsException("setTTYMode()", e, |
| 1837 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1838 | } |
Shriram Ganesh | c403b7b | 2014-08-14 14:18:57 +0530 | [diff] [blame] | 1839 | } |
| 1840 | |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 1841 | private ImsReasonInfo makeACopy(ImsReasonInfo imsReasonInfo) { |
| 1842 | Parcel p = Parcel.obtain(); |
| 1843 | imsReasonInfo.writeToParcel(p, 0); |
| 1844 | p.setDataPosition(0); |
| 1845 | ImsReasonInfo clonedReasonInfo = ImsReasonInfo.CREATOR.createFromParcel(p); |
| 1846 | p.recycle(); |
| 1847 | return clonedReasonInfo; |
| 1848 | } |
| 1849 | |
| 1850 | /** |
| 1851 | * Get Recent IMS Disconnect Reasons. |
| 1852 | * |
| 1853 | * @return ArrayList of ImsReasonInfo objects. MAX size of the arraylist |
| 1854 | * is MAX_RECENT_DISCONNECT_REASONS. The objects are in the |
| 1855 | * chronological order. |
| 1856 | */ |
| 1857 | public ArrayList<ImsReasonInfo> getRecentImsDisconnectReasons() { |
| 1858 | ArrayList<ImsReasonInfo> disconnectReasons = new ArrayList<>(); |
| 1859 | |
| 1860 | for (ImsReasonInfo reason : mRecentDisconnectReasons) { |
| 1861 | disconnectReasons.add(makeACopy(reason)); |
| 1862 | } |
| 1863 | return disconnectReasons; |
| 1864 | } |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1865 | |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1866 | public int getImsServiceStatus() throws ImsException { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1867 | return mImsServiceProxy.getFeatureStatus(); |
| 1868 | } |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 1869 | |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 1870 | /** |
Junda Liu | e7663c0 | 2015-06-23 11:16:26 -0700 | [diff] [blame] | 1871 | * Get the boolean config from carrier config manager. |
| 1872 | * |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1873 | * @param key config key defined in CarrierConfigManager |
| 1874 | * @return boolean value of corresponding key. |
| 1875 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1876 | private boolean getBooleanCarrierConfig(String key) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1877 | int[] subIds = SubscriptionManager.getSubId(mPhoneId); |
| 1878 | int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; |
| 1879 | if (subIds != null && subIds.length >= 1) { |
| 1880 | subId = subIds[0]; |
| 1881 | } |
| 1882 | PersistableBundle b = null; |
| 1883 | if (mConfigManager != null) { |
| 1884 | // If an invalid subId is used, this bundle will contain default values. |
| 1885 | b = mConfigManager.getConfigForSubId(subId); |
| 1886 | } |
| 1887 | if (b != null) { |
| 1888 | return b.getBoolean(key); |
| 1889 | } else { |
| 1890 | // Return static default defined in CarrierConfigManager. |
| 1891 | return CarrierConfigManager.getDefaultConfig().getBoolean(key); |
| 1892 | } |
| 1893 | } |
| 1894 | |
| 1895 | /** |
fionaxu | 5803ef0 | 2016-03-08 11:48:48 -0800 | [diff] [blame] | 1896 | * Get the int config from carrier config manager. |
| 1897 | * |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1898 | * @param key config key defined in CarrierConfigManager |
| 1899 | * @return integer value of corresponding key. |
| 1900 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 1901 | private int getIntCarrierConfig(String key) { |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 1902 | int[] subIds = SubscriptionManager.getSubId(mPhoneId); |
| 1903 | int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; |
| 1904 | if (subIds != null && subIds.length >= 1) { |
| 1905 | subId = subIds[0]; |
| 1906 | } |
| 1907 | PersistableBundle b = null; |
| 1908 | if (mConfigManager != null) { |
| 1909 | // If an invalid subId is used, this bundle will contain default values. |
| 1910 | b = mConfigManager.getConfigForSubId(subId); |
| 1911 | } |
| 1912 | if (b != null) { |
| 1913 | return b.getInt(key); |
| 1914 | } else { |
| 1915 | // Return static default defined in CarrierConfigManager. |
| 1916 | return CarrierConfigManager.getDefaultConfig().getInt(key); |
| 1917 | } |
| 1918 | } |
| 1919 | |
| 1920 | /** |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1921 | * Gets the call ID from the specified incoming call broadcast intent. |
| 1922 | * |
| 1923 | * @param incomingCallIntent the incoming call broadcast intent |
| 1924 | * @return the call ID or null if the intent does not contain it |
| 1925 | */ |
| 1926 | private static String getCallId(Intent incomingCallIntent) { |
| 1927 | if (incomingCallIntent == null) { |
| 1928 | return null; |
| 1929 | } |
| 1930 | |
| 1931 | return incomingCallIntent.getStringExtra(EXTRA_CALL_ID); |
| 1932 | } |
| 1933 | |
| 1934 | /** |
| 1935 | * Gets the service type from the specified incoming call broadcast intent. |
| 1936 | * |
| 1937 | * @param incomingCallIntent the incoming call broadcast intent |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1938 | * @return the session identifier or -1 if the intent does not contain it |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1939 | */ |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1940 | private static int getImsSessionId(Intent incomingCallIntent) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1941 | if (incomingCallIntent == null) { |
| 1942 | return (-1); |
| 1943 | } |
| 1944 | |
| 1945 | return incomingCallIntent.getIntExtra(EXTRA_SERVICE_ID, -1); |
| 1946 | } |
| 1947 | |
| 1948 | /** |
Brad Ebinger | b10b61e | 2017-04-18 11:45:26 -0700 | [diff] [blame] | 1949 | * Checks to see if the ImsService Binder is connected. If it is not, we try to create the |
| 1950 | * connection again. |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1951 | */ |
| 1952 | private void checkAndThrowExceptionIfServiceUnavailable() |
| 1953 | throws ImsException { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1954 | if (mImsServiceProxy == null || !mImsServiceProxy.isBinderAlive()) { |
| 1955 | createImsService(); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1956 | |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1957 | if (mImsServiceProxy == null) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1958 | throw new ImsException("Service is unavailable", |
| 1959 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 1960 | } |
| 1961 | } |
| 1962 | } |
| 1963 | |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1964 | /** |
| 1965 | * Binds the IMS service to make/receive the call. Supports two methods of exposing an |
| 1966 | * ImsService: |
| 1967 | * 1) com.android.ims.ImsService implementation in ServiceManager (deprecated). |
| 1968 | * 2) android.telephony.ims.ImsService implementation through ImsResolver. |
| 1969 | */ |
| 1970 | private void createImsService() { |
| 1971 | if (!mConfigDynamicBind) { |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1972 | // Deprecated method of binding |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1973 | Rlog.i(TAG, "Creating ImsService using ServiceManager"); |
Brad Ebinger | 3418c13 | 2018-01-18 12:03:33 -0800 | [diff] [blame] | 1974 | mImsServiceProxy = ImsServiceProxyCompat.create(mContext, mPhoneId, mDeathRecipient); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1975 | } else { |
| 1976 | Rlog.i(TAG, "Creating ImsService using ImsResolver"); |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1977 | mImsServiceProxy = ImsServiceProxy.create(mContext, mPhoneId); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 1978 | } |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 1979 | // Forwarding interface to tell mStatusCallbacks that the Proxy is unavailable. |
| 1980 | mImsServiceProxy.setStatusCallback(new ImsServiceProxy.IFeatureUpdate() { |
| 1981 | @Override |
| 1982 | public void notifyStateChanged() { |
| 1983 | mStatusCallbacks.forEach(ImsServiceProxy.IFeatureUpdate::notifyStateChanged); |
| 1984 | } |
| 1985 | |
| 1986 | @Override |
| 1987 | public void notifyUnavailable() { |
| 1988 | mStatusCallbacks.forEach(ImsServiceProxy.IFeatureUpdate::notifyUnavailable); |
| 1989 | } |
| 1990 | }); |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 1991 | // We have created a new ImsService connection, signal for re-registration |
| 1992 | synchronized (mHasRegisteredLock) { |
| 1993 | mHasRegisteredForProxy = false; |
| 1994 | } |
Etan Cohen | d772746 | 2014-07-12 14:54:10 -0700 | [diff] [blame] | 1995 | } |
| 1996 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 1997 | /** |
| 1998 | * Creates a {@link ImsCallSession} with the specified call profile. |
| 1999 | * Use other methods, if applicable, instead of interacting with |
| 2000 | * {@link ImsCallSession} directly. |
| 2001 | * |
| 2002 | * @param serviceId a service id which is obtained from {@link ImsManager#open} |
| 2003 | * @param profile a call profile to make the call |
| 2004 | */ |
| 2005 | private ImsCallSession createCallSession(int serviceId, |
| 2006 | ImsCallProfile profile) throws ImsException { |
| 2007 | try { |
Brad Ebinger | b10b61e | 2017-04-18 11:45:26 -0700 | [diff] [blame] | 2008 | // Throws an exception if the ImsService Feature is not ready to accept commands. |
Brad Ebinger | 8409c97 | 2018-01-11 10:29:04 -0800 | [diff] [blame^] | 2009 | return new ImsCallSession(mImsServiceProxy.createCallSession(serviceId, profile)); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2010 | } catch (RemoteException e) { |
Brad Ebinger | b10b61e | 2017-04-18 11:45:26 -0700 | [diff] [blame] | 2011 | Rlog.w(TAG, "CreateCallSession: Error, remote exception: " + e.getMessage()); |
| 2012 | throw new ImsException("createCallSession()", e, |
| 2013 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2014 | |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2015 | } |
| 2016 | } |
| 2017 | |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 2018 | private static void log(String s) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2019 | Rlog.d(TAG, s); |
| 2020 | } |
| 2021 | |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 2022 | private static void loge(String s) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2023 | Rlog.e(TAG, s); |
| 2024 | } |
| 2025 | |
Etan Cohen | a00c919 | 2014-12-23 15:02:29 -0800 | [diff] [blame] | 2026 | private static void loge(String s, Throwable t) { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2027 | Rlog.e(TAG, s, t); |
| 2028 | } |
| 2029 | |
| 2030 | /** |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2031 | * Used for turning on IMS.if its off already |
| 2032 | */ |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 2033 | private void turnOnIms() throws ImsException { |
Etan Cohen | 0c9c09e | 2014-07-25 11:09:12 -0700 | [diff] [blame] | 2034 | checkAndThrowExceptionIfServiceUnavailable(); |
| 2035 | |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2036 | try { |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 2037 | mImsServiceProxy.turnOnIms(); |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2038 | } catch (RemoteException e) { |
| 2039 | throw new ImsException("turnOnIms() ", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2040 | } |
| 2041 | } |
| 2042 | |
Omkar Kolangade | 75f3ca3 | 2014-10-24 11:10:52 -0700 | [diff] [blame] | 2043 | private boolean isImsTurnOffAllowed() { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2044 | return isTurnOffImsAllowedByPlatform() |
| 2045 | && (!isWfcEnabledByPlatform() |
| 2046 | || !isWfcEnabledByUser()); |
Omkar Kolangade | 75f3ca3 | 2014-10-24 11:10:52 -0700 | [diff] [blame] | 2047 | } |
| 2048 | |
Amit Mahajan | 9cba36d | 2016-08-11 10:17:23 -0700 | [diff] [blame] | 2049 | private void setLteFeatureValues(boolean turnOn) { |
| 2050 | log("setLteFeatureValues: " + turnOn); |
Omkar Kolangade | 75f3ca3 | 2014-10-24 11:10:52 -0700 | [diff] [blame] | 2051 | try { |
| 2052 | ImsConfig config = getConfigInterface(); |
Amit Mahajan | 9cba36d | 2016-08-11 10:17:23 -0700 | [diff] [blame] | 2053 | if (config != null) { |
Omkar Kolangade | 75f3ca3 | 2014-10-24 11:10:52 -0700 | [diff] [blame] | 2054 | config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE, |
Pavel Zhamaitsiak | f4b9032 | 2016-01-26 14:34:09 -0800 | [diff] [blame] | 2055 | TelephonyManager.NETWORK_TYPE_LTE, turnOn ? 1 : 0, mImsConfigListener); |
Pavel Zhamaitsiak | ff29b9d | 2016-04-15 12:16:57 -0700 | [diff] [blame] | 2056 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2057 | if (isVolteEnabledByPlatform()) { |
| 2058 | boolean ignoreDataEnabledChanged = getBooleanCarrierConfig( |
Jack Yu | 5778185 | 2016-11-16 17:20:38 -0800 | [diff] [blame] | 2059 | CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2060 | boolean enableViLte = turnOn && isVtEnabledByUser() && |
Jack Yu | 5778185 | 2016-11-16 17:20:38 -0800 | [diff] [blame] | 2061 | (ignoreDataEnabledChanged || isDataEnabled()); |
Pavel Zhamaitsiak | ff29b9d | 2016-04-15 12:16:57 -0700 | [diff] [blame] | 2062 | config.setFeatureValue(ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_LTE, |
| 2063 | TelephonyManager.NETWORK_TYPE_LTE, |
| 2064 | enableViLte ? 1 : 0, |
| 2065 | mImsConfigListener); |
| 2066 | } |
Etan Cohen | b651fa5 | 2014-10-22 10:51:29 -0700 | [diff] [blame] | 2067 | } |
Omkar Kolangade | 75f3ca3 | 2014-10-24 11:10:52 -0700 | [diff] [blame] | 2068 | } catch (ImsException e) { |
Amit Mahajan | 9cba36d | 2016-08-11 10:17:23 -0700 | [diff] [blame] | 2069 | loge("setLteFeatureValues: exception ", e); |
Etan Cohen | cfc784d | 2014-08-07 18:40:31 -0700 | [diff] [blame] | 2070 | } |
Amit Mahajan | 9cba36d | 2016-08-11 10:17:23 -0700 | [diff] [blame] | 2071 | } |
| 2072 | |
| 2073 | private void setAdvanced4GMode(boolean turnOn) throws ImsException { |
| 2074 | checkAndThrowExceptionIfServiceUnavailable(); |
| 2075 | |
| 2076 | // if turnOn: first set feature values then call turnOnIms() |
| 2077 | // if turnOff: only set feature values if IMS turn off is not allowed. If turn off is |
| 2078 | // allowed, first call turnOffIms() then set feature values |
Etan Cohen | cfc784d | 2014-08-07 18:40:31 -0700 | [diff] [blame] | 2079 | if (turnOn) { |
Amit Mahajan | 9cba36d | 2016-08-11 10:17:23 -0700 | [diff] [blame] | 2080 | setLteFeatureValues(turnOn); |
| 2081 | log("setAdvanced4GMode: turnOnIms"); |
Etan Cohen | cfc784d | 2014-08-07 18:40:31 -0700 | [diff] [blame] | 2082 | turnOnIms(); |
Amit Mahajan | 9cba36d | 2016-08-11 10:17:23 -0700 | [diff] [blame] | 2083 | } else { |
| 2084 | if (isImsTurnOffAllowed()) { |
| 2085 | log("setAdvanced4GMode: turnOffIms"); |
| 2086 | turnOffIms(); |
| 2087 | } |
| 2088 | setLteFeatureValues(turnOn); |
Etan Cohen | cfc784d | 2014-08-07 18:40:31 -0700 | [diff] [blame] | 2089 | } |
| 2090 | } |
| 2091 | |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2092 | /** |
| 2093 | * Used for turning off IMS completely in order to make the device CSFB'ed. |
| 2094 | * Once turned off, all calls will be over CS. |
| 2095 | */ |
Etan Cohen | 82f7812 | 2014-12-15 10:10:14 -0800 | [diff] [blame] | 2096 | private void turnOffIms() throws ImsException { |
Etan Cohen | 0c9c09e | 2014-07-25 11:09:12 -0700 | [diff] [blame] | 2097 | checkAndThrowExceptionIfServiceUnavailable(); |
| 2098 | |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2099 | try { |
Brad Ebinger | b5f30c7 | 2017-02-17 14:54:31 -0800 | [diff] [blame] | 2100 | mImsServiceProxy.turnOffIms(); |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2101 | } catch (RemoteException e) { |
| 2102 | throw new ImsException("turnOffIms() ", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2103 | } |
| 2104 | } |
| 2105 | |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 2106 | private void addToRecentDisconnectReasons(ImsReasonInfo reason) { |
| 2107 | if (reason == null) return; |
| 2108 | while (mRecentDisconnectReasons.size() >= MAX_RECENT_DISCONNECT_REASONS) { |
| 2109 | mRecentDisconnectReasons.removeFirst(); |
| 2110 | } |
| 2111 | mRecentDisconnectReasons.addLast(reason); |
| 2112 | } |
| 2113 | |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2114 | /** |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2115 | * Death recipient class for monitoring IMS service. |
| 2116 | */ |
| 2117 | private class ImsServiceDeathRecipient implements IBinder.DeathRecipient { |
| 2118 | @Override |
| 2119 | public void binderDied() { |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 2120 | mImsServiceProxy = null; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2121 | mUt = null; |
Libin.Tang@motorola.com | 076c55d | 2014-06-23 19:46:36 -0500 | [diff] [blame] | 2122 | mConfig = null; |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 2123 | mEcbm = null; |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 2124 | mMultiEndpoint = null; |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2125 | } |
| 2126 | } |
| 2127 | |
| 2128 | /** |
Brad Ebinger | 57b1189 | 2017-06-13 16:21:35 -0700 | [diff] [blame] | 2129 | * Stub implementation of the Registration listener that provides no functionality. |
| 2130 | */ |
| 2131 | private class ImsRegistrationListenerBase extends IImsRegistrationListener.Stub { |
| 2132 | |
| 2133 | @Override |
| 2134 | public void registrationConnected() throws RemoteException { |
| 2135 | } |
| 2136 | |
| 2137 | @Override |
| 2138 | public void registrationProgressing() throws RemoteException { |
| 2139 | } |
| 2140 | |
| 2141 | @Override |
| 2142 | public void registrationConnectedWithRadioTech(int imsRadioTech) throws RemoteException { |
| 2143 | } |
| 2144 | |
| 2145 | @Override |
| 2146 | public void registrationProgressingWithRadioTech(int imsRadioTech) throws RemoteException { |
| 2147 | } |
| 2148 | |
| 2149 | @Override |
| 2150 | public void registrationDisconnected(ImsReasonInfo imsReasonInfo) throws RemoteException { |
| 2151 | } |
| 2152 | |
| 2153 | @Override |
| 2154 | public void registrationResumed() throws RemoteException { |
| 2155 | } |
| 2156 | |
| 2157 | @Override |
| 2158 | public void registrationSuspended() throws RemoteException { |
| 2159 | } |
| 2160 | |
| 2161 | @Override |
| 2162 | public void registrationServiceCapabilityChanged(int serviceClass, int event) |
| 2163 | throws RemoteException { |
| 2164 | } |
| 2165 | |
| 2166 | @Override |
| 2167 | public void registrationFeatureCapabilityChanged(int serviceClass, int[] enabledFeatures, |
| 2168 | int[] disabledFeatures) throws RemoteException { |
| 2169 | } |
| 2170 | |
| 2171 | @Override |
| 2172 | public void voiceMessageCountUpdate(int count) throws RemoteException { |
| 2173 | } |
| 2174 | |
| 2175 | @Override |
| 2176 | public void registrationAssociatedUriChanged(Uri[] uris) throws RemoteException { |
| 2177 | } |
| 2178 | |
| 2179 | @Override |
| 2180 | public void registrationChangeFailed(int targetAccessTech, ImsReasonInfo imsReasonInfo) |
| 2181 | throws RemoteException { |
| 2182 | } |
| 2183 | } |
| 2184 | |
| 2185 | /** |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2186 | * Adapter class for {@link IImsRegistrationListener}. |
| 2187 | */ |
Naveen Kalla | 196fd3b | 2017-02-14 14:55:24 -0800 | [diff] [blame] | 2188 | private class ImsRegistrationListenerProxy extends IImsRegistrationListener.Stub { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2189 | |
Omkar Kolangade | a7ced64 | 2015-05-04 17:55:13 -0700 | [diff] [blame] | 2190 | @Deprecated |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2191 | public void registrationConnected() { |
| 2192 | if (DBG) { |
| 2193 | log("registrationConnected ::"); |
| 2194 | } |
| 2195 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2196 | synchronized (mRegistrationListeners) { |
| 2197 | mRegistrationListeners.forEach(l -> l.onImsConnected( |
| 2198 | ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN)); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2199 | } |
| 2200 | } |
| 2201 | |
Omkar Kolangade | a7ced64 | 2015-05-04 17:55:13 -0700 | [diff] [blame] | 2202 | @Deprecated |
Rekha Kumar | 1463174 | 2015-02-04 10:47:00 -0800 | [diff] [blame] | 2203 | public void registrationProgressing() { |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2204 | if (DBG) { |
Rekha Kumar | 1463174 | 2015-02-04 10:47:00 -0800 | [diff] [blame] | 2205 | log("registrationProgressing ::"); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2206 | } |
| 2207 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2208 | synchronized (mRegistrationListeners) { |
| 2209 | mRegistrationListeners.forEach(l -> l.onImsProgressing( |
| 2210 | ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN)); |
Rekha Kumar | 1463174 | 2015-02-04 10:47:00 -0800 | [diff] [blame] | 2211 | } |
| 2212 | } |
| 2213 | |
| 2214 | @Override |
Omkar Kolangade | a7ced64 | 2015-05-04 17:55:13 -0700 | [diff] [blame] | 2215 | public void registrationConnectedWithRadioTech(int imsRadioTech) { |
| 2216 | // Note: imsRadioTech value maps to RIL_RADIO_TECHNOLOGY |
| 2217 | // values in ServiceState.java. |
| 2218 | if (DBG) { |
| 2219 | log("registrationConnectedWithRadioTech :: imsRadioTech=" + imsRadioTech); |
| 2220 | } |
| 2221 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2222 | synchronized (mRegistrationListeners) { |
| 2223 | mRegistrationListeners.forEach(l -> l.onImsConnected(imsRadioTech)); |
Omkar Kolangade | a7ced64 | 2015-05-04 17:55:13 -0700 | [diff] [blame] | 2224 | } |
| 2225 | } |
| 2226 | |
| 2227 | @Override |
| 2228 | public void registrationProgressingWithRadioTech(int imsRadioTech) { |
| 2229 | // Note: imsRadioTech value maps to RIL_RADIO_TECHNOLOGY |
| 2230 | // values in ServiceState.java. |
| 2231 | if (DBG) { |
| 2232 | log("registrationProgressingWithRadioTech :: imsRadioTech=" + imsRadioTech); |
| 2233 | } |
| 2234 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2235 | synchronized (mRegistrationListeners) { |
| 2236 | mRegistrationListeners.forEach(l -> l.onImsProgressing(imsRadioTech)); |
Omkar Kolangade | a7ced64 | 2015-05-04 17:55:13 -0700 | [diff] [blame] | 2237 | } |
| 2238 | } |
| 2239 | |
| 2240 | @Override |
Rekha Kumar | 1463174 | 2015-02-04 10:47:00 -0800 | [diff] [blame] | 2241 | public void registrationDisconnected(ImsReasonInfo imsReasonInfo) { |
| 2242 | if (DBG) { |
| 2243 | log("registrationDisconnected :: imsReasonInfo" + imsReasonInfo); |
| 2244 | } |
| 2245 | |
Naveen Kalla | 525c3a2 | 2017-02-06 14:46:42 -0800 | [diff] [blame] | 2246 | addToRecentDisconnectReasons(imsReasonInfo); |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2247 | synchronized (mRegistrationListeners) { |
| 2248 | mRegistrationListeners.forEach(l -> l.onImsDisconnected(imsReasonInfo)); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2249 | } |
| 2250 | } |
| 2251 | |
| 2252 | @Override |
| 2253 | public void registrationResumed() { |
| 2254 | if (DBG) { |
| 2255 | log("registrationResumed ::"); |
| 2256 | } |
| 2257 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2258 | synchronized (mRegistrationListeners) { |
| 2259 | mRegistrationListeners.forEach(ImsConnectionStateListener::onImsResumed); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2260 | } |
| 2261 | } |
| 2262 | |
| 2263 | @Override |
| 2264 | public void registrationSuspended() { |
| 2265 | if (DBG) { |
| 2266 | log("registrationSuspended ::"); |
| 2267 | } |
| 2268 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2269 | synchronized (mRegistrationListeners) { |
| 2270 | mRegistrationListeners.forEach(ImsConnectionStateListener::onImsSuspended); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2271 | } |
| 2272 | } |
| 2273 | |
| 2274 | @Override |
| 2275 | public void registrationServiceCapabilityChanged(int serviceClass, int event) { |
| 2276 | log("registrationServiceCapabilityChanged :: serviceClass=" + |
| 2277 | serviceClass + ", event=" + event); |
| 2278 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2279 | synchronized (mRegistrationListeners) { |
| 2280 | mRegistrationListeners.forEach(l -> l.onImsConnected( |
| 2281 | ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN)); |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2282 | } |
| 2283 | } |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2284 | |
| 2285 | @Override |
| 2286 | public void registrationFeatureCapabilityChanged(int serviceClass, |
| 2287 | int[] enabledFeatures, int[] disabledFeatures) { |
| 2288 | log("registrationFeatureCapabilityChanged :: serviceClass=" + |
| 2289 | serviceClass); |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2290 | |
| 2291 | synchronized (mRegistrationListeners) { |
| 2292 | mRegistrationListeners.forEach(l -> l.onFeatureCapabilityChanged(serviceClass, |
| 2293 | enabledFeatures, disabledFeatures)); |
Libin.Tang@motorola.com | e229678 | 2014-08-19 14:20:01 -0500 | [diff] [blame] | 2294 | } |
ram | 7da5a11 | 2014-07-16 20:59:27 +0530 | [diff] [blame] | 2295 | } |
| 2296 | |
Shriram Ganesh | d3adfad | 2015-05-31 10:06:15 -0700 | [diff] [blame] | 2297 | @Override |
| 2298 | public void voiceMessageCountUpdate(int count) { |
| 2299 | log("voiceMessageCountUpdate :: count=" + count); |
| 2300 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2301 | synchronized (mRegistrationListeners) { |
| 2302 | mRegistrationListeners.forEach(l -> l.onVoiceMessageCountChanged(count)); |
Shriram Ganesh | d3adfad | 2015-05-31 10:06:15 -0700 | [diff] [blame] | 2303 | } |
| 2304 | } |
| 2305 | |
Pavel Zhamaitsiak | 4de9cbb | 2016-02-11 17:21:05 -0800 | [diff] [blame] | 2306 | @Override |
| 2307 | public void registrationAssociatedUriChanged(Uri[] uris) { |
| 2308 | if (DBG) log("registrationAssociatedUriChanged ::"); |
| 2309 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2310 | synchronized (mRegistrationListeners) { |
| 2311 | mRegistrationListeners.forEach(l -> l.registrationAssociatedUriChanged(uris)); |
Pavel Zhamaitsiak | 4de9cbb | 2016-02-11 17:21:05 -0800 | [diff] [blame] | 2312 | } |
| 2313 | } |
Meng Wang | bb98b9b | 2016-12-07 16:27:15 -0800 | [diff] [blame] | 2314 | |
| 2315 | @Override |
| 2316 | public void registrationChangeFailed(int targetAccessTech, ImsReasonInfo imsReasonInfo) { |
| 2317 | if (DBG) log("registrationChangeFailed :: targetAccessTech=" + targetAccessTech + |
| 2318 | ", imsReasonInfo=" + imsReasonInfo); |
| 2319 | |
Brad Ebinger | 9a0280c | 2017-06-01 15:58:48 -0700 | [diff] [blame] | 2320 | synchronized (mRegistrationListeners) { |
| 2321 | mRegistrationListeners.forEach(l -> l.onRegistrationChangeFailed(targetAccessTech, |
| 2322 | imsReasonInfo)); |
Meng Wang | bb98b9b | 2016-12-07 16:27:15 -0800 | [diff] [blame] | 2323 | } |
| 2324 | } |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2325 | } |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 2326 | |
Brad Ebinger | 0e170c7 | 2017-12-14 14:24:02 -0800 | [diff] [blame] | 2327 | // New API for Registration, uses ImsConnectionStateListener for backwards compatibility with |
| 2328 | // deprecated APIs. |
| 2329 | private class ImsRegistrationCallback extends IImsRegistrationCallback.Stub { |
| 2330 | |
| 2331 | @Override |
| 2332 | public void onRegistered(int imsRadioTech) { |
| 2333 | if (DBG) log("onRegistered ::"); |
| 2334 | |
| 2335 | synchronized (mRegistrationListeners) { |
| 2336 | mRegistrationListeners.forEach(l -> l.onRegistered(imsRadioTech)); |
| 2337 | } |
| 2338 | } |
| 2339 | |
| 2340 | @Override |
| 2341 | public void onRegistering(int imsRadioTech) { |
| 2342 | if (DBG) log("onRegistering ::"); |
| 2343 | |
| 2344 | synchronized (mRegistrationListeners) { |
| 2345 | mRegistrationListeners.forEach(l -> l.onRegistering(imsRadioTech)); |
| 2346 | } |
| 2347 | } |
| 2348 | |
| 2349 | @Override |
| 2350 | public void onDeregistered(ImsReasonInfo imsReasonInfo) { |
| 2351 | if (DBG) log("onDeregistered ::"); |
| 2352 | |
| 2353 | synchronized (mRegistrationListeners) { |
| 2354 | mRegistrationListeners.forEach(l -> l.onDeregistered(imsReasonInfo)); |
| 2355 | } |
| 2356 | } |
| 2357 | |
| 2358 | @Override |
| 2359 | public void onTechnologyChangeFailed(int targetRadioTech, ImsReasonInfo imsReasonInfo) { |
| 2360 | if (DBG) log("onTechnologyChangeFailed :: targetAccessTech=" + targetRadioTech + |
| 2361 | ", imsReasonInfo=" + imsReasonInfo); |
| 2362 | |
| 2363 | synchronized (mRegistrationListeners) { |
| 2364 | mRegistrationListeners.forEach(l -> l.onTechnologyChangeFailed(targetRadioTech, |
| 2365 | imsReasonInfo)); |
| 2366 | } |
| 2367 | } |
| 2368 | |
| 2369 | @Override |
| 2370 | public void onSubscriberAssociatedUriChanged(Uri[] uris) { |
| 2371 | if (DBG) log("onSubscriberAssociatedUriChanged"); |
| 2372 | synchronized (mRegistrationListeners) { |
| 2373 | mRegistrationListeners.forEach(l -> l.onSubscriberAssociatedUriChanged(uris)); |
| 2374 | } |
| 2375 | } |
| 2376 | } |
| 2377 | |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 2378 | /** |
| 2379 | * Gets the ECBM interface to request ECBM exit. |
| 2380 | * |
| 2381 | * @param serviceId a service id which is obtained from {@link ImsManager#open} |
| 2382 | * @return the ECBM interface instance |
| 2383 | * @throws ImsException if getting the ECBM interface results in an error |
| 2384 | */ |
| 2385 | public ImsEcbm getEcbmInterface(int serviceId) throws ImsException { |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 2386 | if (mEcbm != null && mEcbm.isBinderAlive()) { |
| 2387 | return mEcbm; |
| 2388 | } |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 2389 | |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 2390 | checkAndThrowExceptionIfServiceUnavailable(); |
| 2391 | try { |
| 2392 | IImsEcbm iEcbm = mImsServiceProxy.getEcbmInterface(); |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 2393 | |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 2394 | if (iEcbm == null) { |
| 2395 | throw new ImsException("getEcbmInterface()", |
| 2396 | ImsReasonInfo.CODE_ECBM_NOT_SUPPORTED); |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 2397 | } |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 2398 | mEcbm = new ImsEcbm(iEcbm); |
| 2399 | } catch (RemoteException e) { |
| 2400 | throw new ImsException("getEcbmInterface()", e, |
| 2401 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
Uma Maheswari Ramalingam | 4f2161d | 2014-07-31 16:01:47 -0700 | [diff] [blame] | 2402 | } |
| 2403 | return mEcbm; |
| 2404 | } |
Pavel Zhamaitsiak | 8c065f5 | 2015-11-10 14:36:44 -0800 | [diff] [blame] | 2405 | |
Mohamed Abdalkader | f8800da | 2018-01-10 13:29:26 -0800 | [diff] [blame] | 2406 | public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry, |
| 2407 | byte[] pdu) throws ImsException { |
| 2408 | try { |
| 2409 | mImsServiceProxy.sendSms(token, messageRef, format, smsc, isRetry, pdu); |
| 2410 | } catch (RemoteException e) { |
| 2411 | throw new ImsException("sendSms()", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2412 | } |
| 2413 | } |
| 2414 | |
| 2415 | public void acknowledgeSms(int token, int messageRef, int result) throws ImsException { |
| 2416 | try { |
| 2417 | mImsServiceProxy.acknowledgeSms(token, messageRef, result); |
| 2418 | } catch (RemoteException e) { |
| 2419 | throw new ImsException("acknowledgeSms()", e, |
| 2420 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2421 | } |
| 2422 | } |
| 2423 | |
| 2424 | public void acknowledgeSmsReport(int token, int messageRef, int result) throws ImsException{ |
| 2425 | try { |
| 2426 | mImsServiceProxy.acknowledgeSmsReport(token, messageRef, result); |
| 2427 | } catch (RemoteException e) { |
| 2428 | throw new ImsException("acknowledgeSmsReport()", e, |
| 2429 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2430 | } |
| 2431 | } |
| 2432 | |
| 2433 | public String getSmsFormat() throws ImsException{ |
| 2434 | try { |
| 2435 | return mImsServiceProxy.getSmsFormat(); |
| 2436 | } catch (RemoteException e) { |
| 2437 | throw new ImsException("getSmsFormat()", e, |
| 2438 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2439 | } |
| 2440 | } |
| 2441 | |
| 2442 | public void setSmsListener(IImsSmsListener listener) throws ImsException { |
| 2443 | try { |
| 2444 | mImsServiceProxy.setSmsListener(listener); |
| 2445 | } catch (RemoteException e) { |
| 2446 | throw new ImsException("setSmsListener()", e, |
| 2447 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2448 | } |
| 2449 | } |
Mohamed Abdalkader | 415e6de | 2018-01-19 19:48:31 -0800 | [diff] [blame] | 2450 | |
Mohamed Abdalkader | 4d59b1b | 2018-01-23 13:11:00 -0800 | [diff] [blame] | 2451 | public void onSmsReady() throws ImsException{ |
| 2452 | try { |
| 2453 | mImsServiceProxy.onSmsReady(); |
| 2454 | } catch (RemoteException e) { |
| 2455 | throw new ImsException("onSmsReady()", e, |
| 2456 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2457 | } |
| 2458 | } |
| 2459 | |
Mohamed Abdalkader | 415e6de | 2018-01-19 19:48:31 -0800 | [diff] [blame] | 2460 | public void addRegistrationCallback(ImsRegistrationImplBase.Callback callback) { |
| 2461 | // TODO: implement (coming in ag/3472519) |
| 2462 | } |
| 2463 | |
| 2464 | public void addCapabilitiesCallback(ImsFeature.CapabilityCallback callback) { |
| 2465 | // TODO: implement (coming in ag/3472519) |
| 2466 | } |
| 2467 | |
Pavel Zhamaitsiak | 8c065f5 | 2015-11-10 14:36:44 -0800 | [diff] [blame] | 2468 | /** |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 2469 | * Gets the Multi-Endpoint interface to subscribe to multi-enpoint notifications.. |
| 2470 | * |
| 2471 | * @param serviceId a service id which is obtained from {@link ImsManager#open} |
| 2472 | * @return the multi-endpoint interface instance |
| 2473 | * @throws ImsException if getting the multi-endpoint interface results in an error |
| 2474 | */ |
| 2475 | public ImsMultiEndpoint getMultiEndpointInterface(int serviceId) throws ImsException { |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 2476 | if (mMultiEndpoint != null && mMultiEndpoint.isBinderAlive()) { |
| 2477 | return mMultiEndpoint; |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 2478 | } |
Brad Ebinger | 138b4a6 | 2017-06-20 16:29:50 -0700 | [diff] [blame] | 2479 | |
| 2480 | checkAndThrowExceptionIfServiceUnavailable(); |
| 2481 | try { |
| 2482 | IImsMultiEndpoint iImsMultiEndpoint = mImsServiceProxy.getMultiEndpointInterface(); |
| 2483 | |
| 2484 | if (iImsMultiEndpoint == null) { |
| 2485 | throw new ImsException("getMultiEndpointInterface()", |
| 2486 | ImsReasonInfo.CODE_MULTIENDPOINT_NOT_SUPPORTED); |
| 2487 | } |
| 2488 | mMultiEndpoint = new ImsMultiEndpoint(iImsMultiEndpoint); |
| 2489 | } catch (RemoteException e) { |
| 2490 | throw new ImsException("getMultiEndpointInterface()", e, |
| 2491 | ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); |
| 2492 | } |
| 2493 | |
Tyler Gunn | 4d128b6 | 2016-04-13 15:44:38 -0700 | [diff] [blame] | 2494 | return mMultiEndpoint; |
| 2495 | } |
| 2496 | |
| 2497 | /** |
Pavel Zhamaitsiak | 8c065f5 | 2015-11-10 14:36:44 -0800 | [diff] [blame] | 2498 | * Resets ImsManager settings back to factory defaults. |
| 2499 | * |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2500 | * @deprecated Doesn't support MSIM devices. Use {@link #factoryReset()} instead. |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2501 | * |
Pavel Zhamaitsiak | 8c065f5 | 2015-11-10 14:36:44 -0800 | [diff] [blame] | 2502 | * @hide |
| 2503 | */ |
| 2504 | public static void factoryReset(Context context) { |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2505 | ImsManager mgr = ImsManager.getInstance(context, |
| 2506 | SubscriptionManager.getDefaultVoicePhoneId()); |
| 2507 | if (mgr != null) { |
| 2508 | mgr.factoryReset(); |
| 2509 | } |
| 2510 | loge("factoryReset: ImsManager null."); |
Pavel Zhamaitsiak | 8c065f5 | 2015-11-10 14:36:44 -0800 | [diff] [blame] | 2511 | } |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2512 | |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2513 | /** |
| 2514 | * Resets ImsManager settings back to factory defaults. |
| 2515 | * |
| 2516 | * @hide |
| 2517 | */ |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2518 | public void factoryReset() { |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 2519 | // Set VoLTE to default |
| 2520 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 2521 | SubscriptionManager.ENHANCED_4G_MODE_ENABLED, booleanToPropertyString(true)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2522 | |
| 2523 | // Set VoWiFi to default |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 2524 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 2525 | SubscriptionManager.WFC_IMS_ENABLED, |
| 2526 | booleanToPropertyString(getBooleanCarrierConfig( |
| 2527 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL))); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2528 | |
| 2529 | // Set VoWiFi mode to default |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 2530 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 2531 | SubscriptionManager.WFC_IMS_MODE, |
| 2532 | Integer.toString(getIntCarrierConfig( |
| 2533 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT))); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2534 | |
| 2535 | // Set VoWiFi roaming to default |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 2536 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 2537 | SubscriptionManager.WFC_IMS_ROAMING_ENABLED, |
| 2538 | booleanToPropertyString(getBooleanCarrierConfig( |
| 2539 | CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL))); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2540 | |
| 2541 | // Set VT to default |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 2542 | SubscriptionManager.setSubscriptionProperty(getSubId(), |
| 2543 | SubscriptionManager.VT_IMS_ENABLED, booleanToPropertyString(true)); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2544 | |
| 2545 | // Push settings to ImsConfig |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2546 | updateImsServiceConfig(true); |
Brad Ebinger | 16417b4 | 2017-03-07 13:48:50 -0800 | [diff] [blame] | 2547 | } |
| 2548 | |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 2549 | private boolean isDataEnabled() { |
| 2550 | return SystemProperties.getBoolean(DATA_ENABLED_PROP, true); |
| 2551 | } |
| 2552 | |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 2553 | /** |
| 2554 | * Set data enabled/disabled flag. |
| 2555 | * @param enabled True if data is enabled, otherwise disabled. |
| 2556 | */ |
| 2557 | public void setDataEnabled(boolean enabled) { |
| 2558 | log("setDataEnabled: " + enabled); |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 2559 | SystemProperties.set(DATA_ENABLED_PROP, enabled ? TRUE : FALSE); |
| 2560 | } |
| 2561 | |
| 2562 | private boolean isVolteProvisioned() { |
| 2563 | return SystemProperties.getBoolean(VOLTE_PROVISIONED_PROP, true); |
| 2564 | } |
| 2565 | |
| 2566 | private void setVolteProvisionedProperty(boolean provisioned) { |
| 2567 | SystemProperties.set(VOLTE_PROVISIONED_PROP, provisioned ? TRUE : FALSE); |
| 2568 | } |
| 2569 | |
| 2570 | private boolean isWfcProvisioned() { |
| 2571 | return SystemProperties.getBoolean(WFC_PROVISIONED_PROP, true); |
| 2572 | } |
| 2573 | |
| 2574 | private void setWfcProvisionedProperty(boolean provisioned) { |
| 2575 | SystemProperties.set(WFC_PROVISIONED_PROP, provisioned ? TRUE : FALSE); |
| 2576 | } |
| 2577 | |
| 2578 | private boolean isVtProvisioned() { |
| 2579 | return SystemProperties.getBoolean(VT_PROVISIONED_PROP, true); |
| 2580 | } |
| 2581 | |
| 2582 | private void setVtProvisionedProperty(boolean provisioned) { |
| 2583 | SystemProperties.set(VT_PROVISIONED_PROP, provisioned ? TRUE : FALSE); |
Jack Yu | 643ffe4 | 2016-07-08 14:25:46 -0700 | [diff] [blame] | 2584 | } |
| 2585 | |
Malcolm Chen | 201d231 | 2017-09-28 17:28:45 -0700 | [diff] [blame] | 2586 | private static String booleanToPropertyString(boolean bool) { |
| 2587 | return bool ? "1" : "0"; |
| 2588 | } |
| 2589 | |
| 2590 | |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2591 | public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 2592 | pw.println("ImsManager:"); |
| 2593 | pw.println(" mPhoneId = " + mPhoneId); |
| 2594 | pw.println(" mConfigUpdated = " + mConfigUpdated); |
Brad Ebinger | 16780ff | 2017-01-26 11:18:21 -0800 | [diff] [blame] | 2595 | pw.println(" mImsServiceProxy = " + mImsServiceProxy); |
Amit Mahajan | 24f7b16 | 2016-07-21 16:33:53 -0700 | [diff] [blame] | 2596 | pw.println(" mDataEnabled = " + isDataEnabled()); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2597 | pw.println(" ignoreDataEnabledChanged = " + getBooleanCarrierConfig( |
Jack Yu | 5778185 | 2016-11-16 17:20:38 -0800 | [diff] [blame] | 2598 | CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS)); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2599 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2600 | pw.println(" isGbaValid = " + isGbaValid()); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2601 | pw.println(" isImsTurnOffAllowed = " + isImsTurnOffAllowed()); |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2602 | pw.println(" isNonTtyOrTtyOnVolteEnabled = " + isNonTtyOrTtyOnVolteEnabled()); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2603 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2604 | pw.println(" isVolteEnabledByPlatform = " + isVolteEnabledByPlatform()); |
| 2605 | pw.println(" isVolteProvisionedOnDevice = " + isVolteProvisionedOnDevice()); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2606 | pw.println(" isEnhanced4gLteModeSettingEnabledByUser = " + |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2607 | isEnhanced4gLteModeSettingEnabledByUser()); |
| 2608 | pw.println(" isVtEnabledByPlatform = " + isVtEnabledByPlatform()); |
| 2609 | pw.println(" isVtEnabledByUser = " + isVtEnabledByUser()); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2610 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2611 | pw.println(" isWfcEnabledByPlatform = " + isWfcEnabledByPlatform()); |
| 2612 | pw.println(" isWfcEnabledByUser = " + isWfcEnabledByUser()); |
| 2613 | pw.println(" getWfcMode = " + getWfcMode()); |
| 2614 | pw.println(" isWfcRoamingEnabledByUser = " + isWfcRoamingEnabledByUser()); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2615 | |
Brad Ebinger | 479f52c | 2017-08-28 13:19:22 -0700 | [diff] [blame] | 2616 | pw.println(" isVtProvisionedOnDevice = " + isVtProvisionedOnDevice()); |
| 2617 | pw.println(" isWfcProvisionedOnDevice = " + isWfcProvisionedOnDevice()); |
Jack Yu | 2f102bd | 2015-12-28 15:31:48 -0800 | [diff] [blame] | 2618 | pw.flush(); |
| 2619 | } |
Wink Saville | ef36ef6 | 2014-06-11 08:39:38 -0700 | [diff] [blame] | 2620 | } |