diff options
4 files changed, 184 insertions, 44 deletions
diff --git a/telephony/java/android/telephony/CellConfigLte.java b/telephony/java/android/telephony/CellConfigLte.java new file mode 100644 index 000000000000..35769f04c5ae --- /dev/null +++ b/telephony/java/android/telephony/CellConfigLte.java @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Objects; + +/** + * The container of LTE cell related configs. + * @hide + */ +public class CellConfigLte implements Parcelable { + private final boolean mIsEndcAvailable; + + /** @hide */ + public CellConfigLte() { + mIsEndcAvailable = false; + } + + /** @hide */ + public CellConfigLte(boolean isEndcAvailable) { + mIsEndcAvailable = isEndcAvailable; + } + + /** @hide */ + public CellConfigLte(CellConfigLte config) { + mIsEndcAvailable = config.mIsEndcAvailable; + } + + /** + * Indicates that if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the LTE cell. + * + * Reference: 3GPP TS 36.331 v15.2.2 6.3.1 System information blocks. + * + * @return {@code true} if E-UTRA-NR Dual Connectivity (EN-DC) is supported by the LTE cell. + * + */ + boolean isEndcAvailable() { + return mIsEndcAvailable; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public int hashCode() { + return Objects.hash(mIsEndcAvailable); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof CellConfigLte)) return false; + + CellConfigLte o = (CellConfigLte) other; + return mIsEndcAvailable == o.mIsEndcAvailable; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeBoolean(mIsEndcAvailable); + } + + @Override + public String toString() { + return new StringBuilder().append(this.getClass().getName()) + .append(" :{") + .append(" isEndcAvailable = " + mIsEndcAvailable) + .append(" }") + .toString(); + } + + private CellConfigLte(Parcel in) { + mIsEndcAvailable = in.readBoolean(); + } + + public static final Creator<CellConfigLte> CREATOR = new Creator<CellConfigLte>() { + @Override + public CellConfigLte createFromParcel(Parcel in) { + return new CellConfigLte(in); + } + + @Override + public CellConfigLte[] newArray(int size) { + return new CellConfigLte[0]; + } + }; +} diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java index 389f643e05a4..7d5388b7b7f4 100644 --- a/telephony/java/android/telephony/CellInfoLte.java +++ b/telephony/java/android/telephony/CellInfoLte.java @@ -19,7 +19,8 @@ package android.telephony; import android.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; -import android.telephony.Rlog; + +import java.util.Objects; /** * A {@link CellInfo} representing an LTE cell that provides identity and measurement info. @@ -31,6 +32,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable { private CellIdentityLte mCellIdentityLte; private CellSignalStrengthLte mCellSignalStrengthLte; + private CellConfigLte mCellConfig; /** @hide */ @UnsupportedAppUsage @@ -38,6 +40,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable { super(); mCellIdentityLte = new CellIdentityLte(); mCellSignalStrengthLte = new CellSignalStrengthLte(); + mCellConfig = new CellConfigLte(); } /** @hide */ @@ -45,6 +48,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable { super(ci); this.mCellIdentityLte = ci.mCellIdentityLte.copy(); this.mCellSignalStrengthLte = ci.mCellSignalStrengthLte.copy(); + this.mCellConfig = new CellConfigLte(ci.mCellConfig); } @Override @@ -71,26 +75,37 @@ public final class CellInfoLte extends CellInfo implements Parcelable { mCellSignalStrengthLte = css; } + /** @hide */ + public void setCellConfig(CellConfigLte cellConfig) { + if (DBG) log("setCellConfig: " + cellConfig); + mCellConfig = cellConfig; + } + + /** @hide */ + public CellConfigLte getCellConfig() { + if (DBG) log("getCellConfig: " + mCellConfig); + return mCellConfig; + } + /** * @return hash code */ @Override public int hashCode() { - return super.hashCode() + mCellIdentityLte.hashCode() + mCellSignalStrengthLte.hashCode(); + return Objects.hash( + super.hashCode(), + mCellIdentityLte.hashCode(), + mCellSignalStrengthLte.hashCode(), + mCellConfig.hashCode()); } @Override public boolean equals(Object other) { - if (!super.equals(other)) { - return false; - } - try { - CellInfoLte o = (CellInfoLte) other; - return mCellIdentityLte.equals(o.mCellIdentityLte) - && mCellSignalStrengthLte.equals(o.mCellSignalStrengthLte); - } catch (ClassCastException e) { - return false; - } + if (!(other instanceof CellInfoLte)) return false; + CellInfoLte o = (CellInfoLte) other; + return super.equals(o) && mCellIdentityLte.equals(o.mCellIdentityLte) + && mCellSignalStrengthLte.equals(o.mCellSignalStrengthLte) + && mCellConfig.equals(o.mCellConfig); } @Override @@ -101,6 +116,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable { sb.append(super.toString()); sb.append(" ").append(mCellIdentityLte); sb.append(" ").append(mCellSignalStrengthLte); + sb.append(" ").append(mCellConfig); sb.append("}"); return sb.toString(); @@ -119,6 +135,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable { super.writeToParcel(dest, flags, TYPE_LTE); mCellIdentityLte.writeToParcel(dest, flags); mCellSignalStrengthLte.writeToParcel(dest, flags); + mCellConfig.writeToParcel(dest, flags); } /** @@ -129,6 +146,7 @@ public final class CellInfoLte extends CellInfo implements Parcelable { super(in); mCellIdentityLte = CellIdentityLte.CREATOR.createFromParcel(in); mCellSignalStrengthLte = CellSignalStrengthLte.CREATOR.createFromParcel(in); + mCellConfig = CellConfigLte.CREATOR.createFromParcel(in); if (DBG) log("CellInfoLte(Parcel): " + toString()); } diff --git a/telephony/java/android/telephony/DataSpecificRegistrationStates.java b/telephony/java/android/telephony/DataSpecificRegistrationStates.java index 97e3037b3c90..b6e6cbae8c26 100644 --- a/telephony/java/android/telephony/DataSpecificRegistrationStates.java +++ b/telephony/java/android/telephony/DataSpecificRegistrationStates.java @@ -17,17 +17,40 @@ public class DataSpecificRegistrationStates implements Parcelable{ */ public final int maxDataCalls; - DataSpecificRegistrationStates(int maxDataCalls) { + /** + * Indicates if the use of dual connectivity with NR is restricted. + * Reference: 3GPP TS 24.301 v15.03 section 9.3.3.12A. + */ + public final boolean isDcNrRestricted; + + /** + * Indicates if NR is supported by the selected PLMN. + * + * {@code true} if the bit N is in the PLMN-InfoList-r15 is true and the selected PLMN is + * present in plmn-IdentityList at position N. + * Reference: 3GPP TS 36.331 v15.2.2 section 6.3.1 PLMN-InfoList-r15. + * 3GPP TS 36.331 v15.2.2 section 6.2.2 SystemInformationBlockType1 message. + */ + public final boolean isNrAvailable; + + DataSpecificRegistrationStates( + int maxDataCalls, boolean isDcNrRestricted, boolean isNrAvailable) { this.maxDataCalls = maxDataCalls; + this.isDcNrRestricted = isDcNrRestricted; + this.isNrAvailable = isNrAvailable; } private DataSpecificRegistrationStates(Parcel source) { maxDataCalls = source.readInt(); + isDcNrRestricted = source.readBoolean(); + isNrAvailable = source.readBoolean(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(maxDataCalls); + dest.writeBoolean(isDcNrRestricted); + dest.writeBoolean(isNrAvailable); } @Override @@ -37,24 +60,30 @@ public class DataSpecificRegistrationStates implements Parcelable{ @Override public String toString() { - return "DataSpecificRegistrationStates {" + " mMaxDataCalls=" + maxDataCalls + "}"; + return new StringBuilder().append(this.getClass().getName()) + .append(" :{") + .append(" maxDataCalls = " + maxDataCalls) + .append(" isDcNrRestricted = " + isDcNrRestricted) + .append(" isNrAvailable = " + isNrAvailable) + .append(" }") + .toString(); } @Override public int hashCode() { - return Objects.hash(maxDataCalls); + return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable); } @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || !(o instanceof DataSpecificRegistrationStates)) { - return false; - } + if (!(o instanceof DataSpecificRegistrationStates)) return false; DataSpecificRegistrationStates other = (DataSpecificRegistrationStates) o; - return this.maxDataCalls == other.maxDataCalls; + return this.maxDataCalls == other.maxDataCalls + && this.isDcNrRestricted == other.isDcNrRestricted + && this.isNrAvailable == other.isNrAvailable; } public static final Parcelable.Creator<DataSpecificRegistrationStates> CREATOR = diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java index c3d88989ae96..9b76c60462d6 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.java +++ b/telephony/java/android/telephony/NetworkRegistrationState.java @@ -161,11 +161,9 @@ public class NetworkRegistrationState implements Parcelable { * @hide */ public NetworkRegistrationState(int domain, int transportType, int regState, - int accessNetworkTechnology, int rejectCause, - boolean emergencyOnly, int[] availableServices, - @Nullable CellIdentity cellIdentity, boolean cssSupported, - int roamingIndicator, int systemIsInPrl, - int defaultRoamingIndicator) { + int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, + int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported, + int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) { this(domain, transportType, regState, accessNetworkTechnology, rejectCause, emergencyOnly, availableServices, cellIdentity); @@ -178,13 +176,14 @@ public class NetworkRegistrationState implements Parcelable { * @hide */ public NetworkRegistrationState(int domain, int transportType, int regState, - int accessNetworkTechnology, int rejectCause, - boolean emergencyOnly, int[] availableServices, - @Nullable CellIdentity cellIdentity, int maxDataCalls) { + int accessNetworkTechnology, int rejectCause, boolean emergencyOnly, + int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls, + boolean isDcNrRestricted, boolean isNrAvailable) { this(domain, transportType, regState, accessNetworkTechnology, rejectCause, emergencyOnly, availableServices, cellIdentity); - mDataSpecificStates = new DataSpecificRegistrationStates(maxDataCalls); + mDataSpecificStates = new DataSpecificRegistrationStates( + maxDataCalls, isDcNrRestricted, isNrAvailable); } protected NetworkRegistrationState(Parcel source) { @@ -346,7 +345,7 @@ public class NetworkRegistrationState implements Parcelable { public boolean equals(Object o) { if (this == o) return true; - if (o == null || !(o instanceof NetworkRegistrationState)) { + if (!(o instanceof NetworkRegistrationState)) { return false; } @@ -358,11 +357,10 @@ public class NetworkRegistrationState implements Parcelable { && mAccessNetworkTechnology == other.mAccessNetworkTechnology && mRejectCause == other.mRejectCause && mEmergencyOnly == other.mEmergencyOnly - && (mAvailableServices == other.mAvailableServices - || Arrays.equals(mAvailableServices, other.mAvailableServices)) - && equals(mCellIdentity, other.mCellIdentity) - && equals(mVoiceSpecificStates, other.mVoiceSpecificStates) - && equals(mDataSpecificStates, other.mDataSpecificStates); + && Arrays.equals(mAvailableServices, other.mAvailableServices) + && Objects.equals(mCellIdentity, other.mCellIdentity) + && Objects.equals(mVoiceSpecificStates, other.mVoiceSpecificStates) + && Objects.equals(mDataSpecificStates, other.mDataSpecificStates); } @Override @@ -392,14 +390,4 @@ public class NetworkRegistrationState implements Parcelable { return new NetworkRegistrationState[size]; } }; - - private static boolean equals(Object o1, Object o2) { - if (o1 == o2) { - return true; - } else if (o1 == null) { - return false; - } else { - return o1.equals(o2); - } - } } |