Fix ConnectivityServiceTest for NATT Keepalive
Fix test breakages I caused when adding cell support for NATT keepalives. -Make the minimum keepalive interval a constant in ConnectivityManager and use it in tests. -Re-Disallow IPv6 Keepalives Bug: 73327535 Test: 'runtest -x ConnectivityServiceTest' now passes Change-Id: I5ec4367d250ee371014e65c897c3897a25a05e2d
This commit is contained in:
parent
bc388ae1a9
commit
e8ae0ebed3
1 changed files with 30 additions and 30 deletions
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
package android.net;
|
||||
|
||||
import android.system.OsConstants;
|
||||
import android.net.ConnectivityManager;
|
||||
import static android.net.ConnectivityManager.PacketKeepalive.*;
|
||||
|
||||
import android.net.util.IpUtils;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
|
@ -25,13 +25,10 @@ import android.system.OsConstants;
|
|||
import android.util.Log;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import static android.net.ConnectivityManager.PacketKeepalive.*;
|
||||
|
||||
/**
|
||||
* Represents the actual packets that are sent by the
|
||||
* {@link android.net.ConnectivityManager.PacketKeepalive} API.
|
||||
|
|
@ -98,13 +95,6 @@ public class KeepalivePacketData implements Parcelable {
|
|||
InetAddress srcAddress, int srcPort, InetAddress dstAddress, int dstPort)
|
||||
throws InvalidPacketException {
|
||||
|
||||
// FIXME: remove this and actually support IPv6 keepalives
|
||||
if (srcAddress instanceof Inet6Address && dstAddress instanceof Inet6Address) {
|
||||
// Optimistically returning an IPv6 Keepalive Packet with no data,
|
||||
// which currently only works on cellular
|
||||
return new KeepalivePacketData(srcAddress, srcPort, dstAddress, dstPort, new byte[0]);
|
||||
}
|
||||
|
||||
if (!(srcAddress instanceof Inet4Address) || !(dstAddress instanceof Inet4Address)) {
|
||||
throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue