summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jack Yu <jackyu@google.com> 2022-04-25 18:24:04 -0700
committer Sarah Chin <sarahchin@google.com> 2022-05-12 00:27:19 -0700
commitf419d33c6ae84111ec9ddae85f46d37763e0da3a (patch)
tree92b70d60262dfc75da31185b4ce5dcec1da6f162
parent217b0fdbda51e71fd7912d41d1f27b124e4c91af (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 Merged-In: 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 b0ddf2c28dff..a710e38538ce 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -1290,8 +1290,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,
@@ -1319,7 +1319,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) {