Loading packages/NetworkStack/src/android/net/ip/IpClient.java +4 −9 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); } /** Loading @@ -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); } /** Loading Loading @@ -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); } Loading services/core/java/com/android/server/connectivity/KeepaliveTracker.java +15 −11 Original line number Diff line number Diff line Loading @@ -327,6 +327,8 @@ public class KeepaliveTracker { Log.d(TAG, "Starting keepalive " + mSlot + " on " + mNai.name()); switch (mType) { case TYPE_NATT: mNai.asyncChannel.sendMessage( CMD_ADD_KEEPALIVE_PACKET_FILTER, slot, 0 /* Unused */, mPacket); mNai.asyncChannel .sendMessage(CMD_START_SOCKET_KEEPALIVE, slot, mInterval, mPacket); break; Loading @@ -337,9 +339,8 @@ public class KeepaliveTracker { handleStopKeepalive(mNai, mSlot, ERROR_INVALID_SOCKET); return; } mNai.asyncChannel .sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER, slot, 0 /* Unused */, mPacket); mNai.asyncChannel.sendMessage( CMD_ADD_KEEPALIVE_PACKET_FILTER, slot, 0 /* Unused */, mPacket); // TODO: check result from apf and notify of failure as needed. mNai.asyncChannel .sendMessage(CMD_START_SOCKET_KEEPALIVE, slot, mInterval, mPacket); Loading Loading @@ -375,13 +376,16 @@ public class KeepaliveTracker { return; default: mStartedState = STOPPING; if (mType == TYPE_NATT) { mNai.asyncChannel.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, mSlot); } else if (mType == TYPE_TCP) { mNai.asyncChannel.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, mSlot); mNai.asyncChannel.sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER, mSlot); switch (mType) { case TYPE_TCP: mTcpController.stopSocketMonitor(mSlot); } else { // fall through case TYPE_NATT: mNai.asyncChannel.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, mSlot); mNai.asyncChannel.sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER, mSlot); break; default: Log.wtf(TAG, "Stopping keepalive with unknown type: " + mType); } } Loading Loading
packages/NetworkStack/src/android/net/ip/IpClient.java +4 −9 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); } /** Loading @@ -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); } /** Loading Loading @@ -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); } Loading
services/core/java/com/android/server/connectivity/KeepaliveTracker.java +15 −11 Original line number Diff line number Diff line Loading @@ -327,6 +327,8 @@ public class KeepaliveTracker { Log.d(TAG, "Starting keepalive " + mSlot + " on " + mNai.name()); switch (mType) { case TYPE_NATT: mNai.asyncChannel.sendMessage( CMD_ADD_KEEPALIVE_PACKET_FILTER, slot, 0 /* Unused */, mPacket); mNai.asyncChannel .sendMessage(CMD_START_SOCKET_KEEPALIVE, slot, mInterval, mPacket); break; Loading @@ -337,9 +339,8 @@ public class KeepaliveTracker { handleStopKeepalive(mNai, mSlot, ERROR_INVALID_SOCKET); return; } mNai.asyncChannel .sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER, slot, 0 /* Unused */, mPacket); mNai.asyncChannel.sendMessage( CMD_ADD_KEEPALIVE_PACKET_FILTER, slot, 0 /* Unused */, mPacket); // TODO: check result from apf and notify of failure as needed. mNai.asyncChannel .sendMessage(CMD_START_SOCKET_KEEPALIVE, slot, mInterval, mPacket); Loading Loading @@ -375,13 +376,16 @@ public class KeepaliveTracker { return; default: mStartedState = STOPPING; if (mType == TYPE_NATT) { mNai.asyncChannel.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, mSlot); } else if (mType == TYPE_TCP) { mNai.asyncChannel.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, mSlot); mNai.asyncChannel.sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER, mSlot); switch (mType) { case TYPE_TCP: mTcpController.stopSocketMonitor(mSlot); } else { // fall through case TYPE_NATT: mNai.asyncChannel.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, mSlot); mNai.asyncChannel.sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER, mSlot); break; default: Log.wtf(TAG, "Stopping keepalive with unknown type: " + mType); } } Loading