Merge "Fixed concurrent access network registration info"
This commit is contained in:
@@ -337,7 +337,7 @@ public class ServiceState implements Parcelable {
|
|||||||
* Reference: 3GPP TS 36.104 5.4.3 */
|
* Reference: 3GPP TS 36.104 5.4.3 */
|
||||||
private int mLteEarfcnRsrpBoost = 0;
|
private int mLteEarfcnRsrpBoost = 0;
|
||||||
|
|
||||||
private List<NetworkRegistrationInfo> mNetworkRegistrationInfos = new ArrayList<>();
|
private final List<NetworkRegistrationInfo> mNetworkRegistrationInfos = new ArrayList<>();
|
||||||
|
|
||||||
private String mOperatorAlphaLongRaw;
|
private String mOperatorAlphaLongRaw;
|
||||||
private String mOperatorAlphaShortRaw;
|
private String mOperatorAlphaShortRaw;
|
||||||
@@ -420,8 +420,10 @@ public class ServiceState implements Parcelable {
|
|||||||
mCellBandwidths = s.mCellBandwidths == null ? null :
|
mCellBandwidths = s.mCellBandwidths == null ? null :
|
||||||
Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length);
|
Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length);
|
||||||
mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost;
|
mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost;
|
||||||
mNetworkRegistrationInfos = s.mNetworkRegistrationInfos == null ? null :
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
s.getNetworkRegistrationInfoList();
|
mNetworkRegistrationInfos.clear();
|
||||||
|
mNetworkRegistrationInfos.addAll(s.getNetworkRegistrationInfoList());
|
||||||
|
}
|
||||||
mNrFrequencyRange = s.mNrFrequencyRange;
|
mNrFrequencyRange = s.mNrFrequencyRange;
|
||||||
mOperatorAlphaLongRaw = s.mOperatorAlphaLongRaw;
|
mOperatorAlphaLongRaw = s.mOperatorAlphaLongRaw;
|
||||||
mOperatorAlphaShortRaw = s.mOperatorAlphaShortRaw;
|
mOperatorAlphaShortRaw = s.mOperatorAlphaShortRaw;
|
||||||
@@ -453,8 +455,9 @@ public class ServiceState implements Parcelable {
|
|||||||
mCdmaEriIconMode = in.readInt();
|
mCdmaEriIconMode = in.readInt();
|
||||||
mIsEmergencyOnly = in.readInt() != 0;
|
mIsEmergencyOnly = in.readInt() != 0;
|
||||||
mLteEarfcnRsrpBoost = in.readInt();
|
mLteEarfcnRsrpBoost = in.readInt();
|
||||||
mNetworkRegistrationInfos = new ArrayList<>();
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
in.readList(mNetworkRegistrationInfos, NetworkRegistrationInfo.class.getClassLoader());
|
in.readList(mNetworkRegistrationInfos, NetworkRegistrationInfo.class.getClassLoader());
|
||||||
|
}
|
||||||
mChannelNumber = in.readInt();
|
mChannelNumber = in.readInt();
|
||||||
mCellBandwidths = in.createIntArray();
|
mCellBandwidths = in.createIntArray();
|
||||||
mNrFrequencyRange = in.readInt();
|
mNrFrequencyRange = in.readInt();
|
||||||
@@ -481,7 +484,9 @@ public class ServiceState implements Parcelable {
|
|||||||
out.writeInt(mCdmaEriIconMode);
|
out.writeInt(mCdmaEriIconMode);
|
||||||
out.writeInt(mIsEmergencyOnly ? 1 : 0);
|
out.writeInt(mIsEmergencyOnly ? 1 : 0);
|
||||||
out.writeInt(mLteEarfcnRsrpBoost);
|
out.writeInt(mLteEarfcnRsrpBoost);
|
||||||
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
out.writeList(mNetworkRegistrationInfos);
|
out.writeList(mNetworkRegistrationInfos);
|
||||||
|
}
|
||||||
out.writeInt(mChannelNumber);
|
out.writeInt(mChannelNumber);
|
||||||
out.writeIntArray(mCellBandwidths);
|
out.writeIntArray(mCellBandwidths);
|
||||||
out.writeInt(mNrFrequencyRange);
|
out.writeInt(mNrFrequencyRange);
|
||||||
@@ -823,6 +828,7 @@ public class ServiceState implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
return Objects.hash(
|
return Objects.hash(
|
||||||
mVoiceRegState,
|
mVoiceRegState,
|
||||||
mDataRegState,
|
mDataRegState,
|
||||||
@@ -849,12 +855,14 @@ public class ServiceState implements Parcelable {
|
|||||||
mOperatorAlphaLongRaw,
|
mOperatorAlphaLongRaw,
|
||||||
mOperatorAlphaShortRaw);
|
mOperatorAlphaShortRaw);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals (Object o) {
|
public boolean equals (Object o) {
|
||||||
if (!(o instanceof ServiceState)) return false;
|
if (!(o instanceof ServiceState)) return false;
|
||||||
ServiceState s = (ServiceState) o;
|
ServiceState s = (ServiceState) o;
|
||||||
|
|
||||||
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
return mVoiceRegState == s.mVoiceRegState
|
return mVoiceRegState == s.mVoiceRegState
|
||||||
&& mDataRegState == s.mDataRegState
|
&& mDataRegState == s.mDataRegState
|
||||||
&& mIsManualNetworkSelection == s.mIsManualNetworkSelection
|
&& mIsManualNetworkSelection == s.mIsManualNetworkSelection
|
||||||
@@ -875,11 +883,11 @@ public class ServiceState implements Parcelable {
|
|||||||
&& mIsEmergencyOnly == s.mIsEmergencyOnly
|
&& mIsEmergencyOnly == s.mIsEmergencyOnly
|
||||||
&& equalsHandlesNulls(mOperatorAlphaLongRaw, s.mOperatorAlphaLongRaw)
|
&& equalsHandlesNulls(mOperatorAlphaLongRaw, s.mOperatorAlphaLongRaw)
|
||||||
&& equalsHandlesNulls(mOperatorAlphaShortRaw, s.mOperatorAlphaShortRaw)
|
&& equalsHandlesNulls(mOperatorAlphaShortRaw, s.mOperatorAlphaShortRaw)
|
||||||
&& (mNetworkRegistrationInfos == null
|
&& mNetworkRegistrationInfos.size() == s.mNetworkRegistrationInfos.size()
|
||||||
? s.mNetworkRegistrationInfos == null : s.mNetworkRegistrationInfos != null
|
&& mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos)
|
||||||
&& mNetworkRegistrationInfos.containsAll(s.mNetworkRegistrationInfos))
|
|
||||||
&& mNrFrequencyRange == s.mNrFrequencyRange;
|
&& mNrFrequencyRange == s.mNrFrequencyRange;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert roaming type to string
|
* Convert roaming type to string
|
||||||
@@ -1005,6 +1013,7 @@ public class ServiceState implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
return new StringBuilder().append("{mVoiceRegState=").append(mVoiceRegState)
|
return new StringBuilder().append("{mVoiceRegState=").append(mVoiceRegState)
|
||||||
.append("(" + rilServiceStateToString(mVoiceRegState) + ")")
|
.append("(" + rilServiceStateToString(mVoiceRegState) + ")")
|
||||||
.append(", mDataRegState=").append(mDataRegState)
|
.append(", mDataRegState=").append(mDataRegState)
|
||||||
@@ -1036,6 +1045,7 @@ public class ServiceState implements Parcelable {
|
|||||||
.append(", mOperatorAlphaShortRaw=").append(mOperatorAlphaShortRaw)
|
.append(", mOperatorAlphaShortRaw=").append(mOperatorAlphaShortRaw)
|
||||||
.append("}").toString();
|
.append("}").toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
if (DBG) Rlog.d(LOG_TAG, "init");
|
if (DBG) Rlog.d(LOG_TAG, "init");
|
||||||
@@ -1060,6 +1070,7 @@ public class ServiceState implements Parcelable {
|
|||||||
mIsEmergencyOnly = false;
|
mIsEmergencyOnly = false;
|
||||||
mLteEarfcnRsrpBoost = 0;
|
mLteEarfcnRsrpBoost = 0;
|
||||||
mNrFrequencyRange = FREQUENCY_RANGE_UNKNOWN;
|
mNrFrequencyRange = FREQUENCY_RANGE_UNKNOWN;
|
||||||
|
synchronized (mNetworkRegistrationInfos) {
|
||||||
mNetworkRegistrationInfos.clear();
|
mNetworkRegistrationInfos.clear();
|
||||||
addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
|
addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
|
||||||
.setDomain(NetworkRegistrationInfo.DOMAIN_CS)
|
.setDomain(NetworkRegistrationInfo.DOMAIN_CS)
|
||||||
@@ -1071,6 +1082,7 @@ public class ServiceState implements Parcelable {
|
|||||||
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
|
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
|
||||||
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||||
.build());
|
.build());
|
||||||
|
}
|
||||||
mOperatorAlphaLongRaw = null;
|
mOperatorAlphaLongRaw = null;
|
||||||
mOperatorAlphaShortRaw = null;
|
mOperatorAlphaShortRaw = null;
|
||||||
}
|
}
|
||||||
@@ -1913,10 +1925,13 @@ public class ServiceState implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public ServiceState sanitizeLocationInfo(boolean removeCoarseLocation) {
|
public ServiceState sanitizeLocationInfo(boolean removeCoarseLocation) {
|
||||||
ServiceState state = new ServiceState(this);
|
ServiceState state = new ServiceState(this);
|
||||||
if (state.mNetworkRegistrationInfos != null) {
|
synchronized (state.mNetworkRegistrationInfos) {
|
||||||
state.mNetworkRegistrationInfos = state.mNetworkRegistrationInfos.stream()
|
List<NetworkRegistrationInfo> networkRegistrationInfos =
|
||||||
|
state.mNetworkRegistrationInfos.stream()
|
||||||
.map(NetworkRegistrationInfo::sanitizeLocationInfo)
|
.map(NetworkRegistrationInfo::sanitizeLocationInfo)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
state.mNetworkRegistrationInfos.clear();
|
||||||
|
state.mNetworkRegistrationInfos.addAll(networkRegistrationInfos);
|
||||||
}
|
}
|
||||||
if (!removeCoarseLocation) return state;
|
if (!removeCoarseLocation) return state;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user