blob: 71a21743a449c402d8413a83b1a68913ef5595fc [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;
20import android.os.HandlerExecutor;
21import android.os.Looper;
Brad Ebinger21013dc2017-02-02 16:21:22 -080022import android.os.RemoteException;
23import android.telephony.Rlog;
Brad Ebingerf8c3cd82018-01-22 13:51:52 -080024import android.telephony.ims.ImsReasonInfo;
Brad Ebinger0d36ed22018-10-31 11:22:26 -070025import android.telephony.ims.ProvisioningManager;
Brad Ebinger112c36d2018-01-16 09:33:47 -080026import android.telephony.ims.aidl.IImsConfig;
Brad Ebinger0d36ed22018-10-31 11:22:26 -070027import android.telephony.ims.aidl.IImsConfigCallback;
28
29import java.util.concurrent.Executor;
Brad Ebinger21013dc2017-02-02 16:21:22 -080030
31/**
32 * Provides APIs to get/set the IMS service feature/capability/parameters.
33 * The config items include:
34 * 1) Items provisioned by the operator.
35 * 2) Items configured by user. Mainly service feature class.
36 *
Brad Ebinger0d36ed22018-10-31 11:22:26 -070037 * @deprecated Use {@link ProvisioningManager} to change these configurations in the ImsService.
Brad Ebinger21013dc2017-02-02 16:21:22 -080038 * @hide
39 */
Brad Ebinger0d36ed22018-10-31 11:22:26 -070040@Deprecated
Brad Ebinger21013dc2017-02-02 16:21:22 -080041public class ImsConfig {
42 private static final String TAG = "ImsConfig";
43 private boolean DBG = true;
44 private final IImsConfig miConfig;
Brad Ebinger21013dc2017-02-02 16:21:22 -080045
46 /**
47 * Broadcast action: the feature enable status was changed
48 *
49 * @hide
50 */
51 public static final String ACTION_IMS_FEATURE_CHANGED =
52 "com.android.intent.action.IMS_FEATURE_CHANGED";
53
54 /**
55 * Broadcast action: the configuration was changed
Brad Ebinger0d36ed22018-10-31 11:22:26 -070056 * @deprecated Use {@link android.telephony.ims.ProvisioningManager.Callback} instead.
Brad Ebinger21013dc2017-02-02 16:21:22 -080057 * @hide
58 */
59 public static final String ACTION_IMS_CONFIG_CHANGED =
60 "com.android.intent.action.IMS_CONFIG_CHANGED";
61
62 /**
63 * Extra parameter "item" of intent ACTION_IMS_FEATURE_CHANGED and ACTION_IMS_CONFIG_CHANGED.
64 * It is the value of FeatureConstants or ConfigConstants.
65 *
66 * @hide
67 */
68 public static final String EXTRA_CHANGED_ITEM = "item";
69
70 /**
71 * Extra parameter "value" of intent ACTION_IMS_FEATURE_CHANGED and ACTION_IMS_CONFIG_CHANGED.
72 * It is the new value of "item".
73 *
74 * @hide
75 */
76 public static final String EXTRA_NEW_VALUE = "value";
77
78 /**
79 * Defines IMS service/capability feature constants.
Brad Ebinger112c36d2018-01-16 09:33:47 -080080 * @deprecated Use
81 * {@link android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability} instead.
Brad Ebinger21013dc2017-02-02 16:21:22 -080082 */
83 public static class FeatureConstants {
84 public static final int FEATURE_TYPE_UNKNOWN = -1;
85
86 /**
87 * FEATURE_TYPE_VOLTE supports features defined in 3GPP and
88 * GSMA IR.92 over LTE.
89 */
90 public static final int FEATURE_TYPE_VOICE_OVER_LTE = 0;
91
92 /**
93 * FEATURE_TYPE_LVC supports features defined in 3GPP and
94 * GSMA IR.94 over LTE.
95 */
96 public static final int FEATURE_TYPE_VIDEO_OVER_LTE = 1;
97
98 /**
99 * FEATURE_TYPE_VOICE_OVER_WIFI supports features defined in 3GPP and
100 * GSMA IR.92 over WiFi.
101 */
102 public static final int FEATURE_TYPE_VOICE_OVER_WIFI = 2;
103
104 /**
105 * FEATURE_TYPE_VIDEO_OVER_WIFI supports features defined in 3GPP and
106 * GSMA IR.94 over WiFi.
107 */
108 public static final int FEATURE_TYPE_VIDEO_OVER_WIFI = 3;
109
110 /**
111 * FEATURE_TYPE_UT supports features defined in 3GPP and
112 * GSMA IR.92 over LTE.
113 */
114 public static final int FEATURE_TYPE_UT_OVER_LTE = 4;
115
116 /**
117 * FEATURE_TYPE_UT_OVER_WIFI supports features defined in 3GPP and
118 * GSMA IR.92 over WiFi.
119 */
120 public static final int FEATURE_TYPE_UT_OVER_WIFI = 5;
121 }
122
123 /**
124 * Defines IMS service/capability parameters.
125 */
126 public static class ConfigConstants {
127
128 // Define IMS config items
129 public static final int CONFIG_START = 0;
130
131 // Define operator provisioned config items
132 public static final int PROVISIONED_CONFIG_START = CONFIG_START;
133
134 /**
135 * AMR CODEC Mode Value set, 0-7 in comma separated sequence.
136 * Value is in String format.
137 */
138 public static final int VOCODER_AMRMODESET = CONFIG_START;
139
140 /**
141 * Wide Band AMR CODEC Mode Value set,0-7 in comma separated sequence.
142 * Value is in String format.
143 */
144 public static final int VOCODER_AMRWBMODESET = 1;
145
146 /**
147 * SIP Session Timer value (seconds).
148 * Value is in Integer format.
149 */
150 public static final int SIP_SESSION_TIMER = 2;
151
152 /**
153 * Minimum SIP Session Expiration Timer in (seconds).
154 * Value is in Integer format.
155 */
156 public static final int MIN_SE = 3;
157
158 /**
159 * SIP_INVITE cancellation time out value (in milliseconds). Integer format.
160 * Value is in Integer format.
161 */
162 public static final int CANCELLATION_TIMER = 4;
163
164 /**
165 * Delay time when an iRAT transition from eHRPD/HRPD/1xRTT to LTE.
166 * Value is in Integer format.
167 */
168 public static final int TDELAY = 5;
169
170 /**
171 * Silent redial status of Enabled (True), or Disabled (False).
172 * Value is in Integer format.
173 */
174 public static final int SILENT_REDIAL_ENABLE = 6;
175
176 /**
177 * SIP T1 timer value in milliseconds. See RFC 3261 for define.
178 * Value is in Integer format.
179 */
180 public static final int SIP_T1_TIMER = 7;
181
182 /**
183 * SIP T2 timer value in milliseconds. See RFC 3261 for define.
184 * Value is in Integer format.
185 */
186 public static final int SIP_T2_TIMER = 8;
187
188 /**
189 * SIP TF timer value in milliseconds. See RFC 3261 for define.
190 * Value is in Integer format.
191 */
192 public static final int SIP_TF_TIMER = 9;
193
194 /**
195 * VoLTE status for VLT/s status of Enabled (1), or Disabled (0).
196 * Value is in Integer format.
197 */
198 public static final int VLT_SETTING_ENABLED = 10;
199
200 /**
201 * VoLTE status for LVC/s status of Enabled (1), or Disabled (0).
202 * Value is in Integer format.
203 */
204 public static final int LVC_SETTING_ENABLED = 11;
205 /**
206 * Domain Name for the device to populate the request URI for REGISTRATION.
207 * Value is in String format.
208 */
209 public static final int DOMAIN_NAME = 12;
210 /**
211 * Device Outgoing SMS based on either 3GPP or 3GPP2 standards.
212 * Value is in Integer format. 3GPP2(0), 3GPP(1)
213 */
214 public static final int SMS_FORMAT = 13;
215 /**
216 * Turns IMS ON/OFF on the device.
217 * Value is in Integer format. ON (1), OFF(0).
218 */
219 public static final int SMS_OVER_IP = 14;
220 /**
221 * Requested expiration for Published Online availability.
222 * Value is in Integer format.
223 */
224 public static final int PUBLISH_TIMER = 15;
225 /**
226 * Requested expiration for Published Offline availability.
227 * Value is in Integer format.
228 */
229 public static final int PUBLISH_TIMER_EXTENDED = 16;
230 /**
231 *
232 * Value is in Integer format.
233 */
234 public static final int CAPABILITY_DISCOVERY_ENABLED = 17;
235 /**
236 * Period of time the capability information of the contact is cached on handset.
237 * Value is in Integer format.
238 */
239 public static final int CAPABILITIES_CACHE_EXPIRATION = 18;
240 /**
241 * Peiod of time the availability information of a contact is cached on device.
242 * Value is in Integer format.
243 */
244 public static final int AVAILABILITY_CACHE_EXPIRATION = 19;
245 /**
246 * Interval between successive capabilities polling.
247 * Value is in Integer format.
248 */
249 public static final int CAPABILITIES_POLL_INTERVAL = 20;
250 /**
251 * Minimum time between two published messages from the device.
252 * Value is in Integer format.
253 */
254 public static final int SOURCE_THROTTLE_PUBLISH = 21;
255 /**
256 * The Maximum number of MDNs contained in one Request Contained List.
257 * Value is in Integer format.
258 */
259 public static final int MAX_NUMENTRIES_IN_RCL = 22;
260 /**
261 * Expiration timer for subscription of a Request Contained List, used in capability
262 * polling.
263 * Value is in Integer format.
264 */
265 public static final int CAPAB_POLL_LIST_SUB_EXP = 23;
266 /**
267 * Applies compression to LIST Subscription.
268 * Value is in Integer format. Enable (1), Disable(0).
269 */
270 public static final int GZIP_FLAG = 24;
271 /**
272 * VOLTE Status for EAB/s status of Enabled (1), or Disabled (0).
273 * Value is in Integer format.
274 */
275 public static final int EAB_SETTING_ENABLED = 25;
276 /**
277 * Wi-Fi calling roaming status.
278 * Value is in Integer format. ON (1), OFF(0).
279 */
280 public static final int VOICE_OVER_WIFI_ROAMING = 26;
281 /**
282 * Wi-Fi calling modem - WfcModeFeatureValueConstants.
283 * Value is in Integer format.
284 */
285 public static final int VOICE_OVER_WIFI_MODE = 27;
286 /**
287 * VOLTE Status for voice over wifi status of Enabled (1), or Disabled (0).
288 * Value is in Integer format.
289 */
290 public static final int VOICE_OVER_WIFI_SETTING_ENABLED = 28;
291 /**
292 * Mobile data enabled.
293 * Value is in Integer format. On (1), OFF(0).
294 */
295 public static final int MOBILE_DATA_ENABLED = 29;
296 /**
297 * VoLTE user opted in status.
298 * Value is in Integer format. Opted-in (1) Opted-out (0).
299 */
300 public static final int VOLTE_USER_OPT_IN_STATUS = 30;
301 /**
302 * Proxy for Call Session Control Function(P-CSCF) address for Local-BreakOut(LBO).
303 * Value is in String format.
304 */
305 public static final int LBO_PCSCF_ADDRESS = 31;
306 /**
307 * Keep Alive Enabled for SIP.
308 * Value is in Integer format. On(1), OFF(0).
309 */
310 public static final int KEEP_ALIVE_ENABLED = 32;
311 /**
312 * Registration retry Base Time value in seconds.
313 * Value is in Integer format.
314 */
315 public static final int REGISTRATION_RETRY_BASE_TIME_SEC = 33;
316 /**
317 * Registration retry Max Time value in seconds.
318 * Value is in Integer format.
319 */
320 public static final int REGISTRATION_RETRY_MAX_TIME_SEC = 34;
321 /**
322 * Smallest RTP port for speech codec.
323 * Value is in integer format.
324 */
325 public static final int SPEECH_START_PORT = 35;
326 /**
327 * Largest RTP port for speech code.
328 * Value is in Integer format.
329 */
330 public static final int SPEECH_END_PORT = 36;
331 /**
332 * SIP Timer A's value in milliseconds. Timer A is the INVITE request
333 * retransmit interval, for UDP only.
334 * Value is in Integer format.
335 */
336 public static final int SIP_INVITE_REQ_RETX_INTERVAL_MSEC = 37;
337 /**
338 * SIP Timer B's value in milliseconds. Timer B is the wait time for
339 * INVITE message to be acknowledged.
340 * Value is in Integer format.
341 */
342 public static final int SIP_INVITE_RSP_WAIT_TIME_MSEC = 38;
343 /**
344 * SIP Timer D's value in milliseconds. Timer D is the wait time for
345 * response retransmits of the invite client transactions.
346 * Value is in Integer format.
347 */
348 public static final int SIP_INVITE_RSP_RETX_WAIT_TIME_MSEC = 39;
349 /**
350 * SIP Timer E's value in milliseconds. Timer E is the value Non-INVITE
351 * request retransmit interval, for UDP only.
352 * Value is in Integer format.
353 */
354 public static final int SIP_NON_INVITE_REQ_RETX_INTERVAL_MSEC = 40;
355 /**
356 * SIP Timer F's value in milliseconds. Timer F is the Non-INVITE transaction
357 * timeout timer.
358 * Value is in Integer format.
359 */
360 public static final int SIP_NON_INVITE_TXN_TIMEOUT_TIMER_MSEC = 41;
361 /**
362 * SIP Timer G's value in milliseconds. Timer G is the value of INVITE response
363 * retransmit interval.
364 * Value is in Integer format.
365 */
366 public static final int SIP_INVITE_RSP_RETX_INTERVAL_MSEC = 42;
367 /**
368 * SIP Timer H's value in milliseconds. Timer H is the value of wait time for
369 * ACK receipt.
370 * Value is in Integer format.
371 */
372 public static final int SIP_ACK_RECEIPT_WAIT_TIME_MSEC = 43;
373 /**
374 * SIP Timer I's value in milliseconds. Timer I is the value of wait time for
375 * ACK retransmits.
376 * Value is in Integer format.
377 */
378 public static final int SIP_ACK_RETX_WAIT_TIME_MSEC = 44;
379 /**
380 * SIP Timer J's value in milliseconds. Timer J is the value of wait time for
381 * non-invite request retransmission.
382 * Value is in Integer format.
383 */
384 public static final int SIP_NON_INVITE_REQ_RETX_WAIT_TIME_MSEC = 45;
385 /**
386 * SIP Timer K's value in milliseconds. Timer K is the value of wait time for
387 * non-invite response retransmits.
388 * Value is in Integer format.
389 */
390 public static final int SIP_NON_INVITE_RSP_RETX_WAIT_TIME_MSEC = 46;
391 /**
392 * AMR WB octet aligned dynamic payload type.
393 * Value is in Integer format.
394 */
395 public static final int AMR_WB_OCTET_ALIGNED_PT = 47;
396 /**
397 * AMR WB bandwidth efficient payload type.
398 * Value is in Integer format.
399 */
400 public static final int AMR_WB_BANDWIDTH_EFFICIENT_PT = 48;
401 /**
402 * AMR octet aligned dynamic payload type.
403 * Value is in Integer format.
404 */
405 public static final int AMR_OCTET_ALIGNED_PT = 49;
406 /**
407 * AMR bandwidth efficient payload type.
408 * Value is in Integer format.
409 */
410 public static final int AMR_BANDWIDTH_EFFICIENT_PT = 50;
411 /**
412 * DTMF WB payload type.
413 * Value is in Integer format.
414 */
415 public static final int DTMF_WB_PT = 51;
416 /**
417 * DTMF NB payload type.
418 * Value is in Integer format.
419 */
420 public static final int DTMF_NB_PT = 52;
421 /**
422 * AMR Default encoding mode.
423 * Value is in Integer format.
424 */
425 public static final int AMR_DEFAULT_MODE = 53;
426 /**
427 * SMS Public Service Identity.
428 * Value is in String format.
429 */
430 public static final int SMS_PSI = 54;
431 /**
432 * Video Quality - VideoQualityFeatureValuesConstants.
433 * Value is in Integer format.
434 */
435 public static final int VIDEO_QUALITY = 55;
436 /**
437 * LTE threshold.
438 * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A.
439 */
440 public static final int TH_LTE1 = 56;
441 /**
442 * LTE threshold.
443 * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
444 */
445 public static final int TH_LTE2 = 57;
446 /**
447 * LTE threshold.
448 * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
449 */
450 public static final int TH_LTE3 = 58;
451 /**
452 * 1x threshold.
453 * Handover from 1x to WiFi if 1x < TH1x
454 */
455 public static final int TH_1x = 59;
456 /**
457 * WiFi threshold.
458 * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A.
459 */
460 public static final int VOWT_A = 60;
461 /**
462 * WiFi threshold.
463 * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
464 */
465 public static final int VOWT_B = 61;
466 /**
467 * LTE ePDG timer.
468 * Device shall not handover back to LTE until the T_ePDG_LTE timer expires.
469 */
470 public static final int T_EPDG_LTE = 62;
471 /**
472 * WiFi ePDG timer.
473 * Device shall not handover back to WiFi until the T_ePDG_WiFi timer expires.
474 */
475 public static final int T_EPDG_WIFI = 63;
476 /**
477 * 1x ePDG timer.
478 * Device shall not re-register on 1x until the T_ePDG_1x timer expires.
479 */
480 public static final int T_EPDG_1X = 64;
481 /**
482 * MultiEndpoint status: Enabled (1), or Disabled (0).
483 * Value is in Integer format.
484 */
485 public static final int VICE_SETTING_ENABLED = 65;
486
Anju Mathapati7e177da2017-01-24 11:58:28 -0800487 /**
488 * RTT status: Enabled (1), or Disabled (0).
489 * Value is in Integer format.
490 */
491 public static final int RTT_SETTING_ENABLED = 66;
492
Brad Ebinger21013dc2017-02-02 16:21:22 -0800493 // Expand the operator config items as needed here, need to change
494 // PROVISIONED_CONFIG_END after that.
Anju Mathapati7e177da2017-01-24 11:58:28 -0800495 public static final int PROVISIONED_CONFIG_END = RTT_SETTING_ENABLED;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800496
497 // Expand the operator config items as needed here.
498 }
499
500 /**
501 * Defines IMS set operation status.
502 */
503 public static class OperationStatusConstants {
504 public static final int UNKNOWN = -1;
505 public static final int SUCCESS = 0;
506 public static final int FAILED = 1;
507 public static final int UNSUPPORTED_CAUSE_NONE = 2;
508 public static final int UNSUPPORTED_CAUSE_RAT = 3;
509 public static final int UNSUPPORTED_CAUSE_DISABLED = 4;
510 }
511
512 /**
513 * Defines IMS get operation values.
514 */
515 public static class OperationValuesConstants {
516 /**
517 * Values related to Video Quality
518 */
519 public static final int VIDEO_QUALITY_UNKNOWN = -1;
520 public static final int VIDEO_QUALITY_LOW = 0;
521 public static final int VIDEO_QUALITY_HIGH = 1;
522 }
523
524 /**
525 * Defines IMS video quality feature value.
526 */
527 public static class VideoQualityFeatureValuesConstants {
528 public static final int LOW = 0;
529 public static final int HIGH = 1;
530 }
531
532 /**
533 * Defines IMS feature value.
534 */
535 public static class FeatureValueConstants {
Brad Ebinger27ca2682017-08-25 14:53:30 -0700536 public static final int ERROR = -1;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800537 public static final int OFF = 0;
538 public static final int ON = 1;
539 }
540
541 /**
542 * Defines IMS feature value.
543 */
544 public static class WfcModeFeatureValueConstants {
545 public static final int WIFI_ONLY = 0;
546 public static final int CELLULAR_PREFERRED = 1;
547 public static final int WIFI_PREFERRED = 2;
548 }
549
Brad Ebinger515021e2018-04-26 14:27:10 -0700550 public ImsConfig(IImsConfig iconfig) {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800551 miConfig = iconfig;
Brad Ebinger21013dc2017-02-02 16:21:22 -0800552 }
553
554 /**
Brad Ebinger515021e2018-04-26 14:27:10 -0700555 * @deprecated see {@link #getConfigInt(int)} instead.
Brad Ebinger112c36d2018-01-16 09:33:47 -0800556 */
557 public int getProvisionedValue(int item) throws ImsException {
558 return getConfigInt(item);
559 }
560
561 /**
562 * Gets the configuration value for IMS service/capabilities parameters used by IMS stack.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800563 *
564 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
565 * @return the value in Integer format.
Brad Ebinger112c36d2018-01-16 09:33:47 -0800566 * @throws ImsException if the ImsService is unavailable.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800567 */
Brad Ebinger112c36d2018-01-16 09:33:47 -0800568 public int getConfigInt(int item) throws ImsException {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800569 int ret = 0;
570 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800571 ret = miConfig.getConfigInt(item);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800572 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800573 throw new ImsException("getInt()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800574 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
575 }
Brad Ebinger112c36d2018-01-16 09:33:47 -0800576 if (DBG) Rlog.d(TAG, "getInt(): item = " + item + ", ret =" + ret);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800577
578 return ret;
579 }
580
581 /**
Brad Ebinger112c36d2018-01-16 09:33:47 -0800582 * @deprecated see {@link #getConfigString(int)} instead
583 */
584 public String getProvisionedStringValue(int item) throws ImsException {
585 return getConfigString(item);
586 }
587
588 /**
589 * Gets the configuration value for IMS service/capabilities parameters used by IMS stack.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800590 *
591 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
592 * @return value in String format.
593 *
Brad Ebinger112c36d2018-01-16 09:33:47 -0800594 * @throws ImsException if the ImsService is unavailable.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800595 */
Brad Ebinger112c36d2018-01-16 09:33:47 -0800596 public String getConfigString(int item) throws ImsException {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800597 String ret = "Unknown";
598 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800599 ret = miConfig.getConfigString(item);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800600 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800601 throw new ImsException("getConfigString()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800602 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
603 }
Brad Ebinger112c36d2018-01-16 09:33:47 -0800604 if (DBG) Rlog.d(TAG, "getConfigString(): item = " + item + ", ret =" + ret);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800605
606 return ret;
607 }
608
609 /**
Brad Ebinger112c36d2018-01-16 09:33:47 -0800610 * @deprecated see {@link #setConfig(int, int)} instead.
611 */
612 public int setProvisionedValue(int item, int value) throws ImsException {
613 return setConfig(item, value);
614 }
615
616 /**
617 * @deprecated see {@link #setConfig(int, String)} instead.
618 */
619 public int setProvisionedStringValue(int item, String value) throws ImsException {
620 return setConfig(item, value);
621 }
622
623 /**
624 * Sets the value for ImsService configuration item.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800625 *
626 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
627 * @param value in Integer format.
628 * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants
629 *
Brad Ebinger112c36d2018-01-16 09:33:47 -0800630 * @throws ImsException if the ImsService is unavailable.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800631 */
Brad Ebinger112c36d2018-01-16 09:33:47 -0800632 public int setConfig(int item, int value) throws ImsException {
Brad Ebinger21013dc2017-02-02 16:21:22 -0800633 int ret = OperationStatusConstants.UNKNOWN;
634 if (DBG) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800635 Rlog.d(TAG, "setConfig(): item = " + item +
Brad Ebinger21013dc2017-02-02 16:21:22 -0800636 "value = " + value);
637 }
638 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800639 ret = miConfig.setConfigInt(item, value);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800640 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800641 throw new ImsException("setConfig()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800642 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
643 }
644 if (DBG) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800645 Rlog.d(TAG, "setConfig(): item = " + item +
646 " value = " + value + " ret = " + ret);
647 }
648
649 return ret;
650
651 }
652
653 /**
654 * Sets the value for ImsService configuration item.
655 *
656 * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
657 * @param value in Integer format.
658 * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants
659 *
660 * @throws ImsException if the ImsService is unavailable.
661 */
662 public int setConfig(int item, String value) throws ImsException {
663 int ret = OperationStatusConstants.UNKNOWN;
664 if (DBG) {
665 Rlog.d(TAG, "setConfig(): item = " + item +
666 "value = " + value);
667 }
668 try {
669 ret = miConfig.setConfigString(item, value);
670 } catch (RemoteException e) {
671 throw new ImsException("setConfig()", e,
672 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
673 }
674 if (DBG) {
675 Rlog.d(TAG, "setConfig(): item = " + item +
Brad Ebinger21013dc2017-02-02 16:21:22 -0800676 " value = " + value + " ret = " + ret);
677 }
Malcolm Chen2b460022017-11-01 13:19:30 -0700678
Brad Ebinger21013dc2017-02-02 16:21:22 -0800679 return ret;
680 }
681
682 /**
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700683 * Adds a {@link ProvisioningManager.Callback} to the ImsService to notify when a Configuration
Brad Ebinger112c36d2018-01-16 09:33:47 -0800684 * item has changed.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800685 *
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700686 * Make sure to call {@link #removeConfigCallback(IImsConfigCallback)} when finished
Brad Ebinger112c36d2018-01-16 09:33:47 -0800687 * using this callback.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800688 */
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700689 public void addConfigCallback(ProvisioningManager.Callback callback) throws ImsException {
690 callback.setExecutor(getThreadExecutor());
691 addConfigCallback(callback.getBinder());
692 }
693
694 /**
695 * Adds a {@link IImsConfigCallback} to the ImsService to notify when a Configuration
696 * item has changed.
697 *
698 * Make sure to call {@link #removeConfigCallback(IImsConfigCallback)} when finished
699 * using this callback.
700 */
701 public void addConfigCallback(IImsConfigCallback callback) throws ImsException {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800702 if (DBG) Rlog.d(TAG, "addConfigCallback: " + callback);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800703 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800704 miConfig.addImsConfigCallback(callback);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800705 } catch (RemoteException e) {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800706 throw new ImsException("addConfigCallback()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800707 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
708 }
709 }
710
711 /**
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700712 * Removes an existing {@link IImsConfigCallback} from the ImsService.
Brad Ebinger21013dc2017-02-02 16:21:22 -0800713 */
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700714 public void removeConfigCallback(IImsConfigCallback callback) throws ImsException {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800715 if (DBG) Rlog.d(TAG, "removeConfigCallback: " + callback);
Brad Ebinger21013dc2017-02-02 16:21:22 -0800716 try {
Brad Ebinger112c36d2018-01-16 09:33:47 -0800717 miConfig.removeImsConfigCallback(callback);
718 } catch (RemoteException e) {
719 throw new ImsException("removeConfigCallback()", e,
Brad Ebinger21013dc2017-02-02 16:21:22 -0800720 ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
721 }
722 }
Brad Ebingerc24bc102017-06-22 11:39:11 -0700723
724 /**
725 * @return true if the binder connection is alive, false otherwise.
726 */
727 public boolean isBinderAlive() {
728 return miConfig.asBinder().isBinderAlive();
729 }
Brad Ebinger0d36ed22018-10-31 11:22:26 -0700730
731 private Executor getThreadExecutor() {
732 if (Looper.myLooper() == null) {
733 Looper.prepare();
734 }
735 return new HandlerExecutor(new Handler(Looper.myLooper()));
736 }
Brad Ebinger21013dc2017-02-02 16:21:22 -0800737}