From 37e65ebb7eb932e1a144b1cab262e11ca5fd109b Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Mon, 30 Aug 2010 10:56:47 -0700 Subject: Rename NetworkProperties to LinkProperties Also add copy constructors and use them when giving out data. Change-Id: Id320eb8fb91d0bd250305ce7bb4f628570215615 --- .../java/com/android/server/ConnectivityService.java | 17 ++++++++--------- .../java/com/android/server/TelephonyRegistry.java | 18 +++++++++--------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'services') 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.ConnectivityManager; 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 @@ public class ConnectivityService extends IConnectivityManager.Stub { * 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 @@ public class ConnectivityService extends IConnectivityManager.Stub { return false; } - NetworkProperties p = nt.getNetworkProperties(); + LinkProperties p = nt.getLinkProperties(); if (p == null) return false; String interfaceName = p.getInterfaceName(); @@ -1258,7 +1257,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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 class ConnectivityService extends IConnectivityManager.Stub { 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 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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 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 @@ package com.android.server; 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private ArrayList mConnectedApns; - private NetworkProperties mDataConnectionProperties; + private LinkProperties mDataConnectionProperties; private Bundle mCellLocation = new Bundle(); @@ -355,7 +355,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { mDataConnectionPossible = isDataConnectivityPossible; mDataConnectionReason = reason; mDataConnectionApn = apn; - mDataConnectionProperties = networkProperties; + mDataConnectionProperties = linkProperties; if (mDataConnectionNetworkType != networkType) { mDataConnectionNetworkType = networkType; modified = true; @@ -403,7 +403,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } } broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn, - apnType, networkProperties); + apnType, linkProperties); } public void notifyDataConnectionFailed(String reason, String apnType) { @@ -564,7 +564,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { 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 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { 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()); } -- cgit v1.1