Fix getifaddrs(3).

Originally, we pulled out the IFA_ADDRESS messages and used them. That didn't
work with sholes' ppp interface, where we'd report the *destination* address
rather than the local address. We switched to the logical-sounding IFA_LOCAL
messages instead: for IPv4 you always get both IFA_ADDRESS and IFA_LOCAL, and
they're either the same, or you want IFA_LOCAL. It turns out that you don't
get IFA_LOCAL addresses for IPv6 unless they differ from the corresponding
IFA_ADDRESS. So what we have to do is use the IFA_ADDRESS but let IFA_LOCAL
override it, if it appears.

This code was getting way too large, so I've ripped the implementation out of
the header file and given it its own file. I've also switched to UniquePtr
now it exists, and removed a few unnecessary #includes of "LocalArray.h".

I've also added a unit test to help guard against breaking this again.

Bug: http://code.google.com/p/android/issues/detail?id=13784
Change-Id: I5a7d29b8e9bf652160eca043802363feb91421a2