summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cassie Han <xih@google.com> 2017-11-15 23:43:55 +0000
committer android-build-merger <android-build-merger@google.com> 2017-11-15 23:43:55 +0000
commit03e7512fc7c58591da4cf9a85c3c83847c225d8c (patch)
tree8c8f1ae148228aaea730690f8bbb62b791a1904f
parent5ecc02d28f1a6b6843702ac4ac16cc91e18b6977 (diff)
parent866d2d553e75069396f090d3ee7fddc63f0ee113 (diff)
Merge "Revert "Allow unknown mcc/mnc when constructing a CellIdentity from Parcel."" am: 9b08e4cb8d
am: 866d2d553e Change-Id: I1afee7200c84bc0058ce394c49eaaf46a917793f
-rw-r--r--telephony/java/android/telephony/CellIdentityGsm.java9
-rw-r--r--telephony/java/android/telephony/CellIdentityLte.java9
-rw-r--r--telephony/java/android/telephony/CellIdentityWcdma.java11
3 files changed, 13 insertions, 16 deletions
diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java
index 4d7c71febd6f..6276626afae2 100644
--- a/telephony/java/android/telephony/CellIdentityGsm.java
+++ b/telephony/java/android/telephony/CellIdentityGsm.java
@@ -115,11 +115,10 @@ public final class CellIdentityGsm implements Parcelable {
// for inbound parcels
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
- // Only allow INT_MAX if unknown string mcc/mnc
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
mMccStr = mccStr;
- } else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
- // If the mccStr is empty or unknown, set it as null.
+ } else if (mccStr.isEmpty()) {
+ // If the mccStr parsed from Parcel is empty, set it as null.
mMccStr = null;
} else {
throw new IllegalArgumentException("invalid MCC format");
@@ -127,8 +126,8 @@ public final class CellIdentityGsm implements Parcelable {
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
mMncStr = mncStr;
- } else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
- // If the mncStr is empty or unknown, set it as null.
+ } else if (mncStr.isEmpty()) {
+ // If the mncStr parsed from Parcel is empty, set it as null.
mMncStr = null;
} else {
throw new IllegalArgumentException("invalid MNC format");
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java
index fd837fc0ac26..74d2966b25bc 100644
--- a/telephony/java/android/telephony/CellIdentityLte.java
+++ b/telephony/java/android/telephony/CellIdentityLte.java
@@ -114,11 +114,10 @@ public final class CellIdentityLte implements Parcelable {
mTac = tac;
mEarfcn = earfcn;
- // Only allow INT_MAX if unknown string mcc/mnc
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
mMccStr = mccStr;
- } else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
- // If the mccStr is empty or unknown, set it as null.
+ } else if (mccStr.isEmpty()) {
+ // If the mccStr parsed from Parcel is empty, set it as null.
mMccStr = null;
} else {
throw new IllegalArgumentException("invalid MCC format");
@@ -126,8 +125,8 @@ public final class CellIdentityLte implements Parcelable {
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
mMncStr = mncStr;
- } else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
- // If the mncStr is empty or unknown, set it as null.
+ } else if (mncStr.isEmpty()) {
+ // If the mncStr parsed from Parcel is empty, set it as null.
mMncStr = null;
} else {
throw new IllegalArgumentException("invalid MNC format");
diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java
index 1597245c6fa2..51b11aa82b9a 100644
--- a/telephony/java/android/telephony/CellIdentityWcdma.java
+++ b/telephony/java/android/telephony/CellIdentityWcdma.java
@@ -114,11 +114,10 @@ public final class CellIdentityWcdma implements Parcelable {
mPsc = psc;
mUarfcn = uarfcn;
- // Only allow INT_MAX if unknown string mcc/mnc
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
mMccStr = mccStr;
- } else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
- // If the mccStr is empty or unknown, set it as null.
+ } else if (mccStr.isEmpty()) {
+ // If the mccStr parsed from Parcel is empty, set it as null.
mMccStr = null;
} else {
throw new IllegalArgumentException("invalid MCC format");
@@ -126,8 +125,8 @@ public final class CellIdentityWcdma implements Parcelable {
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
mMncStr = mncStr;
- } else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
- // If the mncStr is empty or unknown, set it as null.
+ } else if (mncStr.isEmpty()) {
+ // If the mncStr parsed from Parcel is empty, set it as null.
mMncStr = null;
} else {
throw new IllegalArgumentException("invalid MNC format");
@@ -136,7 +135,7 @@ public final class CellIdentityWcdma implements Parcelable {
mAlphaLong = alphal;
mAlphaShort = alphas;
}
-
+
private CellIdentityWcdma(CellIdentityWcdma cid) {
this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);