summaryrefslogtreecommitdiff
path: root/telephony/java
diff options
context:
space:
mode:
authorJayachandran Chinnakkannu <jayachandranc@google.com>2021-06-29 06:12:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-06-29 06:12:27 +0000
commit98a11ef7b104c5ab271d70e49f4d697a1bd3a707 (patch)
tree489b0b35a81d78f401d8eb225bf3610e29855777 /telephony/java
parent1591096aed716bcd998abb4482fed302996fbd30 (diff)
parentbd4bd964f442a41bbbfbf3604c0c9f7f0d467871 (diff)
Merge "QOS: Check for portRange validity before filter matching" into sc-dev
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/data/QosBearerFilter.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/data/QosBearerFilter.java b/telephony/java/android/telephony/data/QosBearerFilter.java
index 5642549d7313..54930d0266b7 100644
--- a/telephony/java/android/telephony/data/QosBearerFilter.java
+++ b/telephony/java/android/telephony/data/QosBearerFilter.java
@@ -57,6 +57,12 @@ public final class QosBearerFilter implements Parcelable {
public static final int QOS_PROTOCOL_UDP = android.hardware.radio.V1_6.QosProtocol.UDP;
public static final int QOS_PROTOCOL_ESP = android.hardware.radio.V1_6.QosProtocol.ESP;
public static final int QOS_PROTOCOL_AH = android.hardware.radio.V1_6.QosProtocol.AH;
+ public static final int QOS_MIN_PORT = android.hardware.radio.V1_6.QosPortRange.MIN;
+ /**
+ * Hardcoded inplace of android.hardware.radio.V1_6.QosPortRange.MAX as it
+ * returns -1 due to uint16_t to int conversion in java. (TODO: Fix the HAL)
+ */
+ public static final int QOS_MAX_PORT = 65535; // android.hardware.radio.V1_6.QosPortRange.MIN;
@QosProtocol
private int protocol;
@@ -229,6 +235,12 @@ public final class QosBearerFilter implements Parcelable {
return end;
}
+ public boolean isValid() {
+ return start >= QOS_MIN_PORT && start <= QOS_MAX_PORT
+ && end >= QOS_MIN_PORT && end <= QOS_MAX_PORT
+ && start <= end;
+ }
+
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(start);