summaryrefslogtreecommitdiff
path: root/packages/NetworkStack
diff options
context:
space:
mode:
authorAaron Huang <huangaaron@google.com>2019-05-02 21:14:20 +0800
committerjunyulai <junyulai@google.com>2019-05-13 18:48:19 +0800
commitaedc602ebe88d544173c4161064bc6cd370a854e (patch)
tree54b11d6d67b92bae3620feb4c85a1c336884bd3f /packages/NetworkStack
parent4fbc24fe1b2fc9b4b16afa4901a9c755515d1217 (diff)
Send message to add/remove NAT-T keepalive packet filter.
Remove definition of TYPE_NATT and TYPE_TCP since the type can be identified by checking message.obj is an instance of NattKeepalivePacketData or TcpKeepalivePacketData. It's more simple and won't have dependency on KeepaliveInfo. Bug: 33530442 Test: atest FrameworksNetTests atest NetworkStackTests (Clean cherry-pick of aosp/955419) Change-Id: Ic97ffe9ff5781778efd264460809f5059f0f4230 Merged-In: Ic97ffe9ff5781778efd264460809f5059f0f4230
Diffstat (limited to 'packages/NetworkStack')
-rw-r--r--packages/NetworkStack/src/android/net/ip/IpClient.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/packages/NetworkStack/src/android/net/ip/IpClient.java b/packages/NetworkStack/src/android/net/ip/IpClient.java
index dc74c041c35a..266b1b047a90 100644
--- a/packages/NetworkStack/src/android/net/ip/IpClient.java
+++ b/packages/NetworkStack/src/android/net/ip/IpClient.java
@@ -372,10 +372,6 @@ public class IpClient extends StateMachine {
private boolean mMulticastFiltering;
private long mStartTimeMillis;
- /* This must match the definition in KeepaliveTracker.KeepaliveInfo */
- private static final int TYPE_NATT = 1;
- private static final int TYPE_TCP = 2;
-
/**
* Reading the snapshot is an asynchronous operation initiated by invoking
* Callback.startReadPacketFilter() and completed when the WiFi Service responds with an
@@ -705,7 +701,7 @@ public class IpClient extends StateMachine {
* keepalive offload.
*/
public void addKeepalivePacketFilter(int slot, @NonNull TcpKeepalivePacketDataParcelable pkt) {
- sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF, slot, TYPE_TCP, pkt);
+ sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF, slot, 0 /* Unused */, pkt);
}
/**
@@ -714,7 +710,7 @@ public class IpClient extends StateMachine {
*/
public void addNattKeepalivePacketFilter(int slot,
@NonNull NattKeepalivePacketDataParcelable pkt) {
- sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF, slot, TYPE_NATT, pkt);
+ sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF, slot, 0 /* Unused */ , pkt);
}
/**
@@ -1626,13 +1622,12 @@ public class IpClient extends StateMachine {
case CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF: {
final int slot = msg.arg1;
- final int type = msg.arg2;
if (mApfFilter != null) {
- if (type == TYPE_NATT) {
+ if (msg.obj instanceof NattKeepalivePacketDataParcelable) {
mApfFilter.addNattKeepalivePacketFilter(slot,
(NattKeepalivePacketDataParcelable) msg.obj);
- } else {
+ } else if (msg.obj instanceof TcpKeepalivePacketDataParcelable) {
mApfFilter.addTcpKeepalivePacketFilter(slot,
(TcpKeepalivePacketDataParcelable) msg.obj);
}