Merge "Add Voice / Data network specific reg states."

am: ffdbbc533c

Change-Id: I28d44f657a60ec0f823524c3b5107bc3f4808bb1
This commit is contained in:
Xiangyu/Malcolm Chen
2018-01-26 03:29:53 +00:00
committed by android-build-merger
4 changed files with 264 additions and 2 deletions

View File

@@ -3987,7 +3987,9 @@ package android.telephony {
method public int describeContents();
method public int getAccessNetworkTechnology();
method public int[] getAvailableServices();
method public android.telephony.CellIdentity getCellIdentity();
method public int getDomain();
method public int getReasonForDenial();
method public int getRegState();
method public int getTransportType();
method public boolean isEmergencyEnabled();

View File

@@ -0,0 +1,72 @@
package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* Class that stores information specific to data network registration.
* @hide
*/
public class DataSpecificRegistrationStates implements Parcelable{
/**
* The maximum number of simultaneous Data Calls that
* must be established using setupDataCall().
*/
public final int maxDataCalls;
DataSpecificRegistrationStates(int maxDataCalls) {
this.maxDataCalls = maxDataCalls;
}
private DataSpecificRegistrationStates(Parcel source) {
maxDataCalls = source.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(maxDataCalls);
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
return "DataSpecificRegistrationStates {" + " mMaxDataCalls=" + maxDataCalls + "}";
}
@Override
public int hashCode() {
return Objects.hash(maxDataCalls);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof DataSpecificRegistrationStates)) {
return false;
}
DataSpecificRegistrationStates other = (DataSpecificRegistrationStates) o;
return this.maxDataCalls == other.maxDataCalls;
}
public static final Parcelable.Creator<DataSpecificRegistrationStates> CREATOR =
new Parcelable.Creator<DataSpecificRegistrationStates>() {
@Override
public DataSpecificRegistrationStates createFromParcel(Parcel source) {
return new DataSpecificRegistrationStates(source);
}
@Override
public DataSpecificRegistrationStates[] newArray(int size) {
return new DataSpecificRegistrationStates[size];
}
};
}

View File

