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