Merge "Reordered the params for network registration"

This commit is contained in:
Treehugger Robot
2018-07-02 23:56:11 +00:00
committed by Gerrit Code Review
2 changed files with 18 additions and 17 deletions

View File

@@ -85,12 +85,12 @@ public class NetworkRegistrationState implements Parcelable {
public static final int SERVICE_TYPE_VIDEO = 4; public static final int SERVICE_TYPE_VIDEO = 4;
public static final int SERVICE_TYPE_EMERGENCY = 5; public static final int SERVICE_TYPE_EMERGENCY = 5;
/** {@link AccessNetworkConstants.TransportType}*/
private final int mTransportType;
@Domain @Domain
private final int mDomain; private final int mDomain;
/** {@link AccessNetworkConstants.TransportType}*/
private final int mTransportType;
@RegState @RegState
private final int mRegState; private final int mRegState;
@@ -112,19 +112,19 @@ public class NetworkRegistrationState implements Parcelable {
private DataSpecificRegistrationStates mDataSpecificStates; private DataSpecificRegistrationStates mDataSpecificStates;
/** /**
* @param transportType Transport type. Must be {@link AccessNetworkConstants.TransportType}
* @param domain Network domain. Must be DOMAIN_CS or DOMAIN_PS. * @param domain Network domain. Must be DOMAIN_CS or DOMAIN_PS.
* @param transportType Transport type. Must be {@link AccessNetworkConstants.TransportType}
* @param regState Network registration state. * @param regState Network registration state.
* @param accessNetworkTechnology See TelephonyManager NETWORK_TYPE_XXXX. * @param accessNetworkTechnology See TelephonyManager NETWORK_TYPE_XXXX.
* @param reasonForDenial Reason for denial if the registration state is DENIED. * @param reasonForDenial Reason for denial if the registration state is DENIED.
* @param availableServices The supported service. * @param availableServices The supported service.
* @param cellIdentity The identity representing a unique cell * @param cellIdentity The identity representing a unique cell
*/ */
public NetworkRegistrationState(int transportType, int domain, int regState, public NetworkRegistrationState(int domain, int transportType, int regState,
int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly, int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
int[] availableServices, @Nullable CellIdentity cellIdentity) { int[] availableServices, @Nullable CellIdentity cellIdentity) {
mTransportType = transportType;
mDomain = domain; mDomain = domain;
mTransportType = transportType;
mRegState = regState; mRegState = regState;
mAccessNetworkTechnology = accessNetworkTechnology; mAccessNetworkTechnology = accessNetworkTechnology;
mReasonForDenial = reasonForDenial; mReasonForDenial = reasonForDenial;
@@ -137,11 +137,11 @@ public class NetworkRegistrationState implements Parcelable {
* Constructor for voice network registration states. * Constructor for voice network registration states.
* @hide * @hide
*/ */
public NetworkRegistrationState(int transportType, int domain, int regState, public NetworkRegistrationState(int domain, int transportType, int regState,
int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly, int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported, int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported,
int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) { int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) {
this(transportType, domain, regState, accessNetworkTechnology, this(domain, transportType, regState, accessNetworkTechnology,
reasonForDenial, emergencyOnly, availableServices, cellIdentity); reasonForDenial, emergencyOnly, availableServices, cellIdentity);
mVoiceSpecificStates = new VoiceSpecificRegistrationStates(cssSupported, roamingIndicator, mVoiceSpecificStates = new VoiceSpecificRegistrationStates(cssSupported, roamingIndicator,
@@ -152,18 +152,18 @@ public class NetworkRegistrationState implements Parcelable {
* Constructor for data network registration states. * Constructor for data network registration states.
* @hide * @hide
*/ */
public NetworkRegistrationState(int transportType, int domain, int regState, public NetworkRegistrationState(int domain, int transportType, int regState,
int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly, int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls) { int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls) {
this(transportType, domain, regState, accessNetworkTechnology, this(domain, transportType, regState, accessNetworkTechnology,
reasonForDenial, emergencyOnly, availableServices, cellIdentity); reasonForDenial, emergencyOnly, availableServices, cellIdentity);
mDataSpecificStates = new DataSpecificRegistrationStates(maxDataCalls); mDataSpecificStates = new DataSpecificRegistrationStates(maxDataCalls);
} }
protected NetworkRegistrationState(Parcel source) { protected NetworkRegistrationState(Parcel source) {
mTransportType = source.readInt();
mDomain = source.readInt(); mDomain = source.readInt();
mTransportType = source.readInt();
mRegState = source.readInt(); mRegState = source.readInt();
mAccessNetworkTechnology = source.readInt(); mAccessNetworkTechnology = source.readInt();
mReasonForDenial = source.readInt(); mReasonForDenial = source.readInt();
@@ -260,8 +260,8 @@ public class NetworkRegistrationState implements Parcelable {
@Override @Override
public String toString() { public String toString() {
return new StringBuilder("NetworkRegistrationState{") return new StringBuilder("NetworkRegistrationState{")
.append("transportType=").append(mTransportType)
.append(" domain=").append((mDomain == DOMAIN_CS) ? "CS" : "PS") .append(" domain=").append((mDomain == DOMAIN_CS) ? "CS" : "PS")
.append("transportType=").append(mTransportType)
.append(" regState=").append(regStateToString(mRegState)) .append(" regState=").append(regStateToString(mRegState))
.append(" accessNetworkTechnology=") .append(" accessNetworkTechnology=")
.append(TelephonyManager.getNetworkTypeName(mAccessNetworkTechnology)) .append(TelephonyManager.getNetworkTypeName(mAccessNetworkTechnology))
@@ -290,8 +290,8 @@ public class NetworkRegistrationState implements Parcelable {
} }
NetworkRegistrationState other = (NetworkRegistrationState) o; NetworkRegistrationState other = (NetworkRegistrationState) o;
return mTransportType == other.mTransportType return mDomain == other.mDomain
&& mDomain == other.mDomain && mTransportType == other.mTransportType
&& mRegState == other.mRegState && mRegState == other.mRegState
&& mAccessNetworkTechnology == other.mAccessNetworkTechnology && mAccessNetworkTechnology == other.mAccessNetworkTechnology
&& mReasonForDenial == other.mReasonForDenial && mReasonForDenial == other.mReasonForDenial
@@ -305,8 +305,8 @@ public class NetworkRegistrationState implements Parcelable {
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mTransportType);
dest.writeInt(mDomain); dest.writeInt(mDomain);
dest.writeInt(mTransportType);
dest.writeInt(mRegState); dest.writeInt(mRegState);
dest.writeInt(mAccessNetworkTechnology); dest.writeInt(mAccessNetworkTechnology);
dest.writeInt(mReasonForDenial); dest.writeInt(mReasonForDenial);

View File

@@ -1565,13 +1565,14 @@ public class ServiceState implements Parcelable {
/** /**
* Get the network registration states with given transport type and domain. * Get the network registration states with given transport type and domain.
* *
* @param domain The network domain. Must be {@link NetworkRegistrationState#DOMAIN_CS} or
* {@link NetworkRegistrationState#DOMAIN_PS}.
* @param transportType The transport type. See {@link AccessNetworkConstants.TransportType} * @param transportType The transport type. See {@link AccessNetworkConstants.TransportType}
* @param domain The network domain. Must be DOMAIN_CS or DOMAIN_PS.
* @return The matching NetworkRegistrationState. * @return The matching NetworkRegistrationState.
* @hide * @hide
*/ */
@SystemApi @SystemApi
public NetworkRegistrationState getNetworkRegistrationStates(int transportType, int domain) { public NetworkRegistrationState getNetworkRegistrationStates(int domain, int transportType) {
synchronized (mNetworkRegistrationStates) { synchronized (mNetworkRegistrationStates) {
for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) { for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
if (networkRegistrationState.getTransportType() == transportType if (networkRegistrationState.getTransportType() == transportType