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 java.util.Objects; 26 27 28 /** 29 * Class that stores information specific to data network registration. 30 * @hide 31 */ 32 @SystemApi 33 public final class DataSpecificRegistrationInfo implements Parcelable { 34 /** 35 * @hide 36 * The maximum number of simultaneous Data Calls that 37 * must be established using setupDataCall(). 38 */ 39 public final int maxDataCalls; 40 41 /** 42 * @hide 43 * Indicates if the use of dual connectivity with NR is restricted. 44 * Reference: 3GPP TS 24.301 v15.03 section 9.3.3.12A. 45 */ 46 public final boolean isDcNrRestricted; 47 48 /** 49 * Indicates if NR is supported by the selected PLMN. 50 * @hide 51 * {@code true} if the bit N is in the PLMN-InfoList-r15 is true and the selected PLMN is 52 * present in plmn-IdentityList at position N. 53 * Reference: 3GPP TS 36.331 v15.2.2 section 6.3.1 PLMN-InfoList-r15. 54 * 3GPP TS 36.331 v15.2.2 section 6.2.2 SystemInformationBlockType1 message. 55 */ 56 public final boolean isNrAvailable; 57 58 /** 59 * @hide 60 * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving 61 * cell. 62 * 63 * True the primary serving cell is LTE cell and the plmn-InfoList-r15 is present in SIB2 and 64 * at least one bit in this list is true, otherwise this value should be false. 65 * 66 * Reference: 3GPP TS 36.331 v15.2.2 6.3.1 System information blocks. 67 */ 68 public final boolean isEnDcAvailable; 69 70 /** 71 * Provides network support info for VoPS and Emergency bearer support 72 */ 73 @Nullable 74 private final VopsSupportInfo mVopsSupportInfo; 75 76 /** 77 * @hide 78 */ DataSpecificRegistrationInfo( int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, boolean isEnDcAvailable, @Nullable VopsSupportInfo vops)79 DataSpecificRegistrationInfo( 80 int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, 81 boolean isEnDcAvailable, @Nullable VopsSupportInfo vops) { 82 this.maxDataCalls = maxDataCalls; 83 this.isDcNrRestricted = isDcNrRestricted; 84 this.isNrAvailable = isNrAvailable; 85 this.isEnDcAvailable = isEnDcAvailable; 86 this.mVopsSupportInfo = vops; 87 } 88 89 /** 90 * Constructor from another data specific registration info 91 * 92 * @param dsri another data specific registration info 93 * @hide 94 */ DataSpecificRegistrationInfo(@onNull DataSpecificRegistrationInfo dsri)95 DataSpecificRegistrationInfo(@NonNull DataSpecificRegistrationInfo dsri) { 96 maxDataCalls = dsri.maxDataCalls; 97 isDcNrRestricted = dsri.isDcNrRestricted; 98 isNrAvailable = dsri.isNrAvailable; 99 isEnDcAvailable = dsri.isEnDcAvailable; 100 mVopsSupportInfo = dsri.mVopsSupportInfo; 101 } 102 DataSpecificRegistrationInfo( Parcel source)103 private DataSpecificRegistrationInfo(/* @NonNull */ Parcel source) { 104 maxDataCalls = source.readInt(); 105 isDcNrRestricted = source.readBoolean(); 106 isNrAvailable = source.readBoolean(); 107 isEnDcAvailable = source.readBoolean(); 108 mVopsSupportInfo = source.readParcelable(VopsSupportInfo.class.getClassLoader()); 109 } 110 111 @Override writeToParcel( Parcel dest, int flags)112 public void writeToParcel(/* @NonNull */ Parcel dest, int flags) { 113 dest.writeInt(maxDataCalls); 114 dest.writeBoolean(isDcNrRestricted); 115 dest.writeBoolean(isNrAvailable); 116 dest.writeBoolean(isEnDcAvailable); 117 dest.writeParcelable(mVopsSupportInfo, flags); 118 } 119 120 @Override describeContents()121 public int describeContents() { 122 return 0; 123 } 124 125 @NonNull 126 @Override toString()127 public String toString() { 128 return new StringBuilder().append(this.getClass().getName()) 129 .append(" :{") 130 .append(" maxDataCalls = " + maxDataCalls) 131 .append(" isDcNrRestricted = " + isDcNrRestricted) 132 .append(" isNrAvailable = " + isNrAvailable) 133 .append(" isEnDcAvailable = " + isEnDcAvailable) 134 .append(" " + mVopsSupportInfo) 135 .append(" }") 136 .toString(); 137 } 138 139 @Override hashCode()140 public int hashCode() { 141 return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable, 142 isEnDcAvailable, mVopsSupportInfo); 143 } 144 145 @Override equals(@ullable Object o)146 public boolean equals(@Nullable Object o) { 147 if (this == o) return true; 148 149 if (!(o instanceof DataSpecificRegistrationInfo)) return false; 150 151 DataSpecificRegistrationInfo other = (DataSpecificRegistrationInfo) o; 152 return this.maxDataCalls == other.maxDataCalls 153 && this.isDcNrRestricted == other.isDcNrRestricted 154 && this.isNrAvailable == other.isNrAvailable 155 && this.isEnDcAvailable == other.isEnDcAvailable 156 && Objects.equals(mVopsSupportInfo, other.mVopsSupportInfo); 157 } 158 159 public static final @NonNull Parcelable.Creator<DataSpecificRegistrationInfo> CREATOR = 160 new Parcelable.Creator<DataSpecificRegistrationInfo>() { 161 @Override 162 public DataSpecificRegistrationInfo createFromParcel(Parcel source) { 163 return new DataSpecificRegistrationInfo(source); 164 } 165 166 @Override 167 public DataSpecificRegistrationInfo[] newArray(int size) { 168 return new DataSpecificRegistrationInfo[size]; 169 } 170 }; 171 172 /** 173 * @return The LTE VOPS (Voice over Packet Switched) support information 174 * 175 * @deprecated use {@link #getVopsSupportInfo()} 176 */ 177 @Deprecated 178 @NonNull getLteVopsSupportInfo()179 public LteVopsSupportInfo getLteVopsSupportInfo() { 180 return mVopsSupportInfo instanceof LteVopsSupportInfo 181 ? (LteVopsSupportInfo) mVopsSupportInfo 182 : new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE, 183 LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE); 184 } 185 186 /** 187 * @return The VOPS (Voice over Packet Switched) support information. 188 * 189 * The instance of {@link LTEVopsSupportInfo}, or {@link NrVopsSupportInfo}, 190 * null if there is there is no VOPS support information available. 191 */ 192 @Nullable getVopsSupportInfo()193 public VopsSupportInfo getVopsSupportInfo() { 194 return mVopsSupportInfo; 195 } 196 } 197