diff options
author | Remi NGUYEN VAN <reminv@google.com> | 2019-03-06 18:02:34 +0900 |
---|---|---|
committer | Remi NGUYEN VAN <reminv@google.com> | 2019-03-06 18:02:34 +0900 |
commit | 8709cc6bbeaa1e0c8bebb96ce6d7c92f3420c7fe (patch) | |
tree | 3e4edc969ff99db622120ce2a545706926e50832 /src/android/net/dhcp/DhcpClient.java | |
parent | 189c598dc705aadfd751f6978efb12077ae131b9 (diff) |
Fix SocketUtils API
- connect, sendTo, bind were added as public API, so do not need to be
maintained as SystemApi in SocketUtils. These APIs were added in Q
timeframe.
- Add @Nullable/@NonNull annotations.
Bug: 126699304
Bug: 126477266
Test: booted, WiFi works
Change-Id: I3f086ac8952cfd6a4d8f861d2e1c7aa1ca8be999
Diffstat (limited to 'src/android/net/dhcp/DhcpClient.java')
-rw-r--r-- | src/android/net/dhcp/DhcpClient.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java index b0e8da9..0b7809e 100644 --- a/src/android/net/dhcp/DhcpClient.java +++ b/src/android/net/dhcp/DhcpClient.java @@ -317,7 +317,7 @@ public class DhcpClient extends StateMachine { try { mPacketSock = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IP); SocketAddress addr = makePacketSocketAddress((short) ETH_P_IP, mIface.index); - SocketUtils.bindSocket(mPacketSock, addr); + Os.bind(mPacketSock, addr); SocketUtils.attachDhcpFilter(mPacketSock); } catch(SocketException|ErrnoException e) { Log.e(TAG, "Error creating packet socket", e); @@ -412,8 +412,7 @@ public class DhcpClient extends StateMachine { try { if (encap == DhcpPacket.ENCAP_L2) { if (DBG) Log.d(TAG, "Broadcasting " + description); - SocketUtils.sendTo( - mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr); + Os.sendto(mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr); } else if (encap == DhcpPacket.ENCAP_BOOTP && to.equals(INADDR_BROADCAST)) { if (DBG) Log.d(TAG, "Broadcasting " + description); // We only send L3-encapped broadcasts in DhcpRebindingState, |