summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jack Yu <jackyu@google.com> 2022-04-25 18:24:04 -0700
committer Jack Yu <jackyu@google.com> 2022-04-26 12:23:24 -0700
commit1d470caabb4ddfc9091137c2c82e2351b173324f (patch)
treec712027e4a11f64a3625b987143860c9893fe555
parent75fb4d3021fae1d6615c3ea1d49c39435a5ab318 (diff)
Fixed the incorrect APN dedupling
Fixed that APN settings can't be merged when one APN entry has MTU set, but the other doesn't. Also default MTU unset value to 0 for backwards compatability. Test: atest DataProfileManagerTest & Manual testing Fix: 226563054 Change-Id: I02190be62855f5f3b86c41677bbf7ff6a362e652
-rw-r--r--telephony/java/android/telephony/data/ApnSetting.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index c56cc62abe44..235ed842b749 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -1293,8 +1293,8 @@ public class ApnSetting implements Parcelable {
&& Objects.equals(this.mOperatorNumeric, other.mOperatorNumeric)
&& Objects.equals(this.mProtocol, other.mProtocol)
&& Objects.equals(this.mRoamingProtocol, other.mRoamingProtocol)
- && xorEqualsInt(this.mMtuV4, other.mMtuV4)
- && xorEqualsInt(this.mMtuV6, other.mMtuV6)
+ && mtuUnsetOrEquals(this.mMtuV4, other.mMtuV4)
+ && mtuUnsetOrEquals(this.mMtuV6, other.mMtuV6)
&& Objects.equals(this.mCarrierEnabled, other.mCarrierEnabled)
&& Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask)
&& Objects.equals(this.mLingeringNetworkTypeBitmask,
@@ -1322,7 +1322,12 @@ public class ApnSetting implements Parcelable {
// Equal or one is not specified.
private boolean xorEqualsInt(int first, int second) {
return first == UNSPECIFIED_INT || second == UNSPECIFIED_INT
- || Objects.equals(first, second);
+ || first == second;
+ }
+
+ // Equal or one is not specified. Specific to MTU where <= 0 indicates unset.
+ private boolean mtuUnsetOrEquals(int first, int second) {
+ return first <= 0 || second <= 0 || first == second;
}
private String nullToEmpty(String stringValue) {