Don't crash when passing null destinations to bind, connect, and sendto

Passing a null address to bind or connect is invalid (for
AF_INET6 socekts, they return EINVAL), so throw NPE. Passing a
null address to sendto is valid and means "send to the address
this socket is connected to". Pass the call to the kernel as
the app would expect.

There should be no backwards compatibility implications to this
change because previously these operations would just crash with
a JNI error. See previous CL in topic.

Bug: 126699941
Test: atest CtsLibcoreTestCases:libcore.libcore.io.OsTest#testCrossFamilyBindConnectSendto
Change-Id: I1d36c13e8d0ee426993f4bab33cfcfdc1603bfc8
2 files changed