1 /* 2 * Copyright (C) 2018 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 android.telephony.ims; 18 19 import android.Manifest; 20 import android.annotation.CallbackExecutor; 21 import android.annotation.NonNull; 22 import android.annotation.Nullable; 23 import android.annotation.RequiresFeature; 24 import android.annotation.RequiresPermission; 25 import android.annotation.SdkConstant; 26 import android.annotation.StringDef; 27 import android.annotation.SystemApi; 28 import android.annotation.WorkerThread; 29 import android.content.pm.PackageManager; 30 import android.os.Binder; 31 import android.os.RemoteException; 32 import android.os.ServiceSpecificException; 33 import android.telephony.CarrierConfigManager; 34 import android.telephony.SubscriptionManager; 35 import android.telephony.TelephonyFrameworkInitializer; 36 import android.telephony.TelephonyManager; 37 import android.telephony.ims.aidl.IFeatureProvisioningCallback; 38 import android.telephony.ims.aidl.IImsConfigCallback; 39 import android.telephony.ims.aidl.IRcsConfigCallback; 40 import android.telephony.ims.feature.MmTelFeature; 41 import android.telephony.ims.stub.ImsConfigImplBase; 42 import android.telephony.ims.stub.ImsRegistrationImplBase; 43 44 import com.android.internal.telephony.ITelephony; 45 46 import java.lang.annotation.Retention; 47 import java.lang.annotation.RetentionPolicy; 48 import java.util.concurrent.Executor; 49 50 /** 51 * Manages IMS provisioning and configuration parameters, as well as callbacks for apps to listen 52 * to changes in these configurations. 53 * 54 * IMS provisioning keys are defined per carrier or OEM using OMA-DM or other provisioning 55 * applications and may vary. It is up to the carrier and OEM applications to ensure that the 56 * correct provisioning keys are being used when integrating with a vendor's ImsService. 57 * 58 * Use {@link android.telephony.ims.ImsManager#getProvisioningManager(int)} to get an instance of 59 * this manager. 60 */ 61 @RequiresFeature(PackageManager.FEATURE_TELEPHONY_IMS) 62 public class ProvisioningManager { 63 64 private static final String TAG = "ProvisioningManager"; 65 66 /**@hide*/ 67 @StringDef(prefix = "STRING_QUERY_RESULT_ERROR_", value = { 68 STRING_QUERY_RESULT_ERROR_GENERIC, 69 STRING_QUERY_RESULT_ERROR_NOT_READY 70 }) 71 @Retention(RetentionPolicy.SOURCE) 72 public @interface StringResultError {} 73 74 /** 75 * The query from {@link #getProvisioningStringValue(int)} has resulted in an unspecified error. 76 * @hide 77 */ 78 @SystemApi 79 public static final String STRING_QUERY_RESULT_ERROR_GENERIC = 80 "STRING_QUERY_RESULT_ERROR_GENERIC"; 81 82 /** 83 * The query from {@link #getProvisioningStringValue(int)} has resulted in an error because the 84 * ImsService implementation was not ready for provisioning queries. 85 * @hide 86 */ 87 @SystemApi 88 public static final String STRING_QUERY_RESULT_ERROR_NOT_READY = 89 "STRING_QUERY_RESULT_ERROR_NOT_READY"; 90 91 /** 92 * There is no existing configuration for the queried provisioning key. 93 * @hide 94 */ 95 public static final int PROVISIONING_RESULT_UNKNOWN = -1; 96 97 /** 98 * The integer result of provisioning for the queried key is disabled. 99 * @hide 100 */ 101 @SystemApi 102 public static final int PROVISIONING_VALUE_DISABLED = 0; 103 104 /** 105 * The integer result of provisioning for the queried key is enabled. 106 * @hide 107 */ 108 @SystemApi 109 public static final int PROVISIONING_VALUE_ENABLED = 1; 110 111 112 // Inheriting values from ImsConfig for backwards compatibility. 113 /** 114 * AMR CODEC Mode Value set, 0-7 in comma separated sequence. 115 * <p> 116 * This corresponds to the {@code mode-set} parameter for the AMR codec. 117 * See 3GPP TS 26.101 Table 1A for more information. 118 * <p> 119 * <UL> 120 * <LI>0 - AMR 4.75 kbit/s</LI> 121 * <LI>1 - AMR 5.15 kbit/s</LI> 122 * <LI>2 - AMR 5.90 kbit/s</LI> 123 * <LI>3 - AMR 6.70 kbit/s (PDC-EFR)</LI> 124 * <LI>4 - AMR 7.40 kbit/s (TDMA-EFR)</LI> 125 * <LI>5 - AMR 7.95 kbit/s</LI> 126 * <LI>6 - AMR 10.2 kbit/s</LI> 127 * <LI>7 - AMR 12.2 kbit/s (GSM-EFR)</LI> 128 * </UL> 129 * <p> 130 * Value is in String format. 131 * @see #setProvisioningIntValue(int, int) 132 * @see #getProvisioningIntValue(int) 133 * @hide 134 */ 135 public static final int KEY_AMR_CODEC_MODE_SET_VALUES = 0; 136 137 /** 138 * Wide Band AMR CODEC Mode Value set,0-7 in comma separated sequence. 139 * <p> 140 * This corresponds to the {@code mode-set} parameter for the AMR wideband codec. 141 * See 3GPP TS 26.101 Table 1A for more information. 142 * <p> 143 * <UL> 144 * <LI>0 - AMR 4.75 kbit/s</LI> 145 * <LI>1 - AMR 5.15 kbit/s</LI> 146 * <LI>2 - AMR 5.90 kbit/s</LI> 147 * <LI>3 - AMR 6.70 kbit/s (PDC-EFR)</LI> 148 * <LI>4 - AMR 7.40 kbit/s (TDMA-EFR)</LI> 149 * <LI>5 - AMR 7.95 kbit/s</LI> 150 * <LI>6 - AMR 10.2 kbit/s</LI> 151 * <LI>7 - AMR 12.2 kbit/s (GSM-EFR)</LI> 152 * </UL> 153 * <p> 154 * Value is in String format. 155 * @see #setProvisioningStringValue(int, String) 156 * @see #getProvisioningStringValue(int) 157 * @hide 158 */ 159 public static final int KEY_AMR_WB_CODEC_MODE_SET_VALUES = 1; 160 161 /** 162 * SIP Session Timer value (seconds). 163 * <p> 164 * See RFC4028 for more information. 165 * <p> 166 * Value is in Integer format. 167 * @see #setProvisioningIntValue(int, int) 168 * @see #getProvisioningIntValue(int) 169 * @hide 170 */ 171 public static final int KEY_SIP_SESSION_TIMER_SEC = 2; 172 173 /** 174 * Minimum SIP Session Expiration Timer in (seconds). 175 * <p> 176 * See RFC4028 for more information. 177 * <p> 178 * Value is in Integer format. 179 * @see #setProvisioningIntValue(int, int) 180 * @see #getProvisioningIntValue(int) 181 * @hide 182 */ 183 public static final int KEY_MINIMUM_SIP_SESSION_EXPIRATION_TIMER_SEC = 3; 184 185 /** 186 * SIP_INVITE cancellation time out value (in milliseconds). Integer format. 187 * <p> 188 * See RFC4028 for more information. 189 * <p> 190 * Value is in Integer format. 191 * @see #setProvisioningIntValue(int, int) 192 * @see #getProvisioningIntValue(int) 193 * @hide 194 */ 195 public static final int KEY_SIP_INVITE_CANCELLATION_TIMER_MS = 4; 196 197 /** 198 * Delay time when an iRAT transitions from eHRPD/HRPD/1xRTT to LTE. 199 * Value is in Integer format. 200 * @see #setProvisioningIntValue(int, int) 201 * @see #getProvisioningIntValue(int) 202 * @hide 203 */ 204 public static final int KEY_TRANSITION_TO_LTE_DELAY_MS = 5; 205 206 /** 207 * Silent redial status of Enabled (True), or Disabled (False). 208 * Value is in boolean format. 209 * @see #setProvisioningIntValue(int, int) 210 * @see #getProvisioningIntValue(int) 211 * @hide 212 */ 213 public static final int KEY_ENABLE_SILENT_REDIAL = 6; 214 215 /** 216 * An integer key representing the SIP T1 timer value in milliseconds for the associated 217 * subscription. 218 * <p> 219 * The SIP T1 timer is an estimate of the round-trip time and will retransmit 220 * INVITE transactions that are longer than T1 milliseconds over unreliable transports, doubling 221 * the time before retransmission every time there is no response. See RFC3261, section 17.1.1.1 222 * for more details. 223 * <p> 224 * The value is an integer. 225 * @see #setProvisioningIntValue(int, int) 226 * @see #getProvisioningIntValue(int) 227 * @hide 228 */ 229 public static final int KEY_T1_TIMER_VALUE_MS = 7; 230 231 /** 232 * SIP T2 timer value in milliseconds. See RFC 3261 for information. 233 * <p> 234 * The T2 timer is the maximum retransmit interval for non-INVITE requests and INVITE responses. 235 * <p> 236 * Value is in Integer format. 237 * @see #setProvisioningIntValue(int, int) 238 * @see #getProvisioningIntValue(int) 239 * @hide 240 */ 241 public static final int KEY_T2_TIMER_VALUE_MS = 8; 242 243 /** 244 * SIP TF timer value in milliseconds. See RFC 3261 for information. 245 * <p> 246 * The TF timer is the non-INVITE transaction timeout timer. 247 * <p> 248 * Value is in Integer format. 249 * @see #setProvisioningIntValue(int, int) 250 * @see #getProvisioningIntValue(int) 251 * @hide 252 */ 253 public static final int KEY_TF_TIMER_VALUE_MS = 9; 254 255 /** 256 * An integer key representing the voice over LTE (VoLTE) provisioning status for the 257 * associated subscription. Determines whether the user can register for voice services over 258 * LTE. 259 * <p> 260 * Use {@link #PROVISIONING_VALUE_ENABLED} to enable VoLTE provisioning and 261 * {@link #PROVISIONING_VALUE_DISABLED} to disable VoLTE provisioning. 262 * @see #setProvisioningIntValue(int, int) 263 * @see #getProvisioningIntValue(int) 264 * @hide 265 */ 266 public static final int KEY_VOLTE_PROVISIONING_STATUS = 10; 267 268 /** 269 * An integer key representing the video telephony (VT) provisioning status for the 270 * associated subscription. Determines whether the user can register for video services over 271 * LTE. 272 * <p> 273 * Use {@link #PROVISIONING_VALUE_ENABLED} to enable VT provisioning and 274 * {@link #PROVISIONING_VALUE_DISABLED} to disable VT provisioning. 275 * @see #setProvisioningIntValue(int, int) 276 * @see #getProvisioningIntValue(int) 277 * @hide 278 */ 279 public static final int KEY_VT_PROVISIONING_STATUS = 11; 280 281 /** 282 * Domain Name for the device to populate the request URI for REGISTRATION. 283 * Value is in String format. 284 * @see #setProvisioningStringValue(int, String) 285 * @see #getProvisioningStringValue(int) 286 * @hide 287 */ 288 public static final int KEY_REGISTRATION_DOMAIN_NAME = 12; 289 290 /** 291 * Device Outgoing SMS based on either 3GPP or 3GPP2 standards. 292 * Value is in Integer format. 293 * Valid values are {@link #SMS_FORMAT_3GPP} and {@link #SMS_FORMAT_3GPP2}. 294 * @see #setProvisioningIntValue(int, int) 295 * @see #getProvisioningIntValue(int) 296 * @hide 297 */ 298 public static final int KEY_SMS_FORMAT = 13; 299 300 /** 301 * Value used with {@link #KEY_SMS_FORMAT} to indicate 3GPP2 SMS format is used. 302 * See {@link android.telephony.SmsMessage#FORMAT_3GPP2} for more information. 303 * @hide 304 */ 305 public static final int SMS_FORMAT_3GPP2 = 0; 306 307 /** 308 * Value used with {@link #KEY_SMS_FORMAT} to indicate 3GPP SMS format is used. 309 * See {@link android.telephony.SmsMessage#FORMAT_3GPP} for more information. 310 * @hide 311 */ 312 public static final int SMS_FORMAT_3GPP = 1; 313 314 /** 315 * Turns SMS over IMS ON/OFF on the device. 316 * Value is in Integer format. ON (1), OFF(0). 317 * @see #setProvisioningIntValue(int, int) 318 * @see #getProvisioningIntValue(int) 319 * @hide 320 */ 321 public static final int KEY_SMS_OVER_IP_ENABLED = 14; 322 323 /** 324 * An integer key associated with the carrier configured SIP PUBLISH timer, which dictates the 325 * expiration time in seconds for published online availability in RCS presence. 326 * <p> 327 * Value is in Integer format. 328 * @see #setProvisioningIntValue(int, int) 329 * @see #getProvisioningIntValue(int) 330 * @hide 331 */ 332 public static final int KEY_RCS_PUBLISH_TIMER_SEC = 15; 333 334 /** 335 * An integer key associated with the carrier configured expiration time in seconds for 336 * published offline availability in RCS presence provided, which is provided to the network. 337 * <p> 338 * Value is in Integer format. 339 * @see #setProvisioningIntValue(int, int) 340 * @see #getProvisioningIntValue(int) 341 * @hide 342 */ 343 public static final int KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC = 16; 344 345 /** 346 * An integer key associated with whether or not capability discovery is provisioned for this 347 * subscription. Any capability requests will be ignored by the RCS service. 348 * <p> 349 * The value is an integer, either {@link #PROVISIONING_VALUE_DISABLED} if capability 350 * discovery is disabled or {@link #PROVISIONING_VALUE_ENABLED} if capability discovery is 351 * enabled. 352 * @see #setProvisioningIntValue(int, int) 353 * @see #getProvisioningIntValue(int) 354 * @hide 355 */ 356 public static final int KEY_RCS_CAPABILITY_DISCOVERY_ENABLED = 17; 357 358 /** 359 * An integer key associated with the period of time in seconds the capability information of 360 * each contact is cached on the device. 361 * <p> 362 * Seconds are used because this is usually measured in the span of days. 363 * <p> 364 * Value is in Integer format. 365 * @see #setProvisioningIntValue(int, int) 366 * @see #getProvisioningIntValue(int) 367 * @hide 368 */ 369 public static final int KEY_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC = 18; 370 371 /** 372 * An integer key associated with the period of time in seconds that the availability 373 * information of a contact is cached on the device, which is based on the carrier provisioning 374 * configuration from the network. 375 * <p> 376 * Value is in Integer format. 377 * @see #setProvisioningIntValue(int, int) 378 * @see #getProvisioningIntValue(int) 379 * @hide 380 */ 381 public static final int KEY_RCS_AVAILABILITY_CACHE_EXPIRATION_SEC = 19; 382 383 /** 384 * An integer key associated with the carrier configured interval in seconds expected between 385 * successive capability polling attempts, which is based on the carrier provisioning 386 * configuration from the network. 387 * <p> 388 * Value is in Integer format. 389 * @see #setProvisioningIntValue(int, int) 390 * @see #getProvisioningIntValue(int) 391 * @hide 392 */ 393 public static final int KEY_RCS_CAPABILITIES_POLL_INTERVAL_SEC = 20; 394 395 /** 396 * An integer key representing the minimum time allowed between two consecutive presence publish 397 * messages from the device in milliseconds. 398 * <p> 399 * Value is in Integer format. 400 * @see #setProvisioningIntValue(int, int) 401 * @see #getProvisioningIntValue(int) 402 * @hide 403 */ 404 public static final int KEY_RCS_PUBLISH_SOURCE_THROTTLE_MS = 21; 405 406 /** 407 * An integer key associated with the maximum number of MDNs contained in one SIP Request 408 * Contained List (RCS) used to retrieve the RCS capabilities of the contacts book. 409 * <p> 410 * Value is in Integer format. 411 * @see #setProvisioningIntValue(int, int) 412 * @see #getProvisioningIntValue(int) 413 * @hide 414 */ 415 public static final int KEY_RCS_MAX_NUM_ENTRIES_IN_RCL = 22; 416 417 /** 418 * An integer associated with the expiration timer used during the SIP subscription of a 419 * Request Contained List (RCL), which is used to retrieve the RCS capabilities of the contact 420 * book. This timer value is sent in seconds to the network. 421 * <p> 422 * Value is in Integer format. 423 * @see #setProvisioningIntValue(int, int) 424 * @see #getProvisioningIntValue(int) 425 * @hide 426 */ 427 public static final int KEY_RCS_CAPABILITY_POLL_LIST_SUB_EXP_SEC = 23; 428 429 /** 430 * Applies compression to LIST Subscription. 431 * Value is in Integer format. Enable (1), Disable(0). 432 * @see #setProvisioningIntValue(int, int) 433 * @see #getProvisioningIntValue(int) 434 * @hide 435 */ 436 public static final int KEY_USE_GZIP_FOR_LIST_SUBSCRIPTION = 24; 437 438 /** 439 * An integer key representing the RCS enhanced address book (EAB) provisioning status for the 440 * associated subscription. Determines whether or not SIP OPTIONS or presence will be used to 441 * retrieve RCS capabilities for the user's contacts. 442 * <p> 443 * Use {@link #PROVISIONING_VALUE_ENABLED} to enable EAB provisioning and 444 * {@link #PROVISIONING_VALUE_DISABLED} to disable EAB provisioning. 445 * @see #setProvisioningIntValue(int, int) 446 * @see #getProvisioningIntValue(int) 447 * @hide 448 */ 449 public static final int KEY_EAB_PROVISIONING_STATUS = 25; 450 451 /** 452 * Override the user-defined WiFi Roaming enabled setting for this subscription, defined in 453 * {@link android.telephony.SubscriptionManager#WFC_ROAMING_ENABLED_CONTENT_URI}, 454 * for the purposes of provisioning the subscription for WiFi Calling. 455 * 456 * @see #setProvisioningIntValue(int, int) 457 * @see #getProvisioningIntValue(int) 458 * @hide 459 */ 460 @SystemApi 461 public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26; 462 463 /** 464 * Override the user-defined WiFi mode for this subscription, defined in 465 * {@link android.telephony.SubscriptionManager#WFC_MODE_CONTENT_URI}, 466 * for the purposes of provisioning this subscription for WiFi Calling. 467 * 468 * Valid values for this key are: 469 * {@link ImsMmTelManager#WIFI_MODE_WIFI_ONLY}, 470 * {@link ImsMmTelManager#WIFI_MODE_CELLULAR_PREFERRED}, or 471 * {@link ImsMmTelManager#WIFI_MODE_WIFI_PREFERRED}. 472 * 473 * @see #setProvisioningIntValue(int, int) 474 * @see #getProvisioningIntValue(int) 475 * @hide 476 */ 477 @SystemApi 478 public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; 479 480 /** 481 * Enable voice over wifi. Enabled (1), or Disabled (0). 482 * Value is in Integer format. 483 * @see #setProvisioningIntValue(int, int) 484 * @see #getProvisioningIntValue(int) 485 * @hide 486 */ 487 public static final int KEY_VOICE_OVER_WIFI_ENABLED_OVERRIDE = 28; 488 489 /** 490 * Mobile data enabled. 491 * Value is in Integer format. On (1), OFF(0). 492 * @see #setProvisioningIntValue(int, int) 493 * @see #getProvisioningIntValue(int) 494 * @hide 495 */ 496 public static final int KEY_MOBILE_DATA_ENABLED = 29; 497 498 /** 499 * VoLTE user opted in status. 500 * Value is in Integer format. Opted-in (1) Opted-out (0). 501 * @see #setProvisioningIntValue(int, int) 502 * @see #getProvisioningIntValue(int) 503 * @hide 504 */ 505 public static final int KEY_VOLTE_USER_OPT_IN_STATUS = 30; 506 507 /** 508 * Proxy for Call Session Control Function(P-CSCF) address for Local-BreakOut(LBO). 509 * Value is in String format. 510 * @hide 511 */ 512 public static final int KEY_LOCAL_BREAKOUT_PCSCF_ADDRESS = 31; 513 514 /** 515 * Keep Alive Enabled for SIP. 516 * Value is in Integer format. 517 * @see #setProvisioningIntValue(int, int) 518 * @see #getProvisioningIntValue(int) 519 * @hide 520 */ 521 public static final int KEY_SIP_KEEP_ALIVE_ENABLED = 32; 522 523 /** 524 * Registration retry Base Time value in seconds, which is based off of the carrier 525 * configuration. 526 * Value is in Integer format. 527 * @see #setProvisioningIntValue(int, int) 528 * @see #getProvisioningIntValue(int) 529 * @hide 530 */ 531 public static final int KEY_REGISTRATION_RETRY_BASE_TIME_SEC = 33; 532 533 /** 534 * Registration retry Max Time value in seconds, which is based off of the carrier 535 * configuration. 536 * Value is in Integer format. 537 * @see #setProvisioningIntValue(int, int) 538 * @see #getProvisioningIntValue(int) 539 * @hide 540 */ 541 public static final int KEY_REGISTRATION_RETRY_MAX_TIME_SEC = 34; 542 543 /** 544 * Smallest RTP port for speech codec. 545 * Value is in integer format. 546 * @see #setProvisioningIntValue(int, int) 547 * @see #getProvisioningIntValue(int) 548 * @hide 549 */ 550 551 public static final int KEY_RTP_SPEECH_START_PORT = 35; 552 553 /** 554 * Largest RTP port for speech code. 555 * Value is in Integer format. 556 * @see #setProvisioningIntValue(int, int) 557 * @see #getProvisioningIntValue(int) 558 * @hide 559 */ 560 public static final int KEY_RTP_SPEECH_END_PORT = 36; 561 562 /** 563 * SIP Timer A's value in milliseconds. Timer A is the INVITE request retransmit interval (in 564 * milliseconds), for UDP only. 565 * Value is in Integer format. 566 * @see #setProvisioningIntValue(int, int) 567 * @see #getProvisioningIntValue(int) 568 * @hide 569 */ 570 public static final int KEY_SIP_INVITE_REQUEST_TRANSMIT_INTERVAL_MS = 37; 571 572 /** 573 * SIP Timer B's value in milliseconds. Timer B is the wait time for INVITE message to be, 574 * in milliseconds. 575 * Value is in Integer format. 576 * @see #setProvisioningIntValue(int, int) 577 * @see #getProvisioningIntValue(int) 578 * @hide 579 */ 580 public static final int KEY_SIP_INVITE_ACK_WAIT_TIME_MS = 38; 581 582 /** 583 * SIP Timer D's value in milliseconds. Timer D is the wait time for response retransmits of 584 * the invite client transactions, in milliseconds. 585 * Value is in Integer format. 586 * @see #setProvisioningIntValue(int, int) 587 * @see #getProvisioningIntValue(int) 588 * @hide 589 */ 590 public static final int KEY_SIP_INVITE_RESPONSE_RETRANSMIT_WAIT_TIME_MS = 39; 591 592 /** 593 * SIP Timer E's value in milliseconds. Timer E is the value Non-INVITE request retransmit 594 * interval (in milliseconds), for UDP only. 595 * Value is in Integer format. 596 * @see #setProvisioningIntValue(int, int) 597 * @see #getProvisioningIntValue(int) 598 * @hide 599 */ 600 public static final int KEY_SIP_NON_INVITE_REQUEST_RETRANSMIT_INTERVAL_MS = 40; 601 602 /** 603 * SIP Timer F's value in milliseconds. Timer F is the Non-INVITE transaction timeout timer, 604 * in milliseconds. 605 * Value is in Integer format. 606 * @see #setProvisioningIntValue(int, int) 607 * @see #getProvisioningIntValue(int) 608 * @hide 609 */ 610 public static final int KEY_SIP_NON_INVITE_TRANSACTION_TIMEOUT_TIMER_MS = 41; 611 612 /** 613 * SIP Timer G's value in milliseconds. Timer G is the value of INVITE response 614 * retransmit interval. 615 * Value is in Integer format. 616 * @see #setProvisioningIntValue(int, int) 617 * @see #getProvisioningIntValue(int) 618 * @hide 619 */ 620 public static final int KEY_SIP_INVITE_RESPONSE_RETRANSMIT_INTERVAL_MS = 42; 621 622 /** 623 * SIP Timer H's value in milliseconds. Timer H is the value of wait time for 624 * ACK receipt. 625 * Value is in Integer format. 626 * @see #setProvisioningIntValue(int, int) 627 * @see #getProvisioningIntValue(int) 628 * @hide 629 */ 630 public static final int KEY_SIP_ACK_RECEIPT_WAIT_TIME_MS = 43; 631 632 /** 633 * SIP Timer I's value in milliseconds. Timer I is the value of wait time for 634 * ACK retransmits. 635 * Value is in Integer format. 636 * @see #setProvisioningIntValue(int, int) 637 * @see #getProvisioningIntValue(int) 638 * @hide 639 */ 640 public static final int KEY_SIP_ACK_RETRANSMIT_WAIT_TIME_MS = 44; 641 642 /** 643 * SIP Timer J's value in milliseconds. Timer J is the value of wait time for 644 * non-invite request retransmission. 645 * Value is in Integer format. 646 * @see #setProvisioningIntValue(int, int) 647 * @see #getProvisioningIntValue(int) 648 * @hide 649 */ 650 public static final int KEY_SIP_NON_INVITE_REQUEST_RETRANSMISSION_WAIT_TIME_MS = 45; 651 652 /** 653 * SIP Timer K's value in milliseconds. Timer K is the value of wait time for 654 * non-invite response retransmits. 655 * Value is in Integer format. 656 * @see #setProvisioningIntValue(int, int) 657 * @see #getProvisioningIntValue(int) 658 * @hide 659 */ 660 public static final int KEY_SIP_NON_INVITE_RESPONSE_RETRANSMISSION_WAIT_TIME_MS = 46; 661 662 /** 663 * AMR WB octet aligned dynamic payload type. 664 * Value is in Integer format. 665 * @see #setProvisioningIntValue(int, int) 666 * @see #getProvisioningIntValue(int) 667 * @hide 668 */ 669 public static final int KEY_AMR_WB_OCTET_ALIGNED_PAYLOAD_TYPE = 47; 670 671 /** 672 * AMR WB bandwidth efficient payload type. 673 * Value is in Integer format. 674 * @see #setProvisioningIntValue(int, int) 675 * @see #getProvisioningIntValue(int) 676 * @hide 677 */ 678 public static final int KEY_AMR_WB_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE = 48; 679 680 /** 681 * AMR octet aligned dynamic payload type. 682 * Value is in Integer format. 683 * @see #setProvisioningIntValue(int, int) 684 * @see #getProvisioningIntValue(int) 685 * @hide 686 */ 687 public static final int KEY_AMR_OCTET_ALIGNED_PAYLOAD_TYPE = 49; 688 689 /** 690 * AMR bandwidth efficient payload type. 691 * Value is in Integer format. 692 * @see #setProvisioningIntValue(int, int) 693 * @see #getProvisioningIntValue(int) 694 * @hide 695 */ 696 public static final int KEY_AMR_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE = 50; 697 698 /** 699 * DTMF WB payload type. 700 * Value is in Integer format. 701 * @see #setProvisioningIntValue(int, int) 702 * @see #getProvisioningIntValue(int) 703 * @hide 704 */ 705 public static final int KEY_DTMF_WB_PAYLOAD_TYPE = 51; 706 707 /** 708 * DTMF NB payload type. 709 * Value is in Integer format. 710 * @see #setProvisioningIntValue(int, int) 711 * @see #getProvisioningIntValue(int) 712 * @hide 713 */ 714 public static final int KEY_DTMF_NB_PAYLOAD_TYPE = 52; 715 716 /** 717 * AMR Default encoding mode. 718 * Value is in Integer format. 719 * @see #setProvisioningIntValue(int, int) 720 * @see #getProvisioningIntValue(int) 721 * @hide 722 */ 723 public static final int KEY_AMR_DEFAULT_ENCODING_MODE = 53; 724 725 /** 726 * SMS Public Service Identity. 727 * Value is in String format. 728 * @hide 729 */ 730 public static final int KEY_SMS_PUBLIC_SERVICE_IDENTITY = 54; 731 732 /** 733 * Video Quality - VideoQualityFeatureValuesConstants. 734 * Valid values are: {@link #VIDEO_QUALITY_HIGH} and {@link #VIDEO_QUALITY_LOW}. 735 * Value is in Integer format. 736 * @see #setProvisioningIntValue(int, int) 737 * @see #getProvisioningIntValue(int) 738 * @hide 739 */ 740 public static final int KEY_VIDEO_QUALITY = 55; 741 742 /** 743 * Used with {@link #KEY_VIDEO_QUALITY} to indicate low video quality. 744 * @hide 745 */ 746 public static final int VIDEO_QUALITY_LOW = 0; 747 748 /** 749 * Used with {@link #KEY_VIDEO_QUALITY} to indicate high video quality. 750 * @hide 751 */ 752 public static final int VIDEO_QUALITY_HIGH = 1; 753 754 /** 755 * LTE to WIFI handover threshold. 756 * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= {@link #KEY_WIFI_THRESHOLD_A}. 757 * Value is in Integer format. 758 * @see #setProvisioningIntValue(int, int) 759 * @see #getProvisioningIntValue(int) 760 * @hide 761 */ 762 public static final int KEY_LTE_THRESHOLD_1 = 56; 763 764 /** 765 * WIFI to LTE handover threshold. 766 * Handover from WiFi to LTE if LTE >= {@link #KEY_LTE_THRESHOLD_3} or (WiFi < {@link 767 * #KEY_WIFI_THRESHOLD_B} and LTE >= {@link #KEY_LTE_THRESHOLD_2}). 768 * Value is in Integer format. 769 * 770 * @see #setProvisioningIntValue(int, int) 771 * @see #getProvisioningIntValue(int) 772 * @hide 773 */ 774 public static final int KEY_LTE_THRESHOLD_2 = 57; 775 776 /** 777 * LTE to WIFI handover threshold. 778 * Handover from WiFi to LTE if LTE >= {@link #KEY_LTE_THRESHOLD_3} or (WiFi < {@link 779 * #KEY_WIFI_THRESHOLD_B} and LTE >= {@link #KEY_LTE_THRESHOLD_2}). 780 * Value is in Integer format. 781 * 782 * @see #setProvisioningIntValue(int, int) 783 * @see #getProvisioningIntValue(int) 784 * @hide 785 */ 786 public static final int KEY_LTE_THRESHOLD_3 = 58; 787 788 /** 789 * 1x to WIFI handover threshold. 790 * Handover from 1x to WiFi if 1x < {@link #KEY_1X_THRESHOLD}. 791 * Value is in Integer format. 792 * @see #setProvisioningIntValue(int, int) 793 * @see #getProvisioningIntValue(int) 794 * @hide 795 */ 796 public static final int KEY_1X_THRESHOLD = 59; 797 798 /** 799 * LTE to WIFI threshold A. 800 * Handover from LTE to WiFi if LTE < {@link #KEY_LTE_THRESHOLD_1} and WiFi >= {@link 801 * #KEY_WIFI_THRESHOLD_A}. 802 * Value is in Integer format. 803 * 804 * @see #setProvisioningIntValue(int, int) 805 * @see #getProvisioningIntValue(int) 806 * @hide 807 */ 808 public static final int KEY_WIFI_THRESHOLD_A = 60; 809 810 /** 811 * WiFi to LTRE handover threshold B. 812 * Handover from WiFi to LTE if LTE >= {@link #KEY_LTE_THRESHOLD_3} or (WiFi < 813 * {@link #KEY_WIFI_THRESHOLD_B} and LTE >= {@link #KEY_LTE_THRESHOLD_2}). 814 * Value is in Integer format. 815 * @see #setProvisioningIntValue(int, int) 816 * @see #getProvisioningIntValue(int) 817 * @hide 818 */ 819 public static final int KEY_WIFI_THRESHOLD_B = 61; 820 821 /** 822 * LTE ePDG timer (in seconds). 823 * Device shall not handover back to LTE until the T_ePDG_LTE timer expires. 824 * Value is in Integer format. 825 * @see #setProvisioningIntValue(int, int) 826 * @see #getProvisioningIntValue(int) 827 * @hide 828 */ 829 public static final int KEY_LTE_EPDG_TIMER_SEC = 62; 830 831 /** 832 * WiFi ePDG timer (in seconds). 833 * Device shall not handover back to WiFi until the T_ePDG_WiFi timer expires. 834 * Value is in Integer format. 835 * @see #setProvisioningIntValue(int, int) 836 * @see #getProvisioningIntValue(int) 837 * @hide 838 */ 839 public static final int KEY_WIFI_EPDG_TIMER_SEC = 63; 840 841 /** 842 * 1x ePDG timer (in seconds). 843 * Device shall not re-register on 1x until the T_ePDG_1x timer expires. 844 * @hide 845 */ 846 public static final int KEY_1X_EPDG_TIMER_SEC = 64; 847 848 /** 849 * MultiEndpoint status: Enabled (1), or Disabled (0). 850 * Value is in Integer format. 851 * @see #setProvisioningIntValue(int, int) 852 * @see #getProvisioningIntValue(int) 853 * @hide 854 */ 855 public static final int KEY_MULTIENDPOINT_ENABLED = 65; 856 857 /** 858 * RTT status: Enabled (1), or Disabled (0). 859 * Value is in Integer format. 860 * @see #setProvisioningIntValue(int, int) 861 * @see #getProvisioningIntValue(int) 862 * @hide 863 */ 864 public static final int KEY_RTT_ENABLED = 66; 865 866 /** 867 * An obfuscated string defined by the carrier to indicate VoWiFi entitlement status. 868 * 869 * <p>Implementation note: how to generate the value and how it affects VoWiFi service 870 * should follow carrier requirements. For example, set an empty string could result in 871 * VoWiFi being disabled by IMS service, and set to a specific string could enable. 872 * 873 * <p>Value is in String format. 874 * @see #setProvisioningStringValue(int, String) 875 * @see #getProvisioningStringValue(int) 876 * @hide 877 */ 878 @SystemApi 879 public static final int KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID = 67; 880 881 /** 882 * An integer key representing the voice over IMS opt-in provisioning status for the 883 * associated subscription. Determines whether the user can see for voice services over 884 * IMS. 885 * 886 * <p> The flag will force to show the VoLTE option in settings irrespective of others VoLTE 887 * carrier config which hide the VoLTE option (e.g. 888 * {@link CarrierConfigManager#KEY_HIDE_ENHANCED_4G_LTE_BOOL}). 889 * 890 * <p>Use {@link #PROVISIONING_VALUE_ENABLED} to enable VoIMS provisioning and 891 * {@link #PROVISIONING_VALUE_DISABLED} to disable VoIMS provisioning. 892 * @see #setProvisioningIntValue(int, int) 893 * @see #getProvisioningIntValue(int) 894 * @hide 895 */ 896 public static final int KEY_VOIMS_OPT_IN_STATUS = 68; 897 898 /** 899 * Callback for IMS provisioning changes. 900 * @hide 901 */ 902 @SystemApi 903 public static class Callback { 904 905 private static class CallbackBinder extends IImsConfigCallback.Stub { 906 907 private final Callback mLocalConfigurationCallback; 908 private Executor mExecutor; 909 CallbackBinder(Callback localConfigurationCallback)910 private CallbackBinder(Callback localConfigurationCallback) { 911 mLocalConfigurationCallback = localConfigurationCallback; 912 } 913 914 @Override onIntConfigChanged(int item, int value)915 public final void onIntConfigChanged(int item, int value) { 916 final long callingIdentity = Binder.clearCallingIdentity(); 917 try { 918 mExecutor.execute(() -> 919 mLocalConfigurationCallback.onProvisioningIntChanged(item, value)); 920 } finally { 921 restoreCallingIdentity(callingIdentity); 922 } 923 } 924 925 @Override onStringConfigChanged(int item, String value)926 public final void onStringConfigChanged(int item, String value) { 927 final long callingIdentity = Binder.clearCallingIdentity(); 928 try { 929 mExecutor.execute(() -> 930 mLocalConfigurationCallback.onProvisioningStringChanged(item, value)); 931 } finally { 932 restoreCallingIdentity(callingIdentity); 933 } 934 } 935 setExecutor(Executor executor)936 private void setExecutor(Executor executor) { 937 mExecutor = executor; 938 } 939 } 940 941 private final CallbackBinder mBinder = new CallbackBinder(this); 942 943 /** 944 * Called when a provisioning item has changed. 945 * @param item the IMS provisioning key constant, as defined by the OEM. 946 * @param value the new integer value of the IMS provisioning key. 947 */ onProvisioningIntChanged(int item, int value)948 public void onProvisioningIntChanged(int item, int value) { 949 // Base Implementation 950 } 951 952 /** 953 * Called when a provisioning item has changed. 954 * @param item the IMS provisioning key constant, as defined by the OEM. 955 * @param value the new String value of the IMS configuration constant. 956 */ onProvisioningStringChanged(int item, @NonNull String value)957 public void onProvisioningStringChanged(int item, @NonNull String value) { 958 // Base Implementation 959 } 960 961 /**@hide*/ getBinder()962 public final IImsConfigCallback getBinder() { 963 return mBinder; 964 } 965 966 /**@hide*/ setExecutor(Executor executor)967 public void setExecutor(Executor executor) { 968 mBinder.setExecutor(executor); 969 } 970 } 971 972 /** 973 * Callback for IMS provisioning feature changes. 974 */ 975 public abstract static class FeatureProvisioningCallback { 976 977 private static class CallbackBinder extends IFeatureProvisioningCallback.Stub { 978 979 private final FeatureProvisioningCallback mFeatureProvisioningCallback; 980 private Executor mExecutor; 981 CallbackBinder(FeatureProvisioningCallback featureProvisioningCallback)982 private CallbackBinder(FeatureProvisioningCallback featureProvisioningCallback) { 983 mFeatureProvisioningCallback = featureProvisioningCallback; 984 } 985 986 @Override onFeatureProvisioningChanged( int capability, int tech, boolean isProvisioned)987 public final void onFeatureProvisioningChanged( 988 int capability, int tech, boolean isProvisioned) { 989 final long callingIdentity = Binder.clearCallingIdentity(); 990 try { 991 mExecutor.execute(() -> 992 mFeatureProvisioningCallback.onFeatureProvisioningChanged( 993 capability, tech, isProvisioned)); 994 } finally { 995 restoreCallingIdentity(callingIdentity); 996 } 997 } 998 999 @Override onRcsFeatureProvisioningChanged( int capability, int tech, boolean isProvisioned)1000 public final void onRcsFeatureProvisioningChanged( 1001 int capability, int tech, boolean isProvisioned) { 1002 final long callingIdentity = Binder.clearCallingIdentity(); 1003 try { 1004 mExecutor.execute(() -> 1005 mFeatureProvisioningCallback.onRcsFeatureProvisioningChanged( 1006 capability, tech, isProvisioned)); 1007 } finally { 1008 restoreCallingIdentity(callingIdentity); 1009 } 1010 } 1011 setExecutor(Executor executor)1012 private void setExecutor(Executor executor) { 1013 mExecutor = executor; 1014 } 1015 } 1016 1017 private final CallbackBinder mBinder = new CallbackBinder(this); 1018 1019 /** 1020 * The IMS MMTEL provisioning has changed for a specific capability and IMS 1021 * registration technology. 1022 * @param capability The MMTEL capability that provisioning has changed for. 1023 * @param tech The IMS registration technology associated with the MMTEL capability that 1024 * provisioning has changed for. 1025 * @param isProvisioned {@code true} if the capability is provisioned for the technology 1026 * specified, or {@code false} if the capability is not provisioned for the technology 1027 * specified. 1028 */ onFeatureProvisioningChanged( @mTelFeature.MmTelCapabilities.MmTelCapability int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned)1029 public abstract void onFeatureProvisioningChanged( 1030 @MmTelFeature.MmTelCapabilities.MmTelCapability int capability, 1031 @ImsRegistrationImplBase.ImsRegistrationTech int tech, 1032 boolean isProvisioned); 1033 1034 /** 1035 * The IMS RCS provisioning has changed for a specific capability and IMS 1036 * registration technology. 1037 * @param capability The RCS capability that provisioning has changed for. 1038 * @param tech The IMS registration technology associated with the RCS capability that 1039 * provisioning has changed for. 1040 * @param isProvisioned {@code true} if the capability is provisioned for the technology 1041 * specified, or {@code false} if the capability is not provisioned for the technology 1042 * specified. 1043 */ onRcsFeatureProvisioningChanged( @msRcsManager.RcsImsCapabilityFlag int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned)1044 public abstract void onRcsFeatureProvisioningChanged( 1045 @ImsRcsManager.RcsImsCapabilityFlag int capability, 1046 @ImsRegistrationImplBase.ImsRegistrationTech int tech, 1047 boolean isProvisioned); 1048 1049 /**@hide*/ getBinder()1050 public final IFeatureProvisioningCallback getBinder() { 1051 return mBinder; 1052 } 1053 1054 /**@hide*/ setExecutor(Executor executor)1055 public void setExecutor(Executor executor) { 1056 mBinder.setExecutor(executor); 1057 } 1058 } 1059 1060 private int mSubId; 1061 1062 /** 1063 * The callback for RCS provisioning changes. 1064 * @hide 1065 */ 1066 @SystemApi 1067 public static class RcsProvisioningCallback { 1068 private static class CallbackBinder extends IRcsConfigCallback.Stub { 1069 1070 private final RcsProvisioningCallback mLocalCallback; 1071 private Executor mExecutor; 1072 CallbackBinder(RcsProvisioningCallback localCallback)1073 private CallbackBinder(RcsProvisioningCallback localCallback) { 1074 mLocalCallback = localCallback; 1075 } 1076 1077 @Override onConfigurationChanged(byte[] configXml)1078 public void onConfigurationChanged(byte[] configXml) { 1079 final long identity = Binder.clearCallingIdentity(); 1080 try { 1081 mExecutor.execute(() -> mLocalCallback.onConfigurationChanged(configXml)); 1082 } finally { 1083 Binder.restoreCallingIdentity(identity); 1084 } 1085 } 1086 1087 @Override onAutoConfigurationErrorReceived(int errorCode, String errorString)1088 public void onAutoConfigurationErrorReceived(int errorCode, String errorString) { 1089 final long identity = Binder.clearCallingIdentity(); 1090 try { 1091 mExecutor.execute(() -> mLocalCallback.onAutoConfigurationErrorReceived( 1092 errorCode, errorString)); 1093 } finally { 1094 Binder.restoreCallingIdentity(identity); 1095 } 1096 } 1097 1098 @Override onConfigurationReset()1099 public void onConfigurationReset() { 1100 final long identity = Binder.clearCallingIdentity(); 1101 try { 1102 mExecutor.execute(() -> mLocalCallback.onConfigurationReset()); 1103 } finally { 1104 Binder.restoreCallingIdentity(identity); 1105 } 1106 } 1107 1108 @Override onRemoved()1109 public void onRemoved() { 1110 final long identity = Binder.clearCallingIdentity(); 1111 try { 1112 mExecutor.execute(() -> mLocalCallback.onRemoved()); 1113 } finally { 1114 Binder.restoreCallingIdentity(identity); 1115 } 1116 } 1117 1118 @Override onPreProvisioningReceived(byte[] configXml)1119 public void onPreProvisioningReceived(byte[] configXml) { 1120 final long identity = Binder.clearCallingIdentity(); 1121 try { 1122 mExecutor.execute(() -> mLocalCallback.onPreProvisioningReceived(configXml)); 1123 } finally { 1124 Binder.restoreCallingIdentity(identity); 1125 } 1126 } 1127 setExecutor(Executor executor)1128 private void setExecutor(Executor executor) { 1129 mExecutor = executor; 1130 } 1131 } 1132 1133 private final CallbackBinder mBinder = new CallbackBinder(this); 1134 1135 /** 1136 * RCS configuration received via OTA provisioning. Configuration may change 1137 * due to various triggers defined in GSMA RCC.14 for ACS(auto configuration 1138 * server) or other operator defined triggers. If RCS provisioning is already 1139 * completed at the time of callback registration, then this method shall be 1140 * invoked with the current configuration. 1141 * @param configXml The RCS configuration XML received by OTA. It is defined 1142 * by GSMA RCC.07. 1143 */ onConfigurationChanged(@onNull byte[] configXml)1144 public void onConfigurationChanged(@NonNull byte[] configXml) {} 1145 1146 /** 1147 * Errors during autoconfiguration connection setup are notified by the 1148 * ACS(auto configuration server) client using this interface. 1149 * @param errorCode HTTP error received during connection setup defined in 1150 * GSMA RCC.14 2.4.3, like {@link java.net.HttpURLConnection#HTTP_UNAUTHORIZED}, 1151 * {@link java.net.HttpURLConnection#HTTP_FORBIDDEN}, etc. 1152 * @param errorString reason phrase received with the error 1153 */ onAutoConfigurationErrorReceived(int errorCode, @NonNull String errorString)1154 public void onAutoConfigurationErrorReceived(int errorCode, 1155 @NonNull String errorString) {} 1156 1157 /** 1158 * When the previously valid RCS configuration is cleaned up by telephony for 1159 * any case like SIM removed, default messaging application changed, etc., 1160 * this method will be invoked to notify the application regarding this change. 1161 */ onConfigurationReset()1162 public void onConfigurationReset() {} 1163 1164 /** 1165 * When the RCS application is no longer the Default messaging application, 1166 * or when the subscription associated with this callback is removed (SIM 1167 * removed, ESIM swap,etc...), callback will automatically be removed and 1168 * the below method is invoked. There is a possibility that the method is 1169 * invoked after the subscription has become inactive 1170 */ onRemoved()1171 public void onRemoved() {} 1172 1173 /** 1174 * Some carriers using ACS (auto configuration server) may send a carrier-specific 1175 * pre-provisioning configuration XML if the user has not been provisioned for RCS 1176 * services yet. When this provisioning XML is received, the framework will move 1177 * into a "not provisioned" state for RCS. In order for provisioning to proceed, 1178 * the application must parse this configuration XML and perform the carrier specific 1179 * opt-in flow for RCS services. If the user accepts, {@link #triggerRcsReconfiguration} 1180 * must be called in order for the device to move out of this state and try to fetch 1181 * the RCS provisioning information. 1182 * 1183 * @param configXml the pre-provisioning config in carrier specified format. 1184 */ onPreProvisioningReceived(@onNull byte[] configXml)1185 public void onPreProvisioningReceived(@NonNull byte[] configXml) {} 1186 1187 /**@hide*/ getBinder()1188 public final IRcsConfigCallback getBinder() { 1189 return mBinder; 1190 } 1191 1192 /**@hide*/ setExecutor(Executor executor)1193 public void setExecutor(Executor executor) { 1194 mBinder.setExecutor(executor); 1195 } 1196 } 1197 1198 /** 1199 * Create a new {@link ProvisioningManager} for the subscription specified. 1200 * 1201 * @param subId The ID of the subscription that this ProvisioningManager will use. 1202 * @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList() 1203 * @throws IllegalArgumentException if the subscription is invalid. 1204 * @hide 1205 */ 1206 @SystemApi createForSubscriptionId(int subId)1207 public static @NonNull ProvisioningManager createForSubscriptionId(int subId) { 1208 if (!SubscriptionManager.isValidSubscriptionId(subId)) { 1209 throw new IllegalArgumentException("Invalid subscription ID"); 1210 } 1211 1212 return new ProvisioningManager(subId); 1213 } 1214 1215 /**@hide*/ 1216 //@SystemApi ProvisioningManager(int subId)1217 public ProvisioningManager(int subId) { 1218 mSubId = subId; 1219 } 1220 1221 /** 1222 * Register a new {@link Callback} to listen to changes to changes in IMS provisioning. 1223 * 1224 * When the subscription associated with this callback is removed (SIM removed, ESIM swap, 1225 * etc...), this callback will automatically be removed. 1226 * 1227 * <p> Requires Permission: 1228 * <ul> 1229 * <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li> 1230 * </ul> 1231 * 1232 * @param executor The {@link Executor} to call the callback methods on 1233 * @param callback The provisioning callbackto be registered. 1234 * @see #unregisterProvisioningChangedCallback(Callback) 1235 * @see SubscriptionManager.OnSubscriptionsChangedListener 1236 * @throws IllegalArgumentException if the subscription associated with this callback is not 1237 * active (SIM is not inserted, ESIM inactive) or the subscription is invalid. 1238 * @throws ImsException if the subscription associated with this callback is valid, but 1239 * the {@link ImsService} associated with the subscription is not available. This can happen if 1240 * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed 1241 * reason. 1242 * @hide 1243 */ 1244 @SystemApi 1245 @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) registerProvisioningChangedCallback(@onNull @allbackExecutor Executor executor, @NonNull Callback callback)1246 public void registerProvisioningChangedCallback(@NonNull @CallbackExecutor Executor executor, 1247 @NonNull Callback callback) throws ImsException { 1248 callback.setExecutor(executor); 1249 try { 1250 getITelephony().registerImsProvisioningChangedCallback(mSubId, callback.getBinder()); 1251 } catch (ServiceSpecificException e) { 1252 throw new ImsException(e.getMessage(), e.errorCode); 1253 } catch (RemoteException | IllegalStateException e) { 1254 throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); 1255 } 1256 } 1257 1258 /** 1259 * Unregister an existing {@link Callback}. When the subscription associated with this 1260 * callback is removed (SIM removed, ESIM swap, etc...), this callback will automatically be 1261 * removed. If this method is called for an inactive subscription, it will result in a no-op. 1262 * 1263 * <p> Requires Permission: 1264 * <ul> 1265 * <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li> 1266 * </ul> 1267 * 1268 * @param callback The existing {@link Callback} to be removed. 1269 * @see #registerProvisioningChangedCallback(Executor, Callback) 1270 * 1271 * @throws IllegalArgumentException if the subscription associated with this callback is 1272 * invalid. 1273 * @hide 1274 */ 1275 @SystemApi 1276 @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) unregisterProvisioningChangedCallback(@onNull Callback callback)1277 public void unregisterProvisioningChangedCallback(@NonNull Callback callback) { 1278 try { 1279 getITelephony().unregisterImsProvisioningChangedCallback(mSubId, callback.getBinder()); 1280 } catch (RemoteException e) { 1281 throw e.rethrowAsRuntimeException(); 1282 } 1283 } 1284 1285 /** 1286 * Register a new {@link FeatureProvisioningCallback}, which is used to listen for 1287 * IMS feature provisioning updates. 1288 * <p> 1289 * When the subscription associated with this callback is removed (SIM removed, 1290 * ESIM swap,etc...), this callback will automatically be removed. 1291 * 1292 * <p> Requires Permission: 1293 * <ul> 1294 * <li> android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE,</li> 1295 * <li>{@link android.Manifest.permission#READ_PRECISE_PHONE_STATE},</li> 1296 * <li>or that the caller has carrier privileges (see 1297 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1298 * </ul> 1299 * 1300 * @param executor The executor that the callback methods will be called on. 1301 * @param callback The callback instance being registered. 1302 * @throws ImsException if the subscription associated with this callback is 1303 * valid, but the {@link ImsService the service crashed, for example. See 1304 * {@link ImsException#getCode()} for a more detailed reason. 1305 */ 1306 @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) registerFeatureProvisioningChangedCallback( @onNull @allbackExecutor Executor executor, @NonNull FeatureProvisioningCallback callback)1307 public void registerFeatureProvisioningChangedCallback( 1308 @NonNull @CallbackExecutor Executor executor, 1309 @NonNull FeatureProvisioningCallback callback) throws ImsException { 1310 callback.setExecutor(executor); 1311 try { 1312 getITelephony().registerFeatureProvisioningChangedCallback(mSubId, 1313 callback.getBinder()); 1314 } catch (ServiceSpecificException e) { 1315 throw new ImsException(e.getMessage(), e.errorCode); 1316 } catch (RemoteException | IllegalStateException e) { 1317 throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); 1318 } 1319 } 1320 1321 /** 1322 * Unregisters a previously registered {@link FeatureProvisioningCallback} 1323 * instance. When the subscription associated with this 1324 * callback is removed (SIM removed, ESIM swap, etc...), this callback will 1325 * automatically be removed. If this method is called for an inactive 1326 * subscription, it will result in a no-op. 1327 * 1328 * @param callback The existing {@link FeatureProvisioningCallback} to be removed. 1329 * @see #registerFeatureProvisioningChangedCallback(Executor, FeatureProvisioningCallback) 1330 */ unregisterFeatureProvisioningChangedCallback( @onNull FeatureProvisioningCallback callback)1331 public void unregisterFeatureProvisioningChangedCallback( 1332 @NonNull FeatureProvisioningCallback callback) { 1333 try { 1334 getITelephony().unregisterFeatureProvisioningChangedCallback(mSubId, 1335 callback.getBinder()); 1336 } catch (RemoteException e) { 1337 throw e.rethrowAsRuntimeException(); 1338 } 1339 } 1340 1341 /** 1342 * Query for the integer value associated with the provided key. 1343 * 1344 * This operation is blocking and should not be performed on the UI thread. 1345 * 1346 * @param key An integer that represents the provisioning key, which is defined by the OEM. 1347 * @return an integer value for the provided key, or 1348 * {@link ImsConfigImplBase#CONFIG_RESULT_UNKNOWN} if the key doesn't exist. 1349 * @throws IllegalArgumentException if the key provided was invalid. 1350 * @hide 1351 */ 1352 @SystemApi 1353 @WorkerThread 1354 @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) getProvisioningIntValue(int key)1355 public int getProvisioningIntValue(int key) { 1356 try { 1357 return getITelephony().getImsProvisioningInt(mSubId, key); 1358 } catch (RemoteException e) { 1359 throw e.rethrowAsRuntimeException(); 1360 } 1361 } 1362 1363 /** 1364 * Query for the String value associated with the provided key. 1365 * 1366 * This operation is blocking and should not be performed on the UI thread. 1367 * 1368 * @param key A String that represents the provisioning key, which is defined by the OEM. 1369 * @return a String value for the provided key, {@code null} if the key doesn't exist, or 1370 * {@link StringResultError} if there was an error getting the value for the provided key. 1371 * @throws IllegalArgumentException if the key provided was invalid. 1372 * @hide 1373 */ 1374 @SystemApi 1375 @WorkerThread 1376 @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) getProvisioningStringValue(int key)1377 public @Nullable @StringResultError String getProvisioningStringValue(int key) { 1378 try { 1379 return getITelephony().getImsProvisioningString(mSubId, key); 1380 } catch (RemoteException e) { 1381 throw e.rethrowAsRuntimeException(); 1382 } 1383 } 1384 1385 /** 1386 * Set the integer value associated with the provided key. 1387 * 1388 * This operation is blocking and should not be performed on the UI thread. 1389 * 1390 * Use {@link #setProvisioningStringValue(int, String)} with proper namespacing (to be defined 1391 * per OEM or carrier) when possible instead to avoid key collision if needed. 1392 * @param key An integer that represents the provisioning key, which is defined by the OEM. 1393 * @param value a integer value for the provided key. 1394 * @return the result of setting the configuration value. 1395 * @hide 1396 * 1397 * Note: For compatibility purposes, the integer values [0 - 99] used in 1398 * {@link #setProvisioningIntValue(int, int)} have been reserved for existing provisioning keys 1399 * previously defined in the Android framework. Please do not redefine new provisioning keys 1400 * in this range or it may generate collisions with existing keys. Some common constants have 1401 * also been defined in this class to make integrating with other system apps easier. 1402 */ 1403 @SystemApi 1404 @WorkerThread 1405 @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) setProvisioningIntValue(int key, int value)1406 public @ImsConfigImplBase.SetConfigResult int setProvisioningIntValue(int key, int value) { 1407 try { 1408 return getITelephony().setImsProvisioningInt(mSubId, key, value); 1409 } catch (RemoteException e) { 1410 throw e.rethrowAsRuntimeException(); 1411 } 1412 } 1413 1414 /** 1415 * Set the String value associated with the provided key. 1416 * 1417 * This operation is blocking and should not be performed on the UI thread. 1418 * 1419 * @param key A String that represents the provisioning key, which is defined by the OEM and 1420 * should be appropriately namespaced to avoid collision. 1421 * @param value a String value for the provided key. 1422 * @return the result of setting the configuration value. 1423 * @hide 1424 */ 1425 @SystemApi 1426 @WorkerThread 1427 @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) setProvisioningStringValue(int key, @NonNull String value)1428 public @ImsConfigImplBase.SetConfigResult int setProvisioningStringValue(int key, 1429 @NonNull String value) { 1430 try { 1431 return getITelephony().setImsProvisioningString(mSubId, key, value); 1432 } catch (RemoteException e) { 1433 throw e.rethrowAsRuntimeException(); 1434 } 1435 } 1436 1437 /** 1438 * Set the provisioning status for the IMS MmTel capability using the specified subscription. 1439 * 1440 * Provisioning may or may not be required, depending on the carrier configuration. If 1441 * provisioning is not required for the carrier associated with this subscription or the device 1442 * does not support the capability/technology combination specified, this operation will be a 1443 * no-op. 1444 * 1445 * <p>Requires Permission: 1446 * <ul> 1447 * <li>{@link android.Manifest.permission#MODIFY_PHONE_STATE},</li> 1448 * <li>or that the calling app has carrier privileges (see</li> 1449 * <li>{@link TelephonyManager#hasCarrierPrivileges}).</li> 1450 * </ul> 1451 * 1452 * @see CarrierConfigManager.Ims#KEY_MMTEL_REQUIRES_PROVISIONING_BUNDLE 1453 * @param isProvisioned true if the device is provisioned for UT over IMS, false otherwise. 1454 */ 1455 @WorkerThread 1456 @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) setProvisioningStatusForCapability( @mTelFeature.MmTelCapabilities.MmTelCapability int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned)1457 public void setProvisioningStatusForCapability( 1458 @MmTelFeature.MmTelCapabilities.MmTelCapability int capability, 1459 @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned) { 1460 1461 try { 1462 getITelephony().setImsProvisioningStatusForCapability(mSubId, capability, tech, 1463 isProvisioned); 1464 } catch (RemoteException e) { 1465 throw e.rethrowAsRuntimeException(); 1466 } 1467 } 1468 1469 /** 1470 * Get the provisioning status for the IMS MmTel capability specified. 1471 * 1472 * If provisioning is not required for the queried 1473 * {@link MmTelFeature.MmTelCapabilities.MmTelCapability} and 1474 * {@link ImsRegistrationImplBase.ImsRegistrationTech} combination specified, this method will 1475 * always return {@code true}. 1476 * 1477 * <p> Requires Permission: 1478 * <ul> 1479 * <li>android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE,</li> 1480 * <li>{@link android.Manifest.permission#READ_PRECISE_PHONE_STATE},</li> 1481 * <li>or that the caller has carrier privileges (see 1482 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1483 * </ul> 1484 * 1485 * @see CarrierConfigManager.Ims#KEY_MMTEL_REQUIRES_PROVISIONING_BUNDLE 1486 * @return true if the device is provisioned for the capability or does not require 1487 * provisioning, false if the capability does require provisioning and has not been 1488 * provisioned yet. 1489 */ 1490 @WorkerThread 1491 @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) getProvisioningStatusForCapability( @mTelFeature.MmTelCapabilities.MmTelCapability int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech)1492 public boolean getProvisioningStatusForCapability( 1493 @MmTelFeature.MmTelCapabilities.MmTelCapability int capability, 1494 @ImsRegistrationImplBase.ImsRegistrationTech int tech) { 1495 try { 1496 return getITelephony().getImsProvisioningStatusForCapability(mSubId, capability, tech); 1497 } catch (RemoteException e) { 1498 throw e.rethrowAsRuntimeException(); 1499 } 1500 } 1501 1502 /** 1503 * Get the provisioning status for the IMS RCS capability specified. 1504 * 1505 * If provisioning is not required for the queried 1506 * {@link ImsRcsManager.RcsImsCapabilityFlag} or if the device does not support IMS 1507 * this method will always return {@code true}. 1508 * 1509 * @see CarrierConfigManager.Ims#KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL 1510 * @return true if the device is provisioned for the capability or does not require 1511 * provisioning, false if the capability does require provisioning and has not been 1512 * provisioned yet. 1513 * @deprecated Use {@link #getRcsProvisioningStatusForCapability(int, int)} instead, 1514 * as this only retrieves provisioning information for 1515 * {@link ImsRegistrationImplBase#REGISTRATION_TECH_LTE} 1516 * @hide 1517 */ 1518 @Deprecated 1519 @SystemApi 1520 @WorkerThread 1521 @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) getRcsProvisioningStatusForCapability( @msRcsManager.RcsImsCapabilityFlag int capability)1522 public boolean getRcsProvisioningStatusForCapability( 1523 @ImsRcsManager.RcsImsCapabilityFlag int capability) { 1524 try { 1525 return getITelephony().getRcsProvisioningStatusForCapability(mSubId, capability, 1526 ImsRegistrationImplBase.REGISTRATION_TECH_LTE); 1527 } catch (RemoteException e) { 1528 throw e.rethrowAsRuntimeException(); 1529 } 1530 } 1531 1532 /** 1533 * Get the provisioning status for the IMS RCS capability specified. 1534 * 1535 * If provisioning is not required for the queried 1536 * {@link ImsRcsManager.RcsImsCapabilityFlag} or if the device does not support IMS 1537 * this method will always return {@code true}. 1538 * 1539 * <p> Requires Permission: 1540 * <ul> 1541 * <li>{@link android.Manifest.permission#READ_PRECISE_PHONE_STATE},</li> 1542 * <li>or that the caller has carrier privileges (see 1543 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1544 * </ul> 1545 * 1546 * @see CarrierConfigManager.Ims#KEY_RCS_REQUIRES_PROVISIONING_BUNDLE 1547 * @return true if the device is provisioned for the capability or does not require 1548 * provisioning, false if the capability does require provisioning and has not been 1549 * provisioned yet. 1550 */ 1551 @WorkerThread 1552 @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) getRcsProvisioningStatusForCapability( @msRcsManager.RcsImsCapabilityFlag int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech)1553 public boolean getRcsProvisioningStatusForCapability( 1554 @ImsRcsManager.RcsImsCapabilityFlag int capability, 1555 @ImsRegistrationImplBase.ImsRegistrationTech int tech) { 1556 try { 1557 return getITelephony().getRcsProvisioningStatusForCapability(mSubId, capability, tech); 1558 } catch (RemoteException e) { 1559 throw e.rethrowAsRuntimeException(); 1560 } 1561 } 1562 1563 /** 1564 * Set the provisioning status for the IMS RCS capability using the specified subscription. 1565 * 1566 * <p> Requires Permission: 1567 * <ul> 1568 * <li>{@link android.Manifest.permission#MODIFY_PHONE_STATE}</li> 1569 * <li>or that the caller has carrier privileges (see 1570 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1571 * </ul> 1572 1573 * Provisioning may or may not be required, depending on the carrier configuration. If 1574 * provisioning is not required for the carrier associated with this subscription or the device 1575 * does not support the capability/technology combination specified, this operation will be a 1576 * no-op. 1577 * 1578 * @see CarrierConfigManager#KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL 1579 * @param isProvisioned true if the device is provisioned for the RCS capability specified, 1580 * false otherwise. 1581 * @deprecated Use {@link #setRcsProvisioningStatusForCapability(int, int, boolean)} instead, 1582 * as this method only sets provisioning information for 1583 * {@link ImsRegistrationImplBase#REGISTRATION_TECH_LTE} 1584 * @hide 1585 */ 1586 @Deprecated 1587 @SystemApi 1588 @WorkerThread 1589 @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) setRcsProvisioningStatusForCapability( @msRcsManager.RcsImsCapabilityFlag int capability, boolean isProvisioned)1590 public void setRcsProvisioningStatusForCapability( 1591 @ImsRcsManager.RcsImsCapabilityFlag int capability, 1592 boolean isProvisioned) { 1593 try { 1594 getITelephony().setRcsProvisioningStatusForCapability(mSubId, capability, 1595 ImsRegistrationImplBase.REGISTRATION_TECH_LTE, isProvisioned); 1596 } catch (RemoteException e) { 1597 throw e.rethrowAsRuntimeException(); 1598 } 1599 } 1600 1601 /** 1602 * Set the provisioning status for the IMS RCS capability using the specified subscription. 1603 * 1604 * Provisioning may or may not be required, depending on the carrier configuration. If 1605 * provisioning is not required for the carrier associated with this subscription or the device 1606 * does not support the capability/technology combination specified, this operation will be a 1607 * no-op. 1608 * 1609 * <p> Requires Permission: 1610 * <ul> 1611 * <li>{@link android.Manifest.permission#MODIFY_PHONE_STATE},</li> 1612 * <li>or that the caller has carrier privileges (see 1613 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1614 * </ul> 1615 * 1616 * @see CarrierConfigManager.Ims#KEY_RCS_REQUIRES_PROVISIONING_BUNDLE 1617 * @param isProvisioned true if the device is provisioned for the RCS capability specified, 1618 * false otherwise. 1619 */ 1620 @WorkerThread 1621 @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) setRcsProvisioningStatusForCapability( @msRcsManager.RcsImsCapabilityFlag int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned)1622 public void setRcsProvisioningStatusForCapability( 1623 @ImsRcsManager.RcsImsCapabilityFlag int capability, 1624 @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned) { 1625 try { 1626 getITelephony().setRcsProvisioningStatusForCapability(mSubId, capability, 1627 tech, isProvisioned); 1628 } catch (RemoteException e) { 1629 throw e.rethrowAsRuntimeException(); 1630 } 1631 } 1632 1633 /** 1634 * Indicates whether provisioning for the MMTEL capability and IMS registration technology 1635 * specified is required or not 1636 * 1637 * <p> Requires Permission: 1638 * <ul> 1639 * <li> android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE,</li> 1640 * <li>{@link android.Manifest.permission#READ_PRECISE_PHONE_STATE},</li> 1641 * <li> or that the caller has carrier privileges (see 1642 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1643 * </ul> 1644 * 1645 * @return true if provisioning is required for the MMTEL capability and IMS 1646 * registration technology specified, false if it is not required or if the device does not 1647 * support IMS. 1648 */ 1649 @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) isProvisioningRequiredForCapability( @mTelFeature.MmTelCapabilities.MmTelCapability int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech)1650 public boolean isProvisioningRequiredForCapability( 1651 @MmTelFeature.MmTelCapabilities.MmTelCapability int capability, 1652 @ImsRegistrationImplBase.ImsRegistrationTech int tech) { 1653 try { 1654 return getITelephony().isProvisioningRequiredForCapability(mSubId, capability, tech); 1655 } catch (RemoteException e) { 1656 throw e.rethrowAsRuntimeException(); 1657 } 1658 } 1659 1660 1661 /** 1662 * Indicates whether provisioning for the RCS capability and IMS registration technology 1663 * specified is required or not 1664 * 1665 * <p> Requires Permission: 1666 * <ul> 1667 * <li> android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE,</li> 1668 * <li>{@link android.Manifest.permission#READ_PRECISE_PHONE_STATE},</li> 1669 * <li> or that the caller has carrier privileges (see 1670 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1671 * </ul> 1672 * 1673 * @return true if provisioning is required for the RCS capability and IMS 1674 * registration technology specified, false if it is not required or if the device does not 1675 * support IMS. 1676 */ 1677 @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) isRcsProvisioningRequiredForCapability( @msRcsManager.RcsImsCapabilityFlag int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech)1678 public boolean isRcsProvisioningRequiredForCapability( 1679 @ImsRcsManager.RcsImsCapabilityFlag int capability, 1680 @ImsRegistrationImplBase.ImsRegistrationTech int tech) { 1681 try { 1682 return getITelephony().isRcsProvisioningRequiredForCapability(mSubId, capability, tech); 1683 } catch (RemoteException e) { 1684 throw e.rethrowAsRuntimeException(); 1685 } 1686 } 1687 1688 1689 /** 1690 * Notify the framework that an RCS autoconfiguration XML file has been received for 1691 * provisioning. This API is only valid if the device supports IMS, which can be checked using 1692 * {@link PackageManager#hasSystemFeature}. 1693 * 1694 * <p>Requires Permission: 1695 * <ul> 1696 * <li>{@link Manifest.permission#MODIFY_PHONE_STATE},</li> 1697 * <li>or that the calling app has carrier privileges (see 1698 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1699 * </ul> 1700 * 1701 * @param config The XML file to be read. ASCII/UTF8 encoded text if not compressed. 1702 * @param isCompressed The XML file is compressed in gzip format and must be decompressed 1703 * before being read. 1704 * @hide 1705 */ 1706 @SystemApi 1707 @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) notifyRcsAutoConfigurationReceived(@onNull byte[] config, boolean isCompressed)1708 public void notifyRcsAutoConfigurationReceived(@NonNull byte[] config, boolean isCompressed) { 1709 if (config == null) { 1710 throw new IllegalArgumentException("Must include a non-null config XML file."); 1711 } 1712 1713 try { 1714 getITelephony().notifyRcsAutoConfigurationReceived(mSubId, config, isCompressed); 1715 } catch (RemoteException e) { 1716 throw e.rethrowAsRuntimeException(); 1717 } 1718 1719 } 1720 1721 /** 1722 * Provides the single registration capability of the device and the carrier. 1723 * 1724 * <p>This intent only provides the capability and not the current provisioning status of 1725 * the RCS VoLTE single registration feature. Only default messaging application may receive 1726 * the intent. 1727 * 1728 * <p>Contains {@link #EXTRA_SUBSCRIPTION_ID} to specify the subscription index for which 1729 * the intent is valid. and {@link #EXTRA_STATUS} to specify RCS VoLTE single registration 1730 * status. 1731 * @hide 1732 */ 1733 @SystemApi 1734 @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) 1735 @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) 1736 public static final String ACTION_RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE = 1737 "android.telephony.ims.action.RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE"; 1738 1739 /** 1740 * Integer extra to specify subscription index. 1741 * @hide 1742 */ 1743 @SystemApi 1744 public static final String EXTRA_SUBSCRIPTION_ID = 1745 "android.telephony.ims.extra.SUBSCRIPTION_ID"; 1746 1747 /** 1748 * Integer extra to specify RCS single registration status 1749 * 1750 * <p>The value can be {@link #STATUS_CAPABLE}, {@link #STATUS_DEVICE_NOT_CAPABLE}, 1751 * {@link #STATUS_CARRIER_NOT_CAPABLE}, or bitwise OR of 1752 * {@link #STATUS_DEVICE_NOT_CAPABLE} and {@link #STATUS_CARRIER_NOT_CAPABLE}. 1753 * @hide 1754 */ 1755 @SystemApi 1756 public static final String EXTRA_STATUS = "android.telephony.ims.extra.STATUS"; 1757 1758 /** 1759 * RCS VoLTE single registration is supported by the device and carrier. 1760 * @hide 1761 */ 1762 @SystemApi 1763 public static final int STATUS_CAPABLE = 0; 1764 1765 /** 1766 * RCS VoLTE single registration is not supported by the device. 1767 * @hide 1768 */ 1769 @SystemApi 1770 public static final int STATUS_DEVICE_NOT_CAPABLE = 0x01; 1771 1772 /** 1773 * RCS VoLTE single registration is not supported by the carrier 1774 * @hide 1775 */ 1776 @SystemApi 1777 public static final int STATUS_CARRIER_NOT_CAPABLE = 0x01 << 1; 1778 1779 /** 1780 * Provide the client configuration parameters of the RCS application. 1781 * 1782 * <p>When this application is also the default messaging application, and RCS 1783 * provisioning is done using autoconfiguration, then these parameters shall be 1784 * sent in the HTTP get request to fetch the RCS provisioning. RCS client 1785 * configuration must be provided by the application before registering for the 1786 * provisioning status events 1787 * {@link #registerRcsProvisioningCallback(Executor, RcsProvisioningCallback)} 1788 * When the IMS/RCS service receives the RCS client configuration, it will detect 1789 * the change in the configuration, and trigger the auto-configuration as needed. 1790 * @param rcc RCS client configuration {@link RcsClientConfiguration} 1791 * @hide 1792 */ 1793 @SystemApi 1794 @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) setRcsClientConfiguration( @onNull RcsClientConfiguration rcc)1795 public void setRcsClientConfiguration( 1796 @NonNull RcsClientConfiguration rcc) throws ImsException { 1797 try { 1798 getITelephony().setRcsClientConfiguration(mSubId, rcc); 1799 } catch (ServiceSpecificException e) { 1800 throw new ImsException(e.getMessage(), e.errorCode); 1801 } catch (RemoteException | IllegalStateException e) { 1802 throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); 1803 } 1804 } 1805 1806 /** 1807 * Returns a flag to indicate whether or not the device supports IMS single registration for 1808 * MMTEL and RCS features as well as if the carrier has provisioned the feature. 1809 * 1810 * <p> Requires Permission: 1811 * <ul> 1812 * <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li> 1813 * <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li> 1814 * <li>or that the calling app has carrier privileges (see 1815 * {@link TelephonyManager#hasCarrierPrivileges()}).</li> 1816 * </ul> 1817 * 1818 * @return true if IMS single registration is capable at this time, or false otherwise 1819 * @throws ImsException If the remote ImsService is not available for any reason or 1820 * the subscription associated with this instance is no longer active. 1821 * See {@link ImsException#getCode()} for more information. 1822 * @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION for whether or not this 1823 * device supports IMS single registration. 1824 * @hide 1825 */ 1826 @SystemApi 1827 @RequiresPermission(anyOf = { 1828 Manifest.permission.READ_PRIVILEGED_PHONE_STATE, 1829 Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) isRcsVolteSingleRegistrationCapable()1830 public boolean isRcsVolteSingleRegistrationCapable() throws ImsException { 1831 try { 1832 return getITelephony().isRcsVolteSingleRegistrationCapable(mSubId); 1833 } catch (RemoteException | IllegalStateException e) { 1834 throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); 1835 } catch (ServiceSpecificException e) { 1836 throw new ImsException(e.getMessage(), e.errorCode); 1837 } 1838 } 1839 1840 /** 1841 * Registers a new {@link RcsProvisioningCallback} to listen to changes to 1842 * RCS provisioning xml. 1843 * 1844 * <p>RCS application must be the default messaging application and must 1845 * have already registered its {@link RcsClientConfiguration} by using 1846 * {@link #setRcsClientConfiguration} before it registers the provisioning 1847 * callback. If ProvisioningManager has a valid RCS configuration at the 1848 * time of callback registration and a reconfiguration is not required 1849 * due to RCS client parameters change, then the callback shall be invoked 1850 * immediately with the xml. 1851 * When the subscription associated with this callback is removed (SIM removed, 1852 * ESIM swap,etc...), this callback will automatically be removed. 1853 * <p> Requires Permission: 1854 * <ul> 1855 * <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li> 1856 * <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li> 1857 * </ul> 1858 * 1859 * @param executor The {@link Executor} to call the callback methods on 1860 * @param callback The rcs provisioning callback to be registered. 1861 * @see #unregisterRcsProvisioningCallback(RcsProvisioningCallback) 1862 * @see SubscriptionManager.OnSubscriptionsChangedListener 1863 * @throws IllegalArgumentException if the subscription associated with this 1864 * callback is not active (SIM is not inserted, ESIM inactive) or the 1865 * subscription is invalid. 1866 * @throws ImsException if the subscription associated with this callback is 1867 * valid, but the {@link ImsService} associated with the subscription is not 1868 * available. This can happen if the service crashed, for example. 1869 * It shall also throw this exception when the RCS client parameters for the 1870 * application are not valid. In that case application must set the client 1871 * params (See {@link #setRcsClientConfiguration}) and re register the 1872 * callback. 1873 * See {@link ImsException#getCode()} for a more detailed reason. 1874 * @hide 1875 */ 1876 @SystemApi 1877 @RequiresPermission(anyOf = { 1878 Manifest.permission.READ_PRIVILEGED_PHONE_STATE, 1879 Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) registerRcsProvisioningCallback( @onNull @allbackExecutor Executor executor, @NonNull RcsProvisioningCallback callback)1880 public void registerRcsProvisioningCallback( 1881 @NonNull @CallbackExecutor Executor executor, 1882 @NonNull RcsProvisioningCallback callback) throws ImsException { 1883 callback.setExecutor(executor); 1884 try { 1885 getITelephony().registerRcsProvisioningCallback(mSubId, callback.getBinder()); 1886 } catch (ServiceSpecificException e) { 1887 throw new ImsException(e.getMessage(), e.errorCode); 1888 } catch (RemoteException | IllegalStateException e) { 1889 throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); 1890 } 1891 } 1892 1893 /** 1894 * Unregister an existing {@link RcsProvisioningCallback}. Application can 1895 * unregister when its no longer interested in the provisioning updates 1896 * like when a user disables RCS from the UI/settings. 1897 * When the subscription associated with this callback is removed (SIM 1898 * removed, ESIM swap, etc...), this callback will automatically be 1899 * removed. If this method is called for an inactive subscription, it 1900 * will result in a no-op. 1901 * <p> Requires Permission: 1902 * <ul> 1903 * <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li> 1904 * <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li> 1905 * </ul> 1906 * 1907 * @param callback The existing {@link RcsProvisioningCallback} to be 1908 * removed. 1909 * @see #registerRcsProvisioningCallback(Executor, RcsProvisioningCallback) 1910 * @throws IllegalArgumentException if the subscription associated with 1911 * this callback is invalid. 1912 * @hide 1913 */ 1914 @SystemApi 1915 @RequiresPermission(anyOf = { 1916 Manifest.permission.READ_PRIVILEGED_PHONE_STATE, 1917 Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) unregisterRcsProvisioningCallback( @onNull RcsProvisioningCallback callback)1918 public void unregisterRcsProvisioningCallback( 1919 @NonNull RcsProvisioningCallback callback) { 1920 try { 1921 getITelephony().unregisterRcsProvisioningCallback( 1922 mSubId, callback.getBinder()); 1923 } catch (RemoteException e) { 1924 throw e.rethrowAsRuntimeException(); 1925 } 1926 } 1927 1928 /** 1929 * Reconfiguration triggered by the RCS application. Most likely cause 1930 * is the 403 forbidden to a HTTP request. This API is only valid if the device supports IMS, 1931 * which can be checked using {@link PackageManager#hasSystemFeature} 1932 * 1933 * <p>When this api is called, the RCS configuration for the associated 1934 * subscription will be removed, and the application which has registered 1935 * {@link RcsProvisioningCallback} may expect to receive 1936 * {@link RcsProvisioningCallback#onConfigurationReset}, then 1937 * {@link RcsProvisioningCallback#onConfigurationChanged} when the new 1938 * RCS configuration is received and notified by {@link #notifyRcsAutoConfigurationReceived} 1939 * @hide 1940 */ 1941 @SystemApi 1942 @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) triggerRcsReconfiguration()1943 public void triggerRcsReconfiguration() { 1944 try { 1945 getITelephony().triggerRcsReconfiguration(mSubId); 1946 } catch (RemoteException e) { 1947 throw e.rethrowAsRuntimeException(); 1948 } 1949 } 1950 getITelephony()1951 private static ITelephony getITelephony() { 1952 ITelephony binder = ITelephony.Stub.asInterface( 1953 TelephonyFrameworkInitializer 1954 .getTelephonyServiceManager() 1955 .getTelephonyServiceRegisterer() 1956 .get()); 1957 if (binder == null) { 1958 throw new RuntimeException("Could not find Telephony Service."); 1959 } 1960 return binder; 1961 } 1962 } 1963