• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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  * Copyright (C) 2022 The Android Open Source Project
18  *
19  * Licensed under the Apache License, Version 2.0 (the "License");
20  * you may not use this file except in compliance with the License.
21  * You may obtain a copy of the License at
22  *
23  *      http://www.apache.org/licenses/LICENSE-2.0
24  *
25  * Unless required by applicable law or agreed to in writing, software
26  * distributed under the License is distributed on an "AS IS" BASIS,
27  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28  * See the License for the specific language governing permissions and
29  * limitations under the License.
30  */
31 
32 package com.android.internal.telephony.subscription;
33 
34 import android.annotation.ColorInt;
35 import android.annotation.NonNull;
36 import android.annotation.UserIdInt;
37 import android.os.UserHandle;
38 import android.provider.Telephony.SimInfo;
39 import android.telephony.SubscriptionInfo;
40 import android.telephony.SubscriptionManager;
41 import android.telephony.SubscriptionManager.DeviceToDeviceStatusSharingPreference;
42 import android.telephony.SubscriptionManager.ProfileClass;
43 import android.telephony.SubscriptionManager.SimDisplayNameSource;
44 import android.telephony.SubscriptionManager.SubscriptionType;
45 import android.telephony.SubscriptionManager.UsageSetting;
46 import android.telephony.TelephonyManager;
47 import android.telephony.UiccAccessRule;
48 import android.telephony.ims.ImsMmTelManager;
49 import android.text.TextUtils;
50 
51 import com.android.internal.telephony.uicc.IccUtils;
52 import com.android.internal.telephony.util.TelephonyUtils;
53 import com.android.telephony.Rlog;
54 
55 import java.util.Arrays;
56 import java.util.List;
57 import java.util.Objects;
58 
59 /**
60  * The class represents a single row of {@link SimInfo} table. All columns (excepts unused columns)
61  * in the database have a corresponding field in this class.
62  *
63  * The difference between {@link SubscriptionInfo} and this class is that {@link SubscriptionInfo}
64  * is a subset of this class. This is intended to solve the problem that some database fields
65  * required higher permission like
66  * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} to access while
67  * {@link SubscriptionManager#getActiveSubscriptionIdList()} only requires
68  * {@link android.Manifest.permission#READ_PHONE_STATE} to access. Sometimes blanking out fields in
69  * {@link SubscriptionInfo} creates ambiguity for clients hard to distinguish between insufficient
70  * permission versus true failure.
71  *
72  * Also the fields in this class match the format used in database. For example, boolean values
73  * are stored as integer, or string arrays are stored as a single comma separated string.
74  */
75 public class SubscriptionInfoInternal {
76     /**
77      * Subscription Identifier, this is a device unique number
78      * and not an index into an array
79      */
80     private final int mId;
81 
82     /**
83      * The ICCID of the SIM that is associated with this subscription, empty if unknown.
84      */
85     @NonNull
86     private final String mIccId;
87 
88     /**
89      * The index of the SIM slot that currently contains the subscription and not necessarily unique
90      * and maybe {@link SubscriptionManager#INVALID_SIM_SLOT_INDEX} if unknown or the subscription
91      * is inactive.
92      */
93     private final int mSimSlotIndex;
94 
95     /**
96      * The name displayed to the user that identifies this subscription. This name is used
97      * in Settings page and can be renamed by the user.
98      */
99     @NonNull
100     private final String mDisplayName;
101 
102     /**
103      * The name displayed to the user that identifies subscription provider name. This name is the
104      * SPN displayed in status bar and many other places. Can't be renamed by the user.
105      */
106     @NonNull
107     private final String mCarrierName;
108 
109     /**
110      * The source of the {@link #mDisplayName}.
111      */
112     @SimDisplayNameSource
113     private final int mDisplayNameSource;
114 
115     /**
116      * The color to be used for tinting the icon when displaying to the user.
117      */
118     @ColorInt
119     private final int mIconTint;
120 
121     /**
122      * The number presented to the user identify this subscription.
123      */
124     @NonNull
125     private final String mNumber;
126 
127     /**
128      * Whether user enables data roaming for this subscription or not. Either
129      * {@link SubscriptionManager#DATA_ROAMING_ENABLE} or
130      * {@link SubscriptionManager#DATA_ROAMING_DISABLE}.
131      */
132     private final int mDataRoaming;
133 
134     /**
135      * Mobile Country Code.
136      */
137     @NonNull
138     private final String mMcc;
139 
140     /**
141      * Mobile Network Code.
142      */
143     @NonNull
144     private final String mMnc;
145 
146     /**
147      * EHPLMNs associated with the subscription.
148      */
149     @NonNull
150     private final String mEhplmns;
151 
152     /**
153      * HPLMNs associated with the subscription.
154      */
155     @NonNull
156     private final String mHplmns;
157 
158     /**
159      * Whether the subscription is from eSIM. It is intended to use integer to fit the database
160      * format.
161      */
162     private final int mIsEmbedded;
163 
164     /**
165      * The string ID of the SIM card. It is the ICCID of the active profile for a UICC card and the
166      * EID for an eUICC card.
167      */
168     @NonNull
169     private final String mCardString;
170 
171     /**
172      * The access rules for this subscription, if it is embedded and defines any. This does not
173      * include access rules for non-embedded subscriptions.
174      */
175     @NonNull
176     private final byte[] mNativeAccessRules;
177 
178     /**
179      * The carrier certificates for this subscription that are saved in carrier configs.
180      * This does not include access rules from the Uicc, whether embedded or non-embedded.
181      */
182     @NonNull
183     private final byte[] mCarrierConfigAccessRules;
184 
185     /**
186      * Whether an embedded subscription is on a removable card. Such subscriptions are marked
187      * inaccessible as soon as the current card is removed. Otherwise, they will remain accessible
188      * unless explicitly deleted. Only meaningful when {@link #getEmbedded()} is {@code 1}. It
189      * is intended to use integer to fit the database format.
190      */
191     private final int mIsRemovableEmbedded;
192 
193     /**
194      * Whether cell broadcast extreme threat alert is enabled by the user or not.
195      */
196     private int mIsExtremeThreatAlertEnabled;
197 
198     /**
199      * Whether cell broadcast severe threat alert is enabled by the user or not.
200      */
201     private int mIsSevereThreatAlertEnabled;
202 
203     /**
204      * Whether cell broadcast amber alert is enabled by the user or not.
205      */
206     private int mIsAmberAlertEnabled;
207 
208     /**
209      * Whether cell broadcast emergency alert is enabled by the user or not.
210      */
211     private int mIsEmergencyAlertEnabled;
212 
213     /**
214      * Cell broadcast alert sound duration in seconds.
215      */
216     private int mAlertSoundDuration;
217 
218     /**
219      * Cell broadcast alert reminder interval in minutes.
220      */
221     private int mReminderInterval;
222 
223     /**
224      * Whether cell broadcast alert vibration is enabled by the user or not.
225      */
226     private int mIsAlertVibrationEnabled;
227 
228     /**
229      * Whether cell broadcast alert speech is enabled by the user or not.
230      */
231     private int mIsAlertSpeechEnabled;
232 
233     /**
234      * Whether ETWS test alert is enabled by the user or not.
235      */
236     private int mIsEtwsTestAlertEnabled;
237 
238     /**
239      * Whether area info message is enabled by the user or not.
240      */
241     private int mIsAreaInfoMessageEnabled;
242 
243     /**
244      * Whether cell broadcast test alert is enabled by the user or not.
245      */
246     private int mIsTestAlertEnabled;
247 
248     /**
249      * Whether cell broadcast opt-out dialog should be shown or not.
250      */
251     private int mIsOptOutDialogEnabled;
252 
253     /**
254      * Whether enhanced 4G mode is enabled by the user or not. It is intended to use integer to fit
255      * the database format.
256      */
257     private final int mIsEnhanced4GModeEnabled;
258 
259     /**
260      * Whether video telephony is enabled by the user or not. It is intended to use integer to fit
261      * the database format.
262      */
263     private final int mIsVideoTelephonyEnabled;
264 
265     /**
266      * Whether Wi-Fi calling is enabled by the user or not when the device is not roaming. It is
267      * intended to use integer to fit the database format.
268      */
269     private final int mIsWifiCallingEnabled;
270 
271     /**
272      * Wi-Fi calling mode when the device is not roaming.
273      */
274     @ImsMmTelManager.WiFiCallingMode
275     private final int mWifiCallingMode;
276 
277     /**
278      * Wi-Fi calling mode when the device is roaming.
279      */
280     @ImsMmTelManager.WiFiCallingMode
281     private final int mWifiCallingModeForRoaming;
282 
283     /**
284      * Whether Wi-Fi calling is enabled by the user or not when the device is roaming. It is
285      * intended to use integer to fit the database format.
286      */
287     private final int mIsWifiCallingEnabledForRoaming;
288 
289     /**
290      * Whether the subscription is opportunistic. It is intended to use integer to fit the database
291      * format.
292      */
293     private final int mIsOpportunistic;
294 
295     /**
296      * A UUID assigned to the subscription group in string format.
297      *
298      * @see SubscriptionManager#createSubscriptionGroup(List)
299      */
300     @NonNull
301     private final String mGroupUuid;
302 
303     /**
304      * ISO Country code for the subscription's provider.
305      */
306     @NonNull
307     private final String mCountryIso;
308 
309     /**
310      * The subscription carrier id.
311      *
312      * @see TelephonyManager#getSimCarrierId()
313      */
314     private final int mCarrierId;
315 
316     /**
317      * The profile class populated from the profile metadata if present. Otherwise,
318      * the profile class defaults to {@link SubscriptionManager#PROFILE_CLASS_UNSET} if there is no
319      * profile metadata or the subscription is not on an eUICC ({@link #getEmbedded} returns
320      * {@code 0}).
321      */
322     @ProfileClass
323     private final int mProfileClass;
324 
325     /**
326      * Type of the subscription.
327      */
328     @SubscriptionType
329     private final int mType;
330 
331     /**
332      * A package name that specifies who created the group. Empty if not available.
333      */
334     @NonNull
335     private final String mGroupOwner;
336 
337     /**
338      * The enabled mobile data policies in string format.
339      */
340     @NonNull
341     private final String mEnabledMobileDataPolicies;
342 
343     /**
344      * The IMSI (International Mobile Subscriber Identity) of the subscription.
345      */
346     @NonNull
347     private final String mImsi;
348 
349     /**
350      * Whether uicc applications are configured to enable or disable.
351      * By default it's true. It is intended to use integer to fit the database format.
352      */
353     private final int mAreUiccApplicationsEnabled;
354 
355     /**
356      * Whether the user has enabled IMS RCS User Capability Exchange (UCE) for this subscription.
357      * It is intended to use integer to fit the database format.
358      */
359     private final int mIsRcsUceEnabled;
360 
361     /**
362      * Whether the user has enabled cross SIM calling for this subscription. It is intended to
363      * use integer to fit the database format.
364      */
365     private final int mIsCrossSimCallingEnabled;
366 
367     /**
368      * The RCS configuration.
369      */
370     @NonNull
371     private final byte[] mRcsConfig;
372 
373     /**
374      * The allowed network types for reasons in string format. The format is
375      * "[reason]=[network types bitmask], [reason]=[network types bitmask], ..."
376      *
377      * For example, "user=1239287394, thermal=298791239, carrier=3456812312".
378      */
379     @NonNull
380     private final String mAllowedNetworkTypesForReasons;
381 
382     /**
383      * Device to device sharing status.
384      */
385     @DeviceToDeviceStatusSharingPreference
386     private final int mDeviceToDeviceStatusSharingPreference;
387 
388     /**
389      * Whether the user has opted-in voice over IMS. It is intended to use integer to fit the
390      * database format.
391      */
392     private final int mIsVoImsOptInEnabled;
393 
394     /**
395      * Contacts information that allow device to device sharing.
396      */
397     @NonNull
398     private final String mDeviceToDeviceStatusSharingContacts;
399 
400     /**
401      * Whether the user has enabled NR advanced calling. It is intended to use integer to fit the
402      * database format.
403      */
404     private final int mIsNrAdvancedCallingEnabled;
405 
406     /**
407      * The phone number retrieved from carrier.
408      */
409     @NonNull
410     private final String mNumberFromCarrier;
411 
412     /**
413      * The phone number retrieved from IMS.
414      */
415     @NonNull
416     private final String mNumberFromIms;
417 
418     /**
419      * The port index of the Uicc card.
420      */
421     private final int mPortIndex;
422 
423     /**
424      * Subscription's preferred usage setting.
425      */
426     @UsageSetting
427     private final int mUsageSetting;
428 
429     /**
430      * Last used TP message reference.
431      */
432     private final int mLastUsedTPMessageReference;
433 
434     /**
435      * The user id associated with this subscription.
436      */
437     private final int mUserId;
438 
439     /**
440      * Whether satellite is enabled or disabled.
441      * By default, its disabled. It is intended to use integer to fit the database format.
442      */
443     private final int mIsSatelliteEnabled;
444 
445     /**
446      * Whether satellite attach for carrier is enabled or disabled by user.
447      * By default, its enabled. It is intended to use integer to fit the database format.
448      */
449     private final int mIsSatelliteAttachEnabledForCarrier;
450 
451     /**
452      * Whether this subscription is used for communicating with non-terrestrial networks.
453      * By default, its disabled. It is intended to use integer to fit the database format.
454      */
455     private final int mIsOnlyNonTerrestrialNetwork;
456 
457     // This field does not exist in the SimInfo table.
458     /**
459      * The card ID of the SIM card. This maps uniquely to {@link #mCardString}.
460      */
461     private final int mCardId;
462 
463     // This field does not exist in the SimInfo table.
464     /**
465      * Whether group of the subscription is disabled. This is only useful if it's a grouped
466      * opportunistic subscription. In this case, if all primary (non-opportunistic) subscriptions
467      * in the group are deactivated (unplugged pSIM or deactivated eSIM profile), we should disable
468      * this opportunistic subscription. It is intended to use integer to fit the database format.
469      */
470     private final boolean mIsGroupDisabled;
471 
472     /**
473      * Service capabilities (in the form of bitmask combination) the subscription supports.
474      */
475     private final int mServiceCapabilities;
476 
477     /**
478      * The transfer status of the subscription
479      */
480     private final int mTransferStatus;
481 
482     /**
483      * Whether satellite entitlement status is enabled or disabled by the entitlement query result.
484      * By default, its disabled. It is intended to use integer to fit the database format.
485      */
486     private final int mIsSatelliteEntitlementStatus;
487 
488     /**
489      * The satellite entitlement plmns based on the entitlement query results
490      * By default, its empty. It is intended to use string to fit the database format.
491      */
492     @NonNull private final String mSatelliteEntitlementPlmns;
493 
494     /**
495      * Whether the carrier roaming to satellite is using ESOS for emergency messaging.
496      * By default, its disabled. It is intended to use integer to fit the database format.
497      */
498     private final int mIsSatelliteESOSSupported;
499 
500     /**
501      * Whether this subscription is provisioned for OEM-enabled or carrier roaming NB-IOT satellite
502      * service or not.
503      * By default, its disabled. It is intended to use integer to fit the database format.
504      */
505     private final int mIsSatelliteProvisionedForNonIpDatagram;
506 
507     /**
508      * The satellite entitlement barred plmns based on the entitlement query results
509      * By default, its empty. It is intended to use string to fit the database format.
510      */
511     @NonNull private final String mSatelliteEntitlementBarredPlmnsList;
512 
513     /**
514      * The satellite entitlement data plan for plmns based on the entitlement query results
515      * By default, its empty. It is intended to use string to fit the database format.
516      */
517     @NonNull private final String mSatelliteEntitlementDataPlanForPlmn;
518 
519     /**
520      * The satellite entitlement plmns services based on the entitlement query results
521      * By default, its empty. It is intended to use string to fit the database format.
522      */
523     @NonNull private final String mSatelliteEntitlementServicesForPlmn;
524 
525     /**
526      * The satellite entitlement plmns data service policy based on the entitlement query results
527      * By default, its empty. It is intended to use string to fit the database format.
528      */
529     @NonNull private final String mSatellitePlmnsDataServicePolicy;
530 
531     /**
532      * The satellite entitlement plmns voice service policy based on the entitlement query results
533      * By default, its empty. It is intended to use string to fit the database format.
534      */
535     @NonNull private final String mSatellitePlmnsVoiceServicePolicy;
536 
537     /**
538      * Constructor from builder.
539      *
540      * @param builder Builder of {@link SubscriptionInfoInternal}.
541      */
SubscriptionInfoInternal(@onNull Builder builder)542     private SubscriptionInfoInternal(@NonNull Builder builder) {
543         this.mId = builder.mId;
544         this.mIccId = builder.mIccId;
545         this.mSimSlotIndex = builder.mSimSlotIndex;
546         this.mDisplayName = builder.mDisplayName;
547         this.mCarrierName = builder.mCarrierName;
548         this.mDisplayNameSource = builder.mDisplayNameSource;
549         this.mIconTint = builder.mIconTint;
550         this.mNumber = builder.mNumber;
551         this.mDataRoaming = builder.mDataRoaming;
552         this.mMcc = builder.mMcc;
553         this.mMnc = builder.mMnc;
554         this.mEhplmns = builder.mEhplmns;
555         this.mHplmns = builder.mHplmns;
556         this.mIsEmbedded = builder.mIsEmbedded;
557         this.mCardString = builder.mCardString;
558         this.mNativeAccessRules = builder.mNativeAccessRules;
559         this.mCarrierConfigAccessRules = builder.mCarrierConfigAccessRules;
560         this.mIsRemovableEmbedded = builder.mIsRemovableEmbedded;
561         this.mIsExtremeThreatAlertEnabled = builder.mIsExtremeThreatAlertEnabled;
562         this.mIsSevereThreatAlertEnabled = builder.mIsSevereThreatAlertEnabled;
563         this.mIsAmberAlertEnabled = builder.mIsAmberAlertEnabled;
564         this.mIsEmergencyAlertEnabled = builder.mIsEmergencyAlertEnabled;
565         this.mAlertSoundDuration = builder.mAlertSoundDuration;
566         this.mReminderInterval = builder.mReminderInterval;
567         this.mIsAlertVibrationEnabled = builder.mIsAlertVibrationEnabled;
568         this.mIsAlertSpeechEnabled = builder.mIsAlertSpeechEnabled;
569         this.mIsEtwsTestAlertEnabled = builder.mIsEtwsTestAlertEnabled;
570         this.mIsAreaInfoMessageEnabled = builder.mIsAreaInfoMessageEnabled;
571         this.mIsTestAlertEnabled = builder.mIsTestAlertEnabled;
572         this.mIsOptOutDialogEnabled = builder.mIsOptOutDialogEnabled;
573         this.mIsEnhanced4GModeEnabled = builder.mIsEnhanced4GModeEnabled;
574         this.mIsVideoTelephonyEnabled = builder.mIsVideoTelephonyEnabled;
575         this.mIsWifiCallingEnabled = builder.mIsWifiCallingEnabled;
576         this.mWifiCallingMode = builder.mWifiCallingMode;
577         this.mWifiCallingModeForRoaming = builder.mWifiCallingModeForRoaming;
578         this.mIsWifiCallingEnabledForRoaming = builder.mIsWifiCallingEnabledForRoaming;
579         this.mIsOpportunistic = builder.mIsOpportunistic;
580         this.mGroupUuid = builder.mGroupUuid;
581         this.mCountryIso = builder.mCountryIso;
582         this.mCarrierId = builder.mCarrierId;
583         this.mProfileClass = builder.mProfileClass;
584         this.mType = builder.mType;
585         this.mGroupOwner = builder.mGroupOwner;
586         this.mEnabledMobileDataPolicies = builder.mEnabledMobileDataPolicies;
587         this.mImsi = builder.mImsi;
588         this.mAreUiccApplicationsEnabled = builder.mAreUiccApplicationsEnabled;
589         this.mIsRcsUceEnabled = builder.mIsRcsUceEnabled;
590         this.mIsCrossSimCallingEnabled = builder.mIsCrossSimCallingEnabled;
591         this.mRcsConfig = builder.mRcsConfig;
592         this.mAllowedNetworkTypesForReasons = builder.mAllowedNetworkTypesForReasons;
593         this.mDeviceToDeviceStatusSharingPreference =
594                 builder.mDeviceToDeviceStatusSharingPreference;
595         this.mIsVoImsOptInEnabled = builder.mIsVoImsOptInEnabled;
596         this.mDeviceToDeviceStatusSharingContacts = builder.mDeviceToDeviceStatusSharingContacts;
597         this.mIsNrAdvancedCallingEnabled = builder.mIsNrAdvancedCallingEnabled;
598         this.mNumberFromCarrier = builder.mNumberFromCarrier;
599         this.mNumberFromIms = builder.mNumberFromIms;
600         this.mPortIndex = builder.mPortIndex;
601         this.mUsageSetting = builder.mUsageSetting;
602         this.mLastUsedTPMessageReference = builder.mLastUsedTPMessageReference;
603         this.mUserId = builder.mUserId;
604         this.mIsSatelliteEnabled = builder.mIsSatelliteEnabled;
605         this.mIsSatelliteAttachEnabledForCarrier =
606                 builder.mIsSatelliteAttachEnabledForCarrier;
607         this.mIsOnlyNonTerrestrialNetwork = builder.mIsOnlyNonTerrestrialNetwork;
608 
609         // Below are the fields that do not exist in the SimInfo table.
610         this.mCardId = builder.mCardId;
611         this.mIsGroupDisabled = builder.mIsGroupDisabled;
612         this.mServiceCapabilities = builder.mServiceCapabilities;
613         this.mTransferStatus = builder.mTransferStatus;
614         this.mIsSatelliteEntitlementStatus = builder.mIsSatelliteEntitlementStatus;
615         this.mSatelliteEntitlementPlmns = builder.mSatelliteEntitlementPlmns;
616         this.mIsSatelliteESOSSupported = builder.mIsSatelliteESOSSupported;
617         this.mIsSatelliteProvisionedForNonIpDatagram =
618                 builder.mIsSatelliteProvisionedForNonIpDatagram;
619         this.mSatelliteEntitlementBarredPlmnsList = builder.mSatelliteEntitlementBarredPlmnsList;
620         this.mSatelliteEntitlementDataPlanForPlmn = builder.mSatelliteEntitlementDataPlanForPlmn;
621         this.mSatelliteEntitlementServicesForPlmn = builder.mSatelliteEntitlementServicesForPlmn;
622         this.mSatellitePlmnsDataServicePolicy = builder.mSatellitePlmnsDataServicePolicy;
623         this.mSatellitePlmnsVoiceServicePolicy = builder.mSatellitePlmnsVoiceServicePolicy;
624     }
625 
626     /**
627      * @return The subscription ID.
628      */
getSubscriptionId()629     public int getSubscriptionId() {
630         return mId;
631     }
632 
633     /**
634      * Returns the ICC ID.
635      *
636      * @return the ICC ID, or an empty string if one of these requirements is not met
637      */
638     @NonNull
getIccId()639     public String getIccId() {
640         return mIccId;
641     }
642 
643     /**
644      * @return The index of the SIM slot that currently contains the subscription and not
645      * necessarily unique and maybe {@link SubscriptionManager#INVALID_SIM_SLOT_INDEX} if unknown or
646      * the subscription is inactive.
647      */
getSimSlotIndex()648     public int getSimSlotIndex() {
649         return mSimSlotIndex;
650     }
651 
652     /**
653      * @return The name displayed to the user that identifies this subscription. This name is
654      * used in Settings page and can be renamed by the user.
655      *
656      * @see #getCarrierName()
657      */
658     @NonNull
getDisplayName()659     public String getDisplayName() {
660         return mDisplayName;
661     }
662 
663     /**
664      * @return The name displayed to the user that identifies subscription provider name. This name
665      * is the SPN displayed in status bar and many other places. Can't be renamed by the user.
666      *
667      * @see #getDisplayName()
668      */
669     @NonNull
getCarrierName()670     public String getCarrierName() {
671         return mCarrierName;
672     }
673 
674     /**
675      * @return The source of the {@link #getDisplayName()}.
676      */
677     @SimDisplayNameSource
getDisplayNameSource()678     public int getDisplayNameSource() {
679         return mDisplayNameSource;
680     }
681 
682     /**
683      * A highlight color to use in displaying information about this {@code PhoneAccount}.
684      *
685      * @return A hexadecimal color value.
686      */
687     @ColorInt
getIconTint()688     public int getIconTint() {
689         return mIconTint;
690     }
691 
692     /**
693      * @return the number of this subscription.
694      */
getNumber()695     public String getNumber() {
696         if (TextUtils.isEmpty(mNumberFromCarrier)) return mNumber;
697         return mNumberFromCarrier;
698     }
699 
700     /**
701      * Whether user enables data roaming for this subscription or not. Either
702      * {@link SubscriptionManager#DATA_ROAMING_ENABLE} or
703      * {@link SubscriptionManager#DATA_ROAMING_DISABLE}.
704      */
getDataRoaming()705     public int getDataRoaming() {
706         return mDataRoaming;
707     }
708 
709     /**
710      * @return The mobile country code.
711      */
712     @NonNull
getMcc()713     public String getMcc() {
714         return mMcc;
715     }
716 
717     /**
718      * @return The mobile network code.
719      */
720     @NonNull
getMnc()721     public String getMnc() {
722         return mMnc;
723     }
724 
725     /**
726      * @return Extended home PLMNs associated with this subscription.
727      */
728     @NonNull
getEhplmns()729     public String getEhplmns() {
730         return mEhplmns;
731     }
732 
733     /**
734      * @return Home PLMNs associated with this subscription.
735      */
736     @NonNull
getHplmns()737     public String getHplmns() {
738         return mHplmns;
739     }
740 
741     /**
742      * @return {@code true} if the subscription is from eSIM.
743      */
isEmbedded()744     public boolean isEmbedded() {
745         return mIsEmbedded != 0;
746     }
747 
748     /**
749      * @return {@code 1} if the subscription is from eSIM.
750      */
getEmbedded()751     public int getEmbedded() {
752         return mIsEmbedded;
753     }
754 
755     /**
756      * Returns the card string of the SIM card which contains the subscription.
757      *
758      * @return The card string of the SIM card which contains the subscription. The card string is
759      * the ICCID for UICCs or the EID for
760      * eUICCs.
761      */
762     @NonNull
getCardString()763     public String getCardString() {
764         return mCardString;
765     }
766 
767     /**
768      * @return The access rules for this subscription, if it is embedded and defines any. This
769      * does not include access rules for non-embedded subscriptions. This is the raw string
770      * stored in the database.
771      */
772     @NonNull
getNativeAccessRules()773     public byte[] getNativeAccessRules() {
774         return mNativeAccessRules;
775     }
776 
777     /**
778      * @return The carrier certificates for this subscription that are saved in carrier configs.
779      * This does not include access rules from the Uicc, whether embedded or non-embedded. This
780      * is the raw string stored in the database.
781      */
getCarrierConfigAccessRules()782     public byte[] getCarrierConfigAccessRules() {
783         return mCarrierConfigAccessRules;
784     }
785 
786     /**
787      * @return {@code true} if an embedded subscription is on a removable card. Such subscriptions
788      * are marked inaccessible as soon as the current card is removed. Otherwise, they will remain
789      * accessible unless explicitly deleted. Only meaningful when {@link #getEmbedded()} is 1.
790      */
isRemovableEmbedded()791     public boolean isRemovableEmbedded() {
792         return mIsRemovableEmbedded != 0;
793     }
794 
795     /**
796      * @return {@code 1} if an embedded subscription is on a removable card. Such subscriptions are
797      * marked inaccessible as soon as the current card is removed. Otherwise, they will remain
798      * accessible unless explicitly deleted. Only meaningful when {@link #getEmbedded()} is 1.
799      */
getRemovableEmbedded()800     public int getRemovableEmbedded() {
801         return mIsRemovableEmbedded;
802     }
803 
804     /**
805      * @return {@code 1} if cell broadcast extreme threat alert is enabled by the user.
806      */
getCellBroadcastExtremeThreatAlertEnabled()807     public int getCellBroadcastExtremeThreatAlertEnabled() {
808         return mIsExtremeThreatAlertEnabled;
809     }
810 
811     /**
812      * @return {@code 1} if cell broadcast amber alert is enabled by the user.
813      */
getCellBroadcastSevereThreatAlertEnabled()814     public int getCellBroadcastSevereThreatAlertEnabled() {
815         return mIsSevereThreatAlertEnabled;
816     }
817 
818     /**
819      * @return {@code 1} if cell broadcast emergency alert is enabled by the user.
820      */
getCellBroadcastAmberAlertEnabled()821     public int getCellBroadcastAmberAlertEnabled() {
822         return mIsAmberAlertEnabled;
823     }
824 
825     /**
826      * @return {@code 1} if cell broadcast emergency alert is enabled by the user.
827      */
getCellBroadcastEmergencyAlertEnabled()828     public int getCellBroadcastEmergencyAlertEnabled() {
829         return mIsEmergencyAlertEnabled;
830     }
831 
832     /**
833      * @return {@code 1} if cell broadcast alert sound duration in seconds.
834      */
getCellBroadcastAlertSoundDuration()835     public int getCellBroadcastAlertSoundDuration() {
836         return mAlertSoundDuration;
837     }
838 
839     /**
840      * @return Cell broadcast alert reminder interval in minutes.
841      */
getCellBroadcastAlertReminderInterval()842     public int getCellBroadcastAlertReminderInterval() {
843         return mReminderInterval;
844     }
845 
846     /**
847      * @return {@code 1} if cell broadcast alert vibration is enabled by the user.
848      */
getCellBroadcastAlertVibrationEnabled()849     public int getCellBroadcastAlertVibrationEnabled() {
850         return mIsAlertVibrationEnabled;
851     }
852 
853     /**
854      * @return {@code 1} if cell broadcast alert speech is enabled by the user.
855      */
getCellBroadcastAlertSpeechEnabled()856     public int getCellBroadcastAlertSpeechEnabled() {
857         return mIsAlertSpeechEnabled;
858     }
859 
860     /**
861      * @return {@code 1} if ETWS test alert is enabled by the user.
862      */
getCellBroadcastEtwsTestAlertEnabled()863     public int getCellBroadcastEtwsTestAlertEnabled() {
864         return mIsEtwsTestAlertEnabled;
865     }
866 
867     /**
868      * @return {@code 1} if area info message is enabled by the user.
869      */
getCellBroadcastAreaInfoMessageEnabled()870     public int getCellBroadcastAreaInfoMessageEnabled() {
871         return mIsAreaInfoMessageEnabled;
872     }
873 
874     /**
875      * @return {@code 1} if cell broadcast test alert is enabled by the user.
876      */
getCellBroadcastTestAlertEnabled()877     public int getCellBroadcastTestAlertEnabled() {
878         return mIsTestAlertEnabled;
879     }
880 
881     /**
882      * @return {@code 1} if cell broadcast opt-out dialog should be shown.
883      */
getCellBroadcastOptOutDialogEnabled()884     public int getCellBroadcastOptOutDialogEnabled() {
885         return mIsOptOutDialogEnabled;
886     }
887 
888     /**
889      * @return {@code true} if enhanced 4G mode is enabled by the user or not.
890      */
isEnhanced4GModeEnabled()891     public boolean isEnhanced4GModeEnabled() {
892         return mIsEnhanced4GModeEnabled == 1;
893     }
894 
895     /**
896      * @return {@code 1} if enhanced 4G mode is enabled by the user or not. {@code 0} if disabled.
897      * {@code -1} if the user did not change any setting.
898      */
getEnhanced4GModeEnabled()899     public int getEnhanced4GModeEnabled() {
900         return mIsEnhanced4GModeEnabled;
901     }
902 
903     /**
904      * @return {@code true} if video telephony is enabled by the user or not.
905      */
isVideoTelephonyEnabled()906     public boolean isVideoTelephonyEnabled() {
907         return mIsVideoTelephonyEnabled != 0;
908     }
909 
910     /**
911      * @return {@code 1} if video telephony is enabled by the user or not.
912      */
getVideoTelephonyEnabled()913     public int getVideoTelephonyEnabled() {
914         return mIsVideoTelephonyEnabled;
915     }
916 
917     /**
918      * @return {@code true} if Wi-Fi calling is enabled by the user or not when the device is not
919      * roaming.
920      */
isWifiCallingEnabled()921     public boolean isWifiCallingEnabled() {
922         return mIsWifiCallingEnabled == 1;
923     }
924 
925     /**
926      * @return {@code 1} if Wi-Fi calling is enabled by the user or not when the device is not
927      * roaming. {@code 0} if disabled. {@code -1} if the user did not change any setting.
928      */
getWifiCallingEnabled()929     public int getWifiCallingEnabled() {
930         return mIsWifiCallingEnabled;
931     }
932 
933     /**
934      * @return Wi-Fi calling mode when the device is not roaming.
935      */
936     @ImsMmTelManager.WiFiCallingMode
getWifiCallingMode()937     public int getWifiCallingMode() {
938         return mWifiCallingMode;
939     }
940 
941     /**
942      * @return Wi-Fi calling mode when the device is roaming.
943      */
944     @ImsMmTelManager.WiFiCallingMode
getWifiCallingModeForRoaming()945     public int getWifiCallingModeForRoaming() {
946         return mWifiCallingModeForRoaming;
947     }
948 
949     /**
950      * @return {@code true} if Wi-Fi calling is enabled by the user or not when the device is
951      * roaming. {@code 0} if disabled. {@code -1} if the user did not change any setting.
952      */
isWifiCallingEnabledForRoaming()953     public boolean isWifiCallingEnabledForRoaming() {
954         return mIsWifiCallingEnabledForRoaming == 1;
955     }
956 
957     /**
958      * @return {@code 1} if Wi-Fi calling is enabled by the user or not when the device is roaming.
959      */
getWifiCallingEnabledForRoaming()960     public int getWifiCallingEnabledForRoaming() {
961         return mIsWifiCallingEnabledForRoaming;
962     }
963 
964     /**
965      * An opportunistic subscription connects to a network that is
966      * limited in functionality and / or coverage.
967      *
968      * @return {@code true} if subscription is opportunistic.
969      */
isOpportunistic()970     public boolean isOpportunistic() {
971         return mIsOpportunistic != 0;
972     }
973 
974     /**
975      * An opportunistic subscription connects to a network that is
976      * limited in functionality and / or coverage.
977      *
978      * @return {@code 1} if subscription is opportunistic.
979      */
getOpportunistic()980     public int getOpportunistic() {
981         return mIsOpportunistic;
982     }
983 
984     /**
985      * Used in scenarios where different subscriptions are bundled as a group.
986      * It's typically a primary and an opportunistic subscription. (see {@link #getOpportunistic()})
987      * Such that those subscriptions will have some affiliated behaviors such as opportunistic
988      * subscription may be invisible to the user.
989      *
990      * @return Group UUID in string format.
991      */
992     @NonNull
getGroupUuid()993     public String getGroupUuid() {
994         return mGroupUuid;
995     }
996 
997     /**
998      * @return The ISO country code. Empty if not available.
999      */
getCountryIso()1000     public String getCountryIso() {
1001         return mCountryIso;
1002     }
1003 
1004     /**
1005      * @return The carrier id of this subscription carrier.
1006      *
1007      * @see TelephonyManager#getSimCarrierId()
1008      */
getCarrierId()1009     public int getCarrierId() {
1010         return mCarrierId;
1011     }
1012 
1013     /**
1014      * @return The profile class populated from the profile metadata if present. Otherwise,
1015      * the profile class defaults to {@link SubscriptionManager#PROFILE_CLASS_UNSET} if there is no
1016      * profile metadata or the subscription is not on an eUICC ({@link #getEmbedded} return
1017      * {@code 0}).
1018      */
1019     @ProfileClass
getProfileClass()1020     public int getProfileClass() {
1021         return mProfileClass;
1022     }
1023 
1024     /**
1025      * This method returns the type of a subscription. It can be
1026      * {@link SubscriptionManager#SUBSCRIPTION_TYPE_LOCAL_SIM} or
1027      * {@link SubscriptionManager#SUBSCRIPTION_TYPE_REMOTE_SIM}.
1028      *
1029      * @return The type of the subscription.
1030      */
1031     @SubscriptionType
getSubscriptionType()1032     public int getSubscriptionType() {
1033         return mType;
1034     }
1035 
1036     /**
1037      * @return The owner package of group the subscription belongs to.
1038      */
1039     @NonNull
getGroupOwner()1040     public String getGroupOwner() {
1041         return mGroupOwner;
1042     }
1043 
1044     /**
1045      * @return The enabled mobile data policies in string format.
1046      *
1047      * @see com.android.internal.telephony.data.DataSettingsManager#getMobileDataPolicyEnabled
1048      */
1049     @NonNull
getEnabledMobileDataPolicies()1050     public String getEnabledMobileDataPolicies() {
1051         return mEnabledMobileDataPolicies;
1052     }
1053 
1054     /**
1055      * @return The IMSI (International Mobile Subscriber Identity) of the subscription.
1056      */
1057     @NonNull
getImsi()1058     public String getImsi() {
1059         return mImsi;
1060     }
1061 
1062     /**
1063      * @return {@code true} if Uicc applications are set to be enabled or disabled.
1064      */
areUiccApplicationsEnabled()1065     public boolean areUiccApplicationsEnabled() {
1066         return mAreUiccApplicationsEnabled != 0;
1067     }
1068 
1069     /**
1070      * @return {@code 1} if Uicc applications are set to be enabled or disabled.
1071      */
getUiccApplicationsEnabled()1072     public int getUiccApplicationsEnabled() {
1073         return mAreUiccApplicationsEnabled;
1074     }
1075 
1076     /**
1077      * @return {@code true} if the user has enabled IMS RCS User Capability Exchange (UCE) for this
1078      * subscription.
1079      */
isRcsUceEnabled()1080     public boolean isRcsUceEnabled() {
1081         return mIsRcsUceEnabled != 0;
1082     }
1083 
1084     /**
1085      * @return {@code 1} if the user has enabled IMS RCS User Capability Exchange (UCE) for this
1086      * subscription.
1087      */
getRcsUceEnabled()1088     public int getRcsUceEnabled() {
1089         return mIsRcsUceEnabled;
1090     }
1091 
1092     /**
1093      * @return {@code true} if the user has enabled cross SIM calling for this subscription.
1094      */
isCrossSimCallingEnabled()1095     public boolean isCrossSimCallingEnabled() {
1096         return mIsCrossSimCallingEnabled != 0;
1097     }
1098 
1099     /**
1100      * @return {@code 1} if the user has enabled cross SIM calling for this subscription.
1101      */
getCrossSimCallingEnabled()1102     public int getCrossSimCallingEnabled() {
1103         return mIsCrossSimCallingEnabled;
1104     }
1105 
1106     /**
1107      * @return The RCS configuration.
1108      */
1109     @NonNull
getRcsConfig()1110     public byte[] getRcsConfig() {
1111         return mRcsConfig;
1112     }
1113 
1114     /**
1115      * The allowed network types for reasons in string format. The format is
1116      * "[reason]=[network types bitmask], [reason]=[network types bitmask], ..."
1117      *
1118      * For example, "user=1239287394, thermal=298791239, carrier=3456812312".
1119      */
1120     @NonNull
getAllowedNetworkTypesForReasons()1121     public String getAllowedNetworkTypesForReasons() {
1122         return mAllowedNetworkTypesForReasons;
1123     }
1124 
1125     /**
1126      * @return Device to device sharing status.
1127      */
1128     @DeviceToDeviceStatusSharingPreference
getDeviceToDeviceStatusSharingPreference()1129     public int getDeviceToDeviceStatusSharingPreference() {
1130         return mDeviceToDeviceStatusSharingPreference;
1131     }
1132 
1133     /**
1134      * @return {@code true} if the user has opted-in voice over IMS.
1135      */
isVoImsOptInEnabled()1136     public boolean isVoImsOptInEnabled() {
1137         return mIsVoImsOptInEnabled != 0;
1138     }
1139 
1140     /**
1141      * @return {@code 1} if the user has opted-in voice over IMS.
1142      */
getVoImsOptInEnabled()1143     public int getVoImsOptInEnabled() {
1144         return mIsVoImsOptInEnabled;
1145     }
1146 
1147     /**
1148      * @return Contacts information that allow device to device sharing.
1149      */
1150     @NonNull
getDeviceToDeviceStatusSharingContacts()1151     public String getDeviceToDeviceStatusSharingContacts() {
1152         return mDeviceToDeviceStatusSharingContacts;
1153     }
1154 
1155     /**
1156      * @return {@code true} if the user has enabled NR advanced calling.
1157      */
isNrAdvancedCallingEnabled()1158     public boolean isNrAdvancedCallingEnabled() {
1159         return mIsNrAdvancedCallingEnabled == 1;
1160     }
1161 
1162     /**
1163      * @return {@code 1} if the user has enabled NR advanced calling. {code 0} if disabled.
1164      * {code -1} if the user did not change any setting.
1165      */
getNrAdvancedCallingEnabled()1166     public int getNrAdvancedCallingEnabled() {
1167         return mIsNrAdvancedCallingEnabled;
1168     }
1169 
1170     /**
1171      * @return Get the phone number retrieved from carrier.
1172      */
1173     @NonNull
getNumberFromCarrier()1174     public String getNumberFromCarrier() {
1175         return mNumberFromCarrier;
1176     }
1177 
1178     /**
1179      * @return Get the phone number retrieved from IMS.
1180      */
1181     @NonNull
getNumberFromIms()1182     public String getNumberFromIms() {
1183         return mNumberFromIms;
1184     }
1185 
1186     /**
1187      * @return The port index of the SIM card which contains the subscription.
1188      */
getPortIndex()1189     public int getPortIndex() {
1190         return mPortIndex;
1191     }
1192 
1193     /**
1194      * Get the usage setting for this subscription.
1195      *
1196      * @return The usage setting used for this subscription.
1197      */
1198     @UsageSetting
getUsageSetting()1199     public int getUsageSetting() {
1200         return mUsageSetting;
1201     }
1202 
1203     /**
1204      * @return Last used TP message reference.
1205      */
getLastUsedTPMessageReference()1206     public int getLastUsedTPMessageReference() {
1207         return mLastUsedTPMessageReference;
1208     }
1209 
1210     /**
1211      * @return The user id associated with this subscription.
1212      */
1213     @UserIdInt
getUserId()1214     public int getUserId() {
1215         return mUserId;
1216     }
1217 
1218     /**
1219      * @return {@code 1} if satellite is enabled.
1220      */
getSatelliteEnabled()1221     public int getSatelliteEnabled() {
1222         return mIsSatelliteEnabled;
1223     }
1224 
1225     /**
1226      * @return {@code 1} if satellite attach for carrier is enabled by user.
1227      */
getSatelliteAttachEnabledForCarrier()1228     public int getSatelliteAttachEnabledForCarrier() {
1229         return mIsSatelliteAttachEnabledForCarrier;
1230     }
1231 
1232     /**
1233      * An NTN subscription connects to non-terrestrial networks.
1234      *
1235      * @return {@code 1} if the subscription is for non-terrestrial networks. {@code 0} otherwise.
1236      */
getOnlyNonTerrestrialNetwork()1237     public int getOnlyNonTerrestrialNetwork() {
1238         return mIsOnlyNonTerrestrialNetwork;
1239     }
1240 
1241     // Below are the fields that do not exist in SimInfo table.
1242     /**
1243      * @return The card ID of the SIM card which contains the subscription.
1244      *
1245      * @see android.telephony.UiccCardInfo#getCardId().
1246      */
getCardId()1247     public int getCardId() {
1248         return mCardId;
1249     }
1250 
1251     /**
1252      * @return {@code true} if the group of the subscription is disabled. This is only useful if
1253      * it's a grouped opportunistic subscription. In this case, if all primary (non-opportunistic)
1254      * subscriptions in the group are deactivated (unplugged pSIM or deactivated eSIM profile), we
1255      * should disable this opportunistic subscription.
1256      */
isGroupDisabled()1257     public boolean isGroupDisabled() {
1258         return mIsGroupDisabled;
1259     }
1260 
1261     /**
1262      * @return {@code true} if the subscription is from the actively used SIM.
1263      */
isActive()1264     public boolean isActive() {
1265         return mSimSlotIndex >= 0 || mType == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM;
1266     }
1267 
1268     /**
1269      * @return {@code true} if the subscription is visible to the user.
1270      */
isVisible()1271     public boolean isVisible() {
1272         // Provisioning profile
1273         if (getProfileClass() == SubscriptionManager.PROFILE_CLASS_PROVISIONING) {
1274             return false;
1275         }
1276 
1277         // Satellite profile
1278         if (getOnlyNonTerrestrialNetwork() == 1) {
1279             return false;
1280         }
1281 
1282         // Opportunistic profile
1283         if (isOpportunistic() && !TextUtils.isEmpty(mGroupUuid)) {
1284             return false;
1285         }
1286 
1287         return true;
1288     }
1289 
1290     /**
1291      * Return the service capabilities bitmasks the subscription supports.
1292      */
getServiceCapabilities()1293     public int getServiceCapabilities() {
1294         return mServiceCapabilities;
1295     }
1296     /**
1297      * @return Transfer status.
1298      */
getTransferStatus()1299     public int getTransferStatus() {
1300         return mTransferStatus;
1301     }
1302 
1303     /**
1304      * @return {@code 1} if satellite entitlement status is enabled by entitlement query result.
1305      */
getSatelliteEntitlementStatus()1306     public int getSatelliteEntitlementStatus() {
1307         return mIsSatelliteEntitlementStatus;
1308     }
1309 
1310     /**
1311      * @return Satellite entitlement plmns is empty or not by entitlement query result.
1312      *
1313      * For example, "123123, 12310" or ""
1314      */
1315     @NonNull
getSatelliteEntitlementPlmns()1316     public String getSatelliteEntitlementPlmns() {
1317         return mSatelliteEntitlementPlmns;
1318     }
1319 
1320     /**
1321      * @return {@code 1} if the carrier roaming to satellite is using ESOS for emergency messaging.
1322      */
getSatelliteESOSSupported()1323     public int getSatelliteESOSSupported() {
1324         return mIsSatelliteESOSSupported;
1325     }
1326 
1327     /**
1328      * Return whether the subscription is provisioned for oem satellite service or not.
1329      *
1330      * @return {@code 1} if the subscription is provisioned for oem stellite service. {@code 0}
1331      * otherwise.
1332      */
getIsSatelliteProvisionedForNonIpDatagram()1333     public int getIsSatelliteProvisionedForNonIpDatagram() {
1334         return mIsSatelliteProvisionedForNonIpDatagram;
1335     }
1336 
1337     /**
1338      * @return Satellite entitlement barred plmns is empty or not by entitlement query result.
1339      *
1340      */
1341     @NonNull
getSatelliteEntitlementBarredPlmnsList()1342     public String getSatelliteEntitlementBarredPlmnsList() {
1343         return mSatelliteEntitlementBarredPlmnsList;
1344     }
1345 
1346     /**
1347      * @return Satellite entitlement data plan for plmns is empty or not by entitlement query
1348      * result.
1349      *
1350      */
1351     @NonNull
getSatelliteEntitlementDataPlanForPlmns()1352     public String getSatelliteEntitlementDataPlanForPlmns() {
1353         return mSatelliteEntitlementDataPlanForPlmn;
1354     }
1355 
1356     /**
1357      * @return Satellite entitlement data plan for plmns is empty or not by entitlement query
1358      * result.
1359      *
1360      */
1361     @NonNull
getSatelliteEntitlementPlmnsServiceTypes()1362     public String getSatelliteEntitlementPlmnsServiceTypes() {
1363         return mSatelliteEntitlementServicesForPlmn;
1364     }
1365 
1366     /**
1367      * @return Satellite entitlement plmns data service policy is empty or not by entitlement query
1368      * result.
1369      *
1370      */
1371     @NonNull
getSatellitePlmnsDataServicePolicy()1372     public String getSatellitePlmnsDataServicePolicy() {
1373         return mSatellitePlmnsDataServicePolicy;
1374     }
1375 
1376     /**
1377      * @return Satellite entitlement plmns voice service policy is empty or not by entitlement query
1378      * result.
1379      *
1380      */
1381     @NonNull
getSatellitePlmnsVoiceServicePolicy()1382     public String getSatellitePlmnsVoiceServicePolicy() {
1383         return mSatellitePlmnsVoiceServicePolicy;
1384     }
1385 
1386     /** @return converted {@link SubscriptionInfo}. */
1387     @NonNull
toSubscriptionInfo()1388     public SubscriptionInfo toSubscriptionInfo() {
1389         return new SubscriptionInfo.Builder()
1390                 .setId(mId)
1391                 .setIccId(mIccId)
1392                 .setSimSlotIndex(mSimSlotIndex)
1393                 .setDisplayName(mDisplayName)
1394                 .setCarrierName(mCarrierName)
1395                 .setDisplayNameSource(mDisplayNameSource)
1396                 .setIconTint(mIconTint)
1397                 .setNumber(getNumber())
1398                 .setDataRoaming(mDataRoaming)
1399                 .setMcc(mMcc)
1400                 .setMnc(mMnc)
1401                 .setEhplmns(TextUtils.isEmpty(mEhplmns) ? null : mEhplmns.split(","))
1402                 .setHplmns(TextUtils.isEmpty(mHplmns) ? null : mHplmns.split(","))
1403                 .setCountryIso(mCountryIso)
1404                 .setEmbedded(mIsEmbedded != 0)
1405                 .setNativeAccessRules(mNativeAccessRules.length == 0
1406                         ? null : UiccAccessRule.decodeRules(mNativeAccessRules))
1407                 .setCardString(mCardString)
1408                 .setCardId(mCardId)
1409                 .setOpportunistic(mIsOpportunistic != 0)
1410                 .setGroupUuid(mGroupUuid)
1411                 .setGroupDisabled(mIsGroupDisabled)
1412                 .setCarrierId(mCarrierId)
1413                 .setProfileClass(mProfileClass)
1414                 .setType(mType)
1415                 .setGroupOwner(mGroupOwner)
1416                 .setCarrierConfigAccessRules(mCarrierConfigAccessRules.length == 0
1417                         ? null : UiccAccessRule.decodeRules(mCarrierConfigAccessRules))
1418                 .setUiccApplicationsEnabled(mAreUiccApplicationsEnabled != 0)
1419                 .setPortIndex(mPortIndex)
1420                 .setUsageSetting(mUsageSetting)
1421                 .setOnlyNonTerrestrialNetwork(mIsOnlyNonTerrestrialNetwork == 1)
1422                 .setServiceCapabilities(
1423                         SubscriptionManager.getServiceCapabilitiesSet(mServiceCapabilities))
1424                 .setTransferStatus(mTransferStatus)
1425                 .setSatelliteESOSSupported(mIsSatelliteESOSSupported == 1)
1426                 .build();
1427     }
1428 
1429     @Override
toString()1430     public String toString() {
1431         return "[SubscriptionInfoInternal: id=" + mId
1432                 + " iccId=" + SubscriptionInfo.getPrintableId(mIccId)
1433                 + " simSlotIndex=" + mSimSlotIndex
1434                 + " portIndex=" + mPortIndex
1435                 + " isEmbedded=" + mIsEmbedded
1436                 + " isRemovableEmbedded=" + mIsRemovableEmbedded
1437                 + " carrierId=" + mCarrierId
1438                 + " displayName=" + mDisplayName
1439                 + " carrierName=" + mCarrierName
1440                 + " isOpportunistic=" + mIsOpportunistic
1441                 + " groupUuid=" + mGroupUuid
1442                 + " groupOwner=" + mGroupOwner
1443                 + " displayNameSource="
1444                 + SubscriptionManager.displayNameSourceToString(mDisplayNameSource)
1445                 + " iconTint=" + mIconTint
1446                 + " number=" + Rlog.pii(TelephonyUtils.IS_DEBUGGABLE, getNumber())
1447                 + " dataRoaming=" + mDataRoaming
1448                 + " mcc=" + mMcc
1449                 + " mnc=" + mMnc
1450                 + " ehplmns=" + mEhplmns
1451                 + " hplmns=" + mHplmns
1452                 + " cardString=" + SubscriptionInfo.getPrintableId(mCardString)
1453                 + " cardId=" + mCardId
1454                 + " nativeAccessRules=" + IccUtils.bytesToHexString(mNativeAccessRules)
1455                 + " carrierConfigAccessRules=" + IccUtils.bytesToHexString(
1456                         mCarrierConfigAccessRules)
1457                 + " countryIso=" + mCountryIso
1458                 + " profileClass=" + mProfileClass
1459                 + " type=" + SubscriptionManager.subscriptionTypeToString(mType)
1460                 + " areUiccApplicationsEnabled=" + mAreUiccApplicationsEnabled
1461                 + " usageSetting=" + SubscriptionManager.usageSettingToString(mUsageSetting)
1462                 + " isEnhanced4GModeEnabled=" + mIsEnhanced4GModeEnabled
1463                 + " isVideoTelephonyEnabled=" + mIsVideoTelephonyEnabled
1464                 + " isWifiCallingEnabled=" + mIsWifiCallingEnabled
1465                 + " isWifiCallingEnabledForRoaming=" + mIsWifiCallingEnabledForRoaming
1466                 + " wifiCallingMode=" + ImsMmTelManager.wifiCallingModeToString(mWifiCallingMode)
1467                 + " wifiCallingModeForRoaming="
1468                 + ImsMmTelManager.wifiCallingModeToString(mWifiCallingModeForRoaming)
1469                 + " enabledMobileDataPolicies=" + mEnabledMobileDataPolicies
1470                 + " imsi=" + SubscriptionInfo.getPrintableId(mImsi)
1471                 + " rcsUceEnabled=" + mIsRcsUceEnabled
1472                 + " crossSimCallingEnabled=" + mIsCrossSimCallingEnabled
1473                 + " rcsConfig=" + IccUtils.bytesToHexString(mRcsConfig)
1474                 + " allowedNetworkTypesForReasons=" + mAllowedNetworkTypesForReasons
1475                 + " deviceToDeviceStatusSharingPreference=" + mDeviceToDeviceStatusSharingPreference
1476                 + " isVoImsOptInEnabled=" + mIsVoImsOptInEnabled
1477                 + " deviceToDeviceStatusSharingContacts=" + mDeviceToDeviceStatusSharingContacts
1478                 + " numberFromCarrier=" + Rlog.pii(TelephonyUtils.IS_DEBUGGABLE, mNumberFromCarrier)
1479                 + " numberFromIms=" + Rlog.pii(TelephonyUtils.IS_DEBUGGABLE, mNumberFromIms)
1480                 + " userId=" + mUserId
1481                 + " isSatelliteEnabled=" + mIsSatelliteEnabled
1482                 + " satellite_attach_enabled_for_carrier=" + mIsSatelliteAttachEnabledForCarrier
1483                 + " getOnlyNonTerrestrialNetwork=" + mIsOnlyNonTerrestrialNetwork
1484                 + " isGroupDisabled=" + mIsGroupDisabled
1485                 + " serviceCapabilities=" + mServiceCapabilities
1486                 + " transferStatus=" + mTransferStatus
1487                 + " satelliteEntitlementStatus=" + mIsSatelliteEntitlementStatus
1488                 + " satelliteEntitlementPlmns=" + mSatelliteEntitlementPlmns
1489                 + " isSatelliteESOSSupported=" + mIsSatelliteESOSSupported
1490                 + " isSatelliteProvisionedForNonIpDatagram="
1491                 + mIsSatelliteProvisionedForNonIpDatagram
1492                 + " mSatelliteEntitlementBarredPlmnsList=" + mSatelliteEntitlementBarredPlmnsList
1493                 + " mSatelliteEntitlementDataPlanForPlmn=" + mSatelliteEntitlementDataPlanForPlmn
1494                 + " mSatelliteEntitlementServicesForPlmn=" + mSatelliteEntitlementServicesForPlmn
1495                 + " mSatellitePlmnsDataServicePolicy=" + mSatellitePlmnsDataServicePolicy
1496                 + " mSatellitePlmnsVoiceServicePolicy=" + mSatellitePlmnsVoiceServicePolicy
1497                 + "]";
1498     }
1499 
1500     /**
1501      * Campare only the columns existing in the SimInfo table and the mapped variables to see if
1502      * they are equal.
1503      *
1504      * @param that SubscriptionInfoInternal to be compared
1505      * @return {@code true} if equals.
1506      */
equalsDbItemsOnly(@onNull SubscriptionInfoInternal that)1507     public boolean equalsDbItemsOnly(@NonNull SubscriptionInfoInternal that) {
1508         return mId == that.mId && mSimSlotIndex == that.mSimSlotIndex
1509                 && mDisplayNameSource == that.mDisplayNameSource && mIconTint == that.mIconTint
1510                 && mDataRoaming == that.mDataRoaming && mIsEmbedded == that.mIsEmbedded
1511                 && mIsRemovableEmbedded == that.mIsRemovableEmbedded
1512                 && mIsExtremeThreatAlertEnabled == that.mIsExtremeThreatAlertEnabled
1513                 && mIsSevereThreatAlertEnabled == that.mIsSevereThreatAlertEnabled
1514                 && mIsAmberAlertEnabled == that.mIsAmberAlertEnabled
1515                 && mIsEmergencyAlertEnabled == that.mIsEmergencyAlertEnabled
1516                 && mAlertSoundDuration == that.mAlertSoundDuration
1517                 && mReminderInterval == that.mReminderInterval
1518                 && mIsAlertVibrationEnabled == that.mIsAlertVibrationEnabled
1519                 && mIsAlertSpeechEnabled == that.mIsAlertSpeechEnabled
1520                 && mIsEtwsTestAlertEnabled == that.mIsEtwsTestAlertEnabled
1521                 && mIsAreaInfoMessageEnabled == that.mIsAreaInfoMessageEnabled
1522                 && mIsEnhanced4GModeEnabled == that.mIsEnhanced4GModeEnabled
1523                 && mIsVideoTelephonyEnabled == that.mIsVideoTelephonyEnabled
1524                 && mIsWifiCallingEnabled == that.mIsWifiCallingEnabled
1525                 && mWifiCallingMode == that.mWifiCallingMode
1526                 && mWifiCallingModeForRoaming == that.mWifiCallingModeForRoaming
1527                 && mIsWifiCallingEnabledForRoaming == that.mIsWifiCallingEnabledForRoaming
1528                 && mIsOpportunistic == that.mIsOpportunistic && mCarrierId == that.mCarrierId
1529                 && mProfileClass == that.mProfileClass && mType == that.mType
1530                 && mAreUiccApplicationsEnabled == that.mAreUiccApplicationsEnabled
1531                 && mIsRcsUceEnabled == that.mIsRcsUceEnabled
1532                 && mIsCrossSimCallingEnabled == that.mIsCrossSimCallingEnabled
1533                 && mDeviceToDeviceStatusSharingPreference
1534                 == that.mDeviceToDeviceStatusSharingPreference
1535                 && mIsVoImsOptInEnabled == that.mIsVoImsOptInEnabled
1536                 && mIsNrAdvancedCallingEnabled == that.mIsNrAdvancedCallingEnabled
1537                 && mPortIndex == that.mPortIndex && mUsageSetting == that.mUsageSetting
1538                 && mLastUsedTPMessageReference == that.mLastUsedTPMessageReference
1539                 && mUserId == that.mUserId && mIsSatelliteEnabled == that.mIsSatelliteEnabled
1540                 && mIccId.equals(that.mIccId) && mDisplayName.equals(that.mDisplayName)
1541                 && mCarrierName.equals(that.mCarrierName) && mNumber.equals(that.mNumber)
1542                 && mMcc.equals(that.mMcc) && mMnc.equals(that.mMnc) && mEhplmns.equals(
1543                 that.mEhplmns)
1544                 && mHplmns.equals(that.mHplmns) && mCardString.equals(that.mCardString)
1545                 && Arrays.equals(mNativeAccessRules, that.mNativeAccessRules)
1546                 && Arrays.equals(mCarrierConfigAccessRules, that.mCarrierConfigAccessRules)
1547                 && mGroupUuid.equals(that.mGroupUuid) && mCountryIso.equals(that.mCountryIso)
1548                 && mGroupOwner.equals(that.mGroupOwner) && mEnabledMobileDataPolicies.equals(
1549                 that.mEnabledMobileDataPolicies) && mImsi.equals(that.mImsi) && Arrays.equals(
1550                 mRcsConfig, that.mRcsConfig) && mAllowedNetworkTypesForReasons.equals(
1551                 that.mAllowedNetworkTypesForReasons) && mDeviceToDeviceStatusSharingContacts.equals(
1552                 that.mDeviceToDeviceStatusSharingContacts) && mNumberFromCarrier.equals(
1553                 that.mNumberFromCarrier) && mNumberFromIms.equals(that.mNumberFromIms)
1554                 && mIsSatelliteAttachEnabledForCarrier == that.mIsSatelliteAttachEnabledForCarrier
1555                 && mIsOnlyNonTerrestrialNetwork == that.mIsOnlyNonTerrestrialNetwork
1556                 && mServiceCapabilities == that.mServiceCapabilities
1557                 && mTransferStatus == that.mTransferStatus
1558                 && mIsSatelliteEntitlementStatus == that.mIsSatelliteEntitlementStatus
1559                 && mSatelliteEntitlementPlmns.equals(that.mSatelliteEntitlementPlmns)
1560                 && mIsSatelliteESOSSupported == that.mIsSatelliteESOSSupported
1561                 && mIsSatelliteProvisionedForNonIpDatagram
1562                 == that.mIsSatelliteProvisionedForNonIpDatagram
1563                 && mSatelliteEntitlementBarredPlmnsList.equals(
1564                 that.mSatelliteEntitlementBarredPlmnsList)
1565                 && mSatelliteEntitlementDataPlanForPlmn.equals(
1566                 that.mSatelliteEntitlementDataPlanForPlmn)
1567                 && mSatelliteEntitlementServicesForPlmn.equals(
1568                 that.mSatelliteEntitlementServicesForPlmn)
1569                 && mSatellitePlmnsDataServicePolicy.equals(that.mSatellitePlmnsDataServicePolicy)
1570                 && mSatellitePlmnsVoiceServicePolicy.equals(that.mSatellitePlmnsVoiceServicePolicy);
1571     }
1572 
1573     @Override
equals(Object o)1574     public boolean equals(Object o) {
1575         if (this == o) return true;
1576         if (o == null || getClass() != o.getClass()) return false;
1577         SubscriptionInfoInternal that = (SubscriptionInfoInternal) o;
1578         return equalsDbItemsOnly(that)
1579                 && mCardId == that.mCardId && mIsGroupDisabled == that.mIsGroupDisabled;
1580     }
1581 
1582     @Override
hashCode()1583     public int hashCode() {
1584         int result = Objects.hash(mId, mIccId, mSimSlotIndex, mDisplayName, mCarrierName,
1585                 mDisplayNameSource, mIconTint, mNumber, mDataRoaming, mMcc, mMnc, mEhplmns, mHplmns,
1586                 mIsEmbedded, mCardString, mIsRemovableEmbedded, mIsExtremeThreatAlertEnabled,
1587                 mIsSevereThreatAlertEnabled, mIsAmberAlertEnabled, mIsEmergencyAlertEnabled,
1588                 mAlertSoundDuration, mReminderInterval, mIsAlertVibrationEnabled,
1589                 mIsAlertSpeechEnabled,
1590                 mIsEtwsTestAlertEnabled, mIsAreaInfoMessageEnabled, mIsEnhanced4GModeEnabled,
1591                 mIsVideoTelephonyEnabled, mIsWifiCallingEnabled, mWifiCallingMode,
1592                 mWifiCallingModeForRoaming, mIsWifiCallingEnabledForRoaming, mIsOpportunistic,
1593                 mGroupUuid, mCountryIso, mCarrierId, mProfileClass, mType, mGroupOwner,
1594                 mEnabledMobileDataPolicies, mImsi, mAreUiccApplicationsEnabled, mIsRcsUceEnabled,
1595                 mIsCrossSimCallingEnabled, mAllowedNetworkTypesForReasons,
1596                 mDeviceToDeviceStatusSharingPreference, mIsVoImsOptInEnabled,
1597                 mDeviceToDeviceStatusSharingContacts, mIsNrAdvancedCallingEnabled,
1598                 mNumberFromCarrier,
1599                 mNumberFromIms, mPortIndex, mUsageSetting, mLastUsedTPMessageReference, mUserId,
1600                 mIsSatelliteEnabled, mCardId, mIsGroupDisabled,
1601                 mIsSatelliteAttachEnabledForCarrier, mIsOnlyNonTerrestrialNetwork,
1602                 mServiceCapabilities, mTransferStatus, mIsSatelliteEntitlementStatus,
1603                 mSatelliteEntitlementPlmns, mIsSatelliteESOSSupported,
1604                 mIsSatelliteProvisionedForNonIpDatagram, mSatelliteEntitlementBarredPlmnsList,
1605                 mSatelliteEntitlementDataPlanForPlmn, mSatelliteEntitlementServicesForPlmn,
1606                 mSatellitePlmnsDataServicePolicy, mSatellitePlmnsVoiceServicePolicy);
1607         result = 31 * result + Arrays.hashCode(mNativeAccessRules);
1608         result = 31 * result + Arrays.hashCode(mCarrierConfigAccessRules);
1609         result = 31 * result + Arrays.hashCode(mRcsConfig);
1610         return result;
1611     }
1612 
1613     /**
1614      * The builder class of {@link SubscriptionInfoInternal}.
1615      */
1616     public static class Builder {
1617         /**
1618          * The subscription id.
1619          */
1620         private int mId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
1621 
1622         /**
1623          * The ICCID of the SIM that is associated with this subscription, empty if unknown.
1624          */
1625         @NonNull
1626         private String mIccId = "";
1627 
1628         /**
1629          * The index of the SIM slot that currently contains the subscription and not necessarily
1630          * unique and maybe {@link SubscriptionManager#INVALID_SIM_SLOT_INDEX} if unknown or the
1631          * subscription is inactive.
1632          */
1633         private int mSimSlotIndex = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
1634 
1635         /**
1636          * The name displayed to the user that identifies this subscription. This name is used
1637          * in Settings page and can be renamed by the user.
1638          */
1639         @NonNull
1640         private String mDisplayName = "";
1641 
1642         /**
1643          * The name displayed to the user that identifies subscription provider name. This name
1644          * is the SPN displayed in status bar and many other places. Can't be renamed by the user.
1645          */
1646         @NonNull
1647         private String mCarrierName = "";
1648 
1649         /**
1650          * The source of the display name.
1651          */
1652         @SimDisplayNameSource
1653         private int mDisplayNameSource = SubscriptionManager.NAME_SOURCE_UNKNOWN;
1654 
1655         /**
1656          * The color to be used for tinting the icon when displaying to the user.
1657          */
1658         private int mIconTint = 0;
1659 
1660         /**
1661          * The number presented to the user identify this subscription.
1662          */
1663         @NonNull
1664         private String mNumber = "";
1665 
1666         /**
1667          * Whether user enables data roaming for this subscription or not. Either
1668          * {@link SubscriptionManager#DATA_ROAMING_ENABLE} or
1669          * {@link SubscriptionManager#DATA_ROAMING_DISABLE}.
1670          */
1671         private int mDataRoaming = SubscriptionManager.DATA_ROAMING_DISABLE;
1672 
1673         /**
1674          * The mobile country code.
1675          */
1676         @NonNull
1677         private String mMcc = "";
1678 
1679         /**
1680          * The mobile network code.
1681          */
1682         @NonNull
1683         private String mMnc = "";
1684 
1685         /**
1686          * EHPLMNs associated with the subscription.
1687          */
1688         @NonNull
1689         private String mEhplmns = "";
1690 
1691         /**
1692          * HPLMNs associated with the subscription.
1693          */
1694         @NonNull
1695         private String mHplmns = "";
1696 
1697         /**
1698          * Whether the subscription is from eSIM.
1699          */
1700         private int mIsEmbedded = 0;
1701 
1702         /**
1703          * The card string of the SIM card.
1704          */
1705         @NonNull
1706         private String mCardString = "";
1707 
1708         /**
1709          * The native access rules for this subscription, if it is embedded and defines any. This
1710          * does not include access rules for non-embedded subscriptions.
1711          */
1712         @NonNull
1713         private byte[] mNativeAccessRules = new byte[0];
1714 
1715         /**
1716          * The carrier certificates for this subscription that are saved in carrier configs.
1717          * This does not include access rules from the Uicc, whether embedded or non-embedded.
1718          */
1719         @NonNull
1720         private byte[] mCarrierConfigAccessRules = new byte[0];
1721 
1722         /**
1723          * Whether an embedded subscription is on a removable card. Such subscriptions are marked
1724          * inaccessible as soon as the current card is removed. Otherwise, they will remain
1725          * accessible unless explicitly deleted. Only meaningful when {@link #getEmbedded()} is
1726          * {@code 1}.
1727          */
1728         private int mIsRemovableEmbedded = 0;
1729 
1730         /**
1731          * Whether cell broadcast extreme threat alert is enabled by the user or not.
1732          */
1733         private int mIsExtremeThreatAlertEnabled = 1;
1734 
1735         /**
1736          * Whether cell broadcast severe threat alert is enabled by the user or not.
1737          */
1738         private int mIsSevereThreatAlertEnabled = 1;
1739 
1740         /**
1741          * Whether cell broadcast amber alert is enabled by the user or not.
1742          */
1743         private int mIsAmberAlertEnabled = 1;
1744 
1745         /**
1746          * Whether cell broadcast emergency alert is enabled by the user or not.
1747          */
1748         private int mIsEmergencyAlertEnabled = 1;
1749 
1750         /**
1751          * Cell broadcast alert sound duration in seconds.
1752          */
1753         private int mAlertSoundDuration = 4;
1754 
1755         /**
1756          * Cell broadcast alert reminder interval in minutes.
1757          */
1758         private int mReminderInterval = 0;
1759 
1760         /**
1761          * Whether cell broadcast alert vibration is enabled by the user or not.
1762          */
1763         private int mIsAlertVibrationEnabled = 1;
1764 
1765         /**
1766          * Whether cell broadcast alert speech is enabled by the user or not.
1767          */
1768         private int mIsAlertSpeechEnabled = 1;
1769 
1770         /**
1771          * Whether ETWS test alert is enabled by the user or not.
1772          */
1773         private int mIsEtwsTestAlertEnabled = 0;
1774 
1775         /**
1776          * Whether area info message is enabled by the user or not.
1777          */
1778         private int mIsAreaInfoMessageEnabled = 1;
1779 
1780         /**
1781          * Whether cell broadcast test alert is enabled by the user or not.
1782          */
1783         private int mIsTestAlertEnabled = 0;
1784 
1785         /**
1786          * Whether cell broadcast opt-out dialog should be shown or not.
1787          */
1788         private int mIsOptOutDialogEnabled = 1;
1789 
1790         /**
1791          * Whether enhanced 4G mode is enabled by the user or not.
1792          */
1793         private int mIsEnhanced4GModeEnabled = -1;
1794 
1795         /**
1796          * Whether video telephony is enabled by the user or not.
1797          */
1798         private int mIsVideoTelephonyEnabled = -1;
1799 
1800         /**
1801          * Whether Wi-Fi calling is enabled by the user or not when the device is not roaming.
1802          */
1803         private int mIsWifiCallingEnabled = -1;
1804 
1805         /**
1806          * Wi-Fi calling mode when the device is not roaming.
1807          */
1808         @ImsMmTelManager.WiFiCallingMode
1809         private int mWifiCallingMode = ImsMmTelManager.WIFI_MODE_UNKNOWN;
1810 
1811         /**
1812          * Wi-Fi calling mode when the device is roaming.
1813          */
1814         @ImsMmTelManager.WiFiCallingMode
1815         private int mWifiCallingModeForRoaming = ImsMmTelManager.WIFI_MODE_UNKNOWN;
1816 
1817         /**
1818          * Whether Wi-Fi calling is enabled by the user or not when the device is roaming.
1819          */
1820         private int mIsWifiCallingEnabledForRoaming = -1;
1821 
1822         /**
1823          * Whether the subscription is opportunistic or not.
1824          */
1825         private int mIsOpportunistic = 0;
1826 
1827         /**
1828          * The group UUID of the subscription group in string format.
1829          */
1830         @NonNull
1831         private String mGroupUuid = "";
1832 
1833         /**
1834          * The ISO Country code for the subscription's provider.
1835          */
1836         @NonNull
1837         private String mCountryIso = "";
1838 
1839         /**
1840          * The carrier id.
1841          *
1842          * @see TelephonyManager#getSimCarrierId()
1843          */
1844         private int mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
1845 
1846         /**
1847          * The profile class populated from the profile metadata if present. Otherwise, the profile
1848          * class defaults to {@link SubscriptionManager#PROFILE_CLASS_UNSET} if there is no profile
1849          * metadata or the subscription is not on an eUICC ({@link #getEmbedded} returns
1850          * {@code 0}).
1851          */
1852         @ProfileClass
1853         private int mProfileClass = SubscriptionManager.PROFILE_CLASS_UNSET;
1854 
1855         /**
1856          * The subscription type.
1857          */
1858         @SubscriptionType
1859         private int mType = SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM;
1860 
1861         /**
1862          * The owner package of group the subscription belongs to.
1863          */
1864         @NonNull
1865         private String mGroupOwner = "";
1866 
1867         /**
1868          * The enabled mobile data policies in string format.
1869          */
1870         @NonNull
1871         private String mEnabledMobileDataPolicies = "";
1872 
1873         /**
1874          * The IMSI (International Mobile Subscriber Identity) of the subscription.
1875          */
1876         @NonNull
1877         private String mImsi = "";
1878 
1879         /**
1880          * Whether Uicc applications are configured to enable or not.
1881          */
1882         private int mAreUiccApplicationsEnabled = 1;
1883 
1884         /**
1885          * Whether the user has enabled IMS RCS User Capability Exchange (UCE) for this
1886          * subscription.
1887          */
1888         private int mIsRcsUceEnabled = 0;
1889 
1890         /**
1891          * Whether the user has enabled cross SIM calling for this subscription.
1892          */
1893         private int mIsCrossSimCallingEnabled = 0;
1894 
1895         /**
1896          * The RCS configuration.
1897          */
1898         private byte[] mRcsConfig = new byte[0];
1899 
1900         /**
1901          * The allowed network types for reasons in string format. The format is
1902          * "[reason]=[network types bitmask], [reason]=[network types bitmask], ..."
1903          *
1904          * For example, "user=1239287394, thermal=298791239, carrier=3456812312".
1905          */
1906         private String mAllowedNetworkTypesForReasons = "";
1907 
1908         /**
1909          * Device to device sharing status.
1910          */
1911         @DeviceToDeviceStatusSharingPreference
1912         private int mDeviceToDeviceStatusSharingPreference =
1913                 SubscriptionManager.D2D_SHARING_DISABLED;
1914 
1915         /**
1916          * Whether the user has opted-in voice over IMS.
1917          */
1918         private int mIsVoImsOptInEnabled = 0;
1919 
1920         /**
1921          * Contacts information that allow device to device sharing.
1922          */
1923         @NonNull
1924         private String mDeviceToDeviceStatusSharingContacts = "";
1925 
1926         /**
1927          * Whether the user has enabled NR advanced calling.
1928          */
1929         private int mIsNrAdvancedCallingEnabled = -1;
1930 
1931         /**
1932          * The phone number retrieved from carrier.
1933          */
1934         @NonNull
1935         private String mNumberFromCarrier = "";
1936 
1937         /**
1938          * The phone number retrieved from IMS.
1939          */
1940         @NonNull
1941         private String mNumberFromIms = "";
1942 
1943         /**
1944          * the port index of the Uicc card.
1945          */
1946         private int mPortIndex = TelephonyManager.INVALID_PORT_INDEX;
1947 
1948         /**
1949          * Subscription's preferred usage setting.
1950          */
1951         @UsageSetting
1952         private int mUsageSetting = SubscriptionManager.USAGE_SETTING_UNKNOWN;
1953 
1954         /**
1955          * Last used TP message reference.
1956          */
1957         private int mLastUsedTPMessageReference = -1;
1958 
1959         /**
1960          * The user id associated with this subscription.
1961          */
1962         private int mUserId = UserHandle.USER_NULL;
1963 
1964         /**
1965          * Whether satellite is enabled or not.
1966          */
1967         private int mIsSatelliteEnabled = 0;
1968 
1969         /**
1970          * Whether satellite attach for carrier is enabled by user.
1971          */
1972         private int mIsSatelliteAttachEnabledForCarrier = 1;
1973 
1974         /**
1975          * Whether this subscription is used for communicating with non-terrestrial network or not.
1976          */
1977         private int mIsOnlyNonTerrestrialNetwork = 0;
1978 
1979         // The following fields do not exist in the SimInfo table.
1980         /**
1981          * The card ID of the SIM card which contains the subscription.
1982          */
1983         private int mCardId = TelephonyManager.UNINITIALIZED_CARD_ID;
1984 
1985         /**
1986          * Whether group of the subscription is disabled. This is only useful if it's a grouped
1987          * opportunistic subscription. In this case, if all primary (non-opportunistic)
1988          * subscriptions in the group are deactivated (unplugged pSIM or deactivated eSIM profile),
1989          * we should disable this opportunistic subscription.
1990          */
1991         private boolean mIsGroupDisabled;
1992 
1993         /**
1994          * Service capabilities the subscription supports
1995          */
1996         private int mServiceCapabilities;
1997 
1998         /**
1999          * The transfer status of the subscription
2000          */
2001         private int mTransferStatus;
2002 
2003         /**
2004          * Whether satellite entitlement status is enabled by entitlement query result.
2005          */
2006         private int mIsSatelliteEntitlementStatus = 0;
2007 
2008         /**
2009          * Whether satellite entitlement plmns is empty or not by entitlement query result.
2010          */
2011         @NonNull
2012         private String mSatelliteEntitlementPlmns = "";
2013 
2014         /**
2015          * Whether the carrier roaming to satellite is using ESOS for emergency messaging.
2016          */
2017         private int mIsSatelliteESOSSupported = 0;
2018 
2019         /**
2020          * Whether this subscription is provisioned for oem satellite service or not.
2021          */
2022         private int mIsSatelliteProvisionedForNonIpDatagram = 0;
2023 
2024         /**
2025          * Whether satellite entitlement barred plmns is empty or not by entitlement query result.
2026          */
2027         @NonNull
2028         private String mSatelliteEntitlementBarredPlmnsList = "";
2029 
2030         /**
2031          * Whether satellite entitlement data plan for plmns is empty or not by entitlement query
2032          * result.
2033          */
2034         @NonNull
2035         private String mSatelliteEntitlementDataPlanForPlmn = "";
2036 
2037         /**
2038          * Whether satellite entitlement servicves for plmns is empty or not by entitlement query
2039          * result.
2040          */
2041         @NonNull
2042         private String mSatelliteEntitlementServicesForPlmn = "";
2043 
2044         /**
2045          * Whether satellite entitlement plmns data service policy isempty or not by entitlement
2046          * query result.
2047          */
2048         @NonNull
2049         private String mSatellitePlmnsDataServicePolicy = "";
2050 
2051         /**
2052          * Whether satellite entitlement plmns voice service policy isempty or not by entitlement
2053          * query result.
2054          */
2055         @NonNull
2056         private String mSatellitePlmnsVoiceServicePolicy = "";
2057 
2058 
2059         /**
2060          * Default constructor.
2061          */
Builder()2062         public Builder() {
2063         }
2064 
2065         /**
2066          * Constructor from {@link SubscriptionInfoInternal}.
2067          *
2068          * @param info The subscription info.
2069          */
Builder(@onNull SubscriptionInfoInternal info)2070         public Builder(@NonNull SubscriptionInfoInternal info) {
2071             mId = info.mId;
2072             mIccId = info.mIccId;
2073             mSimSlotIndex = info.mSimSlotIndex;
2074             mDisplayName = info.mDisplayName;
2075             mCarrierName = info.mCarrierName;
2076             mDisplayNameSource = info.mDisplayNameSource;
2077             mIconTint = info.mIconTint;
2078             mNumber = info.mNumber;
2079             mDataRoaming = info.mDataRoaming;
2080             mMcc = info.mMcc;
2081             mMnc = info.mMnc;
2082             mEhplmns = info.mEhplmns;
2083             mHplmns = info.mHplmns;
2084             mIsEmbedded = info.mIsEmbedded;
2085             mCardString = info.mCardString;
2086             mNativeAccessRules = info.mNativeAccessRules;
2087             mCarrierConfigAccessRules = info.mCarrierConfigAccessRules;
2088             mIsRemovableEmbedded = info.mIsRemovableEmbedded;
2089             mIsExtremeThreatAlertEnabled = info.mIsExtremeThreatAlertEnabled;
2090             mIsSevereThreatAlertEnabled = info.mIsSevereThreatAlertEnabled;
2091             mIsAmberAlertEnabled = info.mIsAmberAlertEnabled;
2092             mIsEmergencyAlertEnabled = info.mIsEmergencyAlertEnabled;
2093             mAlertSoundDuration = info.mAlertSoundDuration;
2094             mReminderInterval = info.mReminderInterval;
2095             mIsAlertVibrationEnabled = info.mIsAlertVibrationEnabled;
2096             mIsAlertSpeechEnabled = info.mIsAlertSpeechEnabled;
2097             mIsEtwsTestAlertEnabled = info.mIsEtwsTestAlertEnabled;
2098             mIsAreaInfoMessageEnabled = info.mIsAreaInfoMessageEnabled;
2099             mIsTestAlertEnabled = info.mIsTestAlertEnabled;
2100             mIsOptOutDialogEnabled = info.mIsOptOutDialogEnabled;
2101             mIsEnhanced4GModeEnabled = info.mIsEnhanced4GModeEnabled;
2102             mIsVideoTelephonyEnabled = info.mIsVideoTelephonyEnabled;
2103             mIsWifiCallingEnabled = info.mIsWifiCallingEnabled;
2104             mWifiCallingMode = info.mWifiCallingMode;
2105             mWifiCallingModeForRoaming = info.mWifiCallingModeForRoaming;
2106             mIsWifiCallingEnabledForRoaming = info.mIsWifiCallingEnabledForRoaming;
2107             mIsOpportunistic = info.mIsOpportunistic;
2108             mGroupUuid = info.mGroupUuid;
2109             mCountryIso = info.mCountryIso;
2110             mCarrierId = info.mCarrierId;
2111             mProfileClass = info.mProfileClass;
2112             mType = info.mType;
2113             mGroupOwner = info.mGroupOwner;
2114             mEnabledMobileDataPolicies = info.mEnabledMobileDataPolicies;
2115             mImsi = info.mImsi;
2116             mAreUiccApplicationsEnabled = info.mAreUiccApplicationsEnabled;
2117             mIsRcsUceEnabled = info.mIsRcsUceEnabled;
2118             mIsCrossSimCallingEnabled = info.mIsCrossSimCallingEnabled;
2119             mRcsConfig = info.mRcsConfig;
2120             mAllowedNetworkTypesForReasons = info.mAllowedNetworkTypesForReasons;
2121             mDeviceToDeviceStatusSharingPreference = info.mDeviceToDeviceStatusSharingPreference;
2122             mIsVoImsOptInEnabled = info.mIsVoImsOptInEnabled;
2123             mDeviceToDeviceStatusSharingContacts = info.mDeviceToDeviceStatusSharingContacts;
2124             mIsNrAdvancedCallingEnabled = info.mIsNrAdvancedCallingEnabled;
2125             mNumberFromCarrier = info.mNumberFromCarrier;
2126             mNumberFromIms = info.mNumberFromIms;
2127             mPortIndex = info.mPortIndex;
2128             mUsageSetting = info.mUsageSetting;
2129             mLastUsedTPMessageReference = info.getLastUsedTPMessageReference();
2130             mUserId = info.mUserId;
2131             mIsSatelliteEnabled = info.mIsSatelliteEnabled;
2132             mIsSatelliteAttachEnabledForCarrier = info.mIsSatelliteAttachEnabledForCarrier;
2133             mIsOnlyNonTerrestrialNetwork = info.mIsOnlyNonTerrestrialNetwork;
2134             // Below are the fields that do not exist in the SimInfo table.
2135             mCardId = info.mCardId;
2136             mIsGroupDisabled = info.mIsGroupDisabled;
2137             mServiceCapabilities = info.mServiceCapabilities;
2138             mTransferStatus = info.mTransferStatus;
2139             mIsSatelliteEntitlementStatus = info.mIsSatelliteEntitlementStatus;
2140             mSatelliteEntitlementPlmns = info.mSatelliteEntitlementPlmns;
2141             mIsSatelliteESOSSupported = info.mIsSatelliteESOSSupported;
2142             mIsSatelliteProvisionedForNonIpDatagram = info.mIsSatelliteProvisionedForNonIpDatagram;
2143             mSatelliteEntitlementBarredPlmnsList = info.mSatelliteEntitlementBarredPlmnsList;
2144             mSatelliteEntitlementDataPlanForPlmn = info.mSatelliteEntitlementDataPlanForPlmn;
2145             mSatelliteEntitlementServicesForPlmn = info.mSatelliteEntitlementServicesForPlmn;
2146             mSatellitePlmnsDataServicePolicy = info.mSatellitePlmnsDataServicePolicy;
2147             mSatellitePlmnsVoiceServicePolicy = info.mSatellitePlmnsVoiceServicePolicy;
2148         }
2149 
2150         /**
2151          * Set the subscription id.
2152          *
2153          * @param id The subscription id.
2154          *
2155          * @return The builder.
2156          */
2157         @NonNull
setId(int id)2158         public Builder setId(int id) {
2159             mId = id;
2160             return this;
2161         }
2162 
2163         /**
2164          * Set the ICCID of the SIM that is associated with this subscription.
2165          *
2166          * @param iccId The ICCID of the SIM that is associated with this subscription.
2167          *
2168          * @return The builder.
2169          */
2170         @NonNull
setIccId(@onNull String iccId)2171         public Builder setIccId(@NonNull String iccId) {
2172             Objects.requireNonNull(iccId);
2173             mIccId = iccId;
2174             return this;
2175         }
2176 
2177         /**
2178          * Set the SIM index of the slot that currently contains the subscription. Set to
2179          * {@link SubscriptionManager#INVALID_SIM_SLOT_INDEX} if the subscription is inactive.
2180          *
2181          * @param simSlotIndex The SIM slot index.
2182          *
2183          * @return The builder.
2184          */
2185         @NonNull
setSimSlotIndex(int simSlotIndex)2186         public Builder setSimSlotIndex(int simSlotIndex) {
2187             mSimSlotIndex = simSlotIndex;
2188             return this;
2189         }
2190 
2191         /**
2192          * The name displayed to the user that identifies this subscription. This name is used
2193          * in Settings page and can be renamed by the user.
2194          *
2195          * @param displayName The display name.
2196          *
2197          * @return The builder.
2198          */
2199         @NonNull
setDisplayName(@onNull String displayName)2200         public Builder setDisplayName(@NonNull String displayName) {
2201             Objects.requireNonNull(displayName);
2202             mDisplayName = displayName;
2203             return this;
2204         }
2205 
2206         /**
2207          * The name displayed to the user that identifies subscription provider name. This name
2208          * is the SPN displayed in status bar and many other places. Can't be renamed by the user.
2209          *
2210          * @param carrierName The carrier name.
2211          *
2212          * @return The builder.
2213          */
2214         @NonNull
setCarrierName(@onNull String carrierName)2215         public Builder setCarrierName(@NonNull String carrierName) {
2216             Objects.requireNonNull(carrierName);
2217             mCarrierName = carrierName;
2218             return this;
2219         }
2220 
2221         /**
2222          * Set the source of the display name.
2223          *
2224          * @param displayNameSource The source of the display name.
2225          * @return The builder.
2226          *
2227          * @see SubscriptionInfoInternal#getDisplayName()
2228          */
2229         @NonNull
setDisplayNameSource(@imDisplayNameSource int displayNameSource)2230         public Builder setDisplayNameSource(@SimDisplayNameSource int displayNameSource) {
2231             mDisplayNameSource = displayNameSource;
2232             return this;
2233         }
2234 
2235         /**
2236          * Set the color to be used for tinting the icon when displaying to the user.
2237          *
2238          * @param iconTint The color to be used for tinting the icon when displaying to the user.
2239          *
2240          * @return The builder.
2241          */
2242         @NonNull
setIconTint(int iconTint)2243         public Builder setIconTint(int iconTint) {
2244             mIconTint = iconTint;
2245             return this;
2246         }
2247 
2248         /**
2249          * Set the number presented to the user identify this subscription.
2250          *
2251          * @param number the number presented to the user identify this subscription.
2252          *
2253          * @return The builder.
2254          */
2255         @NonNull
setNumber(@onNull String number)2256         public Builder setNumber(@NonNull String number) {
2257             Objects.requireNonNull(number);
2258             mNumber = number;
2259             return this;
2260         }
2261 
2262         /**
2263          * Set whether user enables data roaming for this subscription or not.
2264          *
2265          * @param dataRoaming Data roaming mode. Either
2266          * {@link SubscriptionManager#DATA_ROAMING_ENABLE} or
2267          * {@link SubscriptionManager#DATA_ROAMING_DISABLE}
2268          *
2269          * @return The builder.
2270          */
2271         @NonNull
setDataRoaming(int dataRoaming)2272         public Builder setDataRoaming(int dataRoaming) {
2273             mDataRoaming = dataRoaming;
2274             return this;
2275         }
2276 
2277         /**
2278          * Set the mobile country code.
2279          *
2280          * @param mcc The mobile country code.
2281          *
2282          * @return The builder.
2283          */
2284         @NonNull
setMcc(@onNull String mcc)2285         public Builder setMcc(@NonNull String mcc) {
2286             Objects.requireNonNull(mcc);
2287             mMcc = mcc;
2288             return this;
2289         }
2290 
2291         /**
2292          * Set the mobile network code.
2293          *
2294          * @param mnc Mobile network code.
2295          *
2296          * @return The builder.
2297          */
2298         @NonNull
setMnc(@onNull String mnc)2299         public Builder setMnc(@NonNull String mnc) {
2300             Objects.requireNonNull(mnc);
2301             mMnc = mnc;
2302             return this;
2303         }
2304 
2305         /**
2306          * Set EHPLMNs associated with the subscription.
2307          *
2308          * @param ehplmns EHPLMNs associated with the subscription.
2309          *
2310          * @return The builder.
2311          */
2312         @NonNull
setEhplmns(@onNull String ehplmns)2313         public Builder setEhplmns(@NonNull String ehplmns) {
2314             Objects.requireNonNull(ehplmns);
2315             mEhplmns = ehplmns;
2316             return this;
2317         }
2318 
2319         /**
2320          * Set HPLMNs associated with the subscription.
2321          *
2322          * @param hplmns HPLMNs associated with the subscription.
2323          *
2324          * @return The builder.
2325          */
2326         @NonNull
setHplmns(@onNull String hplmns)2327         public Builder setHplmns(@NonNull String hplmns) {
2328             Objects.requireNonNull(hplmns);
2329             mHplmns = hplmns;
2330             return this;
2331         }
2332 
2333         /**
2334          * Set whether the subscription is from eSIM or not.
2335          *
2336          * @param isEmbedded {@code 1} if the subscription is from eSIM.
2337          *
2338          * @return The builder.
2339          */
2340         @NonNull
setEmbedded(int isEmbedded)2341         public Builder setEmbedded(int isEmbedded) {
2342             mIsEmbedded = isEmbedded;
2343             return this;
2344         }
2345 
2346         /**
2347          * Set the card string of the SIM card.
2348          *
2349          * @param cardString The card string of the SIM card.
2350          *
2351          * @return The builder.
2352          *
2353          * @see #getCardString()
2354          */
2355         @NonNull
setCardString(@onNull String cardString)2356         public Builder setCardString(@NonNull String cardString) {
2357             Objects.requireNonNull(cardString);
2358             mCardString = cardString;
2359             return this;
2360         }
2361 
2362         /**
2363          * Set the native access rules for this subscription, if it is embedded and defines any.
2364          * This does not include access rules for non-embedded subscriptions.
2365          *
2366          * @param nativeAccessRules The native access rules for this subscription.
2367          *
2368          * @return The builder.
2369          */
2370         @NonNull
setNativeAccessRules(@onNull byte[] nativeAccessRules)2371         public Builder setNativeAccessRules(@NonNull byte[] nativeAccessRules) {
2372             Objects.requireNonNull(nativeAccessRules);
2373             mNativeAccessRules = nativeAccessRules;
2374             return this;
2375         }
2376 
2377         /**
2378          * Set the native access rules for this subscription, if it is embedded and defines any.
2379          * This does not include access rules for non-embedded subscriptions.
2380          *
2381          * @param nativeAccessRules The native access rules for this subscription.
2382          *
2383          * @return The builder.
2384          */
2385         @NonNull
setNativeAccessRules(@onNull List<UiccAccessRule> nativeAccessRules)2386         public Builder setNativeAccessRules(@NonNull List<UiccAccessRule> nativeAccessRules) {
2387             Objects.requireNonNull(nativeAccessRules);
2388             if (!nativeAccessRules.isEmpty()) {
2389                 mNativeAccessRules = UiccAccessRule.encodeRules(
2390                         nativeAccessRules.toArray(new UiccAccessRule[0]));
2391             }
2392             return this;
2393         }
2394 
2395         /**
2396          * Set the carrier certificates for this subscription that are saved in carrier configs.
2397          * This does not include access rules from the Uicc, whether embedded or non-embedded.
2398          *
2399          * @param carrierConfigAccessRules The carrier certificates for this subscription.
2400          *
2401          * @return The builder.
2402          */
2403         @NonNull
setCarrierConfigAccessRules(@onNull byte[] carrierConfigAccessRules)2404         public Builder setCarrierConfigAccessRules(@NonNull byte[] carrierConfigAccessRules) {
2405             Objects.requireNonNull(carrierConfigAccessRules);
2406             mCarrierConfigAccessRules = carrierConfigAccessRules;
2407             return this;
2408         }
2409 
2410         /**
2411          * Set whether an embedded subscription is on a removable card. Such subscriptions are
2412          * marked inaccessible as soon as the current card is removed. Otherwise, they will remain
2413          * accessible unless explicitly deleted. Only meaningful when {@link #getEmbedded()} is
2414          * {@code 1}.
2415          *
2416          * @param isRemovableEmbedded {@code true} if the subscription is from the removable
2417          * embedded SIM.
2418          *
2419          * @return The builder.
2420          */
2421         @NonNull
setRemovableEmbedded(boolean isRemovableEmbedded)2422         public Builder setRemovableEmbedded(boolean isRemovableEmbedded) {
2423             mIsRemovableEmbedded = isRemovableEmbedded ? 1 : 0;
2424             return this;
2425         }
2426 
2427         /**
2428          * Set whether an embedded subscription is on a removable card. Such subscriptions are
2429          * marked inaccessible as soon as the current card is removed. Otherwise, they will remain
2430          * accessible unless explicitly deleted. Only meaningful when {@link #getEmbedded()} is
2431          * {@code 1}.
2432          *
2433          * @param isRemovableEmbedded {@code 1} if the subscription is from the removable
2434          * embedded SIM.
2435          *
2436          * @return The builder.
2437          */
2438         @NonNull
setRemovableEmbedded(int isRemovableEmbedded)2439         public Builder setRemovableEmbedded(int isRemovableEmbedded) {
2440             mIsRemovableEmbedded = isRemovableEmbedded;
2441             return this;
2442         }
2443 
2444         /**
2445          * Set whether cell broadcast extreme threat alert is enabled by the user or not.
2446          *
2447          * @param isExtremeThreatAlertEnabled whether cell broadcast extreme threat alert is enabled
2448          * by the user or not.
2449          *
2450          * @return The builder.
2451          */
2452         @NonNull
setCellBroadcastExtremeThreatAlertEnabled(int isExtremeThreatAlertEnabled)2453         public Builder setCellBroadcastExtremeThreatAlertEnabled(int isExtremeThreatAlertEnabled) {
2454             mIsExtremeThreatAlertEnabled = isExtremeThreatAlertEnabled;
2455             return this;
2456         }
2457 
2458         /**
2459          * Set whether cell broadcast severe threat alert is enabled by the user or not.
2460          *
2461          * @param isSevereThreatAlertEnabled whether cell broadcast severe threat alert is enabled
2462          * by the user or not.
2463          *
2464          * @return The builder.
2465          */
2466         @NonNull
setCellBroadcastSevereThreatAlertEnabled(int isSevereThreatAlertEnabled)2467         public Builder setCellBroadcastSevereThreatAlertEnabled(int isSevereThreatAlertEnabled) {
2468             mIsSevereThreatAlertEnabled = isSevereThreatAlertEnabled;
2469             return this;
2470         }
2471 
2472         /**
2473          * Set whether cell broadcast amber alert is enabled by the user or not.
2474          *
2475          * @param isAmberAlertEnabled whether cell broadcast amber alert is enabled by the user or
2476          * not.
2477          *
2478          * @return The builder.
2479          */
2480         @NonNull
setCellBroadcastAmberAlertEnabled(int isAmberAlertEnabled)2481         public Builder setCellBroadcastAmberAlertEnabled(int isAmberAlertEnabled) {
2482             mIsAmberAlertEnabled = isAmberAlertEnabled;
2483             return this;
2484         }
2485 
2486         /**
2487          * Set whether cell broadcast emergency alert is enabled by the user or not.
2488          *
2489          * @param isEmergencyAlertEnabled whether cell broadcast emergency alert is enabled by the
2490          * user or not.
2491          *
2492          * @return The builder.
2493          */
2494         @NonNull
setCellBroadcastEmergencyAlertEnabled(int isEmergencyAlertEnabled)2495         public Builder setCellBroadcastEmergencyAlertEnabled(int isEmergencyAlertEnabled) {
2496             mIsEmergencyAlertEnabled = isEmergencyAlertEnabled;
2497             return this;
2498         }
2499 
2500         /**
2501          * Set cell broadcast alert sound duration.
2502          *
2503          * @param alertSoundDuration Alert sound duration in seconds.
2504          *
2505          * @return The builder.
2506          */
2507         @NonNull
setCellBroadcastAlertSoundDuration(int alertSoundDuration)2508         public Builder setCellBroadcastAlertSoundDuration(int alertSoundDuration) {
2509             mAlertSoundDuration = alertSoundDuration;
2510             return this;
2511         }
2512 
2513         /**
2514          * Set cell broadcast alert reminder interval in minutes.
2515          *
2516          * @param reminderInterval Alert reminder interval in minutes.
2517          *
2518          * @return The builder.
2519          */
setCellBroadcastAlertReminderInterval(int reminderInterval)2520         public Builder setCellBroadcastAlertReminderInterval(int reminderInterval) {
2521             mReminderInterval = reminderInterval;
2522             return this;
2523         }
2524 
2525         /**
2526          * Set whether cell broadcast alert vibration is enabled by the user or not.
2527          *
2528          * @param isAlertVibrationEnabled whether cell broadcast alert vibration is enabled by the
2529          * user or not.
2530          *
2531          * @return The builder.
2532          */
2533         @NonNull
setCellBroadcastAlertVibrationEnabled(int isAlertVibrationEnabled)2534         public Builder setCellBroadcastAlertVibrationEnabled(int isAlertVibrationEnabled) {
2535             mIsAlertVibrationEnabled = isAlertVibrationEnabled;
2536             return this;
2537         }
2538 
2539         /**
2540          * Set whether cell broadcast alert speech is enabled by the user or not.
2541          *
2542          * @param isAlertSpeechEnabled whether cell broadcast alert speech is enabled by the user or
2543          * not.
2544          *
2545          * @return The builder.
2546          */
2547         @NonNull
setCellBroadcastAlertSpeechEnabled(int isAlertSpeechEnabled)2548         public Builder setCellBroadcastAlertSpeechEnabled(int isAlertSpeechEnabled) {
2549             mIsAlertSpeechEnabled = isAlertSpeechEnabled;
2550             return this;
2551         }
2552 
2553         /**
2554          * Set whether ETWS test alert is enabled by the user or not.
2555          *
2556          * @param isEtwsTestAlertEnabled whether cell broadcast ETWS test alert is enabled by the
2557          * user or not.
2558          *
2559          * @return The builder.
2560          */
2561         @NonNull
setCellBroadcastEtwsTestAlertEnabled(int isEtwsTestAlertEnabled)2562         public Builder setCellBroadcastEtwsTestAlertEnabled(int isEtwsTestAlertEnabled) {
2563             mIsEtwsTestAlertEnabled = isEtwsTestAlertEnabled;
2564             return this;
2565         }
2566 
2567         /**
2568          * Set whether area info message is enabled by the user or not.
2569          *
2570          * @param isAreaInfoMessageEnabled whether cell broadcast area info message is enabled by
2571          * the user or not.
2572          *
2573          * @return The builder.
2574          */
2575         @NonNull
setCellBroadcastAreaInfoMessageEnabled(int isAreaInfoMessageEnabled)2576         public Builder setCellBroadcastAreaInfoMessageEnabled(int isAreaInfoMessageEnabled) {
2577             mIsAreaInfoMessageEnabled = isAreaInfoMessageEnabled;
2578             return this;
2579         }
2580 
2581         /**
2582          * Set whether cell broadcast test alert is enabled by the user or not.
2583          *
2584          * @param isTestAlertEnabled whether cell broadcast test alert is enabled by the user or
2585          * not.
2586          *
2587          * @return The builder.
2588          */
2589         @NonNull
setCellBroadcastTestAlertEnabled(int isTestAlertEnabled)2590         public Builder setCellBroadcastTestAlertEnabled(int isTestAlertEnabled) {
2591             mIsTestAlertEnabled = isTestAlertEnabled;
2592             return this;
2593         }
2594 
2595         /**
2596          * Set whether cell broadcast opt-out dialog should be shown or not.
2597          *
2598          * @param isOptOutDialogEnabled whether cell broadcast opt-out dialog should be shown or
2599          * not.
2600          *
2601          * @return The builder.
2602          */
2603         @NonNull
setCellBroadcastOptOutDialogEnabled(int isOptOutDialogEnabled)2604         public Builder setCellBroadcastOptOutDialogEnabled(int isOptOutDialogEnabled) {
2605             mIsOptOutDialogEnabled = isOptOutDialogEnabled;
2606             return this;
2607         }
2608 
2609         /**
2610          * Set whether enhanced 4G mode is enabled by the user or not.
2611          *
2612          * @param isEnhanced4GModeEnabled whether enhanced 4G mode is enabled by the user or not.
2613          *
2614          * @return The builder.
2615          */
2616         @NonNull
setEnhanced4GModeEnabled(int isEnhanced4GModeEnabled)2617         public Builder setEnhanced4GModeEnabled(int isEnhanced4GModeEnabled) {
2618             mIsEnhanced4GModeEnabled = isEnhanced4GModeEnabled;
2619             return this;
2620         }
2621 
2622         /**
2623          * Set whether video telephony is enabled by the user or not.
2624          *
2625          * @param isVideoTelephonyEnabled whether video telephony is enabled by the user or not.
2626          *
2627          * @return The builder.
2628          */
2629         @NonNull
setVideoTelephonyEnabled(int isVideoTelephonyEnabled)2630         public Builder setVideoTelephonyEnabled(int isVideoTelephonyEnabled) {
2631             mIsVideoTelephonyEnabled = isVideoTelephonyEnabled;
2632             return this;
2633         }
2634 
2635         /**
2636          * Set whether Wi-Fi calling is enabled by the user or not when the device is not roaming.
2637          *
2638          * @param isWifiCallingEnabled whether Wi-Fi calling is enabled by the user or not when
2639          * the device is not roaming.
2640          *
2641          * @return The builder.
2642          */
2643         @NonNull
setWifiCallingEnabled(int isWifiCallingEnabled)2644         public Builder setWifiCallingEnabled(int isWifiCallingEnabled) {
2645             mIsWifiCallingEnabled = isWifiCallingEnabled;
2646             return this;
2647         }
2648 
2649         /**
2650          * Set Wi-Fi calling mode when the device is not roaming.
2651          *
2652          * @param wifiCallingMode Wi-Fi calling mode when the device is not roaming.
2653          *
2654          * @return The builder.
2655          */
2656         @NonNull
setWifiCallingMode(@msMmTelManager.WiFiCallingMode int wifiCallingMode)2657         public Builder setWifiCallingMode(@ImsMmTelManager.WiFiCallingMode int wifiCallingMode) {
2658             mWifiCallingMode = wifiCallingMode;
2659             return this;
2660         }
2661 
2662         /**
2663          * Set Wi-Fi calling mode when the device is roaming.
2664          *
2665          * @param wifiCallingModeForRoaming Wi-Fi calling mode when the device is roaming.
2666          *
2667          * @return The builder.
2668          */
2669         @NonNull
setWifiCallingModeForRoaming( @msMmTelManager.WiFiCallingMode int wifiCallingModeForRoaming)2670         public Builder setWifiCallingModeForRoaming(
2671                 @ImsMmTelManager.WiFiCallingMode int wifiCallingModeForRoaming) {
2672             mWifiCallingModeForRoaming = wifiCallingModeForRoaming;
2673             return this;
2674         }
2675 
2676         /**
2677          * Set whether Wi-Fi calling is enabled by the user or not when the device is roaming.
2678          *
2679          * @param wifiCallingEnabledForRoaming whether Wi-Fi calling is enabled by the user or not
2680          * when the device is roaming.
2681          *
2682          * @return The builder.
2683          */
2684         @NonNull
setWifiCallingEnabledForRoaming(int wifiCallingEnabledForRoaming)2685         public Builder setWifiCallingEnabledForRoaming(int wifiCallingEnabledForRoaming) {
2686             mIsWifiCallingEnabledForRoaming = wifiCallingEnabledForRoaming;
2687             return this;
2688         }
2689 
2690         /**
2691          * Set whether the subscription is opportunistic or not.
2692          *
2693          * @param isOpportunistic {@code 1} if the subscription is opportunistic.
2694          * @return The builder.
2695          */
2696         @NonNull
setOpportunistic(int isOpportunistic)2697         public Builder setOpportunistic(int isOpportunistic) {
2698             mIsOpportunistic = isOpportunistic;
2699             return this;
2700         }
2701 
2702         /**
2703          * Set the group UUID of the subscription group.
2704          *
2705          * @param groupUuid The group UUID.
2706          * @return The builder.
2707          *
2708          */
2709         @NonNull
setGroupUuid(@onNull String groupUuid)2710         public Builder setGroupUuid(@NonNull String groupUuid) {
2711             Objects.requireNonNull(groupUuid);
2712             mGroupUuid = groupUuid;
2713             return this;
2714         }
2715 
2716         /**
2717          * Set the ISO country code for the subscription's provider.
2718          *
2719          * @param countryIso The ISO country code for the subscription's provider.
2720          * @return The builder.
2721          */
2722         @NonNull
setCountryIso(@onNull String countryIso)2723         public Builder setCountryIso(@NonNull String countryIso) {
2724             Objects.requireNonNull(countryIso);
2725             mCountryIso = countryIso;
2726             return this;
2727         }
2728 
2729         /**
2730          * Set the subscription carrier id.
2731          *
2732          * @param carrierId The carrier id.
2733          * @return The builder
2734          *
2735          * @see TelephonyManager#getSimCarrierId()
2736          */
2737         @NonNull
setCarrierId(int carrierId)2738         public Builder setCarrierId(int carrierId) {
2739             mCarrierId = carrierId;
2740             return this;
2741         }
2742 
2743         /**
2744          * Set the profile class populated from the profile metadata if present.
2745          *
2746          * @param profileClass the profile class populated from the profile metadata if present.
2747          * @return The builder
2748          *
2749          * @see #getProfileClass()
2750          */
2751         @NonNull
setProfileClass(@rofileClass int profileClass)2752         public Builder setProfileClass(@ProfileClass int profileClass) {
2753             mProfileClass = profileClass;
2754             return this;
2755         }
2756 
2757         /**
2758          * Set the subscription type.
2759          *
2760          * @param type Subscription type.
2761          * @return The builder.
2762          */
2763         @NonNull
setType(@ubscriptionType int type)2764         public Builder setType(@SubscriptionType int type) {
2765             mType = type;
2766             return this;
2767         }
2768 
2769         /**
2770          * Set the owner package of group the subscription belongs to.
2771          *
2772          * @param groupOwner Owner package of group the subscription belongs to.
2773          * @return The builder.
2774          */
2775         @NonNull
setGroupOwner(@onNull String groupOwner)2776         public Builder setGroupOwner(@NonNull String groupOwner) {
2777             Objects.requireNonNull(groupOwner);
2778             mGroupOwner = groupOwner;
2779             return this;
2780         }
2781 
2782         /**
2783          * Set the enabled mobile data policies.
2784          *
2785          * @param enabledMobileDataPolicies The enabled mobile data policies.
2786          * @return The builder.
2787          */
2788         @NonNull
setEnabledMobileDataPolicies(@onNull String enabledMobileDataPolicies)2789         public Builder setEnabledMobileDataPolicies(@NonNull String enabledMobileDataPolicies) {
2790             Objects.requireNonNull(enabledMobileDataPolicies);
2791             mEnabledMobileDataPolicies = enabledMobileDataPolicies;
2792             return this;
2793         }
2794 
2795         /**
2796          * Set the IMSI (International Mobile Subscriber Identity) of the subscription.
2797          *
2798          * @param imsi The IMSI.
2799          * @return The builder.
2800          */
2801         @NonNull
setImsi(@onNull String imsi)2802         public Builder setImsi(@NonNull String imsi) {
2803             Objects.requireNonNull(imsi);
2804             mImsi = imsi;
2805             return this;
2806         }
2807 
2808         /**
2809          * Set whether Uicc applications are configured to enable or not.
2810          *
2811          * @param areUiccApplicationsEnabled {@code 1} if Uicc applications are configured to
2812          * enable.
2813          * @return The builder.
2814          */
2815         @NonNull
setUiccApplicationsEnabled(int areUiccApplicationsEnabled)2816         public Builder setUiccApplicationsEnabled(int areUiccApplicationsEnabled) {
2817             mAreUiccApplicationsEnabled = areUiccApplicationsEnabled;
2818             return this;
2819         }
2820 
2821         /**
2822          * Set whether the user has enabled IMS RCS User Capability Exchange (UCE) for this
2823          * subscription.
2824          *
2825          * @param isRcsUceEnabled If the user enabled RCS UCE for this subscription.
2826          * @return The builder.
2827          */
2828         @NonNull
setRcsUceEnabled(int isRcsUceEnabled)2829         public Builder setRcsUceEnabled(int isRcsUceEnabled) {
2830             mIsRcsUceEnabled = isRcsUceEnabled;
2831             return this;
2832         }
2833 
2834         /**
2835          * Set whether the user has enabled cross SIM calling for this subscription.
2836          *
2837          * @param isCrossSimCallingEnabled If the user enabled cross SIM calling for this
2838          * subscription.
2839          * @return The builder.
2840          */
2841         @NonNull
setCrossSimCallingEnabled(int isCrossSimCallingEnabled)2842         public Builder setCrossSimCallingEnabled(int isCrossSimCallingEnabled) {
2843             mIsCrossSimCallingEnabled = isCrossSimCallingEnabled;
2844             return this;
2845         }
2846 
2847         /**
2848          * Set the RCS config for this subscription.
2849          *
2850          * @param rcsConfig The RCS config for this subscription.
2851          * @return The builder.
2852          */
2853         @NonNull
setRcsConfig(byte[] rcsConfig)2854         public Builder setRcsConfig(byte[] rcsConfig) {
2855             Objects.requireNonNull(rcsConfig);
2856             mRcsConfig = rcsConfig;
2857             return this;
2858         }
2859 
2860         /**
2861          * Set the allowed network types for reasons.
2862          *
2863          * @param allowedNetworkTypesForReasons The allowed network types for reasons in string
2864          * format. The format is
2865          * "[reason]=[network types bitmask], [reason]=[network types bitmask], ..."
2866          *
2867          * For example, "user=1239287394, thermal=298791239, carrier=3456812312".
2868          *
2869          * @return The builder.
2870          */
setAllowedNetworkTypesForReasons( @onNull String allowedNetworkTypesForReasons)2871         public Builder setAllowedNetworkTypesForReasons(
2872                 @NonNull String allowedNetworkTypesForReasons) {
2873             Objects.requireNonNull(allowedNetworkTypesForReasons);
2874             mAllowedNetworkTypesForReasons = allowedNetworkTypesForReasons;
2875             return this;
2876         }
2877 
2878         /**
2879          * Set device to device sharing status.
2880          *
2881          * @param deviceToDeviceStatusSharingPreference Device to device sharing status.
2882          * @return The builder.
2883          */
setDeviceToDeviceStatusSharingPreference( @eviceToDeviceStatusSharingPreference int deviceToDeviceStatusSharingPreference)2884         public Builder setDeviceToDeviceStatusSharingPreference(
2885                 @DeviceToDeviceStatusSharingPreference int deviceToDeviceStatusSharingPreference) {
2886             mDeviceToDeviceStatusSharingPreference = deviceToDeviceStatusSharingPreference;
2887             return this;
2888         }
2889 
2890         /**
2891          * Set whether the user has opted-in voice over IMS.
2892          *
2893          * @param isVoImsOptInEnabled Whether the user has opted-in voice over IMS.
2894          * @return The builder.
2895          */
2896         @NonNull
setVoImsOptInEnabled(int isVoImsOptInEnabled)2897         public Builder setVoImsOptInEnabled(int isVoImsOptInEnabled) {
2898             mIsVoImsOptInEnabled = isVoImsOptInEnabled;
2899             return this;
2900         }
2901 
2902         /**
2903          * Set contacts information that allow device to device sharing.
2904          *
2905          * @param deviceToDeviceStatusSharingContacts contacts information that allow device to
2906          * device sharing.
2907          * @return The builder.
2908          */
2909         @NonNull
setDeviceToDeviceStatusSharingContacts( @onNull String deviceToDeviceStatusSharingContacts)2910         public Builder setDeviceToDeviceStatusSharingContacts(
2911                 @NonNull String deviceToDeviceStatusSharingContacts) {
2912             Objects.requireNonNull(deviceToDeviceStatusSharingContacts);
2913             mDeviceToDeviceStatusSharingContacts = deviceToDeviceStatusSharingContacts;
2914             return this;
2915         }
2916 
2917         /**
2918          * Set whether the user has enabled NR advanced calling.
2919          *
2920          * @param isNrAdvancedCallingEnabled Whether the user has enabled NR advanced calling.
2921          * @return The builder.
2922          */
2923         @NonNull
setNrAdvancedCallingEnabled(int isNrAdvancedCallingEnabled)2924         public Builder setNrAdvancedCallingEnabled(int isNrAdvancedCallingEnabled) {
2925             mIsNrAdvancedCallingEnabled = isNrAdvancedCallingEnabled;
2926             return this;
2927         }
2928 
2929         /**
2930          * Set the phone number retrieved from carrier.
2931          *
2932          * @param numberFromCarrier The phone number retrieved from carrier.
2933          * @return The builder.
2934          */
2935         @NonNull
setNumberFromCarrier(@onNull String numberFromCarrier)2936         public Builder setNumberFromCarrier(@NonNull String numberFromCarrier) {
2937             Objects.requireNonNull(numberFromCarrier);
2938             mNumberFromCarrier = numberFromCarrier;
2939             return this;
2940         }
2941 
2942         /**
2943          * Set the phone number retrieved from IMS.
2944          *
2945          * @param numberFromIms The phone number retrieved from IMS.
2946          * @return The builder.
2947          */
2948         @NonNull
setNumberFromIms(@onNull String numberFromIms)2949         public Builder setNumberFromIms(@NonNull String numberFromIms) {
2950             Objects.requireNonNull(numberFromIms);
2951             mNumberFromIms = numberFromIms;
2952             return this;
2953         }
2954 
2955         /**
2956          * Set the port index of the Uicc card.
2957          *
2958          * @param portIndex The port index of the Uicc card.
2959          * @return The builder.
2960          */
2961         @NonNull
setPortIndex(int portIndex)2962         public Builder setPortIndex(int portIndex) {
2963             mPortIndex = portIndex;
2964             return this;
2965         }
2966 
2967         /**
2968          * Set subscription's preferred usage setting.
2969          *
2970          * @param usageSetting Subscription's preferred usage setting.
2971          * @return The builder.
2972          */
2973         @NonNull
setUsageSetting(@sageSetting int usageSetting)2974         public Builder setUsageSetting(@UsageSetting int usageSetting) {
2975             mUsageSetting = usageSetting;
2976             return this;
2977         }
2978 
2979         /**
2980          * Set last used TP message reference.
2981          *
2982          * @param lastUsedTPMessageReference Last used TP message reference.
2983          * @return The builder.
2984          */
2985         @NonNull
setLastUsedTPMessageReference( int lastUsedTPMessageReference)2986         public Builder setLastUsedTPMessageReference(
2987                 int lastUsedTPMessageReference) {
2988             mLastUsedTPMessageReference = lastUsedTPMessageReference;
2989             return this;
2990         }
2991 
2992         /**
2993          * Set the user id associated with this subscription.
2994          *
2995          * @param userId The user id associated with this subscription.
2996          * @return The builder.
2997          */
2998         @NonNull
setUserId(@serIdInt int userId)2999         public Builder setUserId(@UserIdInt int userId) {
3000             mUserId = userId;
3001             return this;
3002         }
3003 
3004         /**
3005          * Set whether satellite is enabled or not.
3006          * @param isSatelliteEnabled {@code 1} if satellite is enabled.
3007          * @return The builder.
3008          */
3009         @NonNull
setSatelliteEnabled(int isSatelliteEnabled)3010         public Builder setSatelliteEnabled(int isSatelliteEnabled) {
3011             mIsSatelliteEnabled = isSatelliteEnabled;
3012             return this;
3013         }
3014 
3015         /**
3016          * Set whether satellite attach for carrier is enabled or disabled by user.
3017          * @param isSatelliteAttachEnabledForCarrier {@code 1} if satellite attach for carrier is
3018          * enabled.
3019          * @return The builder.
3020          */
3021         @NonNull
setSatelliteAttachEnabledForCarrier( @onNull int isSatelliteAttachEnabledForCarrier)3022         public Builder setSatelliteAttachEnabledForCarrier(
3023                 @NonNull int isSatelliteAttachEnabledForCarrier) {
3024             mIsSatelliteAttachEnabledForCarrier = isSatelliteAttachEnabledForCarrier;
3025             return this;
3026         }
3027 
3028         /**
3029          * Set whether the subscription is for NTN or not.
3030          *
3031          * @param isOnlyNonTerrestrialNetwork {@code 1} if the subscription is for NTN, {@code 0}
3032          * otherwise.
3033          * @return The builder.
3034          */
3035         @NonNull
setOnlyNonTerrestrialNetwork(int isOnlyNonTerrestrialNetwork)3036         public Builder setOnlyNonTerrestrialNetwork(int isOnlyNonTerrestrialNetwork) {
3037             mIsOnlyNonTerrestrialNetwork = isOnlyNonTerrestrialNetwork;
3038             return this;
3039         }
3040 
3041         // Below are the fields that do not exist in the SimInfo table.
3042         /**
3043          * Set the card ID of the SIM card which contains the subscription.
3044          *
3045          * @param cardId The card ID of the SIM card which contains the subscription.
3046          * @return The builder.
3047          */
3048         @NonNull
setCardId(int cardId)3049         public Builder setCardId(int cardId) {
3050             mCardId = cardId;
3051             return this;
3052         }
3053 
3054         /**
3055          * Whether group of the subscription is disabled. This is only useful if it's a grouped
3056          * opportunistic subscription. In this case, if all primary (non-opportunistic)
3057          * subscriptions in the group are deactivated (unplugged pSIM or deactivated eSIM profile),
3058          * we should disable this opportunistic subscription.
3059          *
3060          * @param isGroupDisabled {@code 1} if group of the subscription is disabled.
3061          * @return The builder.
3062          */
3063         @NonNull
setGroupDisabled(boolean isGroupDisabled)3064         public Builder setGroupDisabled(boolean isGroupDisabled) {
3065             mIsGroupDisabled = isGroupDisabled;
3066             return this;
3067         }
3068 
3069         /**
3070          * Set the service capabilities the subscription supports.
3071          * @param capabilities Cellular service capabilities bitmasks
3072          * @return The builder
3073          */
setServiceCapabilities(int capabilities)3074         public Builder setServiceCapabilities(int capabilities) {
3075             mServiceCapabilities = capabilities;
3076             return this;
3077         }
3078 
3079         /**
3080          * Set the transfer status of the subscription.
3081          *
3082          * @param status The transfer status
3083          * @return The builder.
3084          */
3085         @NonNull
setTransferStatus(int status)3086         public Builder setTransferStatus(int status) {
3087             mTransferStatus = status;
3088             return this;
3089         }
3090 
3091         /**
3092          * Set whether satellite entitlement status is enabled by entitlement query result.
3093          *
3094          * @param isSatelliteEntitlementStatus {@code 1} if satellite entitlement status is
3095          * enabled by entitlement query result.
3096          * @return The builder
3097          */
3098         @NonNull
setSatelliteEntitlementStatus(int isSatelliteEntitlementStatus)3099         public Builder setSatelliteEntitlementStatus(int isSatelliteEntitlementStatus) {
3100             mIsSatelliteEntitlementStatus = isSatelliteEntitlementStatus;
3101             return this;
3102         }
3103 
3104         /**
3105          * Set whether satellite entitlement plmns is empty or not by entitlement query result.
3106          *
3107          * @param satelliteEntitlementPlmns satellite entitlement plmns is empty or not by
3108          * entitlement query result.
3109          * @return The builder
3110          */
3111         @NonNull
setSatelliteEntitlementPlmns(@onNull String satelliteEntitlementPlmns)3112         public Builder setSatelliteEntitlementPlmns(@NonNull String satelliteEntitlementPlmns) {
3113             mSatelliteEntitlementPlmns = satelliteEntitlementPlmns;
3114             return this;
3115         }
3116 
3117         /**
3118          * Set whether the carrier roaming to satellite is using ESOS for emergency messaging.
3119          *
3120          * @param isSatelliteESOSSupported {@code 1} if the carrier roaming to satellite is using
3121          * ESOS for emergency messaging.
3122          * @return The builder
3123          */
3124         @NonNull
setSatelliteESOSSupported(int isSatelliteESOSSupported)3125         public Builder setSatelliteESOSSupported(int isSatelliteESOSSupported) {
3126             mIsSatelliteESOSSupported = isSatelliteESOSSupported;
3127             return this;
3128         }
3129 
3130         /**
3131          * Set whether the subscription is provisioned for oem satellite service or not.
3132          *
3133          * @param isSatelliteProvisionedForNonIpDatagram {@code 1} if the subscription is for NTN,
3134          * {@code 0} otherwise.
3135          * @return The builder.
3136          */
3137         @NonNull
setIsSatelliteProvisionedForNonIpDatagram( int isSatelliteProvisionedForNonIpDatagram)3138         public Builder setIsSatelliteProvisionedForNonIpDatagram(
3139                 int isSatelliteProvisionedForNonIpDatagram) {
3140             mIsSatelliteProvisionedForNonIpDatagram = isSatelliteProvisionedForNonIpDatagram;
3141             return this;
3142         }
3143 
3144         /**
3145          * Build the {@link SubscriptionInfoInternal}.
3146          *
3147          * @return The {@link SubscriptionInfoInternal} instance.
3148          */
build()3149         public SubscriptionInfoInternal build() {
3150             return new SubscriptionInfoInternal(this);
3151         }
3152 
3153         /**
3154          * Set whether satellite entitlement plmns is empty or not by entitlement query result.
3155          *
3156          * @param plmnsBarredList satellite entitlement plmns is empty or not by
3157          * entitlement query result.
3158          * @return The builder
3159          */
3160         @NonNull
setSatelliteEntitlementBarredPlmnsList(@onNull String plmnsBarredList)3161         public Builder setSatelliteEntitlementBarredPlmnsList(@NonNull String plmnsBarredList) {
3162             mSatelliteEntitlementBarredPlmnsList = plmnsBarredList;
3163             return this;
3164         }
3165 
3166         /**
3167          * Set whether satellite entitlement Data plan for plmn is empty or not by entitlement
3168          * query result.
3169          *
3170          * @param plmnDataPlanJson satellite entitlement data plan for plmns.
3171          * @return The builder
3172          */
3173         @NonNull
setSatelliteEntitlementDataPlanForPlmns(@onNull String plmnDataPlanJson)3174         public Builder setSatelliteEntitlementDataPlanForPlmns(@NonNull String plmnDataPlanJson) {
3175             mSatelliteEntitlementDataPlanForPlmn = plmnDataPlanJson;
3176             return this;
3177         }
3178 
3179         /**
3180          * Set whether satellite entitlement services for the plmns is empty or not by entitlement
3181          * query result.
3182          *
3183          * @param plmnServiceMapCv satellite entitlement services for plmns.
3184          * @return The builder
3185          */
3186         @NonNull
setSatelliteEntitlementPlmnServiceTypes( @onNull String plmnServiceMapCv)3187         public Builder setSatelliteEntitlementPlmnServiceTypes(
3188                 @NonNull String plmnServiceMapCv) {
3189             mSatelliteEntitlementServicesForPlmn = plmnServiceMapCv;
3190             return this;
3191         }
3192 
3193         /**
3194          * Set whether satellite entitlement plmns data service policy is empty or not by
3195          * entitlement query result.
3196          *
3197          * @param satellitePlmnsDataServicePolicy satellite entitlement plmns data service policy.
3198          * @return The builder
3199          */
3200         @NonNull
setSatellitePlmnsDataServicePolicy( @onNull String satellitePlmnsDataServicePolicy)3201         public Builder setSatellitePlmnsDataServicePolicy(
3202                 @NonNull String satellitePlmnsDataServicePolicy) {
3203             mSatellitePlmnsDataServicePolicy = satellitePlmnsDataServicePolicy;
3204             return this;
3205         }
3206 
3207         /**
3208          * Set whether satellite entitlement plmns voice service policy is empty or not by
3209          * entitlement query result.
3210          *
3211          * @param satellitePlmnsVoiceServicePolicy satellite entitlement plmns voice service policy.
3212          * @return The builder
3213          */
3214         @NonNull
setSatellitePlmnsVoiceServicePolicy( @onNull String satellitePlmnsVoiceServicePolicy)3215         public Builder setSatellitePlmnsVoiceServicePolicy(
3216                 @NonNull String satellitePlmnsVoiceServicePolicy) {
3217             mSatellitePlmnsVoiceServicePolicy = satellitePlmnsVoiceServicePolicy;
3218             return this;
3219         }
3220     }
3221 }
3222