Mark Os.bind, Os.sendTo as public API

1. There are already related socket API methods that return
   SocketAddress, such as Os.getpeername().
2. Having APIs that take SocketAddress are a closer match
   to the POSIX APIs that android.system.Os is exposing,
   and are more flexible than just taking InetAddress+port
   combinations since the latter only supports IPv4 and
   IPv6.
3. Given that InetSocketAddress is a subclass of
   SocketAddress, there is very little additional
   implementation burden to supporting both SocketAddress
   versions and InetSocketAddress versions - basically
   just ensure that any EINVAL or EAFNOSUPPORT error
   messages coming from the kernel are properly returned.

Arguably, it might have been better to expose only the
SocketAddress variants from the beginning, but obviously
now that we have the InetAddress+port variants we need to
support those too.

Test: m
Bug: 123062477
Change-Id: I2c3d9e42004cebd4c38754bfb4b65cf6a2a56959
2 files changed