1 /*
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 
17 package com.android.ims;
18 
19 import android.os.Handler;
20 import android.os.Looper;
21 import android.os.RemoteException;
22 import android.telephony.ims.ImsReasonInfo;
23 import android.telephony.ims.ProvisioningManager;
24 import android.telephony.ims.aidl.IImsConfig;
25 import android.telephony.ims.aidl.IImsConfigCallback;
26 
27 import com.android.internal.telephony.util.HandlerExecutor;
28 import com.android.telephony.Rlog;
29 
30 import java.util.concurrent.Executor;
31 
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  *
38  * @deprecated Use {@link  ProvisioningManager} to change these configurations in the ImsService.
39  * @hide
40  */
41 @Deprecated
42 public class ImsConfig {
43     private static final String TAG = "ImsConfig";
44     private boolean DBG = true;
45     private final IImsConfig miConfig;
46 
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
57      * @deprecated Use {@link android.telephony.ims.ProvisioningManager.Callback} instead.
58      * @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.
81     * @deprecated Use
82      * {@link android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability} instead.
83     */
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          * @deprecated use {@link ProvisioningManager#KEY_AMR_CODEC_MODE_SET_VALUES} instead.
139          */
140         @Deprecated
141         public static final int VOCODER_AMRMODESET =
142                 ProvisioningManager.KEY_AMR_CODEC_MODE_SET_VALUES;
143 
144         /**
145          * Wide Band AMR CODEC Mode Value set,0-7 in comma separated sequence.
146          * Value is in String format.
147          * @deprecated use {@link ProvisioningManager#KEY_AMR_WB_CODEC_MODE_SET_VALUES} instead.
148          */
149         @Deprecated
150         public static final int VOCODER_AMRWBMODESET =
151                 ProvisioningManager.KEY_AMR_WB_CODEC_MODE_SET_VALUES;
152 
153         /**
154          * SIP Session Timer value (seconds).
155          * Value is in Integer format.
156          * @deprecated use {@link ProvisioningManager#KEY_SIP_SESSION_TIMER_SEC} instead.
157          */
158         @Deprecated
159         public static final int SIP_SESSION_TIMER = ProvisioningManager.KEY_SIP_SESSION_TIMER_SEC;
160 
161         /**
162          * Minimum SIP Session Expiration Timer in (seconds).
163          * Value is in Integer format.
164          * @deprecated use
165          * {@link ProvisioningManager#KEY_MINIMUM_SIP_SESSION_EXPIRATION_TIMER_SEC} instead.
166          */
167         @Deprecated
168         public static final int MIN_SE =
169                 ProvisioningManager.KEY_MINIMUM_SIP_SESSION_EXPIRATION_TIMER_SEC;
170 
171         /**
172          * SIP_INVITE cancellation time out value (in milliseconds). Integer format.
173          * Value is in Integer format.
174          * @deprecated use {@link ProvisioningManager#KEY_SIP_INVITE_CANCELLATION_TIMER_MS} instead.
175          */
176         @Deprecated
177         public static final int CANCELLATION_TIMER =
178                 ProvisioningManager.KEY_SIP_INVITE_CANCELLATION_TIMER_MS;
179 
180         /**
181          * Delay time when an iRAT transition from eHRPD/HRPD/1xRTT to LTE.
182          * Value is in Integer format.
183          * @deprecated use {@link ProvisioningManager#KEY_TRANSITION_TO_LTE_DELAY_MS} instead.
184          */
185         @Deprecated
186         public static final int TDELAY = ProvisioningManager.KEY_TRANSITION_TO_LTE_DELAY_MS;
187 
188         /**
189          * Silent redial status of Enabled (True), or Disabled (False).
190          * Value is in Integer format.
191          * @deprecated use {@link ProvisioningManager#KEY_ENABLE_SILENT_REDIAL} instead.
192          */
193         @Deprecated
194         public static final int SILENT_REDIAL_ENABLE = ProvisioningManager.KEY_ENABLE_SILENT_REDIAL;
195 
196         /**
197          * SIP T1 timer value in milliseconds. See RFC 3261 for define.
198          * Value is in Integer format.
199          * @deprecated use {@link ProvisioningManager#KEY_T1_TIMER_VALUE_MS} instead.
200          */
201         @Deprecated
202         public static final int SIP_T1_TIMER = ProvisioningManager.KEY_T1_TIMER_VALUE_MS;
203 
204         /**
205          * SIP T2 timer value in milliseconds.  See RFC 3261 for define.
206          * Value is in Integer format.
207          * @deprecated use {@link ProvisioningManager#KEY_T2_TIMER_VALUE_MS} instead.
208          */
209         @Deprecated
210         public static final int SIP_T2_TIMER  = ProvisioningManager.KEY_T2_TIMER_VALUE_MS;
211 
212         /**
213          * SIP TF timer value in milliseconds.  See RFC 3261 for define.
214          * Value is in Integer format.
215          * @deprecated use {@link ProvisioningManager#KEY_TF_TIMER_VALUE_MS} instead.
216          */
217         @Deprecated
218         public static final int SIP_TF_TIMER = ProvisioningManager.KEY_TF_TIMER_VALUE_MS;
219 
220         /**
221          * VoLTE status for VLT/s status of Enabled (1), or Disabled (0).
222          * Value is in Integer format.
223          * @deprecated use {@link ProvisioningManager#KEY_VOLTE_PROVISIONING_STATUS} instead.
224          */
225         @Deprecated
226         public static final int VLT_SETTING_ENABLED =
227                 ProvisioningManager.KEY_VOLTE_PROVISIONING_STATUS;
228 
229         /**
230          * VoLTE status for LVC/s status of Enabled (1), or Disabled (0).
231          * Value is in Integer format.
232          * @deprecated use {@link ProvisioningManager#KEY_VT_PROVISIONING_STATUS} instead.
233          */
234         @Deprecated
235         public static final int LVC_SETTING_ENABLED =
236                 ProvisioningManager.KEY_VT_PROVISIONING_STATUS;
237 
238         /**
239          * Domain Name for the device to populate the request URI for REGISTRATION.
240          * Value is in String format.
241          * @deprecated use {@link ProvisioningManager#KEY_REGISTRATION_DOMAIN_NAME}.
242          */
243         @Deprecated
244         public static final int DOMAIN_NAME = ProvisioningManager.KEY_REGISTRATION_DOMAIN_NAME;
245 
246          /**
247          * Device Outgoing SMS based on either 3GPP or 3GPP2 standards.
248          * Value is in Integer format. 3GPP2(0), 3GPP(1)
249           * @deprecated use {@link ProvisioningManager#KEY_SMS_FORMAT}.
250           */
251          @Deprecated
252          public static final int SMS_FORMAT = ProvisioningManager.KEY_SMS_FORMAT;
253 
254          /**
255          * Turns IMS ON/OFF on the device.
256          * Value is in Integer format. ON (1), OFF(0).
257           * @deprecated use {@link ProvisioningManager#KEY_SMS_OVER_IP_ENABLED}.
258           */
259          @Deprecated
260          public static final int SMS_OVER_IP = ProvisioningManager.KEY_SMS_OVER_IP_ENABLED;
261 
262         /**
263          * Requested expiration for Published Online availability.
264          * Value is in Integer format.
265          * @deprecated use {@link ProvisioningManager#KEY_RCS_PUBLISH_TIMER_SEC}.
266          */
267         @Deprecated
268         public static final int PUBLISH_TIMER = ProvisioningManager.KEY_RCS_PUBLISH_TIMER_SEC;
269 
270         /**
271          * Requested expiration for Published Offline availability.
272          * Value is in Integer format.
273          * @deprecated use
274          *     {@link ProvisioningManager#KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC}.
275          */
276         @Deprecated
277         public static final int PUBLISH_TIMER_EXTENDED =
278                 ProvisioningManager.KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC;
279 
280         /**
281          *
282          * Value is in Integer format.
283          * @deprecated use {@link ProvisioningManager#KEY_RCS_CAPABILITY_DISCOVERY_ENABLED}.
284          */
285         @Deprecated
286         public static final int CAPABILITY_DISCOVERY_ENABLED =
287                 ProvisioningManager.KEY_RCS_CAPABILITY_DISCOVERY_ENABLED;
288 
289         /**
290          * Period of time the capability information of the contact is cached on handset.
291          * Value is in Integer format.
292          * @deprecated use {@link ProvisioningManager#KEY_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC}.
293          */
294         @Deprecated
295         public static final int CAPABILITIES_CACHE_EXPIRATION =
296                 ProvisioningManager.KEY_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC;
297 
298         /**
299          * Peiod of time the availability information of a contact is cached on device.
300          * Value is in Integer format.
301          * @deprecated use {@link ProvisioningManager#KEY_RCS_AVAILABILITY_CACHE_EXPIRATION_SEC}.
302          */
303         @Deprecated
304         public static final int AVAILABILITY_CACHE_EXPIRATION =
305                 ProvisioningManager.KEY_RCS_AVAILABILITY_CACHE_EXPIRATION_SEC;
306 
307         /**
308          * Interval between successive capabilities polling.
309          * Value is in Integer format.
310          * @deprecated use {@link ProvisioningManager#KEY_RCS_CAPABILITIES_POLL_INTERVAL_SEC}.
311          */
312         @Deprecated
313         public static final int CAPABILITIES_POLL_INTERVAL =
314                 ProvisioningManager.KEY_RCS_CAPABILITIES_POLL_INTERVAL_SEC;
315 
316         /**
317          * Minimum time between two published messages from the device.
318          * Value is in Integer format.
319          * @deprecated use {@link ProvisioningManager#KEY_RCS_PUBLISH_SOURCE_THROTTLE_MS}.
320          */
321         @Deprecated
322         public static final int SOURCE_THROTTLE_PUBLISH =
323                 ProvisioningManager.KEY_RCS_PUBLISH_SOURCE_THROTTLE_MS;
324 
325         /**
326          * The Maximum number of MDNs contained in one Request Contained List.
327          * Value is in Integer format.
328          * @deprecated use {@link ProvisioningManager#KEY_RCS_MAX_NUM_ENTRIES_IN_RCL}.
329          */
330         @Deprecated
331         public static final int MAX_NUMENTRIES_IN_RCL =
332                 ProvisioningManager.KEY_RCS_MAX_NUM_ENTRIES_IN_RCL;
333 
334         /**
335          * Expiration timer for subscription of a Request Contained List, used in capability
336          * polling.
337          * Value is in Integer format.
338          * @deprecated use {@link ProvisioningManager#KEY_RCS_CAPABILITY_POLL_LIST_SUB_EXP_SEC}.
339          */
340         @Deprecated
341         public static final int CAPAB_POLL_LIST_SUB_EXP =
342                 ProvisioningManager.KEY_RCS_CAPABILITY_POLL_LIST_SUB_EXP_SEC;
343 
344         /**
345          * Applies compression to LIST Subscription.
346          * Value is in Integer format. Enable (1), Disable(0).
347          * @deprecated use {@link ProvisioningManager#KEY_USE_GZIP_FOR_LIST_SUBSCRIPTION}.
348          */
349         @Deprecated
350         public static final int GZIP_FLAG = ProvisioningManager.KEY_USE_GZIP_FOR_LIST_SUBSCRIPTION;
351 
352         /**
353          * VOLTE Status for EAB/s status of Enabled (1), or Disabled (0).
354          * Value is in Integer format.
355          * @deprecated use {@link ProvisioningManager#KEY_EAB_PROVISIONING_STATUS}.
356          */
357         @Deprecated
358         public static final int EAB_SETTING_ENABLED =
359                 ProvisioningManager.KEY_EAB_PROVISIONING_STATUS;
360 
361         /**
362          * Wi-Fi calling roaming status.
363          * Value is in Integer format. ON (1), OFF(0).
364          * @deprecated use {@link ProvisioningManager#KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE}
365          * instead.
366          */
367         @Deprecated
368         public static final int VOICE_OVER_WIFI_ROAMING =
369                 ProvisioningManager.KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE;
370 
371         /**
372          * Wi-Fi calling mode - WfcModeFeatureValueConstants.
373          * Value is in Integer format.
374          * @deprecated use {@link ProvisioningManager#KEY_VOICE_OVER_WIFI_MODE_OVERRIDE}
375          * instead.
376          */
377         @Deprecated
378         public static final int VOICE_OVER_WIFI_MODE =
379                 ProvisioningManager.KEY_VOICE_OVER_WIFI_MODE_OVERRIDE;
380 
381         /**
382          * VOLTE Status for voice over wifi status of Enabled (1), or Disabled (0).
383          * Value is in Integer format.
384          * @deprecated use {@link ProvisioningManager#KEY_VOICE_OVER_WIFI_ENABLED_OVERRIDE}.
385          */
386         @Deprecated
387         public static final int VOICE_OVER_WIFI_SETTING_ENABLED =
388                 ProvisioningManager.KEY_VOICE_OVER_WIFI_ENABLED_OVERRIDE;
389 
390 
391         /**
392          * Mobile data enabled.
393          * Value is in Integer format. On (1), OFF(0).
394          * @deprecated use {@link ProvisioningManager#KEY_MOBILE_DATA_ENABLED}.
395          */
396         @Deprecated
397         public static final int MOBILE_DATA_ENABLED = ProvisioningManager.KEY_MOBILE_DATA_ENABLED;
398 
399         /**
400          * VoLTE user opted in status.
401          * Value is in Integer format. Opted-in (1) Opted-out (0).
402          * @deprecated use {@link ProvisioningManager#KEY_VOLTE_USER_OPT_IN_STATUS}.
403          */
404         @Deprecated
405         public static final int VOLTE_USER_OPT_IN_STATUS =
406                 ProvisioningManager.KEY_VOLTE_USER_OPT_IN_STATUS;
407 
408         /**
409          * Proxy for Call Session Control Function(P-CSCF) address for Local-BreakOut(LBO).
410          * Value is in String format.
411          * @deprecated use {@link ProvisioningManager#KEY_LOCAL_BREAKOUT_PCSCF_ADDRESS}.
412          */
413         @Deprecated
414         public static final int LBO_PCSCF_ADDRESS =
415                 ProvisioningManager.KEY_LOCAL_BREAKOUT_PCSCF_ADDRESS;
416 
417         /**
418          * Keep Alive Enabled for SIP.
419          * Value is in Integer format. On(1), OFF(0).
420          * @deprecated use {@link ProvisioningManager#KEY_SIP_KEEP_ALIVE_ENABLED}.
421          */
422         @Deprecated
423         public static final int KEEP_ALIVE_ENABLED = ProvisioningManager.KEY_SIP_KEEP_ALIVE_ENABLED;
424 
425         /**
426          * Registration retry Base Time value in seconds.
427          * Value is in Integer format.
428          * @deprecated use {@link ProvisioningManager#KEY_REGISTRATION_RETRY_BASE_TIME_SEC}.
429          */
430         @Deprecated
431         public static final int REGISTRATION_RETRY_BASE_TIME_SEC =
432                 ProvisioningManager.KEY_REGISTRATION_RETRY_BASE_TIME_SEC;
433 
434         /**
435          * Registration retry Max Time value in seconds.
436          * Value is in Integer format.
437          * @deprecated use {@link ProvisioningManager#KEY_REGISTRATION_RETRY_MAX_TIME_SEC}.
438          */
439         @Deprecated
440         public static final int REGISTRATION_RETRY_MAX_TIME_SEC =
441                 ProvisioningManager.KEY_REGISTRATION_RETRY_MAX_TIME_SEC;
442 
443         /**
444          * Smallest RTP port for speech codec.
445          * Value is in integer format.
446          * @deprecated use {@link ProvisioningManager#KEY_RTP_SPEECH_START_PORT}.
447          */
448         @Deprecated
449         public static final int SPEECH_START_PORT = ProvisioningManager.KEY_RTP_SPEECH_START_PORT;
450 
451         /**
452          * Largest RTP port for speech code.
453          * Value is in Integer format.
454          * @deprecated use {@link ProvisioningManager#KEY_RTP_SPEECH_END_PORT}.
455          */
456         @Deprecated
457         public static final int SPEECH_END_PORT = ProvisioningManager.KEY_RTP_SPEECH_END_PORT;
458 
459         /**
460          * SIP Timer A's value in milliseconds. Timer A is the INVITE request
461          * retransmit interval, for UDP only.
462          * Value is in Integer format.
463          * @deprecated use {@link ProvisioningManager#KEY_SIP_INVITE_REQUEST_TRANSMIT_INTERVAL_MS}.
464          */
465         @Deprecated
466         public static final int SIP_INVITE_REQ_RETX_INTERVAL_MSEC =
467                 ProvisioningManager.KEY_SIP_INVITE_REQUEST_TRANSMIT_INTERVAL_MS;
468 
469         /**
470          * SIP Timer B's value in milliseconds. Timer B is the wait time for
471          * INVITE message to be acknowledged.
472          * Value is in Integer format.
473          * @deprecated use {@link ProvisioningManager#KEY_SIP_INVITE_ACK_WAIT_TIME_MS}.
474          */
475         @Deprecated
476         public static final int SIP_INVITE_RSP_WAIT_TIME_MSEC =
477                 ProvisioningManager.KEY_SIP_INVITE_ACK_WAIT_TIME_MS;
478 
479         /**
480          * SIP Timer D's value in milliseconds. Timer D is the wait time for
481          * response retransmits of the invite client transactions.
482          * Value is in Integer format.
483          * @deprecated use
484          * {@link ProvisioningManager#KEY_SIP_INVITE_RESPONSE_RETRANSMIT_WAIT_TIME_MS}.
485          */
486         @Deprecated
487         public static final int SIP_INVITE_RSP_RETX_WAIT_TIME_MSEC =
488                 ProvisioningManager.KEY_SIP_INVITE_RESPONSE_RETRANSMIT_WAIT_TIME_MS;
489 
490         /**
491          * SIP Timer E's value in milliseconds. Timer E is the value Non-INVITE
492          * request retransmit interval, for UDP only.
493          * Value is in Integer format.
494          * @deprecated use
495          * {@link ProvisioningManager#KEY_SIP_NON_INVITE_REQUEST_RETRANSMIT_INTERVAL_MS}.
496          */
497         @Deprecated
498         public static final int SIP_NON_INVITE_REQ_RETX_INTERVAL_MSEC =
499                 ProvisioningManager.KEY_SIP_NON_INVITE_REQUEST_RETRANSMIT_INTERVAL_MS;
500 
501         /**
502          * SIP Timer F's value in milliseconds. Timer F is the Non-INVITE transaction
503          * timeout timer.
504          * Value is in Integer format.
505          * @deprecated use
506          * {@link ProvisioningManager#KEY_SIP_NON_INVITE_TRANSACTION_TIMEOUT_TIMER_MS}.
507          */
508         @Deprecated
509         public static final int SIP_NON_INVITE_TXN_TIMEOUT_TIMER_MSEC =
510                 ProvisioningManager.KEY_SIP_NON_INVITE_TRANSACTION_TIMEOUT_TIMER_MS;
511 
512         /**
513          * SIP Timer G's value in milliseconds. Timer G is the value of INVITE response
514          * retransmit interval.
515          * Value is in Integer format.
516          * @deprecated use
517          * {@link ProvisioningManager#KEY_SIP_INVITE_RESPONSE_RETRANSMIT_INTERVAL_MS}.
518          */
519         @Deprecated
520         public static final int SIP_INVITE_RSP_RETX_INTERVAL_MSEC =
521                 ProvisioningManager.KEY_SIP_INVITE_RESPONSE_RETRANSMIT_INTERVAL_MS;
522 
523         /**
524          * SIP Timer H's value in milliseconds. Timer H is the value of wait time for
525          * ACK receipt.
526          * Value is in Integer format.
527          * @deprecated use {@link ProvisioningManager#KEY_SIP_ACK_RECEIPT_WAIT_TIME_MS}.
528          */
529         @Deprecated
530         public static final int SIP_ACK_RECEIPT_WAIT_TIME_MSEC =
531                 ProvisioningManager.KEY_SIP_ACK_RECEIPT_WAIT_TIME_MS;
532 
533         /**
534          * SIP Timer I's value in milliseconds. Timer I is the value of wait time for
535          * ACK retransmits.
536          * Value is in Integer format.
537          * @deprecated use {@link ProvisioningManager#KEY_SIP_ACK_RETRANSMIT_WAIT_TIME_MS}.
538          */
539         @Deprecated
540         public static final int SIP_ACK_RETX_WAIT_TIME_MSEC =
541                 ProvisioningManager.KEY_SIP_ACK_RETRANSMIT_WAIT_TIME_MS;
542 
543         /**
544          * SIP Timer J's value in milliseconds. Timer J is the value of wait time for
545          * non-invite request retransmission.
546          * Value is in Integer format.
547          * @deprecated use
548          * {@link ProvisioningManager#KEY_SIP_NON_INVITE_REQUEST_RETRANSMISSION_WAIT_TIME_MS}.
549          */
550         @Deprecated
551         public static final int SIP_NON_INVITE_REQ_RETX_WAIT_TIME_MSEC =
552                 ProvisioningManager.KEY_SIP_NON_INVITE_REQUEST_RETRANSMISSION_WAIT_TIME_MS;
553 
554         /**
555          * SIP Timer K's value in milliseconds. Timer K is the value of wait time for
556          * non-invite response retransmits.
557          * Value is in Integer format.
558          * @deprecated use
559          * {@link ProvisioningManager#KEY_SIP_NON_INVITE_RESPONSE_RETRANSMISSION_WAIT_TIME_MS}.
560          */
561         @Deprecated
562         public static final int SIP_NON_INVITE_RSP_RETX_WAIT_TIME_MSEC =
563                 ProvisioningManager.KEY_SIP_NON_INVITE_RESPONSE_RETRANSMISSION_WAIT_TIME_MS;
564 
565         /**
566          * AMR WB octet aligned dynamic payload type.
567          * Value is in Integer format.
568          * @deprecated use {@link ProvisioningManager#KEY_AMR_WB_OCTET_ALIGNED_PAYLOAD_TYPE}.
569          */
570         @Deprecated
571         public static final int AMR_WB_OCTET_ALIGNED_PT =
572                 ProvisioningManager.KEY_AMR_WB_OCTET_ALIGNED_PAYLOAD_TYPE;
573 
574         /**
575          * AMR WB bandwidth efficient payload type.
576          * Value is in Integer format.
577          * @deprecated use {@link ProvisioningManager#KEY_AMR_WB_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE}.
578          */
579         @Deprecated
580         public static final int AMR_WB_BANDWIDTH_EFFICIENT_PT =
581                 ProvisioningManager.KEY_AMR_WB_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE;
582 
583         /**
584          * AMR octet aligned dynamic payload type.
585          * Value is in Integer format.
586          * @deprecated use {@link ProvisioningManager#KEY_AMR_OCTET_ALIGNED_PAYLOAD_TYPE}.
587          */
588         @Deprecated
589         public static final int AMR_OCTET_ALIGNED_PT =
590                 ProvisioningManager.KEY_AMR_OCTET_ALIGNED_PAYLOAD_TYPE;
591 
592         /**
593          * AMR bandwidth efficient payload type.
594          * Value is in Integer format.
595          * @deprecated use {@link ProvisioningManager#KEY_AMR_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE}.
596          */
597         @Deprecated
598         public static final int AMR_BANDWIDTH_EFFICIENT_PT =
599                 ProvisioningManager.KEY_AMR_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE;
600 
601         /**
602          * DTMF WB payload type.
603          * Value is in Integer format.
604          * @deprecated use {@link ProvisioningManager#KEY_DTMF_WB_PAYLOAD_TYPE}.
605          */
606         @Deprecated
607         public static final int DTMF_WB_PT = ProvisioningManager.KEY_DTMF_WB_PAYLOAD_TYPE;
608 
609         /**
610          * DTMF NB payload type.
611          * Value is in Integer format.
612          * @deprecated use {@link ProvisioningManager#KEY_DTMF_NB_PAYLOAD_TYPE}.
613          */
614         @Deprecated
615         public static final int DTMF_NB_PT = ProvisioningManager.KEY_DTMF_NB_PAYLOAD_TYPE;
616 
617         /**
618          * AMR Default encoding mode.
619          * Value is in Integer format.
620          * @deprecated use {@link ProvisioningManager#KEY_AMR_DEFAULT_ENCODING_MODE}.
621          */
622         @Deprecated
623         public static final int AMR_DEFAULT_MODE =
624                 ProvisioningManager.KEY_AMR_DEFAULT_ENCODING_MODE;
625 
626         /**
627          * SMS Public Service Identity.
628          * Value is in String format.
629          * @deprecated use {@link ProvisioningManager#KEY_SMS_PUBLIC_SERVICE_IDENTITY}.
630          */
631         @Deprecated
632         public static final int SMS_PSI = ProvisioningManager.KEY_SMS_PUBLIC_SERVICE_IDENTITY;
633 
634         /**
635          * Video Quality - VideoQualityFeatureValuesConstants.
636          * Value is in Integer format.
637          * @deprecated use {@link ProvisioningManager#KEY_VIDEO_QUALITY}.
638          */
639         @Deprecated
640         public static final int VIDEO_QUALITY = ProvisioningManager.KEY_VIDEO_QUALITY;
641 
642         /**
643          * LTE threshold.
644          * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A.
645          * @deprecated use {@link ProvisioningManager#KEY_LTE_THRESHOLD_1}.
646          */
647         @Deprecated
648         public static final int TH_LTE1 = ProvisioningManager.KEY_LTE_THRESHOLD_1;
649 
650         /**
651          * LTE threshold.
652          * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
653          * @deprecated use {@link ProvisioningManager#KEY_LTE_THRESHOLD_2}.
654          */
655         @Deprecated
656         public static final int TH_LTE2 = ProvisioningManager.KEY_LTE_THRESHOLD_2;
657 
658         /**
659          * LTE threshold.
660          * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
661          * @deprecated use {@link ProvisioningManager#KEY_LTE_THRESHOLD_3}.
662          */
663         @Deprecated
664         public static final int TH_LTE3 = ProvisioningManager.KEY_LTE_THRESHOLD_3;
665 
666         /**
667          * 1x threshold.
668          * Handover from 1x to WiFi if 1x < TH1x
669          * @deprecated use {@link ProvisioningManager#KEY_1X_THRESHOLD}.
670          */
671         @Deprecated
672         public static final int TH_1x = ProvisioningManager.KEY_1X_THRESHOLD;
673 
674         /**
675          * WiFi threshold.
676          * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A.
677          * @deprecated use {@link ProvisioningManager#KEY_WIFI_THRESHOLD_A}.
678          */
679         @Deprecated
680         public static final int VOWT_A = ProvisioningManager.KEY_WIFI_THRESHOLD_A;
681 
682         /**
683          * WiFi threshold.
684          * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2).
685          * @deprecated use {@link ProvisioningManager#KEY_WIFI_THRESHOLD_B}.
686          */
687         @Deprecated
688         public static final int VOWT_B = ProvisioningManager.KEY_WIFI_THRESHOLD_B;
689 
690         /**
691          * LTE ePDG timer.
692          * Device shall not handover back to LTE until the T_ePDG_LTE timer expires.
693          * @deprecated use {@link ProvisioningManager#KEY_LTE_EPDG_TIMER_SEC}.
694          */
695         @Deprecated
696         public static final int T_EPDG_LTE = ProvisioningManager.KEY_LTE_EPDG_TIMER_SEC;
697 
698         /**
699          * WiFi ePDG timer.
700          * Device shall not handover back to WiFi until the T_ePDG_WiFi timer expires.
701          * @deprecated use {@link ProvisioningManager#KEY_WIFI_EPDG_TIMER_SEC}.
702          */
703         @Deprecated
704         public static final int T_EPDG_WIFI = ProvisioningManager.KEY_WIFI_EPDG_TIMER_SEC;
705 
706         /**
707          * 1x ePDG timer.
708          * Device shall not re-register on 1x until the T_ePDG_1x timer expires.
709          * @deprecated use {@link ProvisioningManager#KEY_1X_EPDG_TIMER_SEC}.
710          */
711         @Deprecated
712         public static final int T_EPDG_1X = ProvisioningManager.KEY_1X_EPDG_TIMER_SEC;
713 
714         /**
715          * MultiEndpoint status: Enabled (1), or Disabled (0).
716          * Value is in Integer format.
717          * @deprecated use {@link ProvisioningManager#KEY_MULTIENDPOINT_ENABLED}.
718          */
719         @Deprecated
720         public static final int VICE_SETTING_ENABLED = ProvisioningManager.KEY_MULTIENDPOINT_ENABLED;
721 
722         /**
723          * RTT status: Enabled (1), or Disabled (0).
724          * Value is in Integer format.
725          * @deprecated use {@link ProvisioningManager#KEY_RTT_ENABLED}.
726          */
727         @Deprecated
728         public static final int RTT_SETTING_ENABLED = ProvisioningManager.KEY_RTT_ENABLED;
729 
730         // Expand the operator config items as needed here, need to change
731         // PROVISIONED_CONFIG_END after that.
732         public static final int PROVISIONED_CONFIG_END = RTT_SETTING_ENABLED;
733 
734         // Expand the operator config items as needed here.
735     }
736 
737     /**
738     * Defines IMS set operation status.
739     */
740     public static class OperationStatusConstants {
741         public static final int UNKNOWN = -1;
742         public static final int SUCCESS = 0;
743         public static final int FAILED =  1;
744         public static final int UNSUPPORTED_CAUSE_NONE = 2;
745         public static final int UNSUPPORTED_CAUSE_RAT = 3;
746         public static final int UNSUPPORTED_CAUSE_DISABLED = 4;
747     }
748 
749     /**
750      * Defines IMS get operation values.
751      */
752     public static class OperationValuesConstants {
753         /**
754          * Values related to Video Quality
755          */
756         public static final int VIDEO_QUALITY_UNKNOWN = -1;
757         public static final int VIDEO_QUALITY_LOW = 0;
758         public static final int VIDEO_QUALITY_HIGH = 1;
759     }
760 
761     /**
762      * Defines IMS video quality feature value.
763      */
764     public static class VideoQualityFeatureValuesConstants {
765         public static final int LOW = 0;
766         public static final int HIGH = 1;
767     }
768 
769    /**
770     * Defines IMS feature value.
771     */
772     public static class FeatureValueConstants {
773         public static final int ERROR = -1;
774         public static final int OFF = 0;
775         public static final int ON = 1;
776     }
777 
778     /**
779      * Defines IMS feature value.
780      */
781     public static class WfcModeFeatureValueConstants {
782         public static final int WIFI_ONLY = 0;
783         public static final int CELLULAR_PREFERRED = 1;
784         public static final int WIFI_PREFERRED = 2;
785     }
786 
ImsConfig(IImsConfig iconfig)787     public ImsConfig(IImsConfig iconfig) {
788         miConfig = iconfig;
789     }
790 
791     /**
792      * @deprecated see {@link #getConfigInt(int)} instead.
793      */
getProvisionedValue(int item)794     public int getProvisionedValue(int item) throws ImsException {
795         return getConfigInt(item);
796     }
797 
798     /**
799      * Gets the configuration value for IMS service/capabilities parameters used by IMS stack.
800      *
801      * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
802      * @return the value in Integer format.
803      * @throws ImsException if the ImsService is unavailable.
804      */
getConfigInt(int item)805     public int getConfigInt(int item) throws ImsException {
806         int ret = 0;
807         try {
808             ret = miConfig.getConfigInt(item);
809         }  catch (RemoteException e) {
810             throw new ImsException("getInt()", e,
811                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
812         }
813         if (DBG) Rlog.d(TAG, "getInt(): item = " + item + ", ret =" + ret);
814 
815         return ret;
816     }
817 
818     /**
819      * @deprecated see {@link #getConfigString(int)} instead
820      */
getProvisionedStringValue(int item)821     public String getProvisionedStringValue(int item) throws ImsException {
822         return getConfigString(item);
823     }
824 
825     /**
826      * Gets the configuration value for IMS service/capabilities parameters used by IMS stack.
827      *
828      * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
829      * @return value in String format.
830      *
831      * @throws ImsException if the ImsService is unavailable.
832      */
getConfigString(int item)833     public String getConfigString(int item) throws ImsException {
834         String ret = "Unknown";
835         try {
836             ret = miConfig.getConfigString(item);
837         }  catch (RemoteException e) {
838             throw new ImsException("getConfigString()", e,
839                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
840         }
841         if (DBG) Rlog.d(TAG, "getConfigString(): item = " + item + ", ret =" + ret);
842 
843         return ret;
844     }
845 
846     /**
847      * @deprecated see {@link #setConfig(int, int)} instead.
848      */
setProvisionedValue(int item, int value)849     public int setProvisionedValue(int item, int value) throws ImsException {
850         return setConfig(item, value);
851     }
852 
853     /**
854      * @deprecated see {@link #setConfig(int, String)} instead.
855      */
setProvisionedStringValue(int item, String value)856     public int setProvisionedStringValue(int item, String value) throws ImsException {
857         return setConfig(item, value);
858     }
859 
860     /**
861      * Sets the value for ImsService configuration item.
862      *
863      * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
864      * @param value in Integer format.
865      * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants
866      *
867      * @throws ImsException if the ImsService is unavailable.
868      */
setConfig(int item, int value)869     public int setConfig(int item, int value) throws ImsException {
870         int ret = OperationStatusConstants.UNKNOWN;
871         if (DBG) {
872             Rlog.d(TAG, "setConfig(): item = " + item +
873                     "value = " + value);
874         }
875         try {
876             ret = miConfig.setConfigInt(item, value);
877         }  catch (RemoteException e) {
878             throw new ImsException("setConfig()", e,
879                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
880         }
881         if (DBG) {
882             Rlog.d(TAG, "setConfig(): item = " + item +
883                     " value = " + value + " ret = " + ret);
884         }
885 
886         return ret;
887 
888     }
889 
890     /**
891      * Sets the value for ImsService configuration item.
892      *
893      * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants.
894      * @param value in Integer format.
895      * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants
896      *
897      * @throws ImsException if the ImsService is unavailable.
898      */
setConfig(int item, String value)899     public int setConfig(int item, String value) throws ImsException {
900         int ret = OperationStatusConstants.UNKNOWN;
901         if (DBG) {
902             Rlog.d(TAG, "setConfig(): item = " + item +
903                     "value = " + value);
904         }
905         try {
906             ret = miConfig.setConfigString(item, value);
907         }  catch (RemoteException e) {
908             throw new ImsException("setConfig()", e,
909                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
910         }
911         if (DBG) {
912             Rlog.d(TAG, "setConfig(): item = " + item +
913                     " value = " + value + " ret = " + ret);
914         }
915 
916         return ret;
917     }
918 
919     /**
920      * Adds a {@link ProvisioningManager.Callback} to the ImsService to notify when a Configuration
921      * item has changed.
922      *
923      * Make sure to call {@link #removeConfigCallback(IImsConfigCallback)} when finished
924      * using this callback.
925      */
addConfigCallback(ProvisioningManager.Callback callback)926     public void addConfigCallback(ProvisioningManager.Callback callback) throws ImsException {
927         callback.setExecutor(getThreadExecutor());
928         addConfigCallback(callback.getBinder());
929     }
930 
931     /**
932      * Adds a {@link IImsConfigCallback} to the ImsService to notify when a Configuration
933      * item has changed.
934      *
935      * Make sure to call {@link #removeConfigCallback(IImsConfigCallback)} when finished
936      * using this callback.
937      */
addConfigCallback(IImsConfigCallback callback)938     public void addConfigCallback(IImsConfigCallback callback) throws ImsException {
939         if (DBG) Rlog.d(TAG, "addConfigCallback: " + callback);
940         try {
941             miConfig.addImsConfigCallback(callback);
942         }  catch (RemoteException e) {
943             throw new ImsException("addConfigCallback()", e,
944                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
945         }
946     }
947 
948     /**
949      * Removes an existing {@link IImsConfigCallback} from the ImsService.
950      */
removeConfigCallback(IImsConfigCallback callback)951     public void removeConfigCallback(IImsConfigCallback callback) throws ImsException {
952         if (DBG) Rlog.d(TAG, "removeConfigCallback: " + callback);
953         try {
954             miConfig.removeImsConfigCallback(callback);
955         }  catch (RemoteException e) {
956             throw new ImsException("removeConfigCallback()", e,
957                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
958         }
959     }
960 
961     /**
962      * @return true if the binder connection is alive, false otherwise.
963      */
isBinderAlive()964     public boolean isBinderAlive() {
965         return miConfig.asBinder().isBinderAlive();
966     }
967 
getThreadExecutor()968     private Executor getThreadExecutor() {
969         if (Looper.myLooper() == null) {
970             Looper.prepare();
971         }
972         return new HandlerExecutor(new Handler(Looper.myLooper()));
973     }
974 }
975