From 4c01328d90a5ccfed9201cf744ad5a782b5a52a2 Mon Sep 17 00:00:00 2001 From: Malcolm Chen Date: Wed, 24 Jan 2018 16:27:09 -0800 Subject: [PATCH] Add Voice / Data network specific reg states. In NetworkRegistrationState.java, add hidden inner classes that stores information specific to voice network registration state and data network registration state. Bug: 64132030 Test: build Change-Id: I746be2a50cfa138acc5b2b40e38ab875ceab6d8d --- api/system-current.txt | 2 + .../DataSpecificRegistrationStates.java | 72 +++++++++++ .../telephony/NetworkRegistrationState.java | 78 +++++++++++- .../VoiceSpecificRegistrationStates.java | 114 ++++++++++++++++++ 4 files changed, 264 insertions(+), 2 deletions(-) create mode 100644 telephony/java/android/telephony/DataSpecificRegistrationStates.java create mode 100644 telephony/java/android/telephony/VoiceSpecificRegistrationStates.java diff --git a/api/system-current.txt b/api/system-current.txt index 2e39bb7fd6aa0..9e2b0a267f60b 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -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(); diff --git a/telephony/java/android/telephony/DataSpecificRegistrationStates.java b/telephony/java/android/telephony/DataSpecificRegistrationStates.java new file mode 100644 index 0000000000000..97e3037b3c909 --- /dev/null +++ b/telephony/java/android/telephony/DataSpecificRegistrationStates.java @@ -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 CREATOR = + new Parcelable.Creator() { + @Override + public DataSpecificRegistrationStates createFromParcel(Parcel source) { + return new DataSpecificRegistrationStates(source); + } + + @Override + public DataSpecificRegistrationStates[] newArray(int size) { + return new DataSpecificRegistrationStates[size]; + } + }; +} \ No newline at end of file diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java index e0510694d4adf..4f137bea69f70 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.java +++ b/telephony/java/android/telephony/NetworkRegistrationState.java @@ -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 CREATOR = diff --git a/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java b/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java new file mode 100644 index 0000000000000..871ee4d9f0a1a --- /dev/null +++ b/telephony/java/android/telephony/VoiceSpecificRegistrationStates.java @@ -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 CREATOR = + new Parcelable.Creator() { + @Override + public VoiceSpecificRegistrationStates createFromParcel(Parcel source) { + return new VoiceSpecificRegistrationStates(source); + } + + @Override + public VoiceSpecificRegistrationStates[] newArray(int size) { + return new VoiceSpecificRegistrationStates[size]; + } + }; +} \ No newline at end of file