blob: 0d86e2b7c2b1dea222cfabf7e3ba530c237df297 [file] [log] [blame]
Brad Ebinger21013dc2017-02-02 16:21:22 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.ims;
18
Brad Ebinger0d36ed22018-10-31 11:22:26 -070019import android.os.Handler;
Brad Ebinger0d36ed22018-10-31 11:22:26 -070020import android.os.Looper;
Brad Ebinger21013dc2017-02-02 16:21:22 -080021import android.os.RemoteException;
Meng Wang6d3e8212020-01-08 18:03:33 -080022import com.android.telephony.Rlog;
Brad Ebingerf8c3cd82018-01-22 13:51:52 -080023import android.telephony.ims.ImsReasonInfo;
Brad Ebinger0d36ed22018-10-31 11:22:26 -070024import android.telephony.ims.ProvisioningManager;
Brad Ebinger112c36d2018-01-16 09:33:47 -080025import android.telephony.ims.aidl.IImsConfig;
Brad Ebinger0d36ed22018-10-31 11:22:26 -070026import android.telephony.ims.aidl.IImsConfigCallback;
27
Sooraj Sasindran041a6d32019-12-02 13:08:23 -080028import com.android.internal.telephony.util.HandlerExecutor;
29
Brad Ebinger0d36ed22018-10-31 11:22:26 -070030import java.util.concurrent.Executor;
Brad Ebinger21013dc2017-02-02 16:21:22 -080031
32/**
33 * Provides APIs to get/set the IMS service feature/capability/parameters.
34 * The config items include:
35 * 1) Items provisioned by the operator.
36 * 2) Items configured by user. Mainly service feature class.
37 *
Brad Ebinger0d36ed22018-10-31 11:22:26 -070038 * @deprecated Use {@link ProvisioningManager} to change these configurations in the ImsService.
Brad Ebinger21013dc2017-02-02 16:21:22 -080039 * @hide
40 */
Brad Ebinger0d36ed22018-10-31 11:22:26 -070041@Deprecated
Brad Ebinger21013dc2017-02-02 16:21:22 -080042public class ImsConfig {
43 private static final String TAG = "ImsConfig";
44 private boolean DBG = true;
45 private final IImsConfig miConfig;
Brad Ebinger21013dc2017-02-02 16:21:22 -080046
47 /**
48 * Broadcast action: the feature enable status was changed
49 *
50 * @hide
51 */
52 public static final String ACTION_IMS_FEATURE_CHANGED =
53 "com.android.intent.action.IMS_FEATURE_CHANGED";
54
55 /**
56 * Broadcast action: the configuration was changed
Brad Ebinger0d36ed22018-10-31 11:22:26 -070057 * @deprecated Use {@link android.telephony.ims.ProvisioningManager.Callback} instead.
Brad Ebinger21013dc2017-02-02 16:21:22 -080058 * @hide
59 */
60 public static final String ACTION_IMS_CONFIG_CHANGED =
61 "com.android.intent.action.IMS_CONFIG_CHANGED";
62
63 /**
64 * Extra parameter "item" of intent ACTION_IMS_FEATURE_CHANGED and ACTION_IMS_CONFIG_CHANGED.
65 * It is the value of FeatureConstants or ConfigConstants.
66 *
67 * @hide
68 */
69 public static final String EXTRA_CHANGED_ITEM = "item";
70
71 /**
72 * Extra parameter "value" of intent ACTION_IMS_FEATURE_CHANGED and ACTION_IMS_CONFIG_CHANGED.
73 * It is the new value of "item".
74 *
75 * @hide
76 */
77 public static final String EXTRA_NEW_VALUE = "value";
78
79 /**
80 * Defines IMS service/capability feature constants.
Brad Ebinger112c36d2018-01-16 09:33:47 -080081 * @deprecated Use
82 * {@link android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability} instead.
Brad Ebinger21013dc2017-02-02 16:21:22 -080083 */
84 public static class FeatureConstants {
85 public static final int FEATURE_TYPE_UNKNOWN = -1;
86
87 /**
88 * FEATURE_TYPE_VOLTE supports features defined in 3GPP and
89 * GSMA IR.92 over LTE.
90 */
91 public static final int FEATURE_TYPE_VOICE_OVER_LTE = 0;
92
93 /**
94 * FEATURE_TYPE_LVC supports features defined in 3GPP and
95 * GSMA IR.94 over LTE.
96 */
97 public static final int FEATURE_TYPE_VIDEO_OVER_LTE = 1;
98
99 /**
100 * FEATURE_TYPE_VOICE_OVER_WIFI supports features defined in 3GPP and
101 * GSMA IR.92 over WiFi.
102 */
103 public static final int FEATURE_TYPE_VOICE_OVER_WIFI = 2;
104
105 /**
106 * FEATURE_TYPE_VIDEO_OVER_WIFI supports features defined in 3GPP and
107 * GSMA IR.94 over WiFi.
108 */
109 public static final int FEATURE_TYPE_VIDEO_OVER_WIFI = 3;
110
111 /**
112 * FEATURE_TYPE_UT supports features defined in 3GPP and
113 * GSMA IR.92 over LTE.
114 */
115 public static final int FEATURE_TYPE_UT_OVER_LTE = 4;
116
117 /**
118 * FEATURE_TYPE_UT_OVER_WIFI supports features defined in 3GPP and
119 * GSMA IR.92 over WiFi.
120 */
121 public static final int FEATURE_TYPE_UT_OVER_WIFI = 5;
122 }
123
124 /**
125 * Defines IMS service/capability parameters.
126 */
127 public static class ConfigConstants {
128
129 // Define IMS config items
130 public static final int CONFIG_START = 0;
131
132 // Define operator provisioned config items
133 public static final int PROVISIONED_CONFIG_START = CONFIG_START;
134
135 /**
136 * AMR CODEC Mode Value set, 0-7 in comma separated sequence.
137 * Value is in String format.
138 */
139 public static final int VOCODER_AMRMODESET = CONFIG_START;
140
141 /**
142 * Wide Band AMR CODEC Mode Value set,0-7 in comma separated sequence.
143 * Value is in String format.
144 */
145 public static final int VOCODER_AMRWBMODESET = 1;
146
147 /**
148 * SIP Session Timer value (seconds).
149 * Value is in Integer format.
150 */
151 public static final int SIP_SESSION_TIMER = 2;
152
153 /**
154 * Minimum SIP Session Expiration Timer in (seconds).
155 * Value is in Integer format.
156 */
157 public static final int MIN_SE = 3;
158
159 /**
160 * SIP_INVITE cancellation time out value (in milliseconds). Integer format.
161 * Value is in Integer format.
162 */
163 public static final int CANCELLATION_TIMER = 4;
164
165 /**
166 * Delay time when an iRAT transition from eHRPD/HRPD/1xRTT to LTE.
167 * Value is in Integer format.
168 */
169 public static final int TDELAY = 5;
170
171 /**
172 * Silent redial status of Enabled (True), or Disabled (False).
173 * Value is in Integer format.
174 */
175 public static final int SILENT_REDIAL_ENABLE = 6;
176
177 /**
178 * SIP T1 timer value in milliseconds. See RFC 3261 for define.
179 * Value is in Integer format.
180 */
Brad Ebinger103273162020-01-07 16:58:44 -0800181 public static final int SIP_T1_TIMER = ProvisioningManager.KEY_T1_TIMER_VALUE_MS;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800182
183 /**
184 * SIP T2 timer value in milliseconds. See RFC 3261 for define.
185 * Value is in Integer format.
186 */
187 public static final int SIP_T2_TIMER = 8;
188
189 /**
190 * SIP TF timer value in milliseconds. See RFC 3261 for define.
191 * Value is in Integer format.
192 */
193 public static final int SIP_TF_TIMER = 9;
194
195 /**
196 * VoLTE status for VLT/s status of Enabled (1), or Disabled (0).
197 * Value is in Integer format.
198 */
Brad Ebinger103273162020-01-07 16:58:44 -0800199 public static final int VLT_SETTING_ENABLED =
200 ProvisioningManager.KEY_VOLTE_PROVISIONING_STATUS;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800201
202 /**
203 * VoLTE status for LVC/s status of Enabled (1), or Disabled (0).
204 * Value is in Integer format.
205 */
Brad Ebinger103273162020-01-07 16:58:44 -0800206 public static final int LVC_SETTING_ENABLED =
207 ProvisioningManager.KEY_VT_PROVISIONING_STATUS;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800208 /**
209 * Domain Name for the device to populate the request URI for REGISTRATION.
210 * Value is in String format.
211 */
212 public static final int DOMAIN_NAME = 12;
213 /**
214 * Device Outgoing SMS based on either 3GPP or 3GPP2 standards.
215 * Value is in Integer format. 3GPP2(0), 3GPP(1)
216 */
217 public static final int SMS_FORMAT = 13;
218 /**
219 * Turns IMS ON/OFF on the device.
220 * Value is in Integer format. ON (1), OFF(0).
221 */
222 public static final int SMS_OVER_IP = 14;
223 /**
224 * Requested expiration for Published Online availability.
225 * Value is in Integer format.
226 */
Brad Ebinger103273162020-01-07 16:58:44 -0800227 public static final int PUBLISH_TIMER = ProvisioningManager.KEY_RCS_PUBLISH_TIMER_SEC;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800228 /**
229 * Requested expiration for Published Offline availability.
230 * Value is in Integer format.
231 */
Brad Ebinger103273162020-01-07 16:58:44 -0800232 public static final int PUBLISH_TIMER_EXTENDED =
233 ProvisioningManager.KEY_RCS_PUBLISH_TIMER_EXTENDED_SEC;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800234 /**
235 *
236 * Value is in Integer format.
237 */
Brad Ebinger103273162020-01-07 16:58:44 -0800238 public static final int CAPABILITY_DISCOVERY_ENABLED =
239 ProvisioningManager.KEY_RCS_CAPABILITY_DISCOVERY_ENABLED;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800240 /**
241 * Period of time the capability information of the contact is cached on handset.
242 * Value is in Integer format.
243 */
Brad Ebinger103273162020-01-07 16:58:44 -0800244 public static final int CAPABILITIES_CACHE_EXPIRATION =
245 ProvisioningManager.KEY_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800246 /**
247 * Peiod of time the availability information of a contact is cached on device.
248 * Value is in Integer format.
249 */
Brad Ebinger103273162020-01-07 16:58:44 -0800250 public static final int AVAILABILITY_CACHE_EXPIRATION =
251 ProvisioningManager.KEY_RCS_AVAILABILITY_CACHE_EXPIRATION_SEC;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800252 /**
253 * Interval between successive capabilities polling.
254 * Value is in Integer format.
255 */
Brad Ebinger103273162020-01-07 16:58:44 -0800256 public static final int CAPABILITIES_POLL_INTERVAL =
257 ProvisioningManager.KEY_RCS_CAPABILITIES_POLL_INTERVAL_SEC;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800258 /**
259 * Minimum time between two published messages from the device.
260 * Value is in Integer format.
261 */
Brad Ebinger103273162020-01-07 16:58:44 -0800262 public static final int SOURCE_THROTTLE_PUBLISH =
263 ProvisioningManager.KEY_RCS_PUBLISH_SOURCE_THROTTLE_MS;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800264 /**
265 * The Maximum number of MDNs contained in one Request Contained List.
266 * Value is in Integer format.
267 */
Brad Ebinger103273162020-01-07 16:58:44 -0800268 public static final int MAX_NUMENTRIES_IN_RCL =
269 ProvisioningManager.KEY_RCS_MAX_NUM_ENTRIES_IN_RCL;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800270 /**
271 * Expiration timer for subscription of a Request Contained List, used in capability
272 * polling.
273 * Value is in Integer format.
274 */
Brad Ebinger103273162020-01-07 16:58:44 -0800275 public static final int CAPAB_POLL_LIST_SUB_EXP =
276 ProvisioningManager.KEY_RCS_CAPABILITY_POLL_LIST_SUB_EXP_SEC;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800277 /**
278 * Applies compression to LIST Subscription.
279 * Value is in Integer format. Enable (1), Disable(0).
280 */
281 public static final int GZIP_FLAG = 24;
282 /**
283 * VOLTE Status for EAB/s status of Enabled (1), or Disabled (0).
284 * Value is in Integer format.
285 */
Brad Ebinger103273162020-01-07 16:58:44 -0800286 public static final int EAB_SETTING_ENABLED =
287 ProvisioningManager.KEY_EAB_PROVISIONING_STATUS;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800288 /**
289 * Wi-Fi calling roaming status.
290 * Value is in Integer format. ON (1), OFF(0).
291 */
Brad Ebingerad9aec32019-01-11 16:36:34 -0800292 public static final int VOICE_OVER_WIFI_ROAMING =
293 ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800294 /**
295 * Wi-Fi calling modem - WfcModeFeatureValueConstants.
296 * Value is in Integer format.
297 */
Brad Ebingerad9aec32019-01-11 16:36:34 -0800298 public static final int VOICE_OVER_WIFI_MODE =
299 ProvisioningManager.KEY_VOICE_OVER_WIFI_MODE_OVERRIDE;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800300 /**
301 * VOLTE Status for voice over wifi status of Enabled (1), or Disabled (0).
302 * Value is in Integer format.
303 */
304 public static final int VOICE_OVER_WIFI_SETTING_ENABLED = 28;
305 /**
306 * Mobile data enabled.
307 * Value is in Integer format. On (1), OFF(0).
308 */
309 public static final int MOBILE_DATA_ENABLED = 29;
310 /**
311 * VoLTE user opted in status.
312 * Value is in Integer format. Opted-in (1) Opted-out (0).
313 */
314 public static final int VOLTE_USER_OPT_IN_STATUS = 30;
315 /**
316 * Proxy for Call Session Control Function(P-CSCF) address for Local-BreakOut(LBO).
317 * Value is in String format.
318 */
319 public static final int LBO_PCSCF_ADDRESS = 31;
320 /**
321 * Keep Alive Enabled for SIP.
322 * Value is in Integer format. On(1), OFF(0).
323 */
324 public static final int KEEP_ALIVE_ENABLED = 32;
325 /**
326 * Registration retry Base Time value in seconds.
327 * Value is in Integer format.
328 */
329 public static final int REGISTRATION_RETRY_BASE_TIME_SEC = 33;
330 /**
331 * Registration retry Max Time value in seconds.
332 * Value is in Integer format.
333 */
334 public static final int REGISTRATION_RETRY_MAX_TIME_SEC = 34;
335 /**
336 * Smallest RTP port for speech codec.
337 * Value is in integer format.
338 */
339 public static final int SPEECH_START_PORT = 35;
340 /**
341 * Largest RTP port for speech code.
342 * Value is in Integer format.
343 */
344 public static final int SPEECH_END_PORT = 36;
345 /**
346 * SIP Timer A's value in milliseconds. Timer A is the INVITE request
347 * retransmit interval, for UDP only.
348 * Value is in Integer format.
349 */
350 public static final int SIP_INVITE_REQ_RETX_INTERVAL_MSEC = 37;
351 /**
352 * SIP Timer B's value in milliseconds. Timer B is the wait time for
353 * INVITE message to be acknowledged.
354 * Value is in Integer format.
355 */
356 public static final int SIP_INVITE_RSP_WAIT_TIME_MSEC = 38;
357 /**
358 * SIP Timer D's value in milliseconds. Timer D is the wait time for
359 * response retransmits of the invite client transactions.
360 * Value is in Integer format.
361 */
362 public static final int SIP_INVITE_RSP_RETX_WAIT_TIME_MSEC = 39;
363 /**
364 * SIP Timer E's value in milliseconds. Timer E is the value Non-INVITE
365 * request retransmit interval, for UDP only.
366 * Value is in Integer format.
367 */
368 public static final int SIP_NON_INVITE_REQ_RETX_INTERVAL_MSEC = 40;
369 /**
370 * SIP Timer F's value in milliseconds. Timer F is the Non-INVITE transaction
371 * timeout timer.
372 * Value is in Integer format.
373 */
374 public static final int SIP_NON_INVITE_TXN_TIMEOUT_TIMER_MSEC = 41;
375 /**
376 * SIP Timer G's value in milliseconds. Timer G is the value of INVITE response
377 * retransmit interval.
378 * Value is in Integer format.
379 */
380 public static final int SIP_INVITE_RSP_RETX_INTERVAL_MSEC = 42;
381 /**
382 * SIP Timer H's value in milliseconds. Timer H is the value of wait time for
383 * ACK receipt.
384 * Value is in Integer format.
385 */
386 public static final int SIP_ACK_RECEIPT_WAIT_TIME_MSEC = 43;
387 /**
388 * SIP Timer I's value in milliseconds. Timer I is the value of wait time for
389 * ACK retransmits.
390 * Value is in Integer format.
391 */
392 public static final int SIP_ACK_RETX_WAIT_TIME_MSEC = 44;
393 /**
394 * SIP Timer J's value in milliseconds. Timer J is the value of wait time for
395 * non-invite request retransmission.
396 * Value is in Integer format.
397 */
398 public static final int SIP_NON_INVITE_REQ_RETX_WAIT_TIME_MSEC = 45;
399 /**
400 * SIP Timer K's value in milliseconds. Timer K is the value of wait time for
401 * non-invite response retransmits.
402 * Value is in Integer format.
403 */
404 public static final int SIP_NON_INVITE_RSP_RETX_WAIT_TIME_MSEC = 46;
405 /**
406 * AMR WB octet aligned dynamic payload type.
407 * Value is in Integer format.
408 */
409 public static final int AMR_WB_OCTET_ALIGNED_PT = 47;
410 /**
411 * AMR WB bandwidth efficient payload type.
412 * Value is in Integer format.
413 */
414 public static final int AMR_WB_BANDWIDTH_EFFICIENT_PT = 48;
415 /**
416 * AMR octet aligned dynamic payload type.
417 * Value is in Integer format.
418 */
419 public static final int AMR_OCTET_ALIGNED_PT = 49;
420 /**
421 * AMR bandwidth efficient payload type.
422 * Value is in Integer format.
423 */
424 public static final int AMR_BANDWIDTH_EFFICIENT_PT = 50;
425 /**
426 * DTMF WB payload type.
427 * Value is in Integer format.
428 */
429 public static final int DTMF_WB_PT = 51;
430 /**
431 * DTMF NB payload type.
432 * Value is in Integer format.
433 */
434 public static final int DTMF_NB_PT = 52;
435 /**
436 * AMR Default encoding mode.
437 * Value is in Integer format.
438 */
439 public static final int AMR_DEFAULT_MODE = 53;
440 /**
441 * SMS Public Service Identity.
442 * Value is in String format.
443 */
444 public static final int SMS_PSI = 54;
445 /**
446 * Video Quality - VideoQualityFeatureValuesConstants.
447 * Value is in Integer format.
448 */
449 public static final int VIDEO_QUALITY = 55;
450 /**
451 * LTE threshold.
452 * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A.
453 */
454 public static final int TH_LTE1 = 56;
455 /**
456 * LTE threshold.
457 * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
458 */
459 public static final int TH_LTE2 = 57;
460 /**
461 * LTE threshold.
462 * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
463 */
464 public static final int TH_LTE3 = 58;
465 /**
466 * 1x threshold.
467 * Handover from 1x to WiFi if 1x < TH1x
468 */
469 public static final int TH_1x = 59;
470 /**
471 * WiFi threshold.
472 * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A.
473 */
474 public static final int VOWT_A = 60;
475 /**
476 * WiFi threshold.
477 * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
478 */
479 public static final int VOWT_B = 61;
480 /**
481 * LTE ePDG timer.
482 * Device shall not handover back to LTE until the T_ePDG_LTE timer expires.
483 */
484 public static final int T_EPDG_LTE = 62;
485 /**
486 * WiFi ePDG timer.
487 * Device shall not handover back to WiFi until the T_ePDG_WiFi timer expires.
488 */
489 public static final int T_EPDG_WIFI = 63;
490 /**
491 * 1x ePDG timer.
492 * Device shall not re-register on 1x until the T_ePDG_1x timer expires.
493 */
494 public static final int T_EPDG_1X = 64;
495 /**
496 * MultiEndpoint status: Enabled (1), or Disabled (0).
497 * Value is in Integer format.
498 */
499 public static final int VICE_SETTING_ENABLED = 65;
500
Anju Mathapati7e177da2017-01-24 11:58:28 -0800501 /**
502 * RTT status: Enabled (1), or Disabled (0).
503 * Value is in Integer format.
504 */
505 public static final int RTT_SETTING_ENABLED = 66;
506
Brad Ebinger21013dc2017-02-02 16:21:22 -0800507 // Expand the operator config items as needed here, need to change
508 // PROVISIONED_CONFIG_END after that.
Anju Mathapati7e177da2017-01-24 11:58:28 -0800509 public static final int PROVISIONED_CONFIG_END = RTT_SETTING_ENABLED;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800510
511 // Expand the operator config items as needed here.
512 }
513
514 /**
515 * Defines IMS set operation status.
516 */
517 public static class OperationStatusConstants {
518 public static final int UNKNOWN = -1;
519 public static final int SUCCESS = 0;
520 public static final int FAILED = 1;
521 public static final int UNSUPPORTED_CAUSE_NONE = 2;
522 public static final int UNSUPPORTED_CAUSE_RAT = 3;
523 public static final int UNSUPPORTED_CAUSE_DISABLED = 4;
524 }
525
526 /**
527 * Defines IMS get operation values.
528 */
529 public static class OperationValuesConstants {
530 /**
531 * Values related to Video Quality
532 */
533 public static final int VIDEO_QUALITY_UNKNOWN = -1;
534 public static final int VIDEO_QUALITY_LOW = 0;
535 public static final int VIDEO_QUALITY_HIGH = 1;
536 }
537
538 /**
539 * Defines IMS video quality feature value.
540 */
541 public static class VideoQualityFeatureValuesConstants {
542 public static final int LOW = 0;
543 public static final int HIGH = 1;
544 }
545
546 /**
547 * Defines IMS feature value.
548 */
549 public static class FeatureValueConstants {
Brad Ebinger27ca2682017-08-25 14:53:30 -0700550 public static final int ERROR = -1;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800551 public static final int OFF = 0;
552 public static final int ON = 1;
553 }
554
555 /**
556 * Defines IMS feature value.
557 */
558 public static class WfcModeFeatureValueConstants {
559 public static final int WIFI_ONLY = 0;
560 public static final int CELLULAR_PREFERRED = 1;
561 public static final int WIFI_PREFERRED = 2;
562 }
563
Brad Ebinger515021e2018-04-26 14:27:10 -0700564 public ImsConfig(IImsConfig iconfig) {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800565 miConfig = iconfig;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800566 }
567
568 /**
Brad Ebinger515021e2018-04-26 14:27:10 -0700569 * @deprecated see {@link #getConfigInt(int)} instead.
Brad Ebinger112c36d2018-01-16 09:33:47 -0800570 */
571 public int getProvisionedValue(int item) throws ImsException {
572 return getConfigInt(item);
573 }
574
575 /**
576 * Gets the configuration value for IMS service/capabilities parameters used by IMS stack.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800577 *
578 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
579 * @return the value in Integer format.
Brad Ebinger112c36d2018-01-16 09:33:47 -0800580 * @throws ImsException if the ImsService is unavailable.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800581 */
Brad Ebinger112c36d2018-01-16 09:33:47 -0800582 public int getConfigInt(int item) throws ImsException {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800583 int ret = 0;
584 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800585 ret = miConfig.getConfigInt(item);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800586 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800587 throw new ImsException("getInt()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800588 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
589 }
Brad Ebinger112c36d2018-01-16 09:33:47 -0800590 if (DBG) Rlog.d(TAG, "getInt(): item = " + item + ", ret =" + ret);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800591
592 return ret;
593 }
594
595 /**
Brad Ebinger112c36d2018-01-16 09:33:47 -0800596 * @deprecated see {@link #getConfigString(int)} instead
597 */
598 public String getProvisionedStringValue(int item) throws ImsException {
599 return getConfigString(item);
600 }
601
602 /**
603 * Gets the configuration value for IMS service/capabilities parameters used by IMS stack.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800604 *
605 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
606 * @return value in String format.
607 *
Brad Ebinger112c36d2018-01-16 09:33:47 -0800608 * @throws ImsException if the ImsService is unavailable.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800609 */
Brad Ebinger112c36d2018-01-16 09:33:47 -0800610 public String getConfigString(int item) throws ImsException {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800611 String ret = "Unknown";
612 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800613 ret = miConfig.getConfigString(item);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800614 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800615 throw new ImsException("getConfigString()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800616 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
617 }
Brad Ebinger112c36d2018-01-16 09:33:47 -0800618 if (DBG) Rlog.d(TAG, "getConfigString(): item = " + item + ", ret =" + ret);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800619
620 return ret;
621 }
622
623 /**
Brad Ebinger112c36d2018-01-16 09:33:47 -0800624 * @deprecated see {@link #setConfig(int, int)} instead.
625 */
626 public int setProvisionedValue(int item, int value) throws ImsException {
627 return setConfig(item, value);
628 }
629
630 /**
631 * @deprecated see {@link #setConfig(int, String)} instead.
632 */
633 public int setProvisionedStringValue(int item, String value) throws ImsException {
634 return setConfig(item, value);
635 }
636
637 /**
638 * Sets the value for ImsService configuration item.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800639 *
640 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
641 * @param value in Integer format.
642 * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants
643 *
Brad Ebinger112c36d2018-01-16 09:33:47 -0800644 * @throws ImsException if the ImsService is unavailable.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800645 */
Brad Ebinger112c36d2018-01-16 09:33:47 -0800646 public int setConfig(int item, int value) throws ImsException {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800647 int ret = OperationStatusConstants.UNKNOWN;
648 if (DBG) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800649 Rlog.d(TAG, "setConfig(): item = " + item +
Brad Ebinger21013dc2017-02-02 16:21:22 -0800650 "value = " + value);
651 }
652 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800653 ret = miConfig.setConfigInt(item, value);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800654 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800655 throw new ImsException("setConfig()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800656 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
657 }
658 if (DBG) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800659 Rlog.d(TAG, "setConfig(): item = " + item +
660 " value = " + value + " ret = " + ret);
661 }
662
663 return ret;
664
665 }
666
667 /**
668 * Sets the value for ImsService configuration item.
669 *
670 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
671 * @param value in Integer format.
672 * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants
673 *
674 * @throws ImsException if the ImsService is unavailable.
675 */
676 public int setConfig(int item, String value) throws ImsException {
677 int ret = OperationStatusConstants.UNKNOWN;
678 if (DBG) {
679 Rlog.d(TAG, "setConfig(): item = " + item +
680 "value = " + value);
681 }
682 try {
683 ret = miConfig.setConfigString(item, value);
684 } catch (RemoteException e) {
685 throw new ImsException("setConfig()", e,
686 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
687 }
688 if (DBG) {
689 Rlog.d(TAG, "setConfig(): item = " + item +
Brad Ebinger21013dc2017-02-02 16:21:22 -0800690 " value = " + value + " ret = " + ret);
691 }
Malcolm Chen2b460022017-11-01 13:19:30 -0700692
Brad Ebinger21013dc2017-02-02 16:21:22 -0800693 return ret;
694 }
695
696 /**
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700697 * Adds a {@link ProvisioningManager.Callback} to the ImsService to notify when a Configuration
Brad Ebinger112c36d2018-01-16 09:33:47 -0800698 * item has changed.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800699 *
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700700 * Make sure to call {@link #removeConfigCallback(IImsConfigCallback)} when finished
Brad Ebinger112c36d2018-01-16 09:33:47 -0800701 * using this callback.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800702 */
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700703 public void addConfigCallback(ProvisioningManager.Callback callback) throws ImsException {
704 callback.setExecutor(getThreadExecutor());
705 addConfigCallback(callback.getBinder());
706 }
707
708 /**
709 * Adds a {@link IImsConfigCallback} to the ImsService to notify when a Configuration
710 * item has changed.
711 *
712 * Make sure to call {@link #removeConfigCallback(IImsConfigCallback)} when finished
713 * using this callback.
714 */
715 public void addConfigCallback(IImsConfigCallback callback) throws ImsException {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800716 if (DBG) Rlog.d(TAG, "addConfigCallback: " + callback);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800717 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800718 miConfig.addImsConfigCallback(callback);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800719 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800720 throw new ImsException("addConfigCallback()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800721 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
722 }
723 }
724
725 /**
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700726 * Removes an existing {@link IImsConfigCallback} from the ImsService.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800727 */
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700728 public void removeConfigCallback(IImsConfigCallback callback) throws ImsException {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800729 if (DBG) Rlog.d(TAG, "removeConfigCallback: " + callback);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800730 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800731 miConfig.removeImsConfigCallback(callback);
732 } catch (RemoteException e) {
733 throw new ImsException("removeConfigCallback()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800734 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
735 }
736 }
Brad Ebingerc24bc102017-06-22 11:39:11 -0700737
738 /**
739 * @return true if the binder connection is alive, false otherwise.
740 */
741 public boolean isBinderAlive() {
742 return miConfig.asBinder().isBinderAlive();
743 }
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700744
745 private Executor getThreadExecutor() {
746 if (Looper.myLooper() == null) {
747 Looper.prepare();
748 }
749 return new HandlerExecutor(new Handler(Looper.myLooper()));
750 }
Brad Ebinger21013dc2017-02-02 16:21:22 -0800751}