libcutils: add socket_get_local_port().

Tests that require a local server currently hardcode a test value,
which can run into conflicts depending on what's currently running on
the machine.

This CL adds socket_get_local_port(), which lets us pass 0 so the
system picks an open port and we can query which port it chose.

Bug: http://b/26236380
Change-Id: I01d1558884e7636081d9a357db6faa86929934f6
diff --git a/libcutils/Android.mk b/libcutils/Android.mk
index 25b056b..482e4dd 100644
--- a/libcutils/Android.mk
+++ b/libcutils/Android.mk
@@ -17,21 +17,22 @@
 include $(CLEAR_VARS)
 
 libcutils_common_sources := \
-        hashmap.c \
         atomic.c.arm \
-        native_handle.c \
         config_utils.c \
+        fs_config.c \
+        hashmap.c \
+        iosched_policy.c \
         load_file.c \
-        strlcpy.c \
+        native_handle.c \
         open_memstream.c \
+        process_name.c \
+        record_stream.c \
+        sched_policy.c \
+        sockets.cpp \
         strdup16to8.c \
         strdup8to16.c \
-        record_stream.c \
-        process_name.c \
+        strlcpy.c \
         threads.c \
-        sched_policy.c \
-        iosched_policy.c \
-        fs_config.c
 
 # some files must not be compiled when building against Mingw
 # they correspond to features not used by our host development tools