@@ -105,6 +105,11 @@ public class NetworkRegistrationState implements Parcelable {
@Nullable
private final CellIdentity mCellIdentity;
@Nullable
private VoiceSpecificRegistrationStates mVoiceSpecificStates;
@Nullable
private DataSpecificRegistrationStates mDataSpecificStates;
/**
* @param transportType Transport type. Must be {@link AccessNetworkConstants.TransportType}
@@ -128,6 +133,34 @@ public class NetworkRegistrationState implements Parcelable {
mEmergencyOnly = emergencyOnly;
}
/**
* Constructor for voice network registration states.
* @hide
*/
public NetworkRegistrationState(int transportType, int domain, int regState,
int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported,
int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) {
this(transportType, domain, regState, accessNetworkTechnology,
reasonForDenial, emergencyOnly, availableServices, cellIdentity);
mVoiceSpecificStates = new VoiceSpecificRegistrationStates(cssSupported, roamingIndicator,
systemIsInPrl, defaultRoamingIndicator);
}
/**
* Constructor for data network registration states.
* @hide
*/
public NetworkRegistrationState(int transportType, int domain, int regState,
int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls) {
this(transportType, domain, regState, accessNetworkTechnology,
reasonForDenial, emergencyOnly, availableServices, cellIdentity);
mDataSpecificStates = new DataSpecificRegistrationStates(maxDataCalls);
}
protected NetworkRegistrationState(Parcel source) {
mTransportType = source.readInt();
mDomain = source.readInt();
@@ -137,6 +170,10 @@ public class NetworkRegistrationState implements Parcelable {
mEmergencyOnly = source.readBoolean();
mAvailableServices = source.createIntArray();
mCellIdentity = source.readParcelable(CellIdentity.class.getClassLoader());
mVoiceSpecificStates = source.readParcelable(
VoiceSpecificRegistrationStates.class.getClassLoader());
mDataSpecificStates = source.readParcelable(
DataSpecificRegistrationStates.class.getClassLoader());
}
/**
@@ -173,6 +210,36 @@ public class NetworkRegistrationState implements Parcelable {
return mAccessNetworkTechnology;
}
/**
* @return Reason for denial from network.
*/
public int getReasonForDenial() {
return mReasonForDenial;
}
/**
* @return The cell information.
*/
public CellIdentity getCellIdentity() {
return mCellIdentity;
}
/**
* @hide
*/
@Nullable
public VoiceSpecificRegistrationStates getVoiceSpecificStates() {
return mVoiceSpecificStates;
}
/**
* @hide
*/
@Nullable
public DataSpecificRegistrationStates getDataSpecificStates() {
return mDataSpecificStates;
}
@Override
public int describeContents() {
return 0;
@@ -202,13 +269,16 @@ public class NetworkRegistrationState implements Parcelable {
.append(" emergencyEnabled=").append(mEmergencyOnly)
.append(" supportedServices=").append(mAvailableServices)
.append(" cellIdentity=").append(mCellIdentity)
.append(" voiceSpecificStates=").append(mVoiceSpecificStates)
.append(" dataSpecificStates=").append(mDataSpecificStates)
.append("}").toString();
}
@Override
public int hashCode() {
return Objects.hash(mTransportType, mDomain, mRegState, mAccessNetworkTechnology,
mReasonForDenial, mEmergencyOnly, mAvailableServices, mCellIdentity);
mReasonForDenial, mEmergencyOnly, mAvailableServices, mCellIdentity,
mVoiceSpecificStates, mDataSpecificStates);
}
@Override
@@ -228,7 +298,9 @@ public class NetworkRegistrationState implements Parcelable {
&& mEmergencyOnly == other.mEmergencyOnly
&& (mAvailableServices == other.mAvailableServices
|| Arrays.equals(mAvailableServices, other.mAvailableServices))
&& mCellIdentity == other.mCellIdentity;
&& mCellIdentity == other.mCellIdentity
&& mVoiceSpecificStates == other.mVoiceSpecificStates
&& mDataSpecificStates == other.mDataSpecificStates;
}
@Override
@@ -241,6 +313,8 @@ public class NetworkRegistrationState implements Parcelable {
dest.writeBoolean(mEmergencyOnly);
dest.writeIntArray(mAvailableServices);
dest.writeParcelable(mCellIdentity, 0);
dest.writeParcelable(mVoiceSpecificStates, 0);
dest.writeParcelable(mDataSpecificStates, 0);
}
public static final Parcelable.Creator<NetworkRegistrationState> CREATOR =

View File

@@ -0,0 +1,114 @@
package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* Class that stores information specific to voice network registration.
* @hide
*/
public class VoiceSpecificRegistrationStates implements Parcelable{
/**
* oncurrent services support indicator. if
* registered on a CDMA system.
* false - Concurrent services not supported,
* true - Concurrent services supported
*/
public final boolean cssSupported;
/**
* TSB-58 Roaming Indicator if registered
* on a CDMA or EVDO system or -1 if not.
* Valid values are 0-255.
*/
public final int roamingIndicator;
/**
* indicates whether the current system is in the
* PRL if registered on a CDMA or EVDO system or -1 if
* not. 0=not in the PRL, 1=in the PRL
*/
public final int systemIsInPrl;
/**
* default Roaming Indicator from the PRL,
* if registered on a CDMA or EVDO system or -1 if not.
* Valid values are 0-255.
*/
public final int defaultRoamingIndicator;
VoiceSpecificRegistrationStates(boolean cssSupported, int roamingIndicator, int systemIsInPrl,
int defaultRoamingIndicator) {
this.cssSupported = cssSupported;
this.roamingIndicator = roamingIndicator;
this.systemIsInPrl = systemIsInPrl;
this.defaultRoamingIndicator = defaultRoamingIndicator;
}
private VoiceSpecificRegistrationStates(Parcel source) {
this.cssSupported = source.readBoolean();
this.roamingIndicator = source.readInt();
this.systemIsInPrl = source.readInt();
this.defaultRoamingIndicator = source.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeBoolean(cssSupported);
dest.writeInt(roamingIndicator);
dest.writeInt(systemIsInPrl);
dest.writeInt(defaultRoamingIndicator);
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
return "VoiceSpecificRegistrationStates {"
+ " mCssSupported=" + cssSupported
+ " mRoamingIndicator=" + roamingIndicator
+ " mSystemIsInPrl=" + systemIsInPrl
+ " mDefaultRoamingIndicator=" + defaultRoamingIndicator + "}";
}
@Override
public int hashCode() {
return Objects.hash(cssSupported, roamingIndicator, systemIsInPrl,
defaultRoamingIndicator);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof VoiceSpecificRegistrationStates)) {
return false;
}
VoiceSpecificRegistrationStates other = (VoiceSpecificRegistrationStates) o;
return this.cssSupported == other.cssSupported
&& this.roamingIndicator == other.roamingIndicator
&& this.systemIsInPrl == other.systemIsInPrl
&& this.defaultRoamingIndicator == other.defaultRoamingIndicator;
}
public static final Parcelable.Creator<VoiceSpecificRegistrationStates> CREATOR =
new Parcelable.Creator<VoiceSpecificRegistrationStates>() {
@Override
public VoiceSpecificRegistrationStates createFromParcel(Parcel source) {
return new VoiceSpecificRegistrationStates(source);
}
@Override
public VoiceSpecificRegistrationStates[] newArray(int size) {
return new VoiceSpecificRegistrationStates[size];
}
};
}