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 --- .../android/internal/telephony/DataConnection.java | 33 +++++++++++----------- .../internal/telephony/DataConnectionTracker.java | 14 ++++----- .../internal/telephony/DefaultPhoneNotifier.java | 8 +++--- .../internal/telephony/ITelephonyRegistry.aidl | 4 +-- .../java/com/android/internal/telephony/Phone.java | 8 +++--- .../com/android/internal/telephony/PhoneBase.java | 6 ++-- .../com/android/internal/telephony/PhoneProxy.java | 6 ++-- .../internal/telephony/SipPhoneNotifier.java | 8 +++--- .../telephony/cdma/CdmaDataConnectionTracker.java | 2 +- .../telephony/gsm/GsmDataConnectionTracker.java | 4 +-- .../internal/telephony/sip/SipPhoneBase.java | 4 +-- 11 files changed, 49 insertions(+), 48 deletions(-) (limited to 'telephony') diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java index 7e722cb..521d90c 100644 --- a/telephony/java/com/android/internal/telephony/DataConnection.java +++ b/telephony/java/com/android/internal/telephony/DataConnection.java @@ -21,7 +21,7 @@ import com.android.internal.telephony.gsm.ApnSetting; import com.android.internal.util.HierarchicalState; import com.android.internal.util.HierarchicalStateMachine; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.AsyncResult; import android.os.Message; import android.os.SystemProperties; @@ -261,7 +261,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { protected int mTag; protected PhoneBase phone; protected int cid; - protected NetworkProperties mNetworkProperties = new NetworkProperties(); + protected LinkProperties mLinkProperties = new LinkProperties(); protected long createTime; protected long lastFailTime; protected FailCause lastFailCause; @@ -378,7 +378,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { this.lastFailTime = -1; this.lastFailCause = FailCause.NONE; - mNetworkProperties.clear(); + mLinkProperties = new LinkProperties(); } /** @@ -416,7 +416,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { // Start with clean network properties and if we have // a failure we'll clear again at the bottom of this code. - mNetworkProperties.clear(); + LinkProperties linkProperties = new LinkProperties(); if (response.length >= 2) { cid = Integer.parseInt(response[0]); String interfaceName = response[1]; @@ -425,23 +425,23 @@ public abstract class DataConnection extends HierarchicalStateMachine { try { String prefix = "net." + interfaceName + "."; - mNetworkProperties.setInterface(NetworkInterface.getByName(interfaceName)); + linkProperties.setInterface(NetworkInterface.getByName(interfaceName)); // TODO: Get gateway and dns via RIL interface not property? String gatewayAddress = SystemProperties.get(prefix + "gw"); - mNetworkProperties.setGateway(InetAddress.getByName(gatewayAddress)); + linkProperties.setGateway(InetAddress.getByName(gatewayAddress)); if (response.length > 2) { String ipAddress = response[2]; - mNetworkProperties.addAddress(InetAddress.getByName(ipAddress)); + linkProperties.addAddress(InetAddress.getByName(ipAddress)); // TODO: Get gateway and dns via RIL interface not property? String dnsServers[] = new String[2]; dnsServers[0] = SystemProperties.get(prefix + "dns1"); dnsServers[1] = SystemProperties.get(prefix + "dns2"); if (isDnsOk(dnsServers)) { - mNetworkProperties.addDns(InetAddress.getByName(dnsServers[0])); - mNetworkProperties.addDns(InetAddress.getByName(dnsServers[1])); + linkProperties.addDns(InetAddress.getByName(dnsServers[0])); + linkProperties.addDns(InetAddress.getByName(dnsServers[1])); } else { result = SetupResult.ERR_BadDns; } @@ -463,15 +463,16 @@ public abstract class DataConnection extends HierarchicalStateMachine { // An error occurred so clear properties if (result != SetupResult.SUCCESS) { - log("onSetupCompleted with an error clearing NetworkProperties"); - mNetworkProperties.clear(); + log("onSetupCompleted with an error clearing LinkProperties"); + linkProperties.clear(); } + mLinkProperties = linkProperties; } if (DBG) { log("DataConnection setup result='" + result + "' on cid=" + cid); if (result == SetupResult.SUCCESS) { - log("NetworkProperties: " + mNetworkProperties.toString()); + log("LinkProperties: " + mLinkProperties.toString()); } } return result; @@ -636,7 +637,7 @@ public abstract class DataConnection extends HierarchicalStateMachine { case ERR_BadDns: // Connection succeeded but DNS info is bad so disconnect StringBuilder dnsAddressesSb = new StringBuilder(); - for (InetAddress addr : mNetworkProperties.getDnses()) { + for (InetAddress addr : mLinkProperties.getDnses()) { if (dnsAddressesSb.length() != 0) dnsAddressesSb.append(" "); dnsAddressesSb.append(addr.toString()); } @@ -911,10 +912,10 @@ public abstract class DataConnection extends HierarchicalStateMachine { } /** - * @return the connections NetworkProperties + * @return the connections LinkProperties */ - public NetworkProperties getNetworkProperties() { - return mNetworkProperties; + public LinkProperties getLinkProperties() { + return new LinkProperties(mLinkProperties); } /** diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java index 14cb584..765f64b 100644 --- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java @@ -17,7 +17,7 @@ package com.android.internal.telephony; import android.app.PendingIntent; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; @@ -192,8 +192,8 @@ public abstract class DataConnectionTracker extends Handler { /** indication of our availability (preconditions to trysetupData are met) **/ protected boolean mAvailability = false; - /** all our network properties (dns, gateway, ip, etc) */ - protected NetworkProperties mNetworkProperties; + /** all our link properties (dns, gateway, ip, etc) */ + protected LinkProperties mLinkProperties; /** * Default constructor @@ -420,10 +420,10 @@ public abstract class DataConnectionTracker extends Handler { protected abstract void setState(State s); - protected NetworkProperties getNetworkProperties(String apnType) { + protected LinkProperties getLinkProperties(String apnType) { int id = apnTypeToId(apnType); if (isApnIdEnabled(id)) { - return mNetworkProperties; + return new LinkProperties(mLinkProperties); } else { return null; } @@ -673,7 +673,7 @@ public abstract class DataConnectionTracker extends Handler { } } - protected NetworkProperties getNetworkProperties(DataConnection connection) { - return connection.getNetworkProperties(); + protected LinkProperties getLinkProperties(DataConnection connection) { + return connection.getLinkProperties(); } } diff --git a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java index 382c19f..bf3c4d1 100644 --- a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java @@ -16,7 +16,7 @@ package com.android.internal.telephony; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; @@ -108,9 +108,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier { // use apnType as the key to which connection we're talking about. // pass apnType back up to fetch particular for this one. TelephonyManager telephony = TelephonyManager.getDefault(); - NetworkProperties networkProperties = null; + LinkProperties linkProperties = null; if (state == Phone.DataState.CONNECTED) { - networkProperties = sender.getNetworkProperties(apnType); + linkProperties = sender.getLinkProperties(apnType); } try { mRegistry.notifyDataConnection( @@ -118,7 +118,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier { sender.isDataConnectivityPossible(), reason, sender.getActiveApn(), apnType, - networkProperties, + linkProperties, ((telephony!=null) ? telephony.getNetworkType() : TelephonyManager.NETWORK_TYPE_UNKNOWN)); } catch (RemoteException ex) { diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index f7b70ee..eb7e566 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -17,7 +17,7 @@ package com.android.internal.telephony; import android.content.Intent; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.Bundle; import android.telephony.ServiceState; import android.telephony.SignalStrength; @@ -33,7 +33,7 @@ interface ITelephonyRegistry { void notifyCallForwardingChanged(boolean cfi); void notifyDataActivity(int state); void notifyDataConnection(int state, boolean isDataConnectivityPossible, - String reason, String apn, String apnType, in NetworkProperties networkProperties, + String reason, String apn, String apnType, in LinkProperties linkProperties, int networkType); void notifyDataConnectionFailed(String reason, String apnType); void notifyCellLocation(in Bundle cellLocation); diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index e752dc6..fffe057 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -17,7 +17,7 @@ package com.android.internal.telephony; import android.content.Context; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.Handler; import android.os.Message; import android.telephony.CellLocation; @@ -99,7 +99,7 @@ public interface Phone { static final String STATE_CHANGE_REASON_KEY = "reason"; static final String DATA_APN_TYPE_KEY = "apnType"; static final String DATA_APN_KEY = "apn"; - static final String DATA_NETWORK_PROPERTIES_KEY = "dataProperties"; + static final String DATA_LINK_PROPERTIES_KEY = "linkProperties"; static final String DATA_IFACE_NAME_KEY = "iface"; static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable"; @@ -319,9 +319,9 @@ public interface Phone { String getActiveApn(); /** - * Return the NetworkProperties for the named apn or null if not available + * Return the LinkProperties for the named apn or null if not available */ - NetworkProperties getNetworkProperties(String apnType); + LinkProperties getLinkProperties(String apnType); /** * Get current signal strength. No change notification available on this diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 0557942..36a2fcf 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -21,7 +21,7 @@ import android.app.IActivityManager; import android.content.Context; import android.content.res.Configuration; import android.content.SharedPreferences; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Handler; @@ -938,8 +938,8 @@ public abstract class PhoneBase extends Handler implements Phone { return mDataConnection.getActiveApnTypes(); } - public NetworkProperties getNetworkProperties(String apnType) { - return mDataConnection.getNetworkProperties(apnType); + public LinkProperties getLinkProperties(String apnType) { + return mDataConnection.getLinkProperties(apnType); } public String getActiveApn() { diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java index bcf3337..b6e4cda 100644 --- a/telephony/java/com/android/internal/telephony/PhoneProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java @@ -20,7 +20,7 @@ package com.android.internal.telephony; import android.app.ActivityManagerNative; import android.content.Context; import android.content.Intent; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.Handler; import android.os.Message; import android.os.SystemProperties; @@ -208,8 +208,8 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getActiveApnTypes(); } - public NetworkProperties getNetworkProperties(String apnType) { - return mActivePhone.getNetworkProperties(apnType); + public LinkProperties getLinkProperties(String apnType) { + return mActivePhone.getLinkProperties(apnType); } public String getActiveApn() { diff --git a/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java b/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java index 1229d14..30d06d8 100644 --- a/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java @@ -16,7 +16,7 @@ package com.android.internal.telephony; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; @@ -110,9 +110,9 @@ public class SipPhoneNotifier implements PhoneNotifier { // use apnType as the key to which connection we're talking about. // pass apnType back up to fetch particular for this one. TelephonyManager telephony = TelephonyManager.getDefault(); - NetworkProperties networkProperties = null; + LinkProperties linkProperties = null; if (state == Phone.DataState.CONNECTED) { - networkProperties = sender.getNetworkProperties(apnType); + linkProperties = sender.getLinkProperties(apnType); } try { mRegistry.notifyDataConnection( @@ -120,7 +120,7 @@ public class SipPhoneNotifier implements PhoneNotifier { sender.isDataConnectivityPossible(), reason, sender.getActiveApn(), apnType, - networkProperties, + linkProperties, ((telephony!=null) ? telephony.getNetworkType() : TelephonyManager.NETWORK_TYPE_UNKNOWN)); } catch (RemoteException ex) { diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index c94cfa4..5918245 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -732,7 +732,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } if (ar.exception == null) { - mNetworkProperties = getNetworkProperties(mActiveDataConnection); + mLinkProperties = getLinkProperties(mActiveDataConnection); // everything is setup notifyDefaultData(reason); diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index face581..4414460 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -1098,7 +1098,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } if (ar.exception == null) { - mNetworkProperties = getNetworkProperties(mActivePdp); + mLinkProperties = getLinkProperties(mActivePdp); ApnSetting apn = mActivePdp.getApn(); if (apn.proxy != null && apn.proxy.length() != 0) { @@ -1106,7 +1106,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { ProxyProperties proxy = new ProxyProperties(); proxy.setAddress(InetAddress.getByName(apn.proxy)); proxy.setPort(Integer.parseInt(apn.port)); - mNetworkProperties.setHttpProxy(proxy); + mLinkProperties.setHttpProxy(proxy); } catch (UnknownHostException e) { Log.e(LOG_TAG, "UnknownHostException making ProxyProperties: " + e); } catch (SecurityException e) { diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java b/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java index 1d33be9..e742887 100755 --- a/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java +++ b/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java @@ -19,7 +19,7 @@ package com.android.internal.telephony.sip; import android.content.ContentValues; import android.content.Context; import android.content.SharedPreferences; -import android.net.NetworkProperties; +import android.net.LinkProperties; import android.net.Uri; import android.os.AsyncResult; import android.os.Handler; @@ -540,7 +540,7 @@ abstract class SipPhoneBase extends PhoneBase { } //@Override - public NetworkProperties getNetworkProperties(String apnType) { + public LinkProperties getLinkProperties(String apnType) { // FIXME: what's this for SIP? return null; } -- cgit v1.1