Rename NetworkProperties to LinkProperties

Also add copy constructors and use them when giving out data.

Change-Id: Id320eb8fb91d0bd250305ce7bb4f628570215615
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 57e8e02..6f23805 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -26,7 +26,7 @@
 import android.net.IConnectivityManager;
 import android.net.MobileDataStateTracker;
 import android.net.NetworkInfo;
-import android.net.NetworkProperties;
+import android.net.LinkProperties;
 import android.net.NetworkStateTracker;
 import android.net.NetworkUtils;
 import android.net.wifi.WifiStateTracker;
@@ -756,7 +756,6 @@
      * specified host is to be routed
      * @param hostAddress the IP address of the host to which the route is
      * desired
-     * todo - deprecate (only v4!)
      * @return {@code true} on success, {@code false} on failure
      */
     public boolean requestRouteToHost(int networkType, int hostAddress) {
@@ -813,7 +812,7 @@
             return false;
         }
 
-        NetworkProperties p = nt.getNetworkProperties();
+        LinkProperties p = nt.getLinkProperties();
         if (p == null) return false;
         String interfaceName = p.getInterfaceName();
 
@@ -1258,7 +1257,7 @@
 
     private void addPrivateDnsRoutes(NetworkStateTracker nt) {
         boolean privateDnsRouteSet = nt.isPrivateDnsRouteSet();
-        NetworkProperties p = nt.getNetworkProperties();
+        LinkProperties p = nt.getLinkProperties();
         if (p == null) return;
         String interfaceName = p.getInterfaceName();
 
@@ -1279,7 +1278,7 @@
     private void removePrivateDnsRoutes(NetworkStateTracker nt) {
         // TODO - we should do this explicitly but the NetUtils api doesnt
         // support this yet - must remove all.  No worse than before
-        NetworkProperties p = nt.getNetworkProperties();
+        LinkProperties p = nt.getLinkProperties();
         if (p == null) return;
         String interfaceName = p.getInterfaceName();
         boolean privateDnsRouteSet = nt.isPrivateDnsRouteSet();
@@ -1295,7 +1294,7 @@
 
 
     private void addDefaultRoute(NetworkStateTracker nt) {
-        NetworkProperties p = nt.getNetworkProperties();
+        LinkProperties p = nt.getLinkProperties();
         if (p == null) return;
         String interfaceName = p.getInterfaceName();
         InetAddress defaultGatewayAddr = p.getGateway();
@@ -1311,7 +1310,7 @@
 
 
     public void removeDefaultRoute(NetworkStateTracker nt) {
-        NetworkProperties p = nt.getNetworkProperties();
+        LinkProperties p = nt.getLinkProperties();
         if (p == null) return;
         String interfaceName = p.getInterfaceName();
 
@@ -1410,7 +1409,7 @@
             NetworkStateTracker nt = mNetTrackers[i];
             if (nt.getNetworkInfo().isConnected() &&
                     !nt.isTeardownRequested()) {
-                NetworkProperties p = nt.getNetworkProperties();
+                LinkProperties p = nt.getLinkProperties();
                 if (p == null) continue;
                 List pids = mNetRequestersPids[i];
                 for (int j=0; j<pids.size(); j++) {
@@ -1465,7 +1464,7 @@
         // add default net's dns entries
         NetworkStateTracker nt = mNetTrackers[netType];
         if (nt != null && nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) {
-            NetworkProperties p = nt.getNetworkProperties();
+            LinkProperties p = nt.getLinkProperties();
             if (p == null) return;
             Collection<InetAddress> dnses = p.getDnses();
             if (mNetAttributes[netType].isDefault()) {
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index 73234df..0a90a4c 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -19,7 +19,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.net.NetworkProperties;
+import android.net.LinkProperties;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -92,7 +92,7 @@
 
     private ArrayList<String> mConnectedApns;
 
-    private NetworkProperties mDataConnectionProperties;
+    private LinkProperties mDataConnectionProperties;
 
     private Bundle mCellLocation = new Bundle();
 
@@ -355,7 +355,7 @@
     }
 
     public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
-            String reason, String apn, String apnType, NetworkProperties networkProperties,
+            String reason, String apn, String apnType, LinkProperties linkProperties,
             int networkType) {
         if (!checkNotifyPermission("notifyDataConnection()" )) {
             return;
@@ -383,7 +383,7 @@
             mDataConnectionPossible = isDataConnectivityPossible;
             mDataConnectionReason = reason;
             mDataConnectionApn = apn;
-            mDataConnectionProperties = networkProperties;
+            mDataConnectionProperties = linkProperties;
             if (mDataConnectionNetworkType != networkType) {
                 mDataConnectionNetworkType = networkType;
                 modified = true;
@@ -403,7 +403,7 @@
             }
         }
         broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,
-                apnType, networkProperties);
+                apnType, linkProperties);
     }
 
     public void notifyDataConnectionFailed(String reason, String apnType) {
@@ -564,7 +564,7 @@
 
     private void broadcastDataConnectionStateChanged(int state,
             boolean isDataConnectivityPossible,
-            String reason, String apn, String apnType, NetworkProperties networkProperties) {
+            String reason, String apn, String apnType, LinkProperties linkProperties) {
         // Note: not reporting to the battery stats service here, because the
         // status bar takes care of that after taking into account all of the
         // required info.
@@ -577,9 +577,9 @@
         if (reason != null) {
             intent.putExtra(Phone.STATE_CHANGE_REASON_KEY, reason);
         }
-        if (networkProperties != null) {
-            intent.putExtra(Phone.DATA_NETWORK_PROPERTIES_KEY, networkProperties);
-            NetworkInterface iface = networkProperties.getInterface();
+        if (linkProperties != null) {
+            intent.putExtra(Phone.DATA_LINK_PROPERTIES_KEY, linkProperties);
+            NetworkInterface iface = linkProperties.getInterface();
             if (iface != null) {
                 intent.putExtra(Phone.DATA_IFACE_NAME_KEY, iface.getName());
             }