• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.telephony;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.annotation.SystemApi;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24 
25 import com.android.internal.annotations.VisibleForTesting;
26 
27 import java.util.Objects;
28 
29 
30 /**
31  * Class that stores information specific to data network registration.
32  * @hide
33  */
34 @SystemApi
35 public final class DataSpecificRegistrationInfo implements Parcelable {
36     /**
37      * @hide
38      * The maximum number of simultaneous Data Calls that
39      * must be established using setupDataCall().
40      */
41     public final int maxDataCalls;
42 
43     /**
44      * @hide
45      * Indicates if the use of dual connectivity with NR is restricted.
46      * Reference: 3GPP TS 24.301 v15.03 section 9.3.3.12A.
47      */
48     public final boolean isDcNrRestricted;
49 
50     /**
51      * Indicates if NR is supported by the selected PLMN.
52      * @hide
53      * {@code true} if the bit N is in the PLMN-InfoList-r15 is true and the selected PLMN is
54      * present in plmn-IdentityList at position N.
55      * Reference: 3GPP TS 36.331 v15.2.2 section 6.3.1 PLMN-InfoList-r15.
56      *            3GPP TS 36.331 v15.2.2 section 6.2.2 SystemInformationBlockType1 message.
57      */
58     public final boolean isNrAvailable;
59 
60     /**
61      * @hide
62      * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving
63      * cell.
64      *
65      * True the primary serving cell is LTE cell and the plmn-InfoList-r15 is present in SIB2 and
66      * at least one bit in this list is true, otherwise this value should be false.
67      *
68      * Reference: 3GPP TS 36.331 v15.2.2 6.3.1 System information blocks.
69      */
70     public final boolean isEnDcAvailable;
71 
72     /**
73      * Provides network support info for VoPS and Emergency bearer support
74      */
75     @Nullable
76     private final VopsSupportInfo mVopsSupportInfo;
77 
78     /**
79      * @hide
80      */
81     @VisibleForTesting
DataSpecificRegistrationInfo( int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, boolean isEnDcAvailable, @Nullable VopsSupportInfo vops)82     public DataSpecificRegistrationInfo(
83             int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable,
84             boolean isEnDcAvailable, @Nullable VopsSupportInfo vops) {
85         this.maxDataCalls = maxDataCalls;
86         this.isDcNrRestricted = isDcNrRestricted;
87         this.isNrAvailable = isNrAvailable;
88         this.isEnDcAvailable = isEnDcAvailable;
89         this.mVopsSupportInfo = vops;
90     }
91 
92     /**
93      * Constructor from another data specific registration info
94      *
95      * @param dsri another data specific registration info
96      * @hide
97      */
DataSpecificRegistrationInfo(@onNull DataSpecificRegistrationInfo dsri)98     DataSpecificRegistrationInfo(@NonNull DataSpecificRegistrationInfo dsri) {
99         maxDataCalls = dsri.maxDataCalls;
100         isDcNrRestricted = dsri.isDcNrRestricted;
101         isNrAvailable = dsri.isNrAvailable;
102         isEnDcAvailable = dsri.isEnDcAvailable;
103         mVopsSupportInfo = dsri.mVopsSupportInfo;
104     }
105 
DataSpecificRegistrationInfo( Parcel source)106     private DataSpecificRegistrationInfo(/* @NonNull */ Parcel source) {
107         maxDataCalls = source.readInt();
108         isDcNrRestricted = source.readBoolean();
109         isNrAvailable = source.readBoolean();
110         isEnDcAvailable = source.readBoolean();
111         mVopsSupportInfo = source.readParcelable(VopsSupportInfo.class.getClassLoader(), android.telephony.VopsSupportInfo.class);
112     }
113 
114     @Override
writeToParcel( Parcel dest, int flags)115     public void writeToParcel(/* @NonNull */ Parcel dest, int flags) {
116         dest.writeInt(maxDataCalls);
117         dest.writeBoolean(isDcNrRestricted);
118         dest.writeBoolean(isNrAvailable);
119         dest.writeBoolean(isEnDcAvailable);
120         dest.writeParcelable(mVopsSupportInfo, flags);
121     }
122 
123     @Override
describeContents()124     public int describeContents() {
125         return 0;
126     }
127 
128     @NonNull
129     @Override
toString()130     public String toString() {
131         return new StringBuilder().append(this.getClass().getName())
132                 .append(" :{")
133                 .append(" maxDataCalls = " + maxDataCalls)
134                 .append(" isDcNrRestricted = " + isDcNrRestricted)
135                 .append(" isNrAvailable = " + isNrAvailable)
136                 .append(" isEnDcAvailable = " + isEnDcAvailable)
137                 .append(" " + mVopsSupportInfo)
138                 .append(" }")
139                 .toString();
140     }
141 
142     @Override
hashCode()143     public int hashCode() {
144         return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable,
145                 isEnDcAvailable, mVopsSupportInfo);
146     }
147 
148     @Override
equals(@ullable Object o)149     public boolean equals(@Nullable Object o) {
150         if (this == o) return true;
151 
152         if (!(o instanceof DataSpecificRegistrationInfo)) return false;
153 
154         DataSpecificRegistrationInfo other = (DataSpecificRegistrationInfo) o;
155         return this.maxDataCalls == other.maxDataCalls
156                 && this.isDcNrRestricted == other.isDcNrRestricted
157                 && this.isNrAvailable == other.isNrAvailable
158                 && this.isEnDcAvailable == other.isEnDcAvailable
159                 && Objects.equals(mVopsSupportInfo, other.mVopsSupportInfo);
160     }
161 
162     public static final @NonNull Parcelable.Creator<DataSpecificRegistrationInfo> CREATOR =
163             new Parcelable.Creator<DataSpecificRegistrationInfo>() {
164                 @Override
165                 public DataSpecificRegistrationInfo createFromParcel(Parcel source) {
166                     return new DataSpecificRegistrationInfo(source);
167                 }
168 
169                 @Override
170                 public DataSpecificRegistrationInfo[] newArray(int size) {
171                     return new DataSpecificRegistrationInfo[size];
172                 }
173             };
174 
175     /**
176      * @return The LTE VOPS (Voice over Packet Switched) support information
177      *
178      * @deprecated use {@link #getVopsSupportInfo()}
179      */
180     @Deprecated
181     @NonNull
getLteVopsSupportInfo()182     public LteVopsSupportInfo getLteVopsSupportInfo() {
183         return mVopsSupportInfo instanceof LteVopsSupportInfo
184                 ? (LteVopsSupportInfo) mVopsSupportInfo
185                 : new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE,
186                 LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);
187     }
188 
189     /**
190      * @return The VOPS (Voice over Packet Switched) support information.
191      *
192      * The instance of {@link LteVopsSupportInfo}, or {@link NrVopsSupportInfo},
193      * null if there is there is no VOPS support information available.
194      */
195     @Nullable
getVopsSupportInfo()196     public VopsSupportInfo getVopsSupportInfo() {
197         return mVopsSupportInfo;
198     }
199 }
200