1 /*
2  * Copyright 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.telephony;
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.IntDef;
21 import android.annotation.NonNull;
22 import android.annotation.Nullable;
23 import android.annotation.SystemApi;
24 import android.app.compat.CompatChanges;
25 import android.compat.annotation.ChangeId;
26 import android.compat.annotation.EnabledSince;
27 import android.os.Build;
28 import android.os.Parcel;
29 import android.os.Parcelable;
30 import android.telephony.AccessNetworkConstants.TransportType;
31 import android.telephony.Annotation.NetworkType;
32 import android.text.TextUtils;
33 
34 import com.android.internal.telephony.flags.Flags;
35 
36 import java.lang.annotation.Retention;
37 import java.lang.annotation.RetentionPolicy;
38 import java.util.ArrayList;
39 import java.util.Collections;
40 import java.util.List;
41 import java.util.Objects;
42 import java.util.stream.Collectors;
43 
44 /**
45  * Description of a mobile network registration info
46  */
47 public final class NetworkRegistrationInfo implements Parcelable {
48 
49     /**
50      * A new registration state, REGISTRATION_STATE_EMERGENCY, is added to
51      * {@link NetworkRegistrationInfo}. This change will affect the result of getRegistration().
52      * @hide
53      */
54     @ChangeId
55     @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
56     public static final long RETURN_REGISTRATION_STATE_EMERGENCY = 255938466L;
57 
58     /**
59      * Network domain
60      * @hide
61      */
62     @Retention(RetentionPolicy.SOURCE)
63     @IntDef(prefix = "DOMAIN_", value = {DOMAIN_UNKNOWN, DOMAIN_CS, DOMAIN_PS, DOMAIN_CS_PS})
64     public @interface Domain {}
65 
66     /** Unknown / Unspecified domain */
67     public static final int DOMAIN_UNKNOWN = 0;
68     /** Circuit switched domain */
69     public static final int DOMAIN_CS = android.hardware.radio.network.Domain.CS;
70     /** Packet switched domain */
71     public static final int DOMAIN_PS = android.hardware.radio.network.Domain.PS;
72     /** Applicable to both CS and PS Domain */
73     public static final int DOMAIN_CS_PS = DOMAIN_CS | DOMAIN_PS;
74 
75     /**
76      * Network registration state
77      * @hide
78      */
79     @Retention(RetentionPolicy.SOURCE)
80     @IntDef(prefix = "REGISTRATION_STATE_",
81             value = {REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, REGISTRATION_STATE_HOME,
82                     REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, REGISTRATION_STATE_DENIED,
83                     REGISTRATION_STATE_UNKNOWN, REGISTRATION_STATE_ROAMING,
84                     REGISTRATION_STATE_EMERGENCY})
85     public @interface RegistrationState {}
86 
87     /**
88      * Not registered. The device is not currently searching a new operator to register.
89      * @hide
90      */
91     @SystemApi
92     public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0;
93     /**
94      * Registered on home network.
95      * @hide
96      */
97     @SystemApi
98     public static final int REGISTRATION_STATE_HOME = 1;
99     /**
100      * Not registered. The device is currently searching a new operator to register.
101      * @hide
102      */
103     @SystemApi
104     public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2;
105     /**
106      * Registration denied.
107      * @hide
108      */
109     @SystemApi
110     public static final int REGISTRATION_STATE_DENIED = 3;
111     /**
112      * Registration state is unknown.
113      * @hide
114      */
115     @SystemApi
116     public static final int REGISTRATION_STATE_UNKNOWN = 4;
117     /**
118      * Registered on roaming network.
119      * @hide
120      */
121     @SystemApi
122     public static final int REGISTRATION_STATE_ROAMING = 5;
123     /**
124      * Emergency attached in EPS or in 5GS.
125      * IMS service will skip emergency registration if the device is in
126      * emergency attached state. {@link #mEmergencyOnly} can be true
127      * even in case it's not in emergency attached state.
128      *
129      * Reference: 3GPP TS 24.301 9.9.3.11 EPS attach type.
130      * Reference: 3GPP TS 24.501 9.11.3.6 5GS registration result.
131      * @hide
132      */
133     @SystemApi
134     public static final int REGISTRATION_STATE_EMERGENCY = 6;
135 
136     /** @hide */
137     @Retention(RetentionPolicy.SOURCE)
138     @IntDef(prefix = "NR_STATE_",
139             value = {NR_STATE_NONE, NR_STATE_RESTRICTED, NR_STATE_NOT_RESTRICTED,
140                     NR_STATE_CONNECTED})
141     public @interface NRState {}
142 
143     /**
144      * The device isn't camped on an LTE cell or the LTE cell doesn't support E-UTRA-NR
145      * Dual Connectivity(EN-DC).
146      */
147     public static final int NR_STATE_NONE = 0;
148 
149     /**
150      * The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) but
151      * either the use of dual connectivity with NR(DCNR) is restricted or NR is not supported by
152      * the selected PLMN.
153      */
154     public static final int NR_STATE_RESTRICTED = 1;
155 
156     /**
157      * The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) and both
158      * the use of dual connectivity with NR(DCNR) is not restricted and NR is supported by the
159      * selected PLMN.
160      */
161     public static final int NR_STATE_NOT_RESTRICTED = 2;
162 
163     /**
164      * The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) and
165      * also connected to at least one 5G cell as a secondary serving cell.
166      */
167     public static final int NR_STATE_CONNECTED = 3;
168 
169     /**
170      * Supported service type
171      * @hide
172      */
173     @Retention(RetentionPolicy.SOURCE)
174     @IntDef(prefix = "SERVICE_TYPE_",
175             value = {SERVICE_TYPE_UNKNOWN, SERVICE_TYPE_VOICE, SERVICE_TYPE_DATA, SERVICE_TYPE_SMS,
176                     SERVICE_TYPE_VIDEO, SERVICE_TYPE_EMERGENCY, SERVICE_TYPE_MMS})
177     public @interface ServiceType {}
178 
179     /**
180      * Unknown service
181      */
182     public static final int SERVICE_TYPE_UNKNOWN    = 0;
183 
184     /**
185      * Voice service
186      */
187     public static final int SERVICE_TYPE_VOICE      = 1;
188 
189     /**
190      * Data service
191      */
192     public static final int SERVICE_TYPE_DATA       = 2;
193 
194     /**
195      * SMS service
196      */
197     public static final int SERVICE_TYPE_SMS        = 3;
198 
199     /**
200      * Video service
201      */
202     public static final int SERVICE_TYPE_VIDEO      = 4;
203 
204     /**
205      * Emergency service
206      */
207     public static final int SERVICE_TYPE_EMERGENCY  = 5;
208 
209     /**
210      * MMS service
211      */
212     @FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
213     public static final int SERVICE_TYPE_MMS = 6;
214 
215     /** @hide  */
216     public static final int FIRST_SERVICE_TYPE = SERVICE_TYPE_VOICE;
217 
218     /** @hide  */
219     public static final int LAST_SERVICE_TYPE = SERVICE_TYPE_MMS;
220 
221     @Domain
222     private final int mDomain;
223 
224     @TransportType
225     private final int mTransportType;
226 
227     /**
228      * The true registration state of network, This is not affected by any carrier config or
229      * resource overlay.
230      */
231     @RegistrationState
232     private final int mNetworkRegistrationState;
233 
234     /**
235      * The registration state that might have been overridden by config
236      */
237     @RegistrationState
238     private int mRegistrationState;
239 
240     /**
241      * Save the {@link ServiceState.RoamingType roaming type}. it can be overridden roaming type
242      * from resource overlay or carrier config.
243      */
244     @ServiceState.RoamingType
245     private int mRoamingType;
246 
247     @NetworkType
248     private int mAccessNetworkTechnology;
249 
250     @NRState
251     private int mNrState;
252 
253     private final int mRejectCause;
254 
255     private final boolean mEmergencyOnly;
256 
257     @ServiceType
258     private ArrayList<Integer> mAvailableServices;
259 
260     @Nullable
261     private CellIdentity mCellIdentity;
262 
263     @Nullable
264     private VoiceSpecificRegistrationInfo mVoiceSpecificInfo;
265 
266     @Nullable
267     private DataSpecificRegistrationInfo mDataSpecificInfo;
268 
269     @NonNull
270     private String mRplmn;
271 
272     // Updated based on the accessNetworkTechnology
273     private boolean mIsUsingCarrierAggregation;
274 
275     // Set to {@code true} when network is a non-terrestrial network.
276     private boolean mIsNonTerrestrialNetwork;
277 
278     /**
279      * @param domain Network domain. Must be a {@link Domain}. For transport type
280      * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
281      * @param transportType Transport type.
282      * @param registrationState Network registration state. For transport type
283      * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, only
284      * {@link #REGISTRATION_STATE_HOME} and {@link #REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING}
285      * are valid states.
286      * @param accessNetworkTechnology Access network technology.For transport type
287      * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, set to
288      * {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
289      * @param rejectCause Reason for denial if the registration state is
290      * {@link #REGISTRATION_STATE_DENIED}. Depending on {@code accessNetworkTechnology}, the values
291      * are defined in 3GPP TS 24.008 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2
292      * A.S0001 6.2.2.44 for CDMA. If the reject cause is not supported or unknown, set it to 0.
293      * // TODO: Add IWLAN reject cause reference
294      * @param emergencyOnly True if this registration is for emergency only.
295      * @param availableServices The list of the supported services.
296      * @param cellIdentity The identity representing a unique cell or wifi AP. Set to null if the
297      * information is not available.
298      * @param rplmn the registered plmn or the last plmn for attempted registration if reg failed.
299      * @param voiceSpecificInfo Voice specific registration information.
300      * @param dataSpecificInfo Data specific registration information.
301      * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network.
302      */
NetworkRegistrationInfo(@omain int domain, @TransportType int transportType, @RegistrationState int registrationState, @NetworkType int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, @Nullable @ServiceType List<Integer> availableServices, @Nullable CellIdentity cellIdentity, @Nullable String rplmn, @Nullable VoiceSpecificRegistrationInfo voiceSpecificInfo, @Nullable DataSpecificRegistrationInfo dataSpecificInfo, boolean isNonTerrestrialNetwork)303     private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType,
304             @RegistrationState int registrationState,
305             @NetworkType int accessNetworkTechnology, int rejectCause,
306             boolean emergencyOnly, @Nullable @ServiceType List<Integer> availableServices,
307             @Nullable CellIdentity cellIdentity, @Nullable String rplmn,
308             @Nullable VoiceSpecificRegistrationInfo voiceSpecificInfo,
309             @Nullable DataSpecificRegistrationInfo dataSpecificInfo,
310             boolean isNonTerrestrialNetwork) {
311         mDomain = domain;
312         mTransportType = transportType;
313         mRegistrationState = registrationState;
314         mNetworkRegistrationState = registrationState;
315         mRoamingType = (registrationState == REGISTRATION_STATE_ROAMING)
316                 ? ServiceState.ROAMING_TYPE_UNKNOWN : ServiceState.ROAMING_TYPE_NOT_ROAMING;
317         setAccessNetworkTechnology(accessNetworkTechnology);
318         mRejectCause = rejectCause;
319         mAvailableServices = (availableServices != null)
320                 ? new ArrayList<>(availableServices) : new ArrayList<>();
321         mCellIdentity = cellIdentity;
322         mEmergencyOnly = emergencyOnly;
323         mNrState = NR_STATE_NONE;
324         mRplmn = rplmn;
325         mVoiceSpecificInfo = voiceSpecificInfo;
326         mDataSpecificInfo = dataSpecificInfo;
327         mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
328 
329         updateNrState();
330     }
331 
332     /**
333      * Constructor for voice network registration info.
334      * @hide
335      */
NetworkRegistrationInfo(int domain, @TransportType int transportType, int registrationState, int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, @Nullable List<Integer> availableServices, @Nullable CellIdentity cellIdentity, @Nullable String rplmn, boolean cssSupported, int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator)336     public NetworkRegistrationInfo(int domain, @TransportType int transportType,
337                                    int registrationState, int accessNetworkTechnology,
338                                    int rejectCause, boolean emergencyOnly,
339                                    @Nullable List<Integer> availableServices,
340                                    @Nullable CellIdentity cellIdentity, @Nullable String rplmn,
341                                    boolean cssSupported, int roamingIndicator, int systemIsInPrl,
342                                    int defaultRoamingIndicator) {
343         this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
344                 emergencyOnly, availableServices, cellIdentity, rplmn,
345                 new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator,
346                         systemIsInPrl, defaultRoamingIndicator), null, false);
347     }
348 
349     /**
350      * Constructor for data network registration info.
351      * @hide
352      */
NetworkRegistrationInfo(int domain, @TransportType int transportType, int registrationState, int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, @Nullable List<Integer> availableServices, @Nullable CellIdentity cellIdentity, @Nullable String rplmn, int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, boolean isEndcAvailable, @Nullable VopsSupportInfo vopsSupportInfo)353     public NetworkRegistrationInfo(int domain, @TransportType int transportType,
354                                    int registrationState, int accessNetworkTechnology,
355                                    int rejectCause, boolean emergencyOnly,
356                                    @Nullable List<Integer> availableServices,
357                                    @Nullable CellIdentity cellIdentity, @Nullable String rplmn,
358                                    int maxDataCalls, boolean isDcNrRestricted,
359                                    boolean isNrAvailable, boolean isEndcAvailable,
360                                    @Nullable VopsSupportInfo vopsSupportInfo) {
361         this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
362                 emergencyOnly, availableServices, cellIdentity, rplmn, null,
363                 new DataSpecificRegistrationInfo.Builder(maxDataCalls)
364                         .setDcNrRestricted(isDcNrRestricted)
365                         .setNrAvailable(isNrAvailable)
366                         .setEnDcAvailable(isEndcAvailable)
367                         .setVopsSupportInfo(vopsSupportInfo)
368                         .build(), false);
369     }
370 
NetworkRegistrationInfo(Parcel source)371     private NetworkRegistrationInfo(Parcel source) {
372         mDomain = source.readInt();
373         mTransportType = source.readInt();
374         mRegistrationState = source.readInt();
375         mNetworkRegistrationState = source.readInt();
376         mRoamingType = source.readInt();
377         mAccessNetworkTechnology = source.readInt();
378         mRejectCause = source.readInt();
379         mEmergencyOnly = source.readBoolean();
380         mAvailableServices = new ArrayList<>();
381         source.readList(mAvailableServices, Integer.class.getClassLoader(), java.lang.Integer.class);
382         mCellIdentity = source.readParcelable(CellIdentity.class.getClassLoader(), android.telephony.CellIdentity.class);
383         mVoiceSpecificInfo = source.readParcelable(
384                 VoiceSpecificRegistrationInfo.class.getClassLoader(), android.telephony.VoiceSpecificRegistrationInfo.class);
385         mDataSpecificInfo = source.readParcelable(
386                 DataSpecificRegistrationInfo.class.getClassLoader(), android.telephony.DataSpecificRegistrationInfo.class);
387         mNrState = source.readInt();
388         mRplmn = source.readString();
389         mIsUsingCarrierAggregation = source.readBoolean();
390         mIsNonTerrestrialNetwork = source.readBoolean();
391     }
392 
393     /**
394      * Constructor from another network registration info
395      *
396      * @param nri Another network registration info
397      * @hide
398      */
NetworkRegistrationInfo(NetworkRegistrationInfo nri)399     public NetworkRegistrationInfo(NetworkRegistrationInfo nri) {
400         mDomain = nri.mDomain;
401         mTransportType = nri.mTransportType;
402         mRegistrationState = nri.mRegistrationState;
403         mNetworkRegistrationState = nri.mNetworkRegistrationState;
404         mRoamingType = nri.mRoamingType;
405         mAccessNetworkTechnology = nri.mAccessNetworkTechnology;
406         mIsUsingCarrierAggregation = nri.mIsUsingCarrierAggregation;
407         mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
408         mRejectCause = nri.mRejectCause;
409         mEmergencyOnly = nri.mEmergencyOnly;
410         mAvailableServices = new ArrayList<>(nri.mAvailableServices);
411         if (nri.mCellIdentity != null) {
412             Parcel p = Parcel.obtain();
413             nri.mCellIdentity.writeToParcel(p, 0);
414             p.setDataPosition(0);
415             // TODO: Instead of doing this, we should create a formal way for cloning cell identity.
416             // Cell identity is not an immutable object so we have to deep copy it.
417             mCellIdentity = CellIdentity.CREATOR.createFromParcel(p);
418             p.recycle();
419         }
420 
421         if (nri.mVoiceSpecificInfo != null) {
422             mVoiceSpecificInfo = new VoiceSpecificRegistrationInfo(nri.mVoiceSpecificInfo);
423         }
424         if (nri.mDataSpecificInfo != null) {
425             mDataSpecificInfo = new DataSpecificRegistrationInfo(nri.mDataSpecificInfo);
426         }
427         mNrState = nri.mNrState;
428         mRplmn = nri.mRplmn;
429     }
430 
431     /**
432      * @return The transport type.
433      */
getTransportType()434     public @TransportType int getTransportType() { return mTransportType; }
435 
436     /**
437      * @return The network domain.
438      */
getDomain()439     public @Domain int getDomain() { return mDomain; }
440 
441     /**
442      * Get the 5G NR connection state.
443      *
444      * @return the 5G NR connection state.
445      * @hide
446      */
getNrState()447     public @NRState int getNrState() {
448         return mNrState;
449     }
450 
451     /** @hide */
setNrState(@RState int nrState)452     public void setNrState(@NRState int nrState) {
453         mNrState = nrState;
454     }
455 
456     /**
457      * @return The registration state. Note this value can be affected by the carrier config
458      * override.
459      *
460      * @deprecated Use {@link #getNetworkRegistrationState}, which is not affected by any carrier
461      * config or resource overlay, instead.
462      * @hide
463      */
464     @Deprecated
465     @SystemApi
getRegistrationState()466     public @RegistrationState int getRegistrationState() {
467         if (mRegistrationState == REGISTRATION_STATE_EMERGENCY) {
468             if (!CompatChanges.isChangeEnabled(RETURN_REGISTRATION_STATE_EMERGENCY)) {
469                 if (mAccessNetworkTechnology == TelephonyManager.NETWORK_TYPE_LTE) {
470                     return REGISTRATION_STATE_DENIED;
471                 } else if (mAccessNetworkTechnology == TelephonyManager.NETWORK_TYPE_NR) {
472                     return REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
473                 }
474             }
475         }
476         return mRegistrationState;
477     }
478 
479     /**
480      * @return The true registration state of network. (This value is not affected by any carrier
481      * config or resource overlay override).
482      *
483      * @hide
484      */
485     @SystemApi
getNetworkRegistrationState()486     public @RegistrationState int getNetworkRegistrationState() {
487         return mNetworkRegistrationState;
488     }
489 
490     /**
491      * @return {@code true} if registered on roaming or home network. Note this value can be
492      * affected by the carrier config override.
493      *
494      * @deprecated Use {@link #isNetworkRegistered}, which is not affected by any carrier config or
495      * resource overlay, instead.
496      */
497     @Deprecated
isRegistered()498     public boolean isRegistered() {
499         return mRegistrationState == REGISTRATION_STATE_HOME
500                 || mRegistrationState == REGISTRATION_STATE_ROAMING;
501     }
502 
503     /**
504      * @return {@code true} if registered on roaming or home network, {@code false} otherwise. (This
505      * value is not affected by any carrier config or resource overlay override).
506      */
isNetworkRegistered()507     public boolean isNetworkRegistered() {
508         return mNetworkRegistrationState == REGISTRATION_STATE_HOME
509                 || mNetworkRegistrationState == REGISTRATION_STATE_ROAMING;
510     }
511 
512     /**
513      * @return {@code true} if searching for service, {@code false} otherwise.
514      *
515      * @deprecated Use {@link #isNetworkRegistered}, which is not affected by any carrier config or
516      * resource overlay, instead.
517      */
518     @Deprecated
isSearching()519     public boolean isSearching() {
520         return mRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
521     }
522 
523     /**
524      * @return {@code true} if searching for service, {@code false} otherwise. (This value is not
525      * affected by any carrier config or resource overlay override).
526      */
isNetworkSearching()527     public boolean isNetworkSearching() {
528         return mNetworkRegistrationState == REGISTRATION_STATE_NOT_REGISTERED_SEARCHING;
529     }
530 
531     /**
532      * Get the PLMN-ID for this Network Registration, also known as the RPLMN.
533      *
534      * <p>If the device is registered, this will return the registered PLMN-ID. If registration
535      * has failed, then this will return the PLMN ID of the last attempted registration. If the
536      * device is not registered, or if is registered to a non-3GPP radio technology, then this
537      * will return null.
538      *
539      * <p>See 3GPP TS 23.122 for further information about the Registered PLMN.
540      *
541      * @return the registered PLMN-ID or null.
542      */
getRegisteredPlmn()543     @Nullable public String getRegisteredPlmn() {
544         return mRplmn;
545     }
546 
547     /**
548      * @return {@code true} if registered on roaming network overridden by config. Note this value
549      * can be affected by the carrier config override.
550      *
551      * @deprecated Use {@link TelephonyDisplayInfo#isRoaming} instead.
552      */
553     @Deprecated
isRoaming()554     public boolean isRoaming() {
555         return mRoamingType != ServiceState.ROAMING_TYPE_NOT_ROAMING;
556     }
557 
558     /**
559      * @return {@code true} if registered on roaming network. (This value is not affected by any
560      * carrier config or resource overlay override).
561      */
isNetworkRoaming()562     public boolean isNetworkRoaming() {
563         return mNetworkRegistrationState == REGISTRATION_STATE_ROAMING;
564     }
565 
566     /**
567      * @hide
568      * @return {@code true} if in service.
569      */
isInService()570     public boolean isInService() {
571         return mRegistrationState == REGISTRATION_STATE_HOME
572                 || mRegistrationState == REGISTRATION_STATE_ROAMING;
573     }
574 
575     /**
576      * Set {@link ServiceState.RoamingType roaming type}. This could override
577      * roaming type based on resource overlay or carrier config.
578      * @hide
579      */
setRoamingType(@erviceState.RoamingType int roamingType)580     public void setRoamingType(@ServiceState.RoamingType int roamingType) {
581         mRoamingType = roamingType;
582 
583         // make sure mRegistrationState to be consistent in case of any roaming type override
584         if (isRoaming()) {
585             if (mRegistrationState == REGISTRATION_STATE_HOME) {
586                 mRegistrationState = REGISTRATION_STATE_ROAMING;
587             }
588         } else {
589             if (mRegistrationState == REGISTRATION_STATE_ROAMING) {
590                 mRegistrationState = REGISTRATION_STATE_HOME;
591             }
592         }
593     }
594 
595     /**
596      * @return the current network roaming type. Note that this value can be possibly overridden by
597      * the carrier config or resource overlay.
598      * @hide
599      */
600     @SystemApi
getRoamingType()601     public @ServiceState.RoamingType int getRoamingType() {
602         return mRoamingType;
603     }
604 
605     /**
606      * @return Whether emergency is enabled.
607      * @hide
608      */
609     @SystemApi
isEmergencyEnabled()610     public boolean isEmergencyEnabled() { return mEmergencyOnly; }
611 
612     /**
613      * @return List of available service types.
614      */
615     @NonNull
616     @ServiceType
getAvailableServices()617     public List<Integer> getAvailableServices() {
618         return Collections.unmodifiableList(mAvailableServices);
619     }
620 
621     /**
622      * Set available service types.
623      *
624      * @param availableServices The list of available services for this network.
625      * @hide
626      */
setAvailableServices(@onNull @erviceType List<Integer> availableServices)627     public void setAvailableServices(@NonNull @ServiceType List<Integer> availableServices) {
628         mAvailableServices = new ArrayList<>(availableServices);
629     }
630 
631     /**
632      * @return The access network technology network type..
633      */
getAccessNetworkTechnology()634     public @NetworkType int getAccessNetworkTechnology() {
635         return mAccessNetworkTechnology;
636     }
637 
638     /**
639      * override the access network technology {@link NetworkType} e.g, rat ratchet.
640      * @hide
641      */
setAccessNetworkTechnology(@etworkType int tech)642     public void setAccessNetworkTechnology(@NetworkType int tech) {
643         if (tech == TelephonyManager.NETWORK_TYPE_LTE_CA) {
644             // For old device backward compatibility support
645             tech = TelephonyManager.NETWORK_TYPE_LTE;
646             mIsUsingCarrierAggregation = true;
647         }
648         mAccessNetworkTechnology = tech;
649     }
650 
651     /**
652      * Get the 3GPP/3GPP2 reason code indicating why registration failed.
653      *
654      * Returns the reason code for non-transient registration failures. Typically this method will
655      * only return the last reason code received during a network selection procedure. The reason
656      * code is system-specific; however, the reason codes for both 3GPP and 3GPP2 systems are
657      * largely equivalent across generations.
658      *
659      * @return registration reject cause if available, otherwise 0. Depending on
660      * {@link #getAccessNetworkTechnology}, the values are defined in 3GPP TS 24.008 10.5.3.6 for
661      * WCDMA/UMTS, 3GPP TS 24.301 9.9.3.9 for LTE/EPS, 3GPP 24.501 Annex A for NR/5GS, or 3GPP2
662      * A.S0001 6.2.2.44 for CDMA.
663      */
664     @FlaggedApi(Flags.FLAG_NETWORK_REGISTRATION_INFO_REJECT_CAUSE)
getRejectCause()665     public int getRejectCause() {
666         return mRejectCause;
667     }
668 
669     /**
670      * Require {@link android.Manifest.permission#ACCESS_FINE_LOCATION}, otherwise return null.
671      *
672      * @return The cell information.
673      */
674     @Nullable
getCellIdentity()675     public CellIdentity getCellIdentity() {
676         return mCellIdentity;
677     }
678 
679     /**
680      * Set whether network has configured carrier aggregation or not.
681      *
682      * @param isUsingCarrierAggregation set whether or not carrier aggregation is used.
683      *
684      * @hide
685      */
setIsUsingCarrierAggregation(boolean isUsingCarrierAggregation)686     public void setIsUsingCarrierAggregation(boolean isUsingCarrierAggregation) {
687         mIsUsingCarrierAggregation = isUsingCarrierAggregation;
688     }
689 
690     /**
691      * Get whether network has configured carrier aggregation or not.
692      *
693      * @return {@code true} if using carrier aggregation.
694      * @hide
695      */
isUsingCarrierAggregation()696     public boolean isUsingCarrierAggregation() {
697         return mIsUsingCarrierAggregation;
698     }
699 
700     /**
701      * Set whether the network is a non-terrestrial network.
702      *
703      * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network
704      *                                            else {@code false}.
705      * @hide
706      */
setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork)707     public void setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
708         mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
709     }
710 
711     /**
712      * Get whether the network is a non-terrestrial network.
713      *
714      * @return {@code true} if network is a non-terrestrial network else {@code false}.
715      */
716     @FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
isNonTerrestrialNetwork()717     public boolean isNonTerrestrialNetwork() {
718         return mIsNonTerrestrialNetwork;
719     }
720 
721     /**
722      * @hide
723      */
724     @Nullable
getVoiceSpecificInfo()725     public VoiceSpecificRegistrationInfo getVoiceSpecificInfo() {
726         return mVoiceSpecificInfo;
727     }
728 
729     /**
730      * @return Data registration related info
731      * @hide
732      */
733     @Nullable
734     @SystemApi
getDataSpecificInfo()735     public DataSpecificRegistrationInfo getDataSpecificInfo() {
736         return mDataSpecificInfo;
737     }
738 
739     @Override
describeContents()740     public int describeContents() {
741         return 0;
742     }
743 
744     /**
745      * Convert service type to string
746      *
747      * @hide
748      *
749      * @param serviceType The service type
750      * @return The service type in string format
751      */
serviceTypeToString(@erviceType int serviceType)752     public static String serviceTypeToString(@ServiceType int serviceType) {
753         switch (serviceType) {
754             case SERVICE_TYPE_VOICE: return "VOICE";
755             case SERVICE_TYPE_DATA: return "DATA";
756             case SERVICE_TYPE_SMS: return "SMS";
757             case SERVICE_TYPE_VIDEO: return "VIDEO";
758             case SERVICE_TYPE_EMERGENCY: return "EMERGENCY";
759             case SERVICE_TYPE_MMS: return "MMS";
760         }
761         return "Unknown service type " + serviceType;
762     }
763 
764     /**
765      * Convert registration state to string
766      *
767      * @hide
768      *
769      * @param registrationState The registration state
770      * @return The reg state in string
771      */
registrationStateToString(@egistrationState int registrationState)772     public static String registrationStateToString(@RegistrationState int registrationState) {
773         switch (registrationState) {
774             case REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING: return "NOT_REG_OR_SEARCHING";
775             case REGISTRATION_STATE_HOME: return "HOME";
776             case REGISTRATION_STATE_NOT_REGISTERED_SEARCHING: return "NOT_REG_SEARCHING";
777             case REGISTRATION_STATE_DENIED: return "DENIED";
778             case REGISTRATION_STATE_UNKNOWN: return "UNKNOWN";
779             case REGISTRATION_STATE_ROAMING: return "ROAMING";
780             case REGISTRATION_STATE_EMERGENCY: return "EMERGENCY";
781         }
782         return "Unknown reg state " + registrationState;
783     }
784 
785     /** @hide */
nrStateToString(@RState int nrState)786     public static String nrStateToString(@NRState int nrState) {
787         switch (nrState) {
788             case NR_STATE_RESTRICTED:
789                 return "RESTRICTED";
790             case NR_STATE_NOT_RESTRICTED:
791                 return "NOT_RESTRICTED";
792             case NR_STATE_CONNECTED:
793                 return "CONNECTED";
794             default:
795                 return "NONE";
796         }
797     }
798 
799     /** @hide */
domainToString(@omain int domain)800     static @NonNull String domainToString(@Domain int domain) {
801         switch (domain) {
802             case DOMAIN_CS: return "CS";
803             case DOMAIN_PS: return "PS";
804             case DOMAIN_CS_PS: return "CS_PS";
805             default: return "UNKNOWN";
806         }
807     }
808 
809     /**
810      * Convert isNonTerrestrialNetwork to string
811      *
812      * @param isNonTerrestrialNetwork boolean indicating whether network is a non-terrestrial
813      *                                network
814      * @return string format of isNonTerrestrialNetwork.
815      * @hide
816      */
isNonTerrestrialNetworkToString(boolean isNonTerrestrialNetwork)817     public static String isNonTerrestrialNetworkToString(boolean isNonTerrestrialNetwork) {
818         return isNonTerrestrialNetwork ? "NON-TERRESTRIAL" : "TERRESTRIAL";
819     }
820 
821     @NonNull
822     @Override
toString()823     public String toString() {
824         return new StringBuilder("NetworkRegistrationInfo{")
825                 .append(" domain=").append(domainToString(mDomain))
826                 .append(" transportType=").append(
827                         AccessNetworkConstants.transportTypeToString(mTransportType))
828                 .append(" registrationState=").append(registrationStateToString(mRegistrationState))
829                 .append(" networkRegistrationState=")
830                 .append(registrationStateToString(mNetworkRegistrationState))
831                 .append(" roamingType=").append(ServiceState.roamingTypeToString(mRoamingType))
832                 .append(" accessNetworkTechnology=")
833                 .append(TelephonyManager.getNetworkTypeName(mAccessNetworkTechnology))
834                 .append(" rejectCause=").append(mRejectCause)
835                 .append(" emergencyEnabled=").append(mEmergencyOnly)
836                 .append(" availableServices=").append("[" + (mAvailableServices != null
837                         ? mAvailableServices.stream().map(type -> serviceTypeToString(type))
838                         .collect(Collectors.joining(",")) : null) + "]")
839                 .append(" cellIdentity=").append(mCellIdentity)
840                 .append(" voiceSpecificInfo=").append(mVoiceSpecificInfo)
841                 .append(" dataSpecificInfo=").append(mDataSpecificInfo)
842                 .append(" nrState=").append(Build.IS_DEBUGGABLE
843                         ? nrStateToString(mNrState) : "****")
844                 .append(" rRplmn=").append(mRplmn)
845                 .append(" isUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
846                 .append(" isNonTerrestrialNetwork=").append(
847                         isNonTerrestrialNetworkToString(mIsNonTerrestrialNetwork))
848                 .append("}").toString();
849     }
850 
851     @Override
hashCode()852     public int hashCode() {
853         return Objects.hash(mDomain, mTransportType, mRegistrationState, mNetworkRegistrationState,
854                 mRoamingType, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly,
855                 mAvailableServices, mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState,
856                 mRplmn, mIsUsingCarrierAggregation, mIsNonTerrestrialNetwork);
857     }
858 
859     @Override
equals(@ullable Object o)860     public boolean equals(@Nullable Object o) {
861         if (this == o) return true;
862 
863         if (!(o instanceof NetworkRegistrationInfo)) {
864             return false;
865         }
866 
867         NetworkRegistrationInfo other = (NetworkRegistrationInfo) o;
868         return mDomain == other.mDomain
869                 && mTransportType == other.mTransportType
870                 && mRegistrationState == other.mRegistrationState
871                 && mNetworkRegistrationState == other.mNetworkRegistrationState
872                 && mRoamingType == other.mRoamingType
873                 && mAccessNetworkTechnology == other.mAccessNetworkTechnology
874                 && mRejectCause == other.mRejectCause
875                 && mEmergencyOnly == other.mEmergencyOnly
876                 && mAvailableServices.equals(other.mAvailableServices)
877                 && mIsUsingCarrierAggregation == other.mIsUsingCarrierAggregation
878                 && Objects.equals(mCellIdentity, other.mCellIdentity)
879                 && Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo)
880                 && Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo)
881                 && TextUtils.equals(mRplmn, other.mRplmn)
882                 && mNrState == other.mNrState
883                 && mIsNonTerrestrialNetwork == other.mIsNonTerrestrialNetwork;
884     }
885 
886     /**
887      * @hide
888      */
889     @Override
890     @SystemApi
writeToParcel(Parcel dest, int flags)891     public void writeToParcel(Parcel dest, int flags) {
892         dest.writeInt(mDomain);
893         dest.writeInt(mTransportType);
894         dest.writeInt(mRegistrationState);
895         dest.writeInt(mNetworkRegistrationState);
896         dest.writeInt(mRoamingType);
897         dest.writeInt(mAccessNetworkTechnology);
898         dest.writeInt(mRejectCause);
899         dest.writeBoolean(mEmergencyOnly);
900         dest.writeList(mAvailableServices);
901         dest.writeParcelable(mCellIdentity, 0);
902         dest.writeParcelable(mVoiceSpecificInfo, 0);
903         dest.writeParcelable(mDataSpecificInfo, 0);
904         dest.writeInt(mNrState);
905         dest.writeString(mRplmn);
906         dest.writeBoolean(mIsUsingCarrierAggregation);
907         dest.writeBoolean(mIsNonTerrestrialNetwork);
908     }
909 
910     /**
911      * Use the 5G NR Non-Standalone indicators from the network registration state to update the
912      * NR state. There are 3 indicators in the network registration state:
913      *
914      * 1. if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving cell.
915      * 2. if NR is supported by the selected PLMN.
916      * 3. if the use of dual connectivity with NR is restricted.
917      *
918      * The network has 5G NR capability if E-UTRA-NR Dual Connectivity is supported by the primary
919      * serving cell.
920      *
921      * The use of NR 5G is not restricted If the network has 5G NR capability and both the use of
922      * DCNR is not restricted and NR is supported by the selected PLMN. Otherwise the use of 5G
923      * NR is restricted.
924      *
925      * @hide
926      */
updateNrState()927     public void updateNrState() {
928         mNrState = NR_STATE_NONE;
929         if (mDataSpecificInfo != null && mDataSpecificInfo.isEnDcAvailable) {
930             if (!mDataSpecificInfo.isDcNrRestricted && mDataSpecificInfo.isNrAvailable) {
931                 mNrState = NR_STATE_NOT_RESTRICTED;
932             } else {
933                 mNrState = NR_STATE_RESTRICTED;
934             }
935         }
936     }
937 
938     public static final @NonNull Parcelable.Creator<NetworkRegistrationInfo> CREATOR =
939             new Parcelable.Creator<NetworkRegistrationInfo>() {
940                 @Override
941                 public NetworkRegistrationInfo createFromParcel(Parcel source) {
942                     return new NetworkRegistrationInfo(source);
943                 }
944 
945                 @Override
946                 public NetworkRegistrationInfo[] newArray(int size) {
947                     return new NetworkRegistrationInfo[size];
948                 }
949             };
950 
951     /**
952      * @hide
953      */
sanitizeLocationInfo()954     public NetworkRegistrationInfo sanitizeLocationInfo() {
955         NetworkRegistrationInfo result = copy();
956         result.mCellIdentity = null;
957         return result;
958     }
959 
copy()960     private NetworkRegistrationInfo copy() {
961         Parcel p = Parcel.obtain();
962         this.writeToParcel(p, 0);
963         p.setDataPosition(0);
964         NetworkRegistrationInfo result = new NetworkRegistrationInfo(p);
965         p.recycle();
966         return result;
967     }
968 
969     /**
970      * Provides a convenient way to set the fields of a {@link NetworkRegistrationInfo} when
971      * creating a new instance.
972      *
973      * <p>The example below shows how you might create a new {@code NetworkRegistrationInfo}:
974      *
975      * <pre><code>
976      *
977      * NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
978      *     .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
979      *     .setRegistrationState(REGISTRATION_STATE_HOME)
980      *     .build();
981      * </code></pre>
982      * @hide
983      */
984     @SystemApi
985     public static final class Builder {
986         @Domain
987         private int mDomain;
988 
989         @TransportType
990         private int mTransportType;
991 
992         @RegistrationState
993         private int mNetworkRegistrationState;
994 
995         @NetworkType
996         private int mAccessNetworkTechnology;
997 
998         private int mRejectCause;
999 
1000         private boolean mEmergencyOnly;
1001 
1002         @ServiceType
1003         private List<Integer> mAvailableServices;
1004 
1005         @Nullable
1006         private CellIdentity mCellIdentity;
1007 
1008         @NonNull
1009         private String mRplmn = "";
1010 
1011         @Nullable
1012         private DataSpecificRegistrationInfo mDataSpecificRegistrationInfo;
1013 
1014         @Nullable
1015         private VoiceSpecificRegistrationInfo mVoiceSpecificRegistrationInfo;
1016 
1017         private boolean mIsNonTerrestrialNetwork;
1018 
1019         /**
1020          * Default constructor for Builder.
1021          */
Builder()1022         public Builder() {}
1023 
1024         /**
1025          * Builder from the existing {@link NetworkRegistrationInfo}.
1026          *
1027          * @param nri The network registration info object.
1028          * @hide
1029          */
Builder(@onNull NetworkRegistrationInfo nri)1030         public Builder(@NonNull NetworkRegistrationInfo nri) {
1031             mDomain = nri.mDomain;
1032             mTransportType = nri.mTransportType;
1033             mNetworkRegistrationState = nri.mNetworkRegistrationState;
1034             mAccessNetworkTechnology = nri.mAccessNetworkTechnology;
1035             mRejectCause = nri.mRejectCause;
1036             mEmergencyOnly = nri.mEmergencyOnly;
1037             mAvailableServices = new ArrayList<>(nri.mAvailableServices);
1038             mCellIdentity = nri.mCellIdentity;
1039             if (nri.mDataSpecificInfo != null) {
1040                 mDataSpecificRegistrationInfo = new DataSpecificRegistrationInfo(
1041                         nri.mDataSpecificInfo);
1042             }
1043             if (nri.mVoiceSpecificInfo != null) {
1044                 mVoiceSpecificRegistrationInfo = new VoiceSpecificRegistrationInfo(
1045                         nri.mVoiceSpecificInfo);
1046             }
1047             mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
1048         }
1049 
1050         /**
1051          * Set the network domain.
1052          *
1053          * @param domain Network domain.
1054          *
1055          * @return The same instance of the builder.
1056          */
setDomain(@omain int domain)1057         public @NonNull Builder setDomain(@Domain int domain) {
1058             mDomain = domain;
1059             return this;
1060         }
1061 
1062         /**
1063          * Set the transport type.
1064          *
1065          * @param transportType Transport type.
1066          *
1067          * @return The same instance of the builder.
1068          */
setTransportType(@ransportType int transportType)1069         public @NonNull Builder setTransportType(@TransportType int transportType) {
1070             mTransportType = transportType;
1071             return this;
1072         }
1073 
1074         /**
1075          * Set the registration state.
1076          *
1077          * @param registrationState The registration state.
1078          *
1079          * @return The same instance of the builder.
1080          */
setRegistrationState(@egistrationState int registrationState)1081         public @NonNull Builder setRegistrationState(@RegistrationState int registrationState) {
1082             mNetworkRegistrationState = registrationState;
1083             return this;
1084         }
1085 
1086         /**
1087          * Set tne access network technology.
1088          *
1089          * @return The same instance of the builder.
1090          *
1091          * @param accessNetworkTechnology The access network technology
1092          */
setAccessNetworkTechnology( @etworkType int accessNetworkTechnology)1093         public @NonNull Builder setAccessNetworkTechnology(
1094                 @NetworkType int accessNetworkTechnology) {
1095             mAccessNetworkTechnology = accessNetworkTechnology;
1096             return this;
1097         }
1098 
1099         /**
1100          * Set the network reject cause.
1101          *
1102          * @param rejectCause Reason for denial if the registration state is
1103          * {@link #REGISTRATION_STATE_DENIED}.Depending on {@code accessNetworkTechnology}, the
1104          * values are defined in 3GPP TS 24.008 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE,
1105          * and 3GPP2 A.S0001 6.2.2.44 for CDMA. If the reject cause is not supported or unknown, set
1106          * it to 0.
1107          *
1108          * @return The same instance of the builder.
1109          */
setRejectCause(int rejectCause)1110         public @NonNull Builder setRejectCause(int rejectCause) {
1111             mRejectCause = rejectCause;
1112             return this;
1113         }
1114 
1115         /**
1116          * Set emergency only.
1117          *
1118          * @param emergencyOnly True if this network registration is for emergency use only.
1119          *
1120          * @return The same instance of the builder.
1121          * @hide
1122          */
1123         @SystemApi
setEmergencyOnly(boolean emergencyOnly)1124         public @NonNull Builder setEmergencyOnly(boolean emergencyOnly) {
1125             mEmergencyOnly = emergencyOnly;
1126             return this;
1127         }
1128 
1129         /**
1130          * Set the available services.
1131          *
1132          * @param availableServices Available services.
1133          *
1134          * @return The same instance of the builder.
1135          * @hide
1136          */
1137         @SystemApi
setAvailableServices( @onNull @erviceType List<Integer> availableServices)1138         public @NonNull Builder setAvailableServices(
1139                 @NonNull @ServiceType List<Integer> availableServices) {
1140             mAvailableServices = availableServices;
1141             return this;
1142         }
1143 
1144         /**
1145          * Set the cell identity.
1146          *
1147          * @param cellIdentity The cell identity.
1148          *
1149          * @return The same instance of the builder.
1150          * @hide
1151          */
1152         @SystemApi
setCellIdentity(@ullable CellIdentity cellIdentity)1153         public @NonNull Builder setCellIdentity(@Nullable CellIdentity cellIdentity) {
1154             mCellIdentity = cellIdentity;
1155             return this;
1156         }
1157 
1158         /**
1159          * Set the registered PLMN.
1160          *
1161          * @param rplmn the registered plmn.
1162          *
1163          * @return The same instance of the builder.
1164          */
setRegisteredPlmn(@ullable String rplmn)1165         public @NonNull Builder setRegisteredPlmn(@Nullable String rplmn) {
1166             mRplmn = rplmn;
1167             return this;
1168         }
1169 
1170         /**
1171          * Set voice specific registration information.
1172          *
1173          * @param info The voice specific registration information.
1174          * @return The builder.
1175          * @hide
1176          */
setVoiceSpecificInfo(@onNull VoiceSpecificRegistrationInfo info)1177         public @NonNull Builder setVoiceSpecificInfo(@NonNull VoiceSpecificRegistrationInfo info) {
1178             mVoiceSpecificRegistrationInfo = info;
1179             return this;
1180         }
1181 
1182         /**
1183          * Set data specific registration information.
1184          *
1185          * @param info The data specific registration information.
1186          * @return The builder.
1187          * @hide
1188          */
setDataSpecificInfo(@onNull DataSpecificRegistrationInfo info)1189         public @NonNull Builder setDataSpecificInfo(@NonNull DataSpecificRegistrationInfo info) {
1190             mDataSpecificRegistrationInfo = info;
1191             return this;
1192         }
1193 
1194         /**
1195          * Set whether the network is a non-terrestrial network.
1196          *
1197          * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network
1198          *                                            else {@code false}.
1199          * @return The builder.
1200          */
1201         @FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork)1202         public @NonNull Builder setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
1203             mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
1204             return this;
1205         }
1206 
1207         /**
1208          * Build the NetworkRegistrationInfo.
1209          * @return the NetworkRegistrationInfo object.
1210          * @hide
1211          */
1212         @SystemApi
build()1213         public @NonNull NetworkRegistrationInfo build() {
1214             return new NetworkRegistrationInfo(mDomain, mTransportType, mNetworkRegistrationState,
1215                     mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
1216                     mCellIdentity, mRplmn, mVoiceSpecificRegistrationInfo,
1217                     mDataSpecificRegistrationInfo, mIsNonTerrestrialNetwork);
1218         }
1219     }
1220 }
1221