Merge "Add 5G NSA status to ServiceSate"
This commit is contained in:
@@ -70,6 +70,43 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
/** Registered on roaming network */
|
/** Registered on roaming network */
|
||||||
public static final int REG_STATE_ROAMING = 5;
|
public static final int REG_STATE_ROAMING = 5;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef(prefix = "NR_STATUS_",
|
||||||
|
value = {NR_STATUS_NONE, NR_STATUS_RESTRICTED, NR_STATUS_NOT_RESTRICTED,
|
||||||
|
NR_STATUS_CONNECTED})
|
||||||
|
public @interface NRStatus {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The device isn't camped on an LTE cell or the LTE cell doesn't support E-UTRA-NR
|
||||||
|
* Dual Connectivity(EN-DC).
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int NR_STATUS_NONE = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) but
|
||||||
|
* either the use of dual connectivity with NR(DCNR) is restricted or NR is not supported by
|
||||||
|
* the selected PLMN.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int NR_STATUS_RESTRICTED = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) and both
|
||||||
|
* the use of dual connectivity with NR(DCNR) is not restricted and NR is supported by the
|
||||||
|
* selected PLMN.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int NR_STATUS_NOT_RESTRICTED = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The device is camped on an LTE cell that supports E-UTRA-NR Dual Connectivity(EN-DC) and
|
||||||
|
* also connected to at least one 5G cell as a secondary serving cell.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int NR_STATUS_CONNECTED = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported service type
|
* Supported service type
|
||||||
* @hide
|
* @hide
|
||||||
@@ -104,6 +141,9 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
|
|
||||||
private int mAccessNetworkTechnology;
|
private int mAccessNetworkTechnology;
|
||||||
|
|
||||||
|
@NRStatus
|
||||||
|
private int mNrStatus;
|
||||||
|
|
||||||
private final int mRejectCause;
|
private final int mRejectCause;
|
||||||
|
|
||||||
private final boolean mEmergencyOnly;
|
private final boolean mEmergencyOnly;
|
||||||
@@ -154,6 +194,7 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
mAvailableServices = availableServices;
|
mAvailableServices = availableServices;
|
||||||
mCellIdentity = cellIdentity;
|
mCellIdentity = cellIdentity;
|
||||||
mEmergencyOnly = emergencyOnly;
|
mEmergencyOnly = emergencyOnly;
|
||||||
|
mNrStatus = NR_STATUS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,6 +241,7 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
VoiceSpecificRegistrationStates.class.getClassLoader());
|
VoiceSpecificRegistrationStates.class.getClassLoader());
|
||||||
mDataSpecificStates = source.readParcelable(
|
mDataSpecificStates = source.readParcelable(
|
||||||
DataSpecificRegistrationStates.class.getClassLoader());
|
DataSpecificRegistrationStates.class.getClassLoader());
|
||||||
|
mNrStatus = source.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -212,6 +254,19 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public @Domain int getDomain() { return mDomain; }
|
public @Domain int getDomain() { return mDomain; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the 5G NR connection status.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public @NRStatus int getNrStatus() {
|
||||||
|
return mNrStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void setNrStatus(@NRStatus int nrStatus) {
|
||||||
|
mNrStatus = nrStatus;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The registration state.
|
* @return The registration state.
|
||||||
*/
|
*/
|
||||||
@@ -315,6 +370,19 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
return "Unknown reg state " + regState;
|
return "Unknown reg state " + regState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String nrStatusToString(@NRStatus int nrStatus) {
|
||||||
|
switch (nrStatus) {
|
||||||
|
case NR_STATUS_RESTRICTED:
|
||||||
|
return "RESTRICTED";
|
||||||
|
case NR_STATUS_NOT_RESTRICTED:
|
||||||
|
return "NOT_RESTRICTED";
|
||||||
|
case NR_STATUS_CONNECTED:
|
||||||
|
return "CONNECTED";
|
||||||
|
default:
|
||||||
|
return "NONE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new StringBuilder("NetworkRegistrationState{")
|
return new StringBuilder("NetworkRegistrationState{")
|
||||||
@@ -330,6 +398,7 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
.append(" cellIdentity=").append(mCellIdentity)
|
.append(" cellIdentity=").append(mCellIdentity)
|
||||||
.append(" voiceSpecificStates=").append(mVoiceSpecificStates)
|
.append(" voiceSpecificStates=").append(mVoiceSpecificStates)
|
||||||
.append(" dataSpecificStates=").append(mDataSpecificStates)
|
.append(" dataSpecificStates=").append(mDataSpecificStates)
|
||||||
|
.append(" nrStatus=").append(nrStatusToString(mNrStatus))
|
||||||
.append("}").toString();
|
.append("}").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +406,7 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mDomain, mTransportType, mRegState, mRoamingType,
|
return Objects.hash(mDomain, mTransportType, mRegState, mRoamingType,
|
||||||
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
||||||
mCellIdentity, mVoiceSpecificStates, mDataSpecificStates);
|
mCellIdentity, mVoiceSpecificStates, mDataSpecificStates, mNrStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -359,7 +428,8 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
&& Arrays.equals(mAvailableServices, other.mAvailableServices)
|
&& Arrays.equals(mAvailableServices, other.mAvailableServices)
|
||||||
&& Objects.equals(mCellIdentity, other.mCellIdentity)
|
&& Objects.equals(mCellIdentity, other.mCellIdentity)
|
||||||
&& Objects.equals(mVoiceSpecificStates, other.mVoiceSpecificStates)
|
&& Objects.equals(mVoiceSpecificStates, other.mVoiceSpecificStates)
|
||||||
&& Objects.equals(mDataSpecificStates, other.mDataSpecificStates);
|
&& Objects.equals(mDataSpecificStates, other.mDataSpecificStates)
|
||||||
|
&& mNrStatus == other.mNrStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -375,6 +445,7 @@ public class NetworkRegistrationState implements Parcelable {
|
|||||||
dest.writeParcelable(mCellIdentity, 0);
|
dest.writeParcelable(mCellIdentity, 0);
|
||||||
dest.writeParcelable(mVoiceSpecificStates, 0);
|
dest.writeParcelable(mVoiceSpecificStates, 0);
|
||||||
dest.writeParcelable(mDataSpecificStates, 0);
|
dest.writeParcelable(mDataSpecificStates, 0);
|
||||||
|
dest.writeInt(mNrStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<NetworkRegistrationState> CREATOR =
|
public static final Parcelable.Creator<NetworkRegistrationState> CREATOR =
|
||||||
|
|||||||
@@ -83,7 +83,45 @@ public class ServiceState implements Parcelable {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({DUPLEX_MODE_UNKNOWN, DUPLEX_MODE_FDD, DUPLEX_MODE_TDD})
|
@IntDef(prefix = "FREQUENCY_RANGE_",
|
||||||
|
value = {FREQUENCY_RANGE_UNKNOWN, FREQUENCY_RANGE_LOW, FREQUENCY_RANGE_MID,
|
||||||
|
FREQUENCY_RANGE_HIGH, FREQUENCY_RANGE_MMWAVE})
|
||||||
|
public @interface FrequencyRange {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates frequency range is unknown.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int FREQUENCY_RANGE_UNKNOWN = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the frequency range is below 1GHz.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int FREQUENCY_RANGE_LOW = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the frequency range is between 1GHz to 3GHz.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int FREQUENCY_RANGE_MID = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the frequency range is between 3GHz and 6GHz.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int FREQUENCY_RANGE_HIGH = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the frequency range is above 6GHz (millimeter wave frequency).
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int FREQUENCY_RANGE_MMWAVE = 4;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef(prefix = "DUPLEX_MODE_",
|
||||||
|
value = {DUPLEX_MODE_UNKNOWN, DUPLEX_MODE_FDD, DUPLEX_MODE_TDD})
|
||||||
public @interface DuplexMode {}
|
public @interface DuplexMode {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,6 +321,8 @@ public class ServiceState implements Parcelable {
|
|||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
private boolean mIsUsingCarrierAggregation;
|
private boolean mIsUsingCarrierAggregation;
|
||||||
|
|
||||||
|
@FrequencyRange
|
||||||
|
private int mNrFrequencyRange;
|
||||||
private int mChannelNumber;
|
private int mChannelNumber;
|
||||||
private int[] mCellBandwidths = new int[0];
|
private int[] mCellBandwidths = new int[0];
|
||||||
|
|
||||||
@@ -375,6 +415,7 @@ public class ServiceState implements Parcelable {
|
|||||||
mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost;
|
mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost;
|
||||||
mNetworkRegistrationStates = s.mNetworkRegistrationStates == null ? null :
|
mNetworkRegistrationStates = s.mNetworkRegistrationStates == null ? null :
|
||||||
new ArrayList<>(s.mNetworkRegistrationStates);
|
new ArrayList<>(s.mNetworkRegistrationStates);
|
||||||
|
mNrFrequencyRange = s.mNrFrequencyRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,6 +447,7 @@ public class ServiceState implements Parcelable {
|
|||||||
in.readList(mNetworkRegistrationStates, NetworkRegistrationState.class.getClassLoader());
|
in.readList(mNetworkRegistrationStates, NetworkRegistrationState.class.getClassLoader());
|
||||||
mChannelNumber = in.readInt();
|
mChannelNumber = in.readInt();
|
||||||
mCellBandwidths = in.createIntArray();
|
mCellBandwidths = in.createIntArray();
|
||||||
|
mNrFrequencyRange = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel out, int flags) {
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
@@ -433,6 +475,7 @@ public class ServiceState implements Parcelable {
|
|||||||
out.writeList(mNetworkRegistrationStates);
|
out.writeList(mNetworkRegistrationStates);
|
||||||
out.writeInt(mChannelNumber);
|
out.writeInt(mChannelNumber);
|
||||||
out.writeIntArray(mCellBandwidths);
|
out.writeIntArray(mCellBandwidths);
|
||||||
|
out.writeInt(mNrFrequencyRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
@@ -792,7 +835,8 @@ public class ServiceState implements Parcelable {
|
|||||||
mIsEmergencyOnly,
|
mIsEmergencyOnly,
|
||||||
mIsUsingCarrierAggregation,
|
mIsUsingCarrierAggregation,
|
||||||
mLteEarfcnRsrpBoost,
|
mLteEarfcnRsrpBoost,
|
||||||
mNetworkRegistrationStates);
|
mNetworkRegistrationStates,
|
||||||
|
mNrFrequencyRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -823,7 +867,8 @@ public class ServiceState implements Parcelable {
|
|||||||
&& mIsUsingCarrierAggregation == s.mIsUsingCarrierAggregation)
|
&& mIsUsingCarrierAggregation == s.mIsUsingCarrierAggregation)
|
||||||
&& (mNetworkRegistrationStates == null ? s.mNetworkRegistrationStates == null :
|
&& (mNetworkRegistrationStates == null ? s.mNetworkRegistrationStates == null :
|
||||||
s.mNetworkRegistrationStates != null &&
|
s.mNetworkRegistrationStates != null &&
|
||||||
mNetworkRegistrationStates.containsAll(s.mNetworkRegistrationStates));
|
mNetworkRegistrationStates.containsAll(s.mNetworkRegistrationStates))
|
||||||
|
&& mNrFrequencyRange == s.mNrFrequencyRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -958,6 +1003,7 @@ public class ServiceState implements Parcelable {
|
|||||||
.append(", mIsUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
|
.append(", mIsUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
|
||||||
.append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost)
|
.append(", mLteEarfcnRsrpBoost=").append(mLteEarfcnRsrpBoost)
|
||||||
.append(", mNetworkRegistrationStates=").append(mNetworkRegistrationStates)
|
.append(", mNetworkRegistrationStates=").append(mNetworkRegistrationStates)
|
||||||
|
.append(", mNrFrequencyRange=").append(mNrFrequencyRange)
|
||||||
.append("}").toString();
|
.append("}").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -987,6 +1033,7 @@ public class ServiceState implements Parcelable {
|
|||||||
mIsUsingCarrierAggregation = false;
|
mIsUsingCarrierAggregation = false;
|
||||||
mLteEarfcnRsrpBoost = 0;
|
mLteEarfcnRsrpBoost = 0;
|
||||||
mNetworkRegistrationStates = new ArrayList<>();
|
mNetworkRegistrationStates = new ArrayList<>();
|
||||||
|
mNrFrequencyRange = FREQUENCY_RANGE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStateOutOfService() {
|
public void setStateOutOfService() {
|
||||||
@@ -1225,6 +1272,7 @@ public class ServiceState implements Parcelable {
|
|||||||
m.putInt("LteEarfcnRsrpBoost", mLteEarfcnRsrpBoost);
|
m.putInt("LteEarfcnRsrpBoost", mLteEarfcnRsrpBoost);
|
||||||
m.putInt("ChannelNumber", mChannelNumber);
|
m.putInt("ChannelNumber", mChannelNumber);
|
||||||
m.putIntArray("CellBandwidths", mCellBandwidths);
|
m.putIntArray("CellBandwidths", mCellBandwidths);
|
||||||
|
m.putInt("mNrFrequencyRange", mNrFrequencyRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -1288,6 +1336,22 @@ public class ServiceState implements Parcelable {
|
|||||||
mIsUsingCarrierAggregation = ca;
|
mIsUsingCarrierAggregation = ca;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the frequency range of 5G NR.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public @FrequencyRange int getNrFrequencyRange() {
|
||||||
|
return mNrFrequencyRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param nrFrequencyRange the frequency range of 5G NR.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setNrFrequencyRange(@FrequencyRange int nrFrequencyRange) {
|
||||||
|
mNrFrequencyRange = nrFrequencyRange;
|
||||||
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public int getLteEarfcnRsrpBoost() {
|
public int getLteEarfcnRsrpBoost() {
|
||||||
return mLteEarfcnRsrpBoost;
|
return mLteEarfcnRsrpBoost;
|
||||||
|
|||||||
Reference in New Issue
Block a user