Use LinkAddress in address notifications.

Currently address{Updated,Removed} pass in the address as a
string such as "fe80::1/64". Use LinkAddresses instead, since
that's what it is.

This makes the code more robust in the unlikely case that netd
passes in an invalid string. In the future we can move flags and
scope into the LinkAddress itself and simplify the code further.

Bug: 9180552
Change-Id: I66599f9529cf421caa7676fdd0141bb110b8589e
diff --git a/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
index 4385dcd..a78e7b6 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkManagementServiceTest.java
@@ -17,6 +17,7 @@
 package com.android.server;
 
 import android.content.Context;
+import android.net.LinkAddress;
 import android.net.LocalSocket;
 import android.net.LocalServerSocket;
 import android.os.Binder;
@@ -157,19 +158,22 @@
          * IP address changes.
          */
         sendMessage("614 Address updated fe80::1/64 wlan0 128 253");
-        expectSoon(observer).addressUpdated("fe80::1/64", "wlan0", 128, 253);
+        expectSoon(observer).addressUpdated(
+                new LinkAddress("fe80::1/64"), "wlan0", 128, 253);
 
-        // There is no "added".
+        // There is no "added", so we take this as "removed".
         sendMessage("614 Address added fe80::1/64 wlan0 128 253");
-        expectSoon(observer).addressRemoved("fe80::1/64", "wlan0", 128, 253);
+        expectSoon(observer).addressRemoved(
+                new LinkAddress("fe80::1/64"), "wlan0", 128, 253);
 
         sendMessage("614 Address removed 2001:db8::1/64 wlan0 1 0");
-        expectSoon(observer).addressRemoved("2001:db8::1/64", "wlan0", 1, 0);
+        expectSoon(observer).addressRemoved(
+                new LinkAddress("2001:db8::1/64"), "wlan0", 1, 0);
 
         sendMessage("614 Address removed 2001:db8::1/64 wlan0 1");
         // Not enough arguments.
 
-        sendMessage("666 Address added 2001:db8::1/64 wlan0 1 0");
+        sendMessage("666 Address removed 2001:db8::1/64 wlan0 1 0");
         // Invalid code.