diff options
15 files changed, 64 insertions, 46 deletions
diff --git a/api/current.txt b/api/current.txt index 71dc772..a5dc7b6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -19353,7 +19353,7 @@ package android.net.wifi { method public java.lang.String getAnonymousIdentity(); method public java.security.cert.X509Certificate getCaCertificate(); method public java.security.cert.X509Certificate getClientCertificate(); - method public java.lang.String getDomSubjectMatch(); + method public java.lang.String getDomainSubjectMatch(); method public int getEapMethod(); method public java.lang.String getIdentity(); method public java.lang.String getPassword(); @@ -19365,7 +19365,7 @@ package android.net.wifi { method public void setAnonymousIdentity(java.lang.String); method public void setCaCertificate(java.security.cert.X509Certificate); method public void setClientKeyEntry(java.security.PrivateKey, java.security.cert.X509Certificate); - method public void setDomSuffixMatch(java.lang.String); + method public void setDomainSuffixMatch(java.lang.String); method public void setEapMethod(int); method public void setIdentity(java.lang.String); method public void setPassword(java.lang.String); diff --git a/api/system-current.txt b/api/system-current.txt index 699025f..2e29a3d 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -21074,7 +21074,7 @@ package android.net.wifi { method public java.lang.String getAnonymousIdentity(); method public java.security.cert.X509Certificate getCaCertificate(); method public java.security.cert.X509Certificate getClientCertificate(); - method public java.lang.String getDomSubjectMatch(); + method public java.lang.String getDomainSubjectMatch(); method public int getEapMethod(); method public java.lang.String getIdentity(); method public java.lang.String getPassword(); @@ -21086,7 +21086,7 @@ package android.net.wifi { method public void setAnonymousIdentity(java.lang.String); method public void setCaCertificate(java.security.cert.X509Certificate); method public void setClientKeyEntry(java.security.PrivateKey, java.security.cert.X509Certificate); - method public void setDomSuffixMatch(java.lang.String); + method public void setDomainSuffixMatch(java.lang.String); method public void setEapMethod(int); method public void setIdentity(java.lang.String); method public void setPassword(java.lang.String); diff --git a/services/net/java/android/net/dhcp/DhcpAckPacket.java b/services/net/java/android/net/dhcp/DhcpAckPacket.java index 25b8093..c0e1d19 100644 --- a/services/net/java/android/net/dhcp/DhcpAckPacket.java +++ b/services/net/java/android/net/dhcp/DhcpAckPacket.java @@ -29,9 +29,9 @@ class DhcpAckPacket extends DhcpPacket { */ private final Inet4Address mSrcIp; - DhcpAckPacket(int transId, boolean broadcast, Inet4Address serverAddress, + DhcpAckPacket(int transId, short secs, boolean broadcast, Inet4Address serverAddress, Inet4Address clientIp, byte[] clientMac) { - super(transId, INADDR_ANY, clientIp, serverAddress, INADDR_ANY, clientMac, broadcast); + super(transId, secs, INADDR_ANY, clientIp, serverAddress, INADDR_ANY, clientMac, broadcast); mBroadcast = broadcast; mSrcIp = serverAddress; } diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java index ab56493..e1d1787 100644 --- a/services/net/java/android/net/dhcp/DhcpClient.java +++ b/services/net/java/android/net/dhcp/DhcpClient.java @@ -154,6 +154,7 @@ public class DhcpClient extends BaseDhcpStateMachine { private byte[] mHwAddr; private PacketSocketAddress mInterfaceBroadcastAddr; private int mTransactionId; + private long mTransactionStartMillis; private DhcpResults mDhcpLease; private long mDhcpLeaseExpiry; private DhcpResults mOffer; @@ -264,8 +265,9 @@ public class DhcpClient extends BaseDhcpStateMachine { } } - private void initTransactionId() { + private void startNewTransaction() { mTransactionId = mRandom.nextInt(); + mTransactionStartMillis = SystemClock.elapsedRealtime(); } private boolean initSockets() { @@ -344,6 +346,10 @@ public class DhcpClient extends BaseDhcpStateMachine { } } + private short getSecs() { + return (short) ((SystemClock.elapsedRealtime() - mTransactionStartMillis) / 1000); + } + private boolean transmitPacket(ByteBuffer buf, String description, Inet4Address to) { try { if (to.equals(INADDR_BROADCAST)) { @@ -362,7 +368,8 @@ public class DhcpClient extends BaseDhcpStateMachine { private boolean sendDiscoverPacket() { ByteBuffer packet = DhcpPacket.buildDiscoverPacket( - DhcpPacket.ENCAP_L2, mTransactionId, mHwAddr, DO_UNICAST, REQUESTED_PARAMS); + DhcpPacket.ENCAP_L2, mTransactionId, getSecs(), mHwAddr, + DO_UNICAST, REQUESTED_PARAMS); return transmitPacket(packet, "DHCPDISCOVER", INADDR_BROADCAST); } @@ -373,7 +380,7 @@ public class DhcpClient extends BaseDhcpStateMachine { int encap = to.equals(INADDR_BROADCAST) ? DhcpPacket.ENCAP_L2 : DhcpPacket.ENCAP_BOOTP; ByteBuffer packet = DhcpPacket.buildRequestPacket( - encap, mTransactionId, clientAddress, + encap, mTransactionId, getSecs(), clientAddress, DO_UNICAST, mHwAddr, requestedAddress, serverAddress, REQUESTED_PARAMS, null); String description = "DHCPREQUEST ciaddr=" + clientAddress.getHostAddress() + @@ -669,7 +676,7 @@ public class DhcpClient extends BaseDhcpStateMachine { @Override public void enter() { super.enter(); - initTransactionId(); + startNewTransaction(); } protected boolean sendPacket() { @@ -776,7 +783,7 @@ public class DhcpClient extends BaseDhcpStateMachine { @Override public void enter() { super.enter(); - initTransactionId(); + startNewTransaction(); } protected boolean sendPacket() { diff --git a/services/net/java/android/net/dhcp/DhcpDeclinePacket.java b/services/net/java/android/net/dhcp/DhcpDeclinePacket.java index 4a22b65..7ecdea7 100644 --- a/services/net/java/android/net/dhcp/DhcpDeclinePacket.java +++ b/services/net/java/android/net/dhcp/DhcpDeclinePacket.java @@ -26,10 +26,10 @@ class DhcpDeclinePacket extends DhcpPacket { /** * Generates a DECLINE packet with the specified parameters. */ - DhcpDeclinePacket(int transId, Inet4Address clientIp, Inet4Address yourIp, + DhcpDeclinePacket(int transId, short secs, Inet4Address clientIp, Inet4Address yourIp, Inet4Address nextIp, Inet4Address relayIp, byte[] clientMac) { - super(transId, clientIp, yourIp, nextIp, relayIp, clientMac, false); + super(transId, secs, clientIp, yourIp, nextIp, relayIp, clientMac, false); } public String toString() { diff --git a/services/net/java/android/net/dhcp/DhcpDiscoverPacket.java b/services/net/java/android/net/dhcp/DhcpDiscoverPacket.java index ed0fdc6..91e6bd6 100644 --- a/services/net/java/android/net/dhcp/DhcpDiscoverPacket.java +++ b/services/net/java/android/net/dhcp/DhcpDiscoverPacket.java @@ -26,8 +26,8 @@ class DhcpDiscoverPacket extends DhcpPacket { /** * Generates a DISCOVER packet with the specified parameters. */ - DhcpDiscoverPacket(int transId, byte[] clientMac, boolean broadcast) { - super(transId, INADDR_ANY, INADDR_ANY, INADDR_ANY, INADDR_ANY, clientMac, broadcast); + DhcpDiscoverPacket(int transId, short secs, byte[] clientMac, boolean broadcast) { + super(transId, secs, INADDR_ANY, INADDR_ANY, INADDR_ANY, INADDR_ANY, clientMac, broadcast); } public String toString() { diff --git a/services/net/java/android/net/dhcp/DhcpInformPacket.java b/services/net/java/android/net/dhcp/DhcpInformPacket.java index 2434fc9..7a83466 100644 --- a/services/net/java/android/net/dhcp/DhcpInformPacket.java +++ b/services/net/java/android/net/dhcp/DhcpInformPacket.java @@ -26,10 +26,10 @@ class DhcpInformPacket extends DhcpPacket { /** * Generates an INFORM packet with the specified parameters. */ - DhcpInformPacket(int transId, Inet4Address clientIp, Inet4Address yourIp, + DhcpInformPacket(int transId, short secs, Inet4Address clientIp, Inet4Address yourIp, Inet4Address nextIp, Inet4Address relayIp, byte[] clientMac) { - super(transId, clientIp, yourIp, nextIp, relayIp, clientMac, false); + super(transId, secs, clientIp, yourIp, nextIp, relayIp, clientMac, false); } public String toString() { diff --git a/services/net/java/android/net/dhcp/DhcpNakPacket.java b/services/net/java/android/net/dhcp/DhcpNakPacket.java index 1390ea7..6458232 100644 --- a/services/net/java/android/net/dhcp/DhcpNakPacket.java +++ b/services/net/java/android/net/dhcp/DhcpNakPacket.java @@ -26,10 +26,10 @@ class DhcpNakPacket extends DhcpPacket { /** * Generates a NAK packet with the specified parameters. */ - DhcpNakPacket(int transId, Inet4Address clientIp, Inet4Address yourIp, + DhcpNakPacket(int transId, short secs, Inet4Address clientIp, Inet4Address yourIp, Inet4Address nextIp, Inet4Address relayIp, byte[] clientMac) { - super(transId, INADDR_ANY, INADDR_ANY, nextIp, relayIp, + super(transId, secs, INADDR_ANY, INADDR_ANY, nextIp, relayIp, clientMac, false); } diff --git a/services/net/java/android/net/dhcp/DhcpOfferPacket.java b/services/net/java/android/net/dhcp/DhcpOfferPacket.java index b1f3bbd..af41708 100644 --- a/services/net/java/android/net/dhcp/DhcpOfferPacket.java +++ b/services/net/java/android/net/dhcp/DhcpOfferPacket.java @@ -31,9 +31,9 @@ class DhcpOfferPacket extends DhcpPacket { /** * Generates a OFFER packet with the specified parameters. */ - DhcpOfferPacket(int transId, boolean broadcast, Inet4Address serverAddress, + DhcpOfferPacket(int transId, short secs, boolean broadcast, Inet4Address serverAddress, Inet4Address clientIp, byte[] clientMac) { - super(transId, INADDR_ANY, clientIp, INADDR_ANY, INADDR_ANY, clientMac, broadcast); + super(transId, secs, INADDR_ANY, clientIp, INADDR_ANY, INADDR_ANY, clientMac, broadcast); mSrcIp = serverAddress; } diff --git a/services/net/java/android/net/dhcp/DhcpPacket.java b/services/net/java/android/net/dhcp/DhcpPacket.java index a64ee6f..b923b1b 100644 --- a/services/net/java/android/net/dhcp/DhcpPacket.java +++ b/services/net/java/android/net/dhcp/DhcpPacket.java @@ -226,6 +226,11 @@ abstract class DhcpPacket { protected final int mTransId; /** + * The seconds field in the BOOTP header. Per RFC, should be nonzero in client requests only. + */ + protected final short mSecs; + + /** * The IP address of the client host. This address is typically * proposed by the client (from an earlier DHCP negotiation) or * supplied by the server. @@ -258,10 +263,11 @@ abstract class DhcpPacket { */ abstract void finishPacket(ByteBuffer buffer); - protected DhcpPacket(int transId, Inet4Address clientIp, Inet4Address yourIp, + protected DhcpPacket(int transId, short secs, Inet4Address clientIp, Inet4Address yourIp, Inet4Address nextIp, Inet4Address relayIp, byte[] clientMac, boolean broadcast) { mTransId = transId; + mSecs = secs; mClientIp = clientIp; mYourIp = yourIp; mNextIp = nextIp; @@ -357,7 +363,7 @@ abstract class DhcpPacket { buf.put((byte) mClientMac.length); // Hardware Address Length buf.put((byte) 0); // Hop Count buf.putInt(mTransId); // Transaction ID - buf.putShort((short) 0); // Elapsed Seconds + buf.putShort(mSecs); // Elapsed Seconds if (broadcast) { buf.putShort((short) 0x8000); // Flags @@ -652,6 +658,7 @@ abstract class DhcpPacket { { // bootp parameters int transactionId; + short secs; Inet4Address clientIp; Inet4Address yourIp; Inet4Address nextIp; @@ -759,7 +766,7 @@ abstract class DhcpPacket { byte addrLen = packet.get(); byte hops = packet.get(); transactionId = packet.getInt(); - short elapsed = packet.getShort(); + secs = packet.getShort(); short bootpFlags = packet.getShort(); boolean broadcast = (bootpFlags & 0x8000) != 0; byte[] ipv4addr = new byte[4]; @@ -902,33 +909,33 @@ abstract class DhcpPacket { case -1: return null; case DHCP_MESSAGE_TYPE_DISCOVER: newPacket = new DhcpDiscoverPacket( - transactionId, clientMac, broadcast); + transactionId, secs, clientMac, broadcast); break; case DHCP_MESSAGE_TYPE_OFFER: newPacket = new DhcpOfferPacket( - transactionId, broadcast, ipSrc, yourIp, clientMac); + transactionId, secs, broadcast, ipSrc, yourIp, clientMac); break; case DHCP_MESSAGE_TYPE_REQUEST: newPacket = new DhcpRequestPacket( - transactionId, clientIp, clientMac, broadcast); + transactionId, secs, clientIp, clientMac, broadcast); break; case DHCP_MESSAGE_TYPE_DECLINE: newPacket = new DhcpDeclinePacket( - transactionId, clientIp, yourIp, nextIp, relayIp, + transactionId, secs, clientIp, yourIp, nextIp, relayIp, clientMac); break; case DHCP_MESSAGE_TYPE_ACK: newPacket = new DhcpAckPacket( - transactionId, broadcast, ipSrc, yourIp, clientMac); + transactionId, secs, broadcast, ipSrc, yourIp, clientMac); break; case DHCP_MESSAGE_TYPE_NAK: newPacket = new DhcpNakPacket( - transactionId, clientIp, yourIp, nextIp, relayIp, + transactionId, secs, clientIp, yourIp, nextIp, relayIp, clientMac); break; case DHCP_MESSAGE_TYPE_INFORM: newPacket = new DhcpInformPacket( - transactionId, clientIp, yourIp, nextIp, relayIp, + transactionId, secs, clientIp, yourIp, nextIp, relayIp, clientMac); break; default: @@ -1008,9 +1015,9 @@ abstract class DhcpPacket { * parameters. */ public static ByteBuffer buildDiscoverPacket(int encap, int transactionId, - byte[] clientMac, boolean broadcast, byte[] expectedParams) { + short secs, byte[] clientMac, boolean broadcast, byte[] expectedParams) { DhcpPacket pkt = new DhcpDiscoverPacket( - transactionId, clientMac, broadcast); + transactionId, secs, clientMac, broadcast); pkt.mRequestedParams = expectedParams; return pkt.buildPacket(encap, DHCP_SERVER, DHCP_CLIENT); } @@ -1025,7 +1032,7 @@ abstract class DhcpPacket { Inet4Address gateway, List<Inet4Address> dnsServers, Inet4Address dhcpServerIdentifier, String domainName) { DhcpPacket pkt = new DhcpOfferPacket( - transactionId, broadcast, serverIpAddr, clientIpAddr, mac); + transactionId, (short) 0, broadcast, serverIpAddr, clientIpAddr, mac); pkt.mGateway = gateway; pkt.mDnsServers = dnsServers; pkt.mLeaseTime = timeout; @@ -1045,7 +1052,7 @@ abstract class DhcpPacket { Inet4Address gateway, List<Inet4Address> dnsServers, Inet4Address dhcpServerIdentifier, String domainName) { DhcpPacket pkt = new DhcpAckPacket( - transactionId, broadcast, serverIpAddr, clientIpAddr, mac); + transactionId, (short) 0, broadcast, serverIpAddr, clientIpAddr, mac); pkt.mGateway = gateway; pkt.mDnsServers = dnsServers; pkt.mLeaseTime = timeout; @@ -1061,7 +1068,7 @@ abstract class DhcpPacket { */ public static ByteBuffer buildNakPacket(int encap, int transactionId, Inet4Address serverIpAddr, Inet4Address clientIpAddr, byte[] mac) { - DhcpPacket pkt = new DhcpNakPacket(transactionId, clientIpAddr, + DhcpPacket pkt = new DhcpNakPacket(transactionId, (short) 0, clientIpAddr, serverIpAddr, serverIpAddr, serverIpAddr, mac); pkt.mMessage = "requested address not available"; pkt.mRequestedIp = clientIpAddr; @@ -1072,10 +1079,10 @@ abstract class DhcpPacket { * Builds a DHCP-REQUEST packet from the required specified parameters. */ public static ByteBuffer buildRequestPacket(int encap, - int transactionId, Inet4Address clientIp, boolean broadcast, + int transactionId, short secs, Inet4Address clientIp, boolean broadcast, byte[] clientMac, Inet4Address requestedIpAddress, Inet4Address serverIdentifier, byte[] requestedParams, String hostName) { - DhcpPacket pkt = new DhcpRequestPacket(transactionId, clientIp, + DhcpPacket pkt = new DhcpRequestPacket(transactionId, secs, clientIp, clientMac, broadcast); pkt.mRequestedIp = requestedIpAddress; pkt.mServerIdentifier = serverIdentifier; diff --git a/services/net/java/android/net/dhcp/DhcpRequestPacket.java b/services/net/java/android/net/dhcp/DhcpRequestPacket.java index 5d378b8..4f9aa01 100644 --- a/services/net/java/android/net/dhcp/DhcpRequestPacket.java +++ b/services/net/java/android/net/dhcp/DhcpRequestPacket.java @@ -28,9 +28,9 @@ class DhcpRequestPacket extends DhcpPacket { /** * Generates a REQUEST packet with the specified parameters. */ - DhcpRequestPacket(int transId, Inet4Address clientIp, byte[] clientMac, + DhcpRequestPacket(int transId, short secs, Inet4Address clientIp, byte[] clientMac, boolean broadcast) { - super(transId, clientIp, INADDR_ANY, INADDR_ANY, INADDR_ANY, clientMac, broadcast); + super(transId, secs, clientIp, INADDR_ANY, INADDR_ANY, INADDR_ANY, clientMac, broadcast); } public String toString() { diff --git a/services/tests/servicestests/src/android/net/dhcp/DhcpPacketTest.java b/services/tests/servicestests/src/android/net/dhcp/DhcpPacketTest.java index 2658937..4f7c7ec 100644 --- a/services/tests/servicestests/src/android/net/dhcp/DhcpPacketTest.java +++ b/services/tests/servicestests/src/android/net/dhcp/DhcpPacketTest.java @@ -41,7 +41,8 @@ public class DhcpPacketTest extends TestCase { private byte[] mDomainBytes, mVendorInfoBytes; public TestDhcpPacket(byte type, byte[] domainBytes, byte[] vendorInfoBytes) { - super(0xdeadbeef, INADDR_ANY, CLIENT_ADDR, INADDR_ANY, INADDR_ANY, CLIENT_MAC, true); + super(0xdeadbeef, (short) 0, INADDR_ANY, CLIENT_ADDR, INADDR_ANY, INADDR_ANY, + CLIENT_MAC, true); mType = type; mDomainBytes = domainBytes; mVendorInfoBytes = vendorInfoBytes; diff --git a/wifi/java/android/net/wifi/RttManager.java b/wifi/java/android/net/wifi/RttManager.java index ca169f8..d2fb0dd 100644 --- a/wifi/java/android/net/wifi/RttManager.java +++ b/wifi/java/android/net/wifi/RttManager.java @@ -883,9 +883,9 @@ public class RttManager { } index++; } - validateChannel(); ParcelableRttParams parcelableParams = new ParcelableRttParams(params); + Log.i(TAG, "Send RTT request to RTT Service"); sAsyncChannel.sendMessage(CMD_OP_START_RANGING, 0, putListener(listener), parcelableParams); } @@ -1033,6 +1033,7 @@ public class RttManager { } @Override public void handleMessage(Message msg) { + Log.i(TAG, "RTT manager get message: " + msg.what); switch (msg.what) { case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED: if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) { @@ -1058,10 +1059,10 @@ public class RttManager { Object listener = getListener(msg.arg2); if (listener == null) { - if (DBG) Log.d(TAG, "invalid listener key = " + msg.arg2); + Log.e(TAG, "invalid listener key = " + msg.arg2 ); return; } else { - if (DBG) Log.d(TAG, "listener key = " + msg.arg2); + Log.i(TAG, "listener key = " + msg.arg2); } switch (msg.what) { diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 802e0d2..21161b4 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -243,6 +243,7 @@ public class WifiConfiguration implements Parcelable { * The band which AP resides on * 0-2G 1-5G * By default, 2G is chosen + * @hidden */ public int apBand = 0; @@ -251,6 +252,7 @@ public class WifiConfiguration implements Parcelable { * 2G 1-11 * 5G 36,40,44,48,149,153,157,161,165 * 0 - find a random available channel according to the apBand + * @hidden */ public int apChannel = 0; diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java index bee07ab..3525ec2 100644 --- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java +++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java @@ -596,7 +596,7 @@ public class WifiEnterpriseConfig implements Parcelable { * match test-example.com. * @param domain The domain value */ - public void setDomSuffixMatch(String domain) { + public void setDomainSuffixMatch(String domain) { setFieldValue(DOM_SUFFIX_MATCH_KEY, domain); } @@ -604,7 +604,7 @@ public class WifiEnterpriseConfig implements Parcelable { * Get the domain_suffix_match value. See setDomSuffixMatch. * @return The domain value. */ - public String getDomSubjectMatch() { + public String getDomainSubjectMatch() { return getFieldValue(DOM_SUFFIX_MATCH_KEY, ""); } |