Brad Ebinger | 21013dc | 2017-02-02 16:21:22 -0800 | [diff] [blame] | 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.content.Context; |
| 20 | import android.os.RemoteException; |
| 21 | import android.telephony.Rlog; |
| 22 | |
| 23 | import com.android.ims.internal.IImsConfig; |
| 24 | |
| 25 | /** |
| 26 | * Provides APIs to get/set the IMS service feature/capability/parameters. |
| 27 | * The config items include: |
| 28 | * 1) Items provisioned by the operator. |
| 29 | * 2) Items configured by user. Mainly service feature class. |
| 30 | * |
| 31 | * @hide |
| 32 | */ |
| 33 | public class ImsConfig { |
| 34 | private static final String TAG = "ImsConfig"; |
| 35 | private boolean DBG = true; |
| 36 | private final IImsConfig miConfig; |
| 37 | private Context mContext; |
| 38 | |
| 39 | /** |
| 40 | * Broadcast action: the feature enable status was changed |
| 41 | * |
| 42 | * @hide |
| 43 | */ |
| 44 | public static final String ACTION_IMS_FEATURE_CHANGED = |
| 45 | "com.android.intent.action.IMS_FEATURE_CHANGED"; |
| 46 | |
| 47 | /** |
| 48 | * Broadcast action: the configuration was changed |
| 49 | * |
| 50 | * @hide |
| 51 | */ |
| 52 | public static final String ACTION_IMS_CONFIG_CHANGED = |
| 53 | "com.android.intent.action.IMS_CONFIG_CHANGED"; |
| 54 | |
| 55 | /** |
| 56 | * Extra parameter "item" of intent ACTION_IMS_FEATURE_CHANGED and ACTION_IMS_CONFIG_CHANGED. |
| 57 | * It is the value of FeatureConstants or ConfigConstants. |
| 58 | * |
| 59 | * @hide |
| 60 | */ |
| 61 | public static final String EXTRA_CHANGED_ITEM = "item"; |
| 62 | |
| 63 | /** |
| 64 | * Extra parameter "value" of intent ACTION_IMS_FEATURE_CHANGED and ACTION_IMS_CONFIG_CHANGED. |
| 65 | * It is the new value of "item". |
| 66 | * |
| 67 | * @hide |
| 68 | */ |
| 69 | public static final String EXTRA_NEW_VALUE = "value"; |
| 70 | |
| 71 | /** |
| 72 | * Defines IMS service/capability feature constants. |
| 73 | */ |
| 74 | public static class FeatureConstants { |
| 75 | public static final int FEATURE_TYPE_UNKNOWN = -1; |
| 76 | |
| 77 | /** |
| 78 | * FEATURE_TYPE_VOLTE supports features defined in 3GPP and |
| 79 | * GSMA IR.92 over LTE. |
| 80 | */ |
| 81 | public static final int FEATURE_TYPE_VOICE_OVER_LTE = 0; |
| 82 | |
| 83 | /** |
| 84 | * FEATURE_TYPE_LVC supports features defined in 3GPP and |
| 85 | * GSMA IR.94 over LTE. |
| 86 | */ |
| 87 | public static final int FEATURE_TYPE_VIDEO_OVER_LTE = 1; |
| 88 | |
| 89 | /** |
| 90 | * FEATURE_TYPE_VOICE_OVER_WIFI supports features defined in 3GPP and |
| 91 | * GSMA IR.92 over WiFi. |
| 92 | */ |
| 93 | public static final int FEATURE_TYPE_VOICE_OVER_WIFI = 2; |
| 94 | |
| 95 | /** |
| 96 | * FEATURE_TYPE_VIDEO_OVER_WIFI supports features defined in 3GPP and |
| 97 | * GSMA IR.94 over WiFi. |
| 98 | */ |
| 99 | public static final int FEATURE_TYPE_VIDEO_OVER_WIFI = 3; |
| 100 | |
| 101 | /** |
| 102 | * FEATURE_TYPE_UT supports features defined in 3GPP and |
| 103 | * GSMA IR.92 over LTE. |
| 104 | */ |
| 105 | public static final int FEATURE_TYPE_UT_OVER_LTE = 4; |
| 106 | |
| 107 | /** |
| 108 | * FEATURE_TYPE_UT_OVER_WIFI supports features defined in 3GPP and |
| 109 | * GSMA IR.92 over WiFi. |
| 110 | */ |
| 111 | public static final int FEATURE_TYPE_UT_OVER_WIFI = 5; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Defines IMS service/capability parameters. |
| 116 | */ |
| 117 | public static class ConfigConstants { |
| 118 | |
| 119 | // Define IMS config items |
| 120 | public static final int CONFIG_START = 0; |
| 121 | |
| 122 | // Define operator provisioned config items |
| 123 | public static final int PROVISIONED_CONFIG_START = CONFIG_START; |
| 124 | |
| 125 | /** |
| 126 | * AMR CODEC Mode Value set, 0-7 in comma separated sequence. |
| 127 | * Value is in String format. |
| 128 | */ |
| 129 | public static final int VOCODER_AMRMODESET = CONFIG_START; |
| 130 | |
| 131 | /** |
| 132 | * Wide Band AMR CODEC Mode Value set,0-7 in comma separated sequence. |
| 133 | * Value is in String format. |
| 134 | */ |
| 135 | public static final int VOCODER_AMRWBMODESET = 1; |
| 136 | |
| 137 | /** |
| 138 | * SIP Session Timer value (seconds). |
| 139 | * Value is in Integer format. |
| 140 | */ |
| 141 | public static final int SIP_SESSION_TIMER = 2; |
| 142 | |
| 143 | /** |
| 144 | * Minimum SIP Session Expiration Timer in (seconds). |
| 145 | * Value is in Integer format. |
| 146 | */ |
| 147 | public static final int MIN_SE = 3; |
| 148 | |
| 149 | /** |
| 150 | * SIP_INVITE cancellation time out value (in milliseconds). Integer format. |
| 151 | * Value is in Integer format. |
| 152 | */ |
| 153 | public static final int CANCELLATION_TIMER = 4; |
| 154 | |
| 155 | /** |
| 156 | * Delay time when an iRAT transition from eHRPD/HRPD/1xRTT to LTE. |
| 157 | * Value is in Integer format. |
| 158 | */ |
| 159 | public static final int TDELAY = 5; |
| 160 | |
| 161 | /** |
| 162 | * Silent redial status of Enabled (True), or Disabled (False). |
| 163 | * Value is in Integer format. |
| 164 | */ |
| 165 | public static final int SILENT_REDIAL_ENABLE = 6; |
| 166 | |
| 167 | /** |
| 168 | * SIP T1 timer value in milliseconds. See RFC 3261 for define. |
| 169 | * Value is in Integer format. |
| 170 | */ |
| 171 | public static final int SIP_T1_TIMER = 7; |
| 172 | |
| 173 | /** |
| 174 | * SIP T2 timer value in milliseconds. See RFC 3261 for define. |
| 175 | * Value is in Integer format. |
| 176 | */ |
| 177 | public static final int SIP_T2_TIMER = 8; |
| 178 | |
| 179 | /** |
| 180 | * SIP TF timer value in milliseconds. See RFC 3261 for define. |
| 181 | * Value is in Integer format. |
| 182 | */ |
| 183 | public static final int SIP_TF_TIMER = 9; |
| 184 | |
| 185 | /** |
| 186 | * VoLTE status for VLT/s status of Enabled (1), or Disabled (0). |
| 187 | * Value is in Integer format. |
| 188 | */ |
| 189 | public static final int VLT_SETTING_ENABLED = 10; |
| 190 | |
| 191 | /** |
| 192 | * VoLTE status for LVC/s status of Enabled (1), or Disabled (0). |
| 193 | * Value is in Integer format. |
| 194 | */ |
| 195 | public static final int LVC_SETTING_ENABLED = 11; |
| 196 | /** |
| 197 | * Domain Name for the device to populate the request URI for REGISTRATION. |
| 198 | * Value is in String format. |
| 199 | */ |
| 200 | public static final int DOMAIN_NAME = 12; |
| 201 | /** |
| 202 | * Device Outgoing SMS based on either 3GPP or 3GPP2 standards. |
| 203 | * Value is in Integer format. 3GPP2(0), 3GPP(1) |
| 204 | */ |
| 205 | public static final int SMS_FORMAT = 13; |
| 206 | /** |
| 207 | * Turns IMS ON/OFF on the device. |
| 208 | * Value is in Integer format. ON (1), OFF(0). |
| 209 | */ |
| 210 | public static final int SMS_OVER_IP = 14; |
| 211 | /** |
| 212 | * Requested expiration for Published Online availability. |
| 213 | * Value is in Integer format. |
| 214 | */ |
| 215 | public static final int PUBLISH_TIMER = 15; |
| 216 | /** |
| 217 | * Requested expiration for Published Offline availability. |
| 218 | * Value is in Integer format. |
| 219 | */ |
| 220 | public static final int PUBLISH_TIMER_EXTENDED = 16; |
| 221 | /** |
| 222 | * |
| 223 | * Value is in Integer format. |
| 224 | */ |
| 225 | public static final int CAPABILITY_DISCOVERY_ENABLED = 17; |
| 226 | /** |
| 227 | * Period of time the capability information of the contact is cached on handset. |
| 228 | * Value is in Integer format. |
| 229 | */ |
| 230 | public static final int CAPABILITIES_CACHE_EXPIRATION = 18; |
| 231 | /** |
| 232 | * Peiod of time the availability information of a contact is cached on device. |
| 233 | * Value is in Integer format. |
| 234 | */ |
| 235 | public static final int AVAILABILITY_CACHE_EXPIRATION = 19; |
| 236 | /** |
| 237 | * Interval between successive capabilities polling. |
| 238 | * Value is in Integer format. |
| 239 | */ |
| 240 | public static final int CAPABILITIES_POLL_INTERVAL = 20; |
| 241 | /** |
| 242 | * Minimum time between two published messages from the device. |
| 243 | * Value is in Integer format. |
| 244 | */ |
| 245 | public static final int SOURCE_THROTTLE_PUBLISH = 21; |
| 246 | /** |
| 247 | * The Maximum number of MDNs contained in one Request Contained List. |
| 248 | * Value is in Integer format. |
| 249 | */ |
| 250 | public static final int MAX_NUMENTRIES_IN_RCL = 22; |
| 251 | /** |
| 252 | * Expiration timer for subscription of a Request Contained List, used in capability |
| 253 | * polling. |
| 254 | * Value is in Integer format. |
| 255 | */ |
| 256 | public static final int CAPAB_POLL_LIST_SUB_EXP = 23; |
| 257 | /** |
| 258 | * Applies compression to LIST Subscription. |
| 259 | * Value is in Integer format. Enable (1), Disable(0). |
| 260 | */ |
| 261 | public static final int GZIP_FLAG = 24; |
| 262 | /** |
| 263 | * VOLTE Status for EAB/s status of Enabled (1), or Disabled (0). |
| 264 | * Value is in Integer format. |
| 265 | */ |
| 266 | public static final int EAB_SETTING_ENABLED = 25; |
| 267 | /** |
| 268 | * Wi-Fi calling roaming status. |
| 269 | * Value is in Integer format. ON (1), OFF(0). |
| 270 | */ |
| 271 | public static final int VOICE_OVER_WIFI_ROAMING = 26; |
| 272 | /** |
| 273 | * Wi-Fi calling modem - WfcModeFeatureValueConstants. |
| 274 | * Value is in Integer format. |
| 275 | */ |
| 276 | public static final int VOICE_OVER_WIFI_MODE = 27; |
| 277 | /** |
| 278 | * VOLTE Status for voice over wifi status of Enabled (1), or Disabled (0). |
| 279 | * Value is in Integer format. |
| 280 | */ |
| 281 | public static final int VOICE_OVER_WIFI_SETTING_ENABLED = 28; |
| 282 | /** |
| 283 | * Mobile data enabled. |
| 284 | * Value is in Integer format. On (1), OFF(0). |
| 285 | */ |
| 286 | public static final int MOBILE_DATA_ENABLED = 29; |
| 287 | /** |
| 288 | * VoLTE user opted in status. |
| 289 | * Value is in Integer format. Opted-in (1) Opted-out (0). |
| 290 | */ |
| 291 | public static final int VOLTE_USER_OPT_IN_STATUS = 30; |
| 292 | /** |
| 293 | * Proxy for Call Session Control Function(P-CSCF) address for Local-BreakOut(LBO). |
| 294 | * Value is in String format. |
| 295 | */ |
| 296 | public static final int LBO_PCSCF_ADDRESS = 31; |
| 297 | /** |
| 298 | * Keep Alive Enabled for SIP. |
| 299 | * Value is in Integer format. On(1), OFF(0). |
| 300 | */ |
| 301 | public static final int KEEP_ALIVE_ENABLED = 32; |
| 302 | /** |
| 303 | * Registration retry Base Time value in seconds. |
| 304 | * Value is in Integer format. |
| 305 | */ |
| 306 | public static final int REGISTRATION_RETRY_BASE_TIME_SEC = 33; |
| 307 | /** |
| 308 | * Registration retry Max Time value in seconds. |
| 309 | * Value is in Integer format. |
| 310 | */ |
| 311 | public static final int REGISTRATION_RETRY_MAX_TIME_SEC = 34; |
| 312 | /** |
| 313 | * Smallest RTP port for speech codec. |
| 314 | * Value is in integer format. |
| 315 | */ |
| 316 | public static final int SPEECH_START_PORT = 35; |
| 317 | /** |
| 318 | * Largest RTP port for speech code. |
| 319 | * Value is in Integer format. |
| 320 | */ |
| 321 | public static final int SPEECH_END_PORT = 36; |
| 322 | /** |
| 323 | * SIP Timer A's value in milliseconds. Timer A is the INVITE request |
| 324 | * retransmit interval, for UDP only. |
| 325 | * Value is in Integer format. |
| 326 | */ |
| 327 | public static final int SIP_INVITE_REQ_RETX_INTERVAL_MSEC = 37; |
| 328 | /** |
| 329 | * SIP Timer B's value in milliseconds. Timer B is the wait time for |
| 330 | * INVITE message to be acknowledged. |
| 331 | * Value is in Integer format. |
| 332 | */ |
| 333 | public static final int SIP_INVITE_RSP_WAIT_TIME_MSEC = 38; |
| 334 | /** |
| 335 | * SIP Timer D's value in milliseconds. Timer D is the wait time for |
| 336 | * response retransmits of the invite client transactions. |
| 337 | * Value is in Integer format. |
| 338 | */ |
| 339 | public static final int SIP_INVITE_RSP_RETX_WAIT_TIME_MSEC = 39; |
| 340 | /** |
| 341 | * SIP Timer E's value in milliseconds. Timer E is the value Non-INVITE |
| 342 | * request retransmit interval, for UDP only. |
| 343 | * Value is in Integer format. |
| 344 | */ |
| 345 | public static final int SIP_NON_INVITE_REQ_RETX_INTERVAL_MSEC = 40; |
| 346 | /** |
| 347 | * SIP Timer F's value in milliseconds. Timer F is the Non-INVITE transaction |
| 348 | * timeout timer. |
| 349 | * Value is in Integer format. |
| 350 | */ |
| 351 | public static final int SIP_NON_INVITE_TXN_TIMEOUT_TIMER_MSEC = 41; |
| 352 | /** |
| 353 | * SIP Timer G's value in milliseconds. Timer G is the value of INVITE response |
| 354 | * retransmit interval. |
| 355 | * Value is in Integer format. |
| 356 | */ |
| 357 | public static final int SIP_INVITE_RSP_RETX_INTERVAL_MSEC = 42; |
| 358 | /** |
| 359 | * SIP Timer H's value in milliseconds. Timer H is the value of wait time for |
| 360 | * ACK receipt. |
| 361 | * Value is in Integer format. |
| 362 | */ |
| 363 | public static final int SIP_ACK_RECEIPT_WAIT_TIME_MSEC = 43; |
| 364 | /** |
| 365 | * SIP Timer I's value in milliseconds. Timer I is the value of wait time for |
| 366 | * ACK retransmits. |
| 367 | * Value is in Integer format. |
| 368 | */ |
| 369 | public static final int SIP_ACK_RETX_WAIT_TIME_MSEC = 44; |
| 370 | /** |
| 371 | * SIP Timer J's value in milliseconds. Timer J is the value of wait time for |
| 372 | * non-invite request retransmission. |
| 373 | * Value is in Integer format. |
| 374 | */ |
| 375 | public static final int SIP_NON_INVITE_REQ_RETX_WAIT_TIME_MSEC = 45; |
| 376 | /** |
| 377 | * SIP Timer K's value in milliseconds. Timer K is the value of wait time for |
| 378 | * non-invite response retransmits. |
| 379 | * Value is in Integer format. |
| 380 | */ |
| 381 | public static final int SIP_NON_INVITE_RSP_RETX_WAIT_TIME_MSEC = 46; |
| 382 | /** |
| 383 | * AMR WB octet aligned dynamic payload type. |
| 384 | * Value is in Integer format. |
| 385 | */ |
| 386 | public static final int AMR_WB_OCTET_ALIGNED_PT = 47; |
| 387 | /** |
| 388 | * AMR WB bandwidth efficient payload type. |
| 389 | * Value is in Integer format. |
| 390 | */ |
| 391 | public static final int AMR_WB_BANDWIDTH_EFFICIENT_PT = 48; |
| 392 | /** |
| 393 | * AMR octet aligned dynamic payload type. |
| 394 | * Value is in Integer format. |
| 395 | */ |
| 396 | public static final int AMR_OCTET_ALIGNED_PT = 49; |
| 397 | /** |
| 398 | * AMR bandwidth efficient payload type. |
| 399 | * Value is in Integer format. |
| 400 | */ |
| 401 | public static final int AMR_BANDWIDTH_EFFICIENT_PT = 50; |
| 402 | /** |
| 403 | * DTMF WB payload type. |
| 404 | * Value is in Integer format. |
| 405 | */ |
| 406 | public static final int DTMF_WB_PT = 51; |
| 407 | /** |
| 408 | * DTMF NB payload type. |
| 409 | * Value is in Integer format. |
| 410 | */ |
| 411 | public static final int DTMF_NB_PT = 52; |
| 412 | /** |
| 413 | * AMR Default encoding mode. |
| 414 | * Value is in Integer format. |
| 415 | */ |
| 416 | public static final int AMR_DEFAULT_MODE = 53; |
| 417 | /** |
| 418 | * SMS Public Service Identity. |
| 419 | * Value is in String format. |
| 420 | */ |
| 421 | public static final int SMS_PSI = 54; |
| 422 | /** |
| 423 | * Video Quality - VideoQualityFeatureValuesConstants. |
| 424 | * Value is in Integer format. |
| 425 | */ |
| 426 | public static final int VIDEO_QUALITY = 55; |
| 427 | /** |
| 428 | * LTE threshold. |
| 429 | * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A. |
| 430 | */ |
| 431 | public static final int TH_LTE1 = 56; |
| 432 | /** |
| 433 | * LTE threshold. |
| 434 | * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2). |
| 435 | */ |
| 436 | public static final int TH_LTE2 = 57; |
| 437 | /** |
| 438 | * LTE threshold. |
| 439 | * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2). |
| 440 | */ |
| 441 | public static final int TH_LTE3 = 58; |
| 442 | /** |
| 443 | * 1x threshold. |
| 444 | * Handover from 1x to WiFi if 1x < TH1x |
| 445 | */ |
| 446 | public static final int TH_1x = 59; |
| 447 | /** |
| 448 | * WiFi threshold. |
| 449 | * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= VOWT_A. |
| 450 | */ |
| 451 | public static final int VOWT_A = 60; |
| 452 | /** |
| 453 | * WiFi threshold. |
| 454 | * Handover from WiFi to LTE if LTE >= THLTE3 or (WiFi < VOWT_B and LTE >= THLTE2). |
| 455 | */ |
| 456 | public static final int VOWT_B = 61; |
| 457 | /** |
| 458 | * LTE ePDG timer. |
| 459 | * Device shall not handover back to LTE until the T_ePDG_LTE timer expires. |
| 460 | */ |
| 461 | public static final int T_EPDG_LTE = 62; |
| 462 | /** |
| 463 | * WiFi ePDG timer. |
| 464 | * Device shall not handover back to WiFi until the T_ePDG_WiFi timer expires. |
| 465 | */ |
| 466 | public static final int T_EPDG_WIFI = 63; |
| 467 | /** |
| 468 | * 1x ePDG timer. |
| 469 | * Device shall not re-register on 1x until the T_ePDG_1x timer expires. |
| 470 | */ |
| 471 | public static final int T_EPDG_1X = 64; |
| 472 | /** |
| 473 | * MultiEndpoint status: Enabled (1), or Disabled (0). |
| 474 | * Value is in Integer format. |
| 475 | */ |
| 476 | public static final int VICE_SETTING_ENABLED = 65; |
| 477 | |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame^] | 478 | /** |
| 479 | * RTT status: Enabled (1), or Disabled (0). |
| 480 | * Value is in Integer format. |
| 481 | */ |
| 482 | public static final int RTT_SETTING_ENABLED = 66; |
| 483 | |
Brad Ebinger | 21013dc | 2017-02-02 16:21:22 -0800 | [diff] [blame] | 484 | // Expand the operator config items as needed here, need to change |
| 485 | // PROVISIONED_CONFIG_END after that. |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame^] | 486 | public static final int PROVISIONED_CONFIG_END = RTT_SETTING_ENABLED; |
Brad Ebinger | 21013dc | 2017-02-02 16:21:22 -0800 | [diff] [blame] | 487 | |
| 488 | // Expand the operator config items as needed here. |
| 489 | } |
| 490 | |
| 491 | /** |
| 492 | * Defines IMS set operation status. |
| 493 | */ |
| 494 | public static class OperationStatusConstants { |
| 495 | public static final int UNKNOWN = -1; |
| 496 | public static final int SUCCESS = 0; |
| 497 | public static final int FAILED = 1; |
| 498 | public static final int UNSUPPORTED_CAUSE_NONE = 2; |
| 499 | public static final int UNSUPPORTED_CAUSE_RAT = 3; |
| 500 | public static final int UNSUPPORTED_CAUSE_DISABLED = 4; |
| 501 | } |
| 502 | |
| 503 | /** |
| 504 | * Defines IMS get operation values. |
| 505 | */ |
| 506 | public static class OperationValuesConstants { |
| 507 | /** |
| 508 | * Values related to Video Quality |
| 509 | */ |
| 510 | public static final int VIDEO_QUALITY_UNKNOWN = -1; |
| 511 | public static final int VIDEO_QUALITY_LOW = 0; |
| 512 | public static final int VIDEO_QUALITY_HIGH = 1; |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * Defines IMS video quality feature value. |
| 517 | */ |
| 518 | public static class VideoQualityFeatureValuesConstants { |
| 519 | public static final int LOW = 0; |
| 520 | public static final int HIGH = 1; |
| 521 | } |
| 522 | |
| 523 | /** |
| 524 | * Defines IMS feature value. |
| 525 | */ |
| 526 | public static class FeatureValueConstants { |
| 527 | public static final int OFF = 0; |
| 528 | public static final int ON = 1; |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 | * Defines IMS feature value. |
| 533 | */ |
| 534 | public static class WfcModeFeatureValueConstants { |
| 535 | public static final int WIFI_ONLY = 0; |
| 536 | public static final int CELLULAR_PREFERRED = 1; |
| 537 | public static final int WIFI_PREFERRED = 2; |
| 538 | } |
| 539 | |
| 540 | public ImsConfig(IImsConfig iconfig, Context context) { |
| 541 | if (DBG) Rlog.d(TAG, "ImsConfig creates"); |
| 542 | miConfig = iconfig; |
| 543 | mContext = context; |
| 544 | } |
| 545 | |
| 546 | /** |
| 547 | * Gets the provisioned value for IMS service/capabilities parameters used by IMS stack. |
| 548 | * This function should not be called from the mainthread as it could block the |
| 549 | * mainthread. |
| 550 | * |
| 551 | * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants. |
| 552 | * @return the value in Integer format. |
| 553 | * |
| 554 | * @throws ImsException if calling the IMS service results in an error. |
| 555 | */ |
| 556 | public int getProvisionedValue(int item) throws ImsException { |
| 557 | int ret = 0; |
| 558 | try { |
| 559 | ret = miConfig.getProvisionedValue(item); |
| 560 | } catch (RemoteException e) { |
| 561 | throw new ImsException("getValue()", e, |
| 562 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 563 | } |
| 564 | if (DBG) Rlog.d(TAG, "getProvisionedValue(): item = " + item + ", ret =" + ret); |
| 565 | |
| 566 | return ret; |
| 567 | } |
| 568 | |
| 569 | /** |
| 570 | * Gets the provisioned value for IMS service/capabilities parameters used by IMS stack. |
| 571 | * This function should not be called from the mainthread as it could block the |
| 572 | * mainthread. |
| 573 | * |
| 574 | * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants. |
| 575 | * @return value in String format. |
| 576 | * |
| 577 | * @throws ImsException if calling the IMS service results in an error. |
| 578 | */ |
| 579 | public String getProvisionedStringValue(int item) throws ImsException { |
| 580 | String ret = "Unknown"; |
| 581 | try { |
| 582 | ret = miConfig.getProvisionedStringValue(item); |
| 583 | } catch (RemoteException e) { |
| 584 | throw new ImsException("getProvisionedStringValue()", e, |
| 585 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 586 | } |
| 587 | if (DBG) Rlog.d(TAG, "getProvisionedStringValue(): item = " + item + ", ret =" + ret); |
| 588 | |
| 589 | return ret; |
| 590 | } |
| 591 | |
| 592 | /** |
| 593 | * Sets the value for IMS service/capabilities parameters by |
| 594 | * the operator device management entity. |
| 595 | * This function should not be called from main thread as it could block |
| 596 | * mainthread. |
| 597 | * |
| 598 | * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants. |
| 599 | * @param value in Integer format. |
| 600 | * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants |
| 601 | * |
| 602 | * @throws ImsException if calling the IMS service results in an error. |
| 603 | */ |
| 604 | public int setProvisionedValue(int item, int value) |
| 605 | throws ImsException { |
| 606 | int ret = OperationStatusConstants.UNKNOWN; |
| 607 | if (DBG) { |
| 608 | Rlog.d(TAG, "setProvisionedValue(): item = " + item + |
| 609 | "value = " + value); |
| 610 | } |
| 611 | try { |
| 612 | ret = miConfig.setProvisionedValue(item, value); |
| 613 | } catch (RemoteException e) { |
| 614 | throw new ImsException("setProvisionedValue()", e, |
| 615 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 616 | } |
| 617 | if (DBG) { |
| 618 | Rlog.d(TAG, "setProvisionedValue(): item = " + item + |
| 619 | " value = " + value + " ret = " + ret); |
| 620 | } |
| 621 | return ret; |
| 622 | } |
| 623 | |
| 624 | /** |
| 625 | * Sets the value for IMS service/capabilities parameters by |
| 626 | * the operator device management entity. |
| 627 | * This function should not be called from main thread as it could block |
| 628 | * mainthread. |
| 629 | * |
| 630 | * @param item, as defined in com.android.ims.ImsConfig#ConfigConstants. |
| 631 | * @param value in String format. |
| 632 | * @return as defined in com.android.ims.ImsConfig#OperationStatusConstants |
| 633 | * |
| 634 | * @throws ImsException if calling the IMS service results in an error. |
| 635 | */ |
| 636 | public int setProvisionedStringValue(int item, String value) |
| 637 | throws ImsException { |
| 638 | int ret = OperationStatusConstants.UNKNOWN; |
| 639 | try { |
| 640 | ret = miConfig.setProvisionedStringValue(item, value); |
| 641 | } catch (RemoteException e) { |
| 642 | throw new ImsException("setProvisionedStringValue()", e, |
| 643 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 644 | } |
| 645 | if (DBG) { |
| 646 | Rlog.d(TAG, "setProvisionedStringValue(): item = " + item + |
| 647 | ", value =" + value); |
| 648 | } |
| 649 | return ret; |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * Gets the value for IMS feature item for specified network type. |
| 654 | * |
| 655 | * @param feature, defined as in FeatureConstants. |
| 656 | * @param network, defined as in android.telephony.TelephonyManager#NETWORK_TYPE_XXX. |
| 657 | * @param listener, provided to be notified for the feature on/off status. |
| 658 | * @return void |
| 659 | * |
| 660 | * @throws ImsException if calling the IMS service results in an error. |
| 661 | */ |
| 662 | public void getFeatureValue(int feature, int network, |
| 663 | ImsConfigListener listener) throws ImsException { |
| 664 | if (DBG) { |
| 665 | Rlog.d(TAG, "getFeatureValue: feature = " + feature + ", network =" + network + |
| 666 | ", listener =" + listener); |
| 667 | } |
| 668 | try { |
| 669 | miConfig.getFeatureValue(feature, network, listener); |
| 670 | } catch (RemoteException e) { |
| 671 | throw new ImsException("getFeatureValue()", e, |
| 672 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | /** |
| 677 | * Sets the value for IMS feature item for specified network type. |
| 678 | * |
| 679 | * @param feature, as defined in FeatureConstants. |
| 680 | * @param network, as defined in android.telephony.TelephonyManager#NETWORK_TYPE_XXX. |
| 681 | * @param value, as defined in FeatureValueConstants. |
| 682 | * @param listener, provided if caller needs to be notified for set result. |
| 683 | * @return void |
| 684 | * |
| 685 | * @throws ImsException if calling the IMS service results in an error. |
| 686 | */ |
| 687 | public void setFeatureValue(int feature, int network, int value, |
| 688 | ImsConfigListener listener) throws ImsException { |
| 689 | if (DBG) { |
| 690 | Rlog.d(TAG, "setFeatureValue: feature = " + feature + ", network =" + network + |
| 691 | ", value =" + value + ", listener =" + listener); |
| 692 | } |
| 693 | try { |
| 694 | miConfig.setFeatureValue(feature, network, value, listener); |
| 695 | } catch (RemoteException e) { |
| 696 | throw new ImsException("setFeatureValue()", e, |
| 697 | ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); |
| 698 | } |
| 699 | } |
| 700 | } |