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.annotation.TestApi; 23 import android.os.Parcel; 24 import android.os.Parcelable; 25 26 import java.util.Objects; 27 28 29 /** 30 * Class that stores information specific to data network registration. 31 * @hide 32 */ 33 @SystemApi 34 @TestApi 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 LTE VoPS and LTE Emergency bearer support 74 */ 75 @Nullable 76 private final LteVopsSupportInfo mLteVopsSupportInfo; 77 78 /** 79 * @hide 80 */ DataSpecificRegistrationInfo( int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, boolean isEnDcAvailable, @Nullable LteVopsSupportInfo lteVops)81 DataSpecificRegistrationInfo( 82 int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable, 83 boolean isEnDcAvailable, @Nullable LteVopsSupportInfo lteVops) { 84 this.maxDataCalls = maxDataCalls; 85 this.isDcNrRestricted = isDcNrRestricted; 86 this.isNrAvailable = isNrAvailable; 87 this.isEnDcAvailable = isEnDcAvailable; 88 this.mLteVopsSupportInfo = lteVops; 89 } 90 91 /** 92 * Constructor from another data specific registration info 93 * 94 * @param dsri another data specific registration info 95 * @hide 96 */ DataSpecificRegistrationInfo(@onNull DataSpecificRegistrationInfo dsri)97 DataSpecificRegistrationInfo(@NonNull DataSpecificRegistrationInfo dsri) { 98 maxDataCalls = dsri.maxDataCalls; 99 isDcNrRestricted = dsri.isDcNrRestricted; 100 isNrAvailable = dsri.isNrAvailable; 101 isEnDcAvailable = dsri.isEnDcAvailable; 102 mLteVopsSupportInfo = dsri.mLteVopsSupportInfo; 103 } 104 DataSpecificRegistrationInfo( Parcel source)105 private DataSpecificRegistrationInfo(/* @NonNull */ Parcel source) { 106 maxDataCalls = source.readInt(); 107 isDcNrRestricted = source.readBoolean(); 108 isNrAvailable = source.readBoolean(); 109 isEnDcAvailable = source.readBoolean(); 110 mLteVopsSupportInfo = LteVopsSupportInfo.CREATOR.createFromParcel(source); 111 } 112 113 @Override writeToParcel( Parcel dest, int flags)114 public void writeToParcel(/* @NonNull */ Parcel dest, int flags) { 115 dest.writeInt(maxDataCalls); 116 dest.writeBoolean(isDcNrRestricted); 117 dest.writeBoolean(isNrAvailable); 118 dest.writeBoolean(isEnDcAvailable); 119 mLteVopsSupportInfo.writeToParcel(dest, flags); 120 } 121 122 @Override describeContents()123 public int describeContents() { 124 return 0; 125 } 126 127 @NonNull 128 @Override toString()129 public String toString() { 130 return new StringBuilder().append(this.getClass().getName()) 131 .append(" :{") 132 .append(" maxDataCalls = " + maxDataCalls) 133 .append(" isDcNrRestricted = " + isDcNrRestricted) 134 .append(" isNrAvailable = " + isNrAvailable) 135 .append(" isEnDcAvailable = " + isEnDcAvailable) 136 .append(" " + mLteVopsSupportInfo) 137 .append(" }") 138 .toString(); 139 } 140 141 @Override hashCode()142 public int hashCode() { 143 return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable, isEnDcAvailable, 144 mLteVopsSupportInfo); 145 } 146 147 @Override equals(@ullable Object o)148 public boolean equals(@Nullable Object o) { 149 if (this == o) return true; 150 151 if (!(o instanceof DataSpecificRegistrationInfo)) return false; 152 153 DataSpecificRegistrationInfo other = (DataSpecificRegistrationInfo) o; 154 return this.maxDataCalls == other.maxDataCalls 155 && this.isDcNrRestricted == other.isDcNrRestricted 156 && this.isNrAvailable == other.isNrAvailable 157 && this.isEnDcAvailable == other.isEnDcAvailable 158 && Objects.equals(mLteVopsSupportInfo, other.mLteVopsSupportInfo); 159 } 160 161 public static final @NonNull Parcelable.Creator<DataSpecificRegistrationInfo> CREATOR = 162 new Parcelable.Creator<DataSpecificRegistrationInfo>() { 163 @Override 164 public DataSpecificRegistrationInfo createFromParcel(Parcel source) { 165 return new DataSpecificRegistrationInfo(source); 166 } 167 168 @Override 169 public DataSpecificRegistrationInfo[] newArray(int size) { 170 return new DataSpecificRegistrationInfo[size]; 171 } 172 }; 173 174 /** 175 * @return The LTE VOPS (Voice over Packet Switched) support information 176 */ 177 @NonNull getLteVopsSupportInfo()178 public LteVopsSupportInfo getLteVopsSupportInfo() { 179 return mLteVopsSupportInfo; 180 } 181 182 } 183