Merge "Add NetworkRegistrationState into SS's list." am: 9f92ed943c
am: 6576ed3d5b
Change-Id: I02efc2c7dceb775a5ce2eb3e3f2696e098cef046
This commit is contained in:
@@ -1526,7 +1526,9 @@ public class ServiceState implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public List<NetworkRegistrationState> getNetworkRegistrationStates() {
|
public List<NetworkRegistrationState> getNetworkRegistrationStates() {
|
||||||
return mNetworkRegistrationStates;
|
synchronized (mNetworkRegistrationStates) {
|
||||||
|
return new ArrayList<>(mNetworkRegistrationStates);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1539,11 +1541,15 @@ public class ServiceState implements Parcelable {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
public List<NetworkRegistrationState> getNetworkRegistrationStates(int transportType) {
|
public List<NetworkRegistrationState> getNetworkRegistrationStates(int transportType) {
|
||||||
List<NetworkRegistrationState> list = new ArrayList<>();
|
List<NetworkRegistrationState> list = new ArrayList<>();
|
||||||
for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
|
|
||||||
if (networkRegistrationState.getTransportType() == transportType) {
|
synchronized (mNetworkRegistrationStates) {
|
||||||
list.add(networkRegistrationState);
|
for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
|
||||||
|
if (networkRegistrationState.getTransportType() == transportType) {
|
||||||
|
list.add(networkRegistrationState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1557,12 +1563,36 @@ public class ServiceState implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
@SystemApi
|
@SystemApi
|
||||||
public NetworkRegistrationState getNetworkRegistrationStates(int transportType, int domain) {
|
public NetworkRegistrationState getNetworkRegistrationStates(int transportType, int domain) {
|
||||||
for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
|
synchronized (mNetworkRegistrationStates) {
|
||||||
if (networkRegistrationState.getTransportType() == transportType
|
for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
|
||||||
&& networkRegistrationState.getDomain() == domain) {
|
if (networkRegistrationState.getTransportType() == transportType
|
||||||
return networkRegistrationState;
|
&& networkRegistrationState.getDomain() == domain) {
|
||||||
|
return networkRegistrationState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void addNetworkRegistrationState(NetworkRegistrationState regState) {
|
||||||
|
if (regState == null) return;
|
||||||
|
|
||||||
|
synchronized (mNetworkRegistrationStates) {
|
||||||
|
for (int i = 0; i < mNetworkRegistrationStates.size(); i++) {
|
||||||
|
NetworkRegistrationState curRegState = mNetworkRegistrationStates.get(i);
|
||||||
|
if (curRegState.getTransportType() == regState.getTransportType()
|
||||||
|
&& curRegState.getDomain() == regState.getDomain()) {
|
||||||
|
mNetworkRegistrationStates.remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mNetworkRegistrationStates.add(regState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user