Merge "Allow unknown mcc/mnc when constructing a CellIdentity from Parcel."
This commit is contained in:
@@ -115,22 +115,29 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
// for inbound parcels
|
// for inbound parcels
|
||||||
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
|
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
|
||||||
|
|
||||||
|
// Only allow INT_MAX if unknown string mcc/mnc
|
||||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
||||||
mMccStr = mccStr;
|
mMccStr = mccStr;
|
||||||
} else if (mccStr.isEmpty()) {
|
} else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
// If the mccStr parsed from Parcel is empty, set it as null.
|
// If the mccStr is empty or unknown, set it as null.
|
||||||
mMccStr = null;
|
mMccStr = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("invalid MCC format");
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMccStr = null;
|
||||||
|
log("invalid MCC format: " + mccStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
||||||
mMncStr = mncStr;
|
mMncStr = mncStr;
|
||||||
} else if (mncStr.isEmpty()) {
|
} else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
// If the mncStr parsed from Parcel is empty, set it as null.
|
// If the mncStr is empty or unknown, set it as null.
|
||||||
mMncStr = null;
|
mMncStr = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("invalid MNC format");
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMncStr = null;
|
||||||
|
log("invalid MNC format: " + mncStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
|
|||||||
@@ -114,22 +114,29 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
mTac = tac;
|
mTac = tac;
|
||||||
mEarfcn = earfcn;
|
mEarfcn = earfcn;
|
||||||
|
|
||||||
|
// Only allow INT_MAX if unknown string mcc/mnc
|
||||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
||||||
mMccStr = mccStr;
|
mMccStr = mccStr;
|
||||||
} else if (mccStr.isEmpty()) {
|
} else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
// If the mccStr parsed from Parcel is empty, set it as null.
|
// If the mccStr is empty or unknown, set it as null.
|
||||||
mMccStr = null;
|
mMccStr = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("invalid MCC format");
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMccStr = null;
|
||||||
|
log("invalid MCC format: " + mccStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
||||||
mMncStr = mncStr;
|
mMncStr = mncStr;
|
||||||
} else if (mncStr.isEmpty()) {
|
} else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
// If the mncStr parsed from Parcel is empty, set it as null.
|
// If the mncStr is empty or unknown, set it as null.
|
||||||
mMncStr = null;
|
mMncStr = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("invalid MNC format");
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMncStr = null;
|
||||||
|
log("invalid MNC format: " + mncStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
|
|||||||
@@ -114,22 +114,29 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
mPsc = psc;
|
mPsc = psc;
|
||||||
mUarfcn = uarfcn;
|
mUarfcn = uarfcn;
|
||||||
|
|
||||||
|
// Only allow INT_MAX if unknown string mcc/mnc
|
||||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
||||||
mMccStr = mccStr;
|
mMccStr = mccStr;
|
||||||
} else if (mccStr.isEmpty()) {
|
} else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
// If the mccStr parsed from Parcel is empty, set it as null.
|
// If the mccStr is empty or unknown, set it as null.
|
||||||
mMccStr = null;
|
mMccStr = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("invalid MCC format");
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMccStr = null;
|
||||||
|
log("invalid MCC format: " + mccStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
||||||
mMncStr = mncStr;
|
mMncStr = mncStr;
|
||||||
} else if (mncStr.isEmpty()) {
|
} else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
// If the mncStr parsed from Parcel is empty, set it as null.
|
// If the mncStr is empty or unknown, set it as null.
|
||||||
mMncStr = null;
|
mMncStr = null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("invalid MNC format");
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMncStr = null;
|
||||||
|
log("invalid MNC format: " + mncStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
|
|||||||
Reference in New Issue
Block a user