Fix minor thread corectness issue in NetworkInfo
Hold the right lock while copying info from another NetworkInfo object to prevent changes being made to it while the copy is in progress. Change-Id: I1aa2c29e81e045b0359f957352c438e79e692823
This commit is contained in:
parent
4c6caa5172
commit
32dd3cc091
1 changed files with 14 additions and 12 deletions
|
|
@ -156,18 +156,20 @@ public class NetworkInfo implements Parcelable {
|
|||
/** {@hide} */
|
||||
public NetworkInfo(NetworkInfo source) {
|
||||
if (source != null) {
|
||||
mNetworkType = source.mNetworkType;
|
||||
mSubtype = source.mSubtype;
|
||||
mTypeName = source.mTypeName;
|
||||
mSubtypeName = source.mSubtypeName;
|
||||
mState = source.mState;
|
||||
mDetailedState = source.mDetailedState;
|
||||
mReason = source.mReason;
|
||||
mExtraInfo = source.mExtraInfo;
|
||||
mIsFailover = source.mIsFailover;
|
||||
mIsRoaming = source.mIsRoaming;
|
||||
mIsAvailable = source.mIsAvailable;
|
||||
mIsConnectedToProvisioningNetwork = source.mIsConnectedToProvisioningNetwork;
|
||||
synchronized (source) {
|
||||
mNetworkType = source.mNetworkType;
|
||||
mSubtype = source.mSubtype;
|
||||
mTypeName = source.mTypeName;
|
||||
mSubtypeName = source.mSubtypeName;
|
||||
mState = source.mState;
|
||||
mDetailedState = source.mDetailedState;
|
||||
mReason = source.mReason;
|
||||
mExtraInfo = source.mExtraInfo;
|
||||
mIsFailover = source.mIsFailover;
|
||||
mIsRoaming = source.mIsRoaming;
|
||||
mIsAvailable = source.mIsAvailable;
|
||||
mIsConnectedToProvisioningNetwork = source.mIsConnectedToProvisioningNetwork;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue