diff --git a/api/current.txt b/api/current.txt index dcae81fa53e89..6ddabaf03c09f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -44996,6 +44996,7 @@ package android.telephony { public final class CellIdentityNr extends android.telephony.CellIdentity { method @NonNull public java.util.List getAdditionalPlmns(); + method public int getBand(); method @Nullable public String getMccString(); method @Nullable public String getMncString(); method public long getNci(); diff --git a/api/system-current.txt b/api/system-current.txt index a92fd515e46e2..d5ba70c472167 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8391,6 +8391,13 @@ package android.telephony { field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff } + public static final class AccessNetworkConstants.NgranBands { + method public static int getFrequencyRangeGroup(int); + field public static final int FREQUENCY_RANGE_GROUP_1 = 1; // 0x1 + field public static final int FREQUENCY_RANGE_GROUP_2 = 2; // 0x2 + field public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; // 0x0 + } + public final class CallAttributes implements android.os.Parcelable { ctor public CallAttributes(@NonNull android.telephony.PreciseCallState, int, @NonNull android.telephony.CallQuality); method public int describeContents(); diff --git a/api/test-current.txt b/api/test-current.txt index b9d53dbaf5ceb..9a331a2f85215 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3036,6 +3036,13 @@ package android.telephony { field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff } + public static final class AccessNetworkConstants.NgranBands { + method public static int getFrequencyRangeGroup(int); + field public static final int FREQUENCY_RANGE_GROUP_1 = 1; // 0x1 + field public static final int FREQUENCY_RANGE_GROUP_2 = 2; // 0x2 + field public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; // 0x0 + } + public final class CallQuality implements android.os.Parcelable { ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); method public int describeContents(); diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java index b1d647fec0c58..610eef80c571f 100644 --- a/telephony/java/android/telephony/AccessNetworkConstants.java +++ b/telephony/java/android/telephony/AccessNetworkConstants.java @@ -317,6 +317,159 @@ public final class AccessNetworkConstants { public static final int BAND_260 = 260; public static final int BAND_261 = 261; + /** + * NR Bands + * + * @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"BAND_"}, + value = {BAND_1, + BAND_2, + BAND_3, + BAND_5, + BAND_7, + BAND_8, + BAND_12, + BAND_14, + BAND_18, + BAND_20, + BAND_25, + BAND_28, + BAND_29, + BAND_30, + BAND_34, + BAND_38, + BAND_39, + BAND_40, + BAND_41, + BAND_48, + BAND_50, + BAND_51, + BAND_65, + BAND_66, + BAND_70, + BAND_71, + BAND_74, + BAND_75, + BAND_76, + BAND_77, + BAND_78, + BAND_79, + BAND_80, + BAND_81, + BAND_82, + BAND_83, + BAND_84, + BAND_86, + BAND_90, + BAND_257, + BAND_258, + BAND_260, + BAND_261}) + public @interface NgranBand {} + + /** + * Unknown NR frequency. + * + * @hide + */ + @SystemApi + @TestApi + public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; + + /** + * NR frequency group 1 defined in 3GPP TS 38.101-1 table 5.2-1 + * + * @hide + */ + @SystemApi + @TestApi + public static final int FREQUENCY_RANGE_GROUP_1 = 1; + + /** + * NR frequency group 2 defined in 3GPP TS 38.101-2 table 5.2-1 + * + * @hide + */ + @SystemApi + @TestApi + public static final int FREQUENCY_RANGE_GROUP_2 = 2; + + /** + * Radio frequency range group + * + * @hide + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"FREQUENCY_RANGE_GROUP_"}, + value = { + FREQUENCY_RANGE_GROUP_UNKNOWN, + FREQUENCY_RANGE_GROUP_1, + FREQUENCY_RANGE_GROUP_2}) + public @interface FrequencyRangeGroup {} + + /** + * Get frequency range group + * + * @param band NR band + * @return The frequency range group + * + * @hide + */ + @SystemApi + @TestApi + public static @FrequencyRangeGroup int getFrequencyRangeGroup(@NgranBand int band) { + switch (band) { + case BAND_1: + case BAND_2: + case BAND_3: + case BAND_5: + case BAND_7: + case BAND_8: + case BAND_12: + case BAND_14: + case BAND_18: + case BAND_20: + case BAND_25: + case BAND_28: + case BAND_29: + case BAND_30: + case BAND_34: + case BAND_38: + case BAND_39: + case BAND_40: + case BAND_41: + case BAND_48: + case BAND_50: + case BAND_51: + case BAND_65: + case BAND_66: + case BAND_70: + case BAND_71: + case BAND_74: + case BAND_75: + case BAND_76: + case BAND_77: + case BAND_78: + case BAND_79: + case BAND_80: + case BAND_81: + case BAND_82: + case BAND_83: + case BAND_84: + case BAND_86: + case BAND_90: + return FREQUENCY_RANGE_GROUP_1; + case BAND_257: + case BAND_258: + case BAND_260: + case BAND_261: + return FREQUENCY_RANGE_GROUP_2; + default: + return FREQUENCY_RANGE_GROUP_UNKNOWN; + } + }; + /** @hide */ private NgranBands() {} } diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java index 0034a0519ad00..40927a13919aa 100644 --- a/telephony/java/android/telephony/CellIdentityNr.java +++ b/telephony/java/android/telephony/CellIdentityNr.java @@ -20,6 +20,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; +import android.telephony.AccessNetworkConstants.NgranBands.NgranBand; import android.telephony.gsm.GsmCellLocation; import java.util.Collections; @@ -41,6 +42,7 @@ public final class CellIdentityNr extends CellIdentity { private final int mPci; private final int mTac; private final long mNci; + private final int mBand; // a list of additional PLMN-IDs reported for this cell private final List mAdditionalPlmns; @@ -50,6 +52,7 @@ public final class CellIdentityNr extends CellIdentity { * @param pci Physical Cell Id in range [0, 1007]. * @param tac 16-bit Tracking Area Code. * @param nrArfcn NR Absolute Radio Frequency Channel Number, in range [0, 3279165]. + * @param band Band number defined in 3GPP TS 38.101-1 and TS 38.101-2. * @param mccStr 3-digit Mobile Country Code in string format. * @param mncStr 2 or 3-digit Mobile Network Code in string format. * @param nci The 36-bit NR Cell Identity in range [0, 68719476735]. @@ -59,25 +62,28 @@ public final class CellIdentityNr extends CellIdentity { * * @hide */ - public CellIdentityNr(int pci, int tac, int nrArfcn, String mccStr, String mncStr, - long nci, String alphal, String alphas, List additionalPlmns) { + public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand int band, String mccStr, + String mncStr, long nci, String alphal, String alphas, List additionalPlmns) { super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas); mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN); + mBand = inRangeOrUnavailable(band, AccessNetworkConstants.NgranBands.BAND_1, + AccessNetworkConstants.NgranBands.BAND_261); mNci = inRangeOrUnavailable(nci, 0, MAX_NCI); mAdditionalPlmns = additionalPlmns; } /** @hide */ public CellIdentityNr(android.hardware.radio.V1_4.CellIdentityNr cid) { - this(cid.pci, cid.tac, cid.nrarfcn, cid.mcc, cid.mnc, cid.nci, cid.operatorNames.alphaLong, - cid.operatorNames.alphaShort, Collections.emptyList()); + this(cid.pci, cid.tac, cid.nrarfcn, 0, cid.mcc, cid.mnc, cid.nci, + cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, + Collections.emptyList()); } /** @hide */ public CellIdentityNr(android.hardware.radio.V1_5.CellIdentityNr cid) { - this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.base.mcc, cid.base.mnc, + this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.band, cid.base.mcc, cid.base.mnc, cid.base.nci, cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort, cid.additionalPlmns); } @@ -85,8 +91,9 @@ public final class CellIdentityNr extends CellIdentity { /** @hide */ @Override public @NonNull CellIdentityNr sanitizeLocationInfo() { - return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, - mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort, mAdditionalPlmns); + return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mNrArfcn, + mBand, mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort, + mAdditionalPlmns); } /** @@ -102,7 +109,7 @@ public final class CellIdentityNr extends CellIdentity { @Override public int hashCode() { return Objects.hash(super.hashCode(), mPci, mTac, - mNrArfcn, mNci, mAdditionalPlmns.hashCode()); + mNrArfcn, mBand, mNci, mAdditionalPlmns.hashCode()); } @Override @@ -113,7 +120,8 @@ public final class CellIdentityNr extends CellIdentity { CellIdentityNr o = (CellIdentityNr) other; return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn - && mNci == o.mNci && mAdditionalPlmns.equals(o.mAdditionalPlmns); + && mBand == o.mBand && mNci == o.mNci + && mAdditionalPlmns.equals(o.mAdditionalPlmns); } /** @@ -139,6 +147,19 @@ public final class CellIdentityNr extends CellIdentity { return mNrArfcn; } + /** + * Get band of the cell + * + * Reference: TS 38.101-1 table 5.2-1 + * Reference: TS 38.101-2 table 5.2-1 + * + * @return band number or {@link CellInfo@UNAVAILABLE} if not available. + */ + @NgranBand + public int getBand() { + return mBand; + } + /** * Get the physical cell id. * @return Integer value in range [0, 1007] or {@link CellInfo#UNAVAILABLE} if unknown. @@ -193,6 +214,7 @@ public final class CellIdentityNr extends CellIdentity { .append(" mPci = ").append(mPci) .append(" mTac = ").append(mTac) .append(" mNrArfcn = ").append(mNrArfcn) + .append(" mBand = ").append(mBand) .append(" mMcc = ").append(mMccStr) .append(" mMnc = ").append(mMncStr) .append(" mNci = ").append(mNci) @@ -209,6 +231,7 @@ public final class CellIdentityNr extends CellIdentity { dest.writeInt(mPci); dest.writeInt(mTac); dest.writeInt(mNrArfcn); + dest.writeInt(mBand); dest.writeLong(mNci); dest.writeList(mAdditionalPlmns); } @@ -219,6 +242,7 @@ public final class CellIdentityNr extends CellIdentity { mPci = in.readInt(); mTac = in.readInt(); mNrArfcn = in.readInt(); + mBand = in.readInt(); mNci = in.readLong(); mAdditionalPlmns = in.readArrayList(null); }