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.RequiresPermission;
24 import android.annotation.StringDef;
25 import android.annotation.SystemApi;
26 import android.annotation.TestApi;
27 import android.annotation.WorkerThread;
28 import android.os.Binder;
29 import android.os.RemoteException;
30 import android.os.ServiceSpecificException;
31 import android.telephony.CarrierConfigManager;
32 import android.telephony.SubscriptionManager;
33 import android.telephony.TelephonyFrameworkInitializer;
34 import android.telephony.ims.aidl.IImsConfigCallback;
35 import android.telephony.ims.feature.MmTelFeature;
36 import android.telephony.ims.feature.RcsFeature;
37 import android.telephony.ims.stub.ImsConfigImplBase;
38 import android.telephony.ims.stub.ImsRegistrationImplBase;
39 
40 import com.android.internal.telephony.ITelephony;
41 
42 import java.lang.annotation.Retention;
43 import java.lang.annotation.RetentionPolicy;
44 import java.util.concurrent.Executor;
45 
46 /**
47  * Manages IMS provisioning and configuration parameters, as well as callbacks for apps to listen
48  * to changes in these configurations.
49  *
50  * IMS provisioning keys are defined per carrier or OEM using OMA-DM or other provisioning
51  * applications and may vary. It is up to the carrier and OEM applications to ensure that the
52  * correct provisioning keys are being used when integrating with a vendor's ImsService.
53  *
54  * Note: For compatibility purposes, the integer values [0 - 99] used in
55  * {@link #setProvisioningIntValue(int, int)} have been reserved for existing provisioning keys
56  * previously defined in the Android framework. Please do not redefine new provisioning keys in this
57  * range or it may generate collisions with existing keys. Some common constants have also been
58  * defined in this class to make integrating with other system apps easier.
59  * @hide
60  */
61 @SystemApi
62 @TestApi
63 public class ProvisioningManager {
64 
65     /**@hide*/
66     @StringDef(prefix = "STRING_QUERY_RESULT_ERROR_", value = {
67             STRING_QUERY_RESULT_ERROR_GENERIC,
68             STRING_QUERY_RESULT_ERROR_NOT_READY
69     })
70     @Retention(RetentionPolicy.SOURCE)
71     public @interface StringResultError {}
72 
73     /**
74      * The query from {@link #getProvisioningStringValue(int)} has resulted in an unspecified error.
75      */
76     public static final String STRING_QUERY_RESULT_ERROR_GENERIC =
77             "STRING_QUERY_RESULT_ERROR_GENERIC";
78 
79     /**
80      * The query from {@link #getProvisioningStringValue(int)} has resulted in an error because the
81      * ImsService implementation was not ready for provisioning queries.
82      */
83     public static final String STRING_QUERY_RESULT_ERROR_NOT_READY =
84             "STRING_QUERY_RESULT_ERROR_NOT_READY";
85 
86     /**
87      * There is no existing configuration for the queried provisioning key.
88      * @hide
89      */
90     public static final int PROVISIONING_RESULT_UNKNOWN = -1;
91 
92     /**
93      * The integer result of provisioning for the queried key is disabled.
94      */
95     public static final int PROVISIONING_VALUE_DISABLED = 0;
96 
97     /**
98      * The integer result of provisioning for the queried key is enabled.
99      */
100     public static final int PROVISIONING_VALUE_ENABLED = 1;
101 
102 
103     // Inheriting values from ImsConfig for backwards compatibility.
104     /**
105      * AMR CODEC Mode Value set, 0-7 in comma separated sequence.
106      * <p>
107      * This corresponds to the {@code mode-set} parameter for the AMR codec.
108      * See 3GPP TS 26.101 Table 1A for more information.
109      * <p>
110      * <UL>
111      *     <LI>0 - AMR 4.75 kbit/s</LI>
112      *     <LI>1 - AMR 5.15 kbit/s</LI>
113      *     <LI>2 - AMR 5.90 kbit/s</LI>
114      *     <LI>3 - AMR 6.70 kbit/s (PDC-EFR)</LI>
115      *     <LI>4 - AMR 7.40 kbit/s (TDMA-EFR)</LI>
116      *     <LI>5 - AMR 7.95 kbit/s</LI>
117      *     <LI>6 - AMR 10.2 kbit/s</LI>
118      *     <LI>7 - AMR 12.2 kbit/s (GSM-EFR)</LI>
119      * </UL>
120      * <p>
121      * Value is in String format.
122      * @see #setProvisioningIntValue(int, int)
123      * @see #getProvisioningIntValue(int)
124      * @hide
125      */
126     public static final int KEY_AMR_CODEC_MODE_SET_VALUES = 0;
127 
128     /**
129      * Wide Band AMR CODEC Mode Value set,0-7 in comma separated sequence.
130      * <p>
131      * This corresponds to the {@code mode-set} parameter for the AMR wideband codec.
132      * See 3GPP TS 26.101 Table 1A for more information.
133      * <p>
134      * <UL>
135      *     <LI>0 - AMR 4.75 kbit/s</LI>
136      *     <LI>1 - AMR 5.15 kbit/s</LI>
137      *     <LI>2 - AMR 5.90 kbit/s</LI>
138      *     <LI>3 - AMR 6.70 kbit/s (PDC-EFR)</LI>
139      *     <LI>4 - AMR 7.40 kbit/s (TDMA-EFR)</LI>
140      *     <LI>5 - AMR 7.95 kbit/s</LI>
141      *     <LI>6 - AMR 10.2 kbit/s</LI>
142      *     <LI>7 - AMR 12.2 kbit/s (GSM-EFR)</LI>
143      * </UL>
144      * <p>
145      * Value is in String format.
146      * @see #setProvisioningStringValue(int, String)
147      * @see #getProvisioningStringValue(int)
148      * @hide
149      */
150     public static final int KEY_AMR_WB_CODEC_MODE_SET_VALUES = 1;
151 
152     /**
153      * SIP Session Timer value (seconds).
154      * <p>
155      * See RFC4028 for more information.
156      * <p>
157      * Value is in Integer format.
158      * @see #setProvisioningIntValue(int, int)
159      * @see #getProvisioningIntValue(int)
160      * @hide
161      */
162     public static final int KEY_SIP_SESSION_TIMER_SEC = 2;
163 
164     /**
165      * Minimum SIP Session Expiration Timer in (seconds).
166      * <p>
167      * See RFC4028 for more information.
168      * <p>
169      * Value is in Integer format.
170      * @see #setProvisioningIntValue(int, int)
171      * @see #getProvisioningIntValue(int)
172      * @hide
173      */
174     public static final int KEY_MINIMUM_SIP_SESSION_EXPIRATION_TIMER_SEC = 3;
175 
176     /**
177      * SIP_INVITE cancellation time out value (in milliseconds). Integer format.
178      * <p>
179      * See RFC4028 for more information.
180      * <p>
181      * Value is in Integer format.
182      * @see #setProvisioningIntValue(int, int)
183      * @see #getProvisioningIntValue(int)
184      * @hide
185      */
186     public static final int KEY_SIP_INVITE_CANCELLATION_TIMER_MS = 4;
187 
188     /**
189      * Delay time when an iRAT transitions from eHRPD/HRPD/1xRTT to LTE.
190      * Value is in Integer format.
191      * @see #setProvisioningIntValue(int, int)
192      * @see #getProvisioningIntValue(int)
193      * @hide
194      */
195     public static final int KEY_TRANSITION_TO_LTE_DELAY_MS = 5;
196 
197     /**
198      * Silent redial status of Enabled (True), or Disabled (False).
199      * Value is in boolean format.
200      * @see #setProvisioningIntValue(int, int)
201      * @see #getProvisioningIntValue(int)
202      * @hide
203      */
204     public static final int KEY_ENABLE_SILENT_REDIAL = 6;
205 
206     /**
207      * An integer key representing the SIP T1 timer value in milliseconds for the associated
208      * subscription.
209      * <p>
210      * The SIP T1 timer is an estimate of the round-trip time and will retransmit
211      * INVITE transactions that are longer than T1 milliseconds over unreliable transports, doubling
212      * the time before retransmission every time there is no response. See RFC3261, section 17.1.1.1
213      * for more details.
214      * <p>
215      * The value is an integer.
216      * @see #setProvisioningIntValue(int, int)
217      * @see #getProvisioningIntValue(int)
218      * @hide
219      */
220     public static final int KEY_T1_TIMER_VALUE_MS = 7;
221 
222     /**
223      * SIP T2 timer value in milliseconds.  See RFC 3261 for information.
224      * <p>
225      * The T2 timer is the maximum retransmit interval for non-INVITE requests and INVITE responses.
226      * <p>
227      * Value is in Integer format.
228      * @see #setProvisioningIntValue(int, int)
229      * @see #getProvisioningIntValue(int)
230      * @hide
231      */
232     public static final int KEY_T2_TIMER_VALUE_MS = 8;
233 
234     /**
235      * SIP TF timer value in milliseconds.  See RFC 3261 for information.
236      * <p>
237      * The TF timer is the non-INVITE transaction timeout timer.
238      * <p>
239      * Value is in Integer format.
240      * @see #setProvisioningIntValue(int, int)
241      * @see #getProvisioningIntValue(int)
242      * @hide
243      */
244     public static final int KEY_TF_TIMER_VALUE_MS = 9;
245 
246     /**
247      * An integer key representing the voice over LTE (VoLTE) provisioning status for the
248      * associated subscription. Determines whether the user can register for voice services over
249      * LTE.
250      * <p>
251      * Use {@link #PROVISIONING_VALUE_ENABLED} to enable VoLTE provisioning and
252      * {@link #PROVISIONING_VALUE_DISABLED} to disable VoLTE provisioning.
253      * @see #setProvisioningIntValue(int, int)
254      * @see #getProvisioningIntValue(int)
255      * @hide
256      */
257     public static final int KEY_VOLTE_PROVISIONING_STATUS = 10;
258 
259     /**
260      * An integer key representing the video telephony (VT) provisioning status for the
261      * associated subscription. Determines whether the user can register for video services over
262      * LTE.
263      * <p>
264      * Use {@link #PROVISIONING_VALUE_ENABLED} to enable VT provisioning and
265      * {@link #PROVISIONING_VALUE_DISABLED} to disable VT provisioning.
266      * @see #setProvisioningIntValue(int, int)
267      * @see #getProvisioningIntValue(int)
268      * @hide
269      */
270     public static final int KEY_VT_PROVISIONING_STATUS = 11;
271 
272     /**
273      * Domain Name for the device to populate the request URI for REGISTRATION.
274      * Value is in String format.
275      * @see #setProvisioningStringValue(int, String)
276      * @see #getProvisioningStringValue(int)
277      * @hide
278      */
279     public static final int KEY_REGISTRATION_DOMAIN_NAME = 12;
280 
281     /**
282      * Device Outgoing SMS based on either 3GPP or 3GPP2 standards.
283      * Value is in Integer format.
284      * Valid values are {@link #SMS_FORMAT_3GPP} and {@link #SMS_FORMAT_3GPP2}.
285      * @see #setProvisioningIntValue(int, int)
286      * @see #getProvisioningIntValue(int)
287      * @hide
288      */
289     public static final int KEY_SMS_FORMAT = 13;
290 
291     /**
292      * Value used with {@link #KEY_SMS_FORMAT} to indicate 3GPP2 SMS format is used.
293      * See {@link android.telephony.SmsMessage#FORMAT_3GPP2} for more information.
294      * @hide
295      */
296     public static final int SMS_FORMAT_3GPP2 = 0;
297 
298     /**
299      * Value used with {@link #KEY_SMS_FORMAT} to indicate 3GPP SMS format is used.
300      * See {@link android.telephony.SmsMessage#FORMAT_3GPP} for more information.
301      * @hide
302      */
303     public static final int SMS_FORMAT_3GPP = 1;
304 
305     /**
306      * Turns SMS over IMS ON/OFF on the device.
307      * Value is in Integer format. ON (1), OFF(0).
308      * @see #setProvisioningIntValue(int, int)
309      * @see #getProvisioningIntValue(int)
310      * @hide
311      */
312     public static final int KEY_SMS_OVER_IP_ENABLED = 14;
313 
314     /**
315      * An integer key associated with the carrier configured SIP PUBLISH timer, which dictates the
316      * expiration time in seconds for published online availability in RCS presence.
317      * <p>
318      * Value is in Integer format.
319      * @see #setProvisioningIntValue(int, int)
320      * @see #getProvisioningIntValue(int)
321      * @hide
322      */
323     public static final int KEY_RCS_PUBLISH_TIMER_SEC = 15;
324 
325     /**
326      * An integer key associated with the carrier configured expiration time in seconds for
327      * published offline availability in RCS presence provided, which is provided to the network.
328      * <p>
329      * Value is in Integer format.
330      * @see #setProvisioningIntValue(int, int)
331      * @see #getProvisioningIntValue(int)
332      * @hide
333      */
334     public static final int KEY_RCS_PUBLISH_OFFLINE_AVAILABILITY_TIMER_SEC = 16;
335 
336     /**
337      * An integer key associated with whether or not capability discovery is provisioned for this
338      * subscription. Any capability requests will be ignored by the RCS service.
339      * <p>
340      * The value is an integer, either {@link #PROVISIONING_VALUE_DISABLED} if capability
341      * discovery is disabled or {@link #PROVISIONING_VALUE_ENABLED} if capability discovery is
342      * enabled.
343      * @see #setProvisioningIntValue(int, int)
344      * @see #getProvisioningIntValue(int)
345      * @hide
346      */
347     public static final int KEY_RCS_CAPABILITY_DISCOVERY_ENABLED = 17;
348 
349     /**
350      * An integer key associated with the period of time in seconds the capability information of
351      * each contact is cached on the device.
352      * <p>
353      * Seconds are used because this is usually measured in the span of days.
354      * <p>
355      * Value is in Integer format.
356      * @see #setProvisioningIntValue(int, int)
357      * @see #getProvisioningIntValue(int)
358      * @hide
359      */
360     public static final int KEY_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC = 18;
361 
362     /**
363      * An integer key associated with the period of time in seconds that the availability
364      * information of a contact is cached on the device, which is based on the carrier provisioning
365      * configuration from the network.
366      * <p>
367      * Value is in Integer format.
368      * @see #setProvisioningIntValue(int, int)
369      * @see #getProvisioningIntValue(int)
370      * @hide
371      */
372     public static final int KEY_RCS_AVAILABILITY_CACHE_EXPIRATION_SEC = 19;
373 
374     /**
375      * An integer key associated with the carrier configured interval in seconds expected between
376      * successive capability polling attempts, which is based on the carrier provisioning
377      * configuration from the network.
378      * <p>
379      * Value is in Integer format.
380      * @see #setProvisioningIntValue(int, int)
381      * @see #getProvisioningIntValue(int)
382      * @hide
383      */
384     public static final int KEY_RCS_CAPABILITIES_POLL_INTERVAL_SEC = 20;
385 
386     /**
387      * An integer key representing the minimum time allowed between two consecutive presence publish
388      * messages from the device in milliseconds.
389      * <p>
390      * Value is in Integer format.
391      * @see #setProvisioningIntValue(int, int)
392      * @see #getProvisioningIntValue(int)
393      * @hide
394      */
395     public static final int KEY_RCS_PUBLISH_SOURCE_THROTTLE_MS = 21;
396 
397     /**
398      * An integer key associated with the maximum number of MDNs contained in one SIP Request
399      * Contained List (RCS) used to retrieve the RCS capabilities of the contacts book.
400      * <p>
401      * Value is in Integer format.
402      * @see #setProvisioningIntValue(int, int)
403      * @see #getProvisioningIntValue(int)
404      * @hide
405      */
406     public static final int KEY_RCS_MAX_NUM_ENTRIES_IN_RCL = 22;
407 
408     /**
409      * An integer associated with the expiration timer used during the SIP subscription of a
410      * Request Contained List (RCL), which is used to retrieve the RCS capabilities of the contact
411      * book. This timer value is sent in seconds to the network.
412      * <p>
413      * Value is in Integer format.
414      * @see #setProvisioningIntValue(int, int)
415      * @see #getProvisioningIntValue(int)
416      * @hide
417      */
418     public static final int KEY_RCS_CAPABILITY_POLL_LIST_SUB_EXP_SEC = 23;
419 
420     /**
421      * Applies compression to LIST Subscription.
422      * Value is in Integer format. Enable (1), Disable(0).
423      * @see #setProvisioningIntValue(int, int)
424      * @see #getProvisioningIntValue(int)
425      * @hide
426      */
427     public static final int KEY_USE_GZIP_FOR_LIST_SUBSCRIPTION = 24;
428 
429     /**
430      * An integer key representing the RCS enhanced address book (EAB) provisioning status for the
431      * associated subscription. Determines whether or not SIP OPTIONS or presence will be used to
432      * retrieve RCS capabilities for the user's contacts.
433      * <p>
434      * Use {@link #PROVISIONING_VALUE_ENABLED} to enable EAB provisioning and
435      * {@link #PROVISIONING_VALUE_DISABLED} to disable EAB provisioning.
436      * @see #setProvisioningIntValue(int, int)
437      * @see #getProvisioningIntValue(int)
438      * @hide
439      */
440     public static final int KEY_EAB_PROVISIONING_STATUS = 25;
441 
442     /**
443      * Override the user-defined WiFi Roaming enabled setting for this subscription, defined in
444      * {@link SubscriptionManager#WFC_ROAMING_ENABLED_CONTENT_URI}, for the purposes of provisioning
445      * the subscription for WiFi Calling.
446      *
447      * @see #getProvisioningIntValue(int)
448      * @see #setProvisioningIntValue(int, int)
449      */
450     public static final int KEY_VOICE_OVER_WIFI_ROAMING_ENABLED_OVERRIDE = 26;
451 
452     /**
453      * Override the user-defined WiFi mode for this subscription, defined in
454      * {@link SubscriptionManager#WFC_MODE_CONTENT_URI}, for the purposes of provisioning
455      * this subscription for WiFi Calling.
456      *
457      * Valid values for this key are:
458      * {@link ImsMmTelManager#WIFI_MODE_WIFI_ONLY},
459      * {@link ImsMmTelManager#WIFI_MODE_CELLULAR_PREFERRED}, or
460      * {@link ImsMmTelManager#WIFI_MODE_WIFI_PREFERRED}.
461      *
462      * @see #getProvisioningIntValue(int)
463      * @see #setProvisioningIntValue(int, int)
464      */
465     public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27;
466 
467     /**
468      * Enable voice over wifi.  Enabled (1), or Disabled (0).
469      * Value is in Integer format.
470      * @see #setProvisioningIntValue(int, int)
471      * @see #getProvisioningIntValue(int)
472      * @hide
473      */
474     public static final int KEY_VOICE_OVER_WIFI_ENABLED_OVERRIDE = 28;
475 
476     /**
477      * Mobile data enabled.
478      * Value is in Integer format. On (1), OFF(0).
479      * @see #setProvisioningIntValue(int, int)
480      * @see #getProvisioningIntValue(int)
481      * @hide
482      */
483     public static final int KEY_MOBILE_DATA_ENABLED = 29;
484 
485     /**
486      * VoLTE user opted in status.
487      * Value is in Integer format. Opted-in (1) Opted-out (0).
488      * @see #setProvisioningIntValue(int, int)
489      * @see #getProvisioningIntValue(int)
490      * @hide
491      */
492     public static final int KEY_VOLTE_USER_OPT_IN_STATUS = 30;
493 
494     /**
495      * Proxy for Call Session Control Function(P-CSCF) address for Local-BreakOut(LBO).
496      * Value is in String format.
497      * @hide
498      */
499     public static final int KEY_LOCAL_BREAKOUT_PCSCF_ADDRESS = 31;
500 
501     /**
502      * Keep Alive Enabled for SIP.
503      * Value is in Integer format.
504      * @see #setProvisioningIntValue(int, int)
505      * @see #getProvisioningIntValue(int)
506      * @hide
507      */
508     public static final int KEY_SIP_KEEP_ALIVE_ENABLED = 32;
509 
510     /**
511      * Registration retry Base Time value in seconds, which is based off of the carrier
512      * configuration.
513      * Value is in Integer format.
514      * @see #setProvisioningIntValue(int, int)
515      * @see #getProvisioningIntValue(int)
516      * @hide
517      */
518     public static final int KEY_REGISTRATION_RETRY_BASE_TIME_SEC = 33;
519 
520     /**
521      * Registration retry Max Time value in seconds, which is based off of the carrier
522      * configuration.
523      * Value is in Integer format.
524      * @see #setProvisioningIntValue(int, int)
525      * @see #getProvisioningIntValue(int)
526      * @hide
527      */
528     public static final int KEY_REGISTRATION_RETRY_MAX_TIME_SEC = 34;
529 
530     /**
531      * Smallest RTP port for speech codec.
532      * Value is in integer format.
533      * @see #setProvisioningIntValue(int, int)
534      * @see #getProvisioningIntValue(int)
535      * @hide
536      */
537 
538     public static final int KEY_RTP_SPEECH_START_PORT = 35;
539 
540     /**
541      * Largest RTP port for speech code.
542      * Value is in Integer format.
543      * @see #setProvisioningIntValue(int, int)
544      * @see #getProvisioningIntValue(int)
545      * @hide
546      */
547     public static final int KEY_RTP_SPEECH_END_PORT = 36;
548 
549     /**
550      * SIP Timer A's value in milliseconds. Timer A is the INVITE request retransmit interval (in
551      * milliseconds), for UDP only.
552      * Value is in Integer format.
553      * @see #setProvisioningIntValue(int, int)
554      * @see #getProvisioningIntValue(int)
555      * @hide
556      */
557     public static final int KEY_SIP_INVITE_REQUEST_TRANSMIT_INTERVAL_MS = 37;
558 
559     /**
560      * SIP Timer B's value in milliseconds. Timer B is the wait time for INVITE message to be,
561      * in milliseconds.
562      * Value is in Integer format.
563      * @see #setProvisioningIntValue(int, int)
564      * @see #getProvisioningIntValue(int)
565      * @hide
566      */
567     public static final int KEY_SIP_INVITE_ACK_WAIT_TIME_MS = 38;
568 
569     /**
570      * SIP Timer D's value in milliseconds. Timer D is the wait time for response retransmits of
571      * the invite client transactions, in milliseconds.
572      * Value is in Integer format.
573      * @see #setProvisioningIntValue(int, int)
574      * @see #getProvisioningIntValue(int)
575      * @hide
576      */
577     public static final int KEY_SIP_INVITE_RESPONSE_RETRANSMIT_WAIT_TIME_MS = 39;
578 
579     /**
580      * SIP Timer E's value in milliseconds. Timer E is the value Non-INVITE request retransmit
581      * interval (in milliseconds), for UDP only.
582      * Value is in Integer format.
583      * @see #setProvisioningIntValue(int, int)
584      * @see #getProvisioningIntValue(int)
585      * @hide
586      */
587     public static final int KEY_SIP_NON_INVITE_REQUEST_RETRANSMIT_INTERVAL_MS = 40;
588 
589     /**
590      * SIP Timer F's value in milliseconds. Timer F is the Non-INVITE transaction timeout timer,
591      * in milliseconds.
592      * Value is in Integer format.
593      * @see #setProvisioningIntValue(int, int)
594      * @see #getProvisioningIntValue(int)
595      * @hide
596      */
597     public static final int KEY_SIP_NON_INVITE_TRANSACTION_TIMEOUT_TIMER_MS = 41;
598 
599     /**
600      * SIP Timer G's value in milliseconds. Timer G is the value of INVITE response
601      * retransmit interval.
602      * Value is in Integer format.
603      * @see #setProvisioningIntValue(int, int)
604      * @see #getProvisioningIntValue(int)
605      * @hide
606      */
607     public static final int KEY_SIP_INVITE_RESPONSE_RETRANSMIT_INTERVAL_MS = 42;
608 
609     /**
610      * SIP Timer H's value in milliseconds. Timer H is the value of wait time for
611      * ACK receipt.
612      * Value is in Integer format.
613      * @see #setProvisioningIntValue(int, int)
614      * @see #getProvisioningIntValue(int)
615      * @hide
616      */
617     public static final int KEY_SIP_ACK_RECEIPT_WAIT_TIME_MS = 43;
618 
619     /**
620      * SIP Timer I's value in milliseconds. Timer I is the value of wait time for
621      * ACK retransmits.
622      * Value is in Integer format.
623      * @see #setProvisioningIntValue(int, int)
624      * @see #getProvisioningIntValue(int)
625      * @hide
626      */
627     public static final int KEY_SIP_ACK_RETRANSMIT_WAIT_TIME_MS = 44;
628 
629     /**
630      * SIP Timer J's value in milliseconds. Timer J is the value of wait time for
631      * non-invite request retransmission.
632      * Value is in Integer format.
633      * @see #setProvisioningIntValue(int, int)
634      * @see #getProvisioningIntValue(int)
635      * @hide
636      */
637     public static final int KEY_SIP_NON_INVITE_REQUEST_RETRANSMISSION_WAIT_TIME_MS = 45;
638 
639     /**
640      * SIP Timer K's value in milliseconds. Timer K is the value of wait time for
641      * non-invite response retransmits.
642      * Value is in Integer format.
643      * @see #setProvisioningIntValue(int, int)
644      * @see #getProvisioningIntValue(int)
645      * @hide
646      */
647     public static final int KEY_SIP_NON_INVITE_RESPONSE_RETRANSMISSION_WAIT_TIME_MS = 46;
648 
649     /**
650      * AMR WB octet aligned dynamic payload type.
651      * Value is in Integer format.
652      * @see #setProvisioningIntValue(int, int)
653      * @see #getProvisioningIntValue(int)
654      * @hide
655      */
656     public static final int KEY_AMR_WB_OCTET_ALIGNED_PAYLOAD_TYPE = 47;
657 
658     /**
659      * AMR WB bandwidth efficient payload type.
660      * Value is in Integer format.
661      * @see #setProvisioningIntValue(int, int)
662      * @see #getProvisioningIntValue(int)
663      * @hide
664      */
665     public static final int KEY_AMR_WB_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE = 48;
666 
667     /**
668      * AMR octet aligned dynamic payload type.
669      * Value is in Integer format.
670      * @see #setProvisioningIntValue(int, int)
671      * @see #getProvisioningIntValue(int)
672      * @hide
673      */
674     public static final int KEY_AMR_OCTET_ALIGNED_PAYLOAD_TYPE = 49;
675 
676     /**
677      * AMR bandwidth efficient payload type.
678      * Value is in Integer format.
679      * @see #setProvisioningIntValue(int, int)
680      * @see #getProvisioningIntValue(int)
681      * @hide
682      */
683     public static final int KEY_AMR_BANDWIDTH_EFFICIENT_PAYLOAD_TYPE = 50;
684 
685     /**
686      * DTMF WB payload type.
687      * Value is in Integer format.
688      * @see #setProvisioningIntValue(int, int)
689      * @see #getProvisioningIntValue(int)
690      * @hide
691      */
692     public static final int KEY_DTMF_WB_PAYLOAD_TYPE = 51;
693 
694     /**
695      * DTMF NB payload type.
696      * Value is in Integer format.
697      * @see #setProvisioningIntValue(int, int)
698      * @see #getProvisioningIntValue(int)
699      * @hide
700      */
701     public static final int KEY_DTMF_NB_PAYLOAD_TYPE = 52;
702 
703     /**
704      * AMR Default encoding mode.
705      * Value is in Integer format.
706      * @see #setProvisioningIntValue(int, int)
707      * @see #getProvisioningIntValue(int)
708      * @hide
709      */
710     public static final int KEY_AMR_DEFAULT_ENCODING_MODE = 53;
711 
712     /**
713      * SMS Public Service Identity.
714      * Value is in String format.
715      * @hide
716      */
717     public static final int KEY_SMS_PUBLIC_SERVICE_IDENTITY = 54;
718 
719     /**
720      * Video Quality - VideoQualityFeatureValuesConstants.
721      * Valid values are: {@link #VIDEO_QUALITY_HIGH} and {@link #VIDEO_QUALITY_LOW}.
722      * Value is in Integer format.
723      * @see #setProvisioningIntValue(int, int)
724      * @see #getProvisioningIntValue(int)
725      * @hide
726      */
727     public static final int KEY_VIDEO_QUALITY = 55;
728 
729     /**
730      * Used with {@link #KEY_VIDEO_QUALITY} to indicate low video quality.
731      * @hide
732      */
733     public static final int VIDEO_QUALITY_LOW = 0;
734 
735     /**
736      * Used with {@link #KEY_VIDEO_QUALITY} to indicate high video quality.
737      * @hide
738      */
739     public static final int VIDEO_QUALITY_HIGH = 1;
740 
741     /**
742      * LTE to WIFI handover threshold.
743      * Handover from LTE to WiFi if LTE < THLTE1 and WiFi >= {@link #KEY_WIFI_THRESHOLD_A}.
744      * Value is in Integer format.
745      * @see #setProvisioningIntValue(int, int)
746      * @see #getProvisioningIntValue(int)
747      * @hide
748      */
749     public static final int KEY_LTE_THRESHOLD_1 = 56;
750 
751     /**
752      * WIFI to LTE handover threshold.
753      * Handover from WiFi to LTE if LTE >= {@link #KEY_LTE_THRESHOLD_3} or (WiFi < {@link
754      * #KEY_WIFI_THRESHOLD_B} and LTE >= {@link #KEY_LTE_THRESHOLD_2}).
755      * Value is in Integer format.
756      *
757      * @see #setProvisioningIntValue(int, int)
758      * @see #getProvisioningIntValue(int)
759      * @hide
760      */
761     public static final int KEY_LTE_THRESHOLD_2 = 57;
762 
763     /**
764      * LTE to WIFI handover threshold.
765      * Handover from WiFi to LTE if LTE >= {@link #KEY_LTE_THRESHOLD_3} or (WiFi < {@link
766      * #KEY_WIFI_THRESHOLD_B} and LTE >= {@link #KEY_LTE_THRESHOLD_2}).
767      * Value is in Integer format.
768      *
769      * @see #setProvisioningIntValue(int, int)
770      * @see #getProvisioningIntValue(int)
771      * @hide
772      */
773     public static final int KEY_LTE_THRESHOLD_3 = 58;
774 
775     /**
776      * 1x to WIFI handover threshold.
777      * Handover from 1x to WiFi if 1x < {@link #KEY_1X_THRESHOLD}.
778      * Value is in Integer format.
779      * @see #setProvisioningIntValue(int, int)
780      * @see #getProvisioningIntValue(int)
781      * @hide
782      */
783     public static final int KEY_1X_THRESHOLD = 59;
784 
785     /**
786      * LTE to WIFI threshold A.
787      * Handover from LTE to WiFi if LTE < {@link #KEY_LTE_THRESHOLD_1} and WiFi >= {@link
788      * #KEY_WIFI_THRESHOLD_A}.
789      * Value is in Integer format.
790      *
791      * @see #setProvisioningIntValue(int, int)
792      * @see #getProvisioningIntValue(int)
793      * @hide
794      */
795     public static final int KEY_WIFI_THRESHOLD_A = 60;
796 
797     /**
798      * WiFi to LTRE handover threshold B.
799      * Handover from WiFi to LTE if LTE >= {@link #KEY_LTE_THRESHOLD_3} or (WiFi <
800      * {@link #KEY_WIFI_THRESHOLD_B} and LTE >= {@link #KEY_LTE_THRESHOLD_2}).
801      * Value is in Integer format.
802      * @see #setProvisioningIntValue(int, int)
803      * @see #getProvisioningIntValue(int)
804      * @hide
805      */
806     public static final int KEY_WIFI_THRESHOLD_B = 61;
807 
808     /**
809      * LTE ePDG timer (in seconds).
810      * Device shall not handover back to LTE until the T_ePDG_LTE timer expires.
811      * Value is in Integer format.
812      * @see #setProvisioningIntValue(int, int)
813      * @see #getProvisioningIntValue(int)
814      * @hide
815      */
816     public static final int KEY_LTE_EPDG_TIMER_SEC = 62;
817 
818     /**
819      * WiFi ePDG timer (in seconds).
820      * Device shall not handover back to WiFi until the T_ePDG_WiFi timer expires.
821      * Value is in Integer format.
822      * @see #setProvisioningIntValue(int, int)
823      * @see #getProvisioningIntValue(int)
824      * @hide
825      */
826     public static final int KEY_WIFI_EPDG_TIMER_SEC = 63;
827 
828     /**
829      * 1x ePDG timer (in seconds).
830      * Device shall not re-register on 1x until the T_ePDG_1x timer expires.
831      * @hide
832      */
833     public static final int KEY_1X_EPDG_TIMER_SEC = 64;
834 
835     /**
836      * MultiEndpoint status: Enabled (1), or Disabled (0).
837      * Value is in Integer format.
838      * @see #setProvisioningIntValue(int, int)
839      * @see #getProvisioningIntValue(int)
840      * @hide
841      */
842     public static final int KEY_MULTIENDPOINT_ENABLED = 65;
843 
844     /**
845      * RTT status: Enabled (1), or Disabled (0).
846      * Value is in Integer format.
847      * @see #setProvisioningIntValue(int, int)
848      * @see #getProvisioningIntValue(int)
849      * @hide
850      */
851     public static final int KEY_RTT_ENABLED = 66;
852 
853     /**
854      * Callback for IMS provisioning changes.
855      */
856     public static class Callback {
857 
858         private static class CallbackBinder extends IImsConfigCallback.Stub {
859 
860             private final Callback mLocalConfigurationCallback;
861             private Executor mExecutor;
862 
CallbackBinder(Callback localConfigurationCallback)863             private CallbackBinder(Callback localConfigurationCallback) {
864                 mLocalConfigurationCallback = localConfigurationCallback;
865             }
866 
867             @Override
onIntConfigChanged(int item, int value)868             public final void onIntConfigChanged(int item, int value) {
869                 long callingIdentity = Binder.clearCallingIdentity();
870                 try {
871                     mExecutor.execute(() ->
872                             mLocalConfigurationCallback.onProvisioningIntChanged(item, value));
873                 } finally {
874                     restoreCallingIdentity(callingIdentity);
875                 }
876             }
877 
878             @Override
onStringConfigChanged(int item, String value)879             public final void onStringConfigChanged(int item, String value) {
880                 long callingIdentity = Binder.clearCallingIdentity();
881                 try {
882                     mExecutor.execute(() ->
883                             mLocalConfigurationCallback.onProvisioningStringChanged(item, value));
884                 } finally {
885                     restoreCallingIdentity(callingIdentity);
886                 }
887             }
888 
setExecutor(Executor executor)889             private void setExecutor(Executor executor) {
890                 mExecutor = executor;
891             }
892         }
893 
894         private final CallbackBinder mBinder = new CallbackBinder(this);
895 
896         /**
897          * Called when a provisioning item has changed.
898          * @param item the IMS provisioning key constant, as defined by the OEM.
899          * @param value the new integer value of the IMS provisioning key.
900          */
onProvisioningIntChanged(int item, int value)901         public void onProvisioningIntChanged(int item, int value) {
902             // Base Implementation
903         }
904 
905         /**
906          * Called when a provisioning item has changed.
907          * @param item the IMS provisioning key constant, as defined by the OEM.
908          * @param value the new String value of the IMS configuration constant.
909          */
onProvisioningStringChanged(int item, @NonNull String value)910         public void onProvisioningStringChanged(int item, @NonNull String value) {
911             // Base Implementation
912         }
913 
914         /**@hide*/
getBinder()915         public final IImsConfigCallback getBinder() {
916             return mBinder;
917         }
918 
919         /**@hide*/
setExecutor(Executor executor)920         public void setExecutor(Executor executor) {
921             mBinder.setExecutor(executor);
922         }
923     }
924 
925     private int mSubId;
926 
927     /**
928      * Create a new {@link ProvisioningManager} for the subscription specified.
929      *
930      * @param subId The ID of the subscription that this ProvisioningManager will use.
931      * @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
932      * @throws IllegalArgumentException if the subscription is invalid.
933      */
createForSubscriptionId(int subId)934     public static @NonNull ProvisioningManager createForSubscriptionId(int subId) {
935         if (!SubscriptionManager.isValidSubscriptionId(subId)) {
936             throw new IllegalArgumentException("Invalid subscription ID");
937         }
938 
939         return new ProvisioningManager(subId);
940     }
941 
ProvisioningManager(int subId)942     private ProvisioningManager(int subId) {
943         mSubId = subId;
944     }
945 
946     /**
947      * Register a new {@link Callback} to listen to changes to changes in IMS provisioning.
948      *
949      * When the subscription associated with this callback is removed (SIM removed, ESIM swap,
950      * etc...), this callback will automatically be removed.
951      * @param executor The {@link Executor} to call the callback methods on
952      * @param callback The provisioning callbackto be registered.
953      * @see #unregisterProvisioningChangedCallback(Callback)
954      * @see SubscriptionManager.OnSubscriptionsChangedListener
955      * @throws IllegalArgumentException if the subscription associated with this callback is not
956      * active (SIM is not inserted, ESIM inactive) or the subscription is invalid.
957      * @throws ImsException if the subscription associated with this callback is valid, but
958      * the {@link ImsService} associated with the subscription is not available. This can happen if
959      * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
960      * reason.
961      */
962     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
registerProvisioningChangedCallback(@onNull @allbackExecutor Executor executor, @NonNull Callback callback)963     public void registerProvisioningChangedCallback(@NonNull @CallbackExecutor Executor executor,
964             @NonNull Callback callback) throws ImsException {
965         callback.setExecutor(executor);
966         try {
967             getITelephony().registerImsProvisioningChangedCallback(mSubId, callback.getBinder());
968         } catch (ServiceSpecificException e) {
969             throw new ImsException(e.getMessage(), e.errorCode);
970         } catch (RemoteException | IllegalStateException e) {
971             throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
972         }
973     }
974 
975     /**
976      * Unregister an existing {@link Callback}. When the subscription associated with this
977      * callback is removed (SIM removed, ESIM swap, etc...), this callback will automatically be
978      * removed. If this method is called for an inactive subscription, it will result in a no-op.
979      * @param callback The existing {@link Callback} to be removed.
980      * @see #registerProvisioningChangedCallback(Executor, Callback)
981      *
982      * @throws IllegalArgumentException if the subscription associated with this callback is
983      * invalid.
984      */
985     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
unregisterProvisioningChangedCallback(@onNull Callback callback)986     public void unregisterProvisioningChangedCallback(@NonNull Callback callback) {
987         try {
988             getITelephony().unregisterImsProvisioningChangedCallback(mSubId, callback.getBinder());
989         } catch (RemoteException e) {
990             throw e.rethrowAsRuntimeException();
991         }
992     }
993 
994     /**
995      * Query for the integer value associated with the provided key.
996      *
997      * This operation is blocking and should not be performed on the UI thread.
998      *
999      * @param key An integer that represents the provisioning key, which is defined by the OEM.
1000      * @return an integer value for the provided key, or
1001      * {@link ImsConfigImplBase#CONFIG_RESULT_UNKNOWN} if the key doesn't exist.
1002      * @throws IllegalArgumentException if the key provided was invalid.
1003      */
1004     @WorkerThread
1005     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
getProvisioningIntValue(int key)1006     public int getProvisioningIntValue(int key) {
1007         try {
1008             return getITelephony().getImsProvisioningInt(mSubId, key);
1009         } catch (RemoteException e) {
1010             throw e.rethrowAsRuntimeException();
1011         }
1012     }
1013 
1014     /**
1015      * Query for the String value associated with the provided key.
1016      *
1017      * This operation is blocking and should not be performed on the UI thread.
1018      *
1019      * @param key A String that represents the provisioning key, which is defined by the OEM.
1020      * @return a String value for the provided key, {@code null} if the key doesn't exist, or
1021      * {@link StringResultError} if there was an error getting the value for the provided key.
1022      * @throws IllegalArgumentException if the key provided was invalid.
1023      */
1024     @WorkerThread
1025     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
getProvisioningStringValue(int key)1026     public @Nullable @StringResultError String getProvisioningStringValue(int key) {
1027         try {
1028             return getITelephony().getImsProvisioningString(mSubId, key);
1029         } catch (RemoteException e) {
1030             throw e.rethrowAsRuntimeException();
1031         }
1032     }
1033 
1034     /**
1035      * Set the integer value associated with the provided key.
1036      *
1037      * This operation is blocking and should not be performed on the UI thread.
1038      *
1039      * Use {@link #setProvisioningStringValue(int, String)} with proper namespacing (to be defined
1040      * per OEM or carrier) when possible instead to avoid key collision if needed.
1041      * @param key An integer that represents the provisioning key, which is defined by the OEM.
1042      * @param value a integer value for the provided key.
1043      * @return the result of setting the configuration value.
1044      */
1045     @WorkerThread
1046     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
setProvisioningIntValue(int key, int value)1047     public @ImsConfigImplBase.SetConfigResult int setProvisioningIntValue(int key, int value) {
1048         try {
1049             return getITelephony().setImsProvisioningInt(mSubId, key, value);
1050         } catch (RemoteException e) {
1051             throw e.rethrowAsRuntimeException();
1052         }
1053     }
1054 
1055     /**
1056      * Set the String value associated with the provided key.
1057      *
1058      * This operation is blocking and should not be performed on the UI thread.
1059      *
1060      * @param key A String that represents the provisioning key, which is defined by the OEM and
1061      *     should be appropriately namespaced to avoid collision.
1062      * @param value a String value for the provided key.
1063      * @return the result of setting the configuration value.
1064      */
1065     @WorkerThread
1066     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
setProvisioningStringValue(int key, @NonNull String value)1067     public @ImsConfigImplBase.SetConfigResult int setProvisioningStringValue(int key,
1068             @NonNull String value) {
1069         try {
1070             return getITelephony().setImsProvisioningString(mSubId, key, value);
1071         } catch (RemoteException e) {
1072             throw e.rethrowAsRuntimeException();
1073         }
1074     }
1075 
1076     /**
1077      * Set the provisioning status for the IMS MmTel capability using the specified subscription.
1078      *
1079      * Provisioning may or may not be required, depending on the carrier configuration. If
1080      * provisioning is not required for the carrier associated with this subscription or the device
1081      * does not support the capability/technology combination specified, this operation will be a
1082      * no-op.
1083      *
1084      * @see CarrierConfigManager#KEY_CARRIER_UT_PROVISIONING_REQUIRED_BOOL
1085      * @see CarrierConfigManager#KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL
1086      * @param isProvisioned true if the device is provisioned for UT over IMS, false otherwise.
1087      */
1088     @WorkerThread
1089     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
setProvisioningStatusForCapability( @mTelFeature.MmTelCapabilities.MmTelCapability int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech, boolean isProvisioned)1090     public void setProvisioningStatusForCapability(
1091             @MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
1092             @ImsRegistrationImplBase.ImsRegistrationTech int tech,  boolean isProvisioned) {
1093         try {
1094             getITelephony().setImsProvisioningStatusForCapability(mSubId, capability, tech,
1095                     isProvisioned);
1096         } catch (RemoteException e) {
1097             throw e.rethrowAsRuntimeException();
1098         }
1099     }
1100 
1101     /**
1102      * Get the provisioning status for the IMS MmTel capability specified.
1103      *
1104      * If provisioning is not required for the queried
1105      * {@link MmTelFeature.MmTelCapabilities.MmTelCapability} and
1106      * {@link ImsRegistrationImplBase.ImsRegistrationTech} combination specified, this method will
1107      * always return {@code true}.
1108      *
1109      * @see CarrierConfigManager#KEY_CARRIER_UT_PROVISIONING_REQUIRED_BOOL
1110      * @see CarrierConfigManager#KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL
1111      * @return true if the device is provisioned for the capability or does not require
1112      * provisioning, false if the capability does require provisioning and has not been
1113      * provisioned yet.
1114      */
1115     @WorkerThread
1116     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
getProvisioningStatusForCapability( @mTelFeature.MmTelCapabilities.MmTelCapability int capability, @ImsRegistrationImplBase.ImsRegistrationTech int tech)1117     public boolean getProvisioningStatusForCapability(
1118             @MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
1119             @ImsRegistrationImplBase.ImsRegistrationTech int tech) {
1120         try {
1121             return getITelephony().getImsProvisioningStatusForCapability(mSubId, capability, tech);
1122         } catch (RemoteException e) {
1123             throw e.rethrowAsRuntimeException();
1124         }
1125     }
1126 
1127     /**
1128      * Get the provisioning status for the IMS RCS capability specified.
1129      *
1130      * If provisioning is not required for the queried
1131      * {@link RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag} this method will always return
1132      * {@code true}.
1133      *
1134      * @see CarrierConfigManager#KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL
1135      * @return true if the device is provisioned for the capability or does not require
1136      * provisioning, false if the capability does require provisioning and has not been
1137      * provisioned yet.
1138      */
1139     @WorkerThread
1140     @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
getRcsProvisioningStatusForCapability( @csFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability)1141     public boolean getRcsProvisioningStatusForCapability(
1142             @RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
1143         try {
1144             return getITelephony().getRcsProvisioningStatusForCapability(mSubId, capability);
1145         } catch (RemoteException e) {
1146             throw e.rethrowAsRuntimeException();
1147         }
1148     }
1149 
1150     /**
1151      * Set the provisioning status for the IMS RCS capability using the specified subscription.
1152      *
1153      * Provisioning may or may not be required, depending on the carrier configuration. If
1154      * provisioning is not required for the carrier associated with this subscription or the device
1155      * does not support the capability/technology combination specified, this operation will be a
1156      * no-op.
1157      *
1158      * @see CarrierConfigManager#KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL
1159      * @param isProvisioned true if the device is provisioned for the RCS capability specified,
1160      *                      false otherwise.
1161      */
1162     @WorkerThread
1163     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
setRcsProvisioningStatusForCapability( @csFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability, boolean isProvisioned)1164     public void setRcsProvisioningStatusForCapability(
1165             @RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability,
1166             boolean isProvisioned) {
1167         try {
1168             getITelephony().setRcsProvisioningStatusForCapability(mSubId, capability,
1169                     isProvisioned);
1170         } catch (RemoteException e) {
1171             throw e.rethrowAsRuntimeException();
1172         }
1173     }
1174 
1175     /**
1176      * Notify the framework that an RCS autoconfiguration XML file has been received for
1177      * provisioning.
1178      * <p>
1179      * Requires Permission: Manifest.permission.MODIFY_PHONE_STATE or that the calling app has
1180      * carrier privileges (see {@link #hasCarrierPrivileges}).
1181      * @param config The XML file to be read. ASCII/UTF8 encoded text if not compressed.
1182      * @param isCompressed The XML file is compressed in gzip format and must be decompressed
1183      *         before being read.
1184      *
1185      */
1186     @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
notifyRcsAutoConfigurationReceived(@onNull byte[] config, boolean isCompressed)1187     public void notifyRcsAutoConfigurationReceived(@NonNull byte[] config, boolean isCompressed) {
1188         if (config == null) {
1189             throw new IllegalArgumentException("Must include a non-null config XML file.");
1190         }
1191         try {
1192             getITelephony().notifyRcsAutoConfigurationReceived(mSubId, config, isCompressed);
1193         } catch (RemoteException e) {
1194             throw e.rethrowAsRuntimeException();
1195         }
1196 
1197     }
1198 
getITelephony()1199     private static ITelephony getITelephony() {
1200         ITelephony binder = ITelephony.Stub.asInterface(
1201                 TelephonyFrameworkInitializer
1202                         .getTelephonyServiceManager()
1203                         .getTelephonyServiceRegisterer()
1204                         .get());
1205         if (binder == null) {
1206             throw new RuntimeException("Could not find Telephony Service.");
1207         }
1208         return binder;
1209     }
1210 }
1211