summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnection.java17
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnectionTracker.java44
-rw-r--r--telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java4
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl3
-rw-r--r--telephony/java/com/android/internal/telephony/Phone.java7
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneBase.java5
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneProxy.java5
-rw-r--r--telephony/java/com/android/internal/telephony/SipPhoneNotifier.java4
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java2
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java2
10 files changed, 84 insertions, 9 deletions
diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java
index 521d90c..3030481 100644
--- a/telephony/java/com/android/internal/telephony/DataConnection.java
+++ b/telephony/java/com/android/internal/telephony/DataConnection.java
@@ -21,6 +21,7 @@ import com.android.internal.telephony.gsm.ApnSetting;
import com.android.internal.util.HierarchicalState;
import com.android.internal.util.HierarchicalStateMachine;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.AsyncResult;
import android.os.Message;
@@ -31,6 +32,7 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
+import java.util.HashMap;
/**
* {@hide}
@@ -262,6 +264,7 @@ public abstract class DataConnection extends HierarchicalStateMachine {
protected PhoneBase phone;
protected int cid;
protected LinkProperties mLinkProperties = new LinkProperties();
+ protected LinkCapabilities mCapabilities = new LinkCapabilities();
protected long createTime;
protected long lastFailTime;
protected FailCause lastFailCause;
@@ -912,13 +915,25 @@ public abstract class DataConnection extends HierarchicalStateMachine {
}
/**
- * @return the connections LinkProperties
+ * Return the LinkProperties for the connection.
+ *
+ * @return a copy of the LinkProperties, is never null.
*/
public LinkProperties getLinkProperties() {
return new LinkProperties(mLinkProperties);
}
/**
+ * A capability is an Integer/String pair, the capabilities
+ * are defined in the class LinkSocket#Key.
+ *
+ * @return a copy of this connections capabilities, may be empty but never null.
+ */
+ public LinkCapabilities getLinkCapabilities() {
+ return new LinkCapabilities(mCapabilities);
+ }
+
+ /**
* @return the current state as a string.
*/
public String getStateAsString() {
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 765f64b..d753973 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -17,6 +17,7 @@
package com.android.internal.telephony;
import android.app.PendingIntent;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.AsyncResult;
import android.os.Handler;
@@ -192,8 +193,11 @@ public abstract class DataConnectionTracker extends Handler {
/** indication of our availability (preconditions to trysetupData are met) **/
protected boolean mAvailability = false;
- /** all our link properties (dns, gateway, ip, etc) */
- protected LinkProperties mLinkProperties;
+ /** The link properties (dns, gateway, ip, etc) */
+ protected LinkProperties mLinkProperties = new LinkProperties();
+
+ /** The link capabilities */
+ protected LinkCapabilities mLinkCapabilities = new LinkCapabilities();
/**
* Default constructor
@@ -425,10 +429,40 @@ public abstract class DataConnectionTracker extends Handler {
if (isApnIdEnabled(id)) {
return new LinkProperties(mLinkProperties);
} else {
- return null;
+ return new LinkProperties();
+ }
+ }
+
+ protected LinkCapabilities getLinkCapabilities(String apnType) {
+ int id = apnTypeToId(apnType);
+ if (isApnIdEnabled(id)) {
+ return new LinkCapabilities(mLinkCapabilities);
+ } else {
+ return new LinkCapabilities();
}
}
+ /**
+ * Return the LinkProperties for the connection.
+ *
+ * @param connection
+ * @return a copy of the LinkProperties, is never null.
+ */
+ protected LinkProperties getLinkProperties(DataConnection connection) {
+ return connection.getLinkProperties();
+ }
+
+ /**
+ * A capability is an Integer/String pair, the capabilities
+ * are defined in the class LinkSocket#Key.
+ *
+ * @param connection
+ * @return a copy of this connections capabilities, may be empty but never null.
+ */
+ protected LinkCapabilities getLinkCapabilities(DataConnection connection) {
+ return connection.getLinkCapabilities();
+ }
+
// tell all active apns of the current condition
protected void notifyDataConnection(String reason) {
for (int id = 0; id < APN_NUM_TYPES; id++) {
@@ -672,8 +706,4 @@ public abstract class DataConnectionTracker extends Handler {
}
}
}
-
- 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 bf3c4d1..6a163dd 100644
--- a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java
+++ b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.Bundle;
import android.os.RemoteException;
@@ -109,8 +110,10 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
// pass apnType back up to fetch particular for this one.
TelephonyManager telephony = TelephonyManager.getDefault();
LinkProperties linkProperties = null;
+ LinkCapabilities linkCapabilities = null;
if (state == Phone.DataState.CONNECTED) {
linkProperties = sender.getLinkProperties(apnType);
+ linkCapabilities = sender.getLinkCapabilities(apnType);
}
try {
mRegistry.notifyDataConnection(
@@ -119,6 +122,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
sender.getActiveApn(),
apnType,
linkProperties,
+ linkCapabilities,
((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 eb7e566..6407a4e 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -18,6 +18,7 @@ package com.android.internal.telephony;
import android.content.Intent;
import android.net.LinkProperties;
+import android.net.LinkCapabilities;
import android.os.Bundle;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -34,7 +35,7 @@ interface ITelephonyRegistry {
void notifyDataActivity(int state);
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
String reason, String apn, String apnType, in LinkProperties linkProperties,
- int networkType);
+ in LinkCapabilities linkCapabilities, 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 28e789c..e5736ca 100644
--- a/telephony/java/com/android/internal/telephony/Phone.java
+++ b/telephony/java/com/android/internal/telephony/Phone.java
@@ -17,6 +17,7 @@
package com.android.internal.telephony;
import android.content.Context;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
@@ -102,6 +103,7 @@ public interface Phone {
static final String DATA_APN_TYPE_KEY = "apnType";
static final String DATA_APN_KEY = "apn";
static final String DATA_LINK_PROPERTIES_KEY = "linkProperties";
+ static final String DATA_LINK_CAPABILITIES_KEY = "linkCapabilities";
static final String DATA_IFACE_NAME_KEY = "iface";
static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable";
@@ -326,6 +328,11 @@ public interface Phone {
LinkProperties getLinkProperties(String apnType);
/**
+ * Return the LinkCapabilities
+ */
+ LinkCapabilities getLinkCapabilities(String apnType);
+
+ /**
* Get current signal strength. No change notification available on this
* interface. Use <code>PhoneStateNotifier</code> or an equivalent.
* An ASU is 0-31 or -1 if unknown (for GSM, dBm = -113 - 2 * asu).
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 78ce473..5412768 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -21,6 +21,7 @@ import android.app.IActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.SharedPreferences;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.net.wifi.WifiManager;
import android.os.AsyncResult;
@@ -942,6 +943,10 @@ public abstract class PhoneBase extends Handler implements Phone {
return mDataConnection.getLinkProperties(apnType);
}
+ public LinkCapabilities getLinkCapabilities(String apnType) {
+ return mDataConnection.getLinkCapabilities(apnType);
+ }
+
public String getActiveApn() {
return mDataConnection.getActiveApnString();
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index b6e4cda..9e0c087 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -20,6 +20,7 @@ package com.android.internal.telephony;
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.Intent;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.Handler;
import android.os.Message;
@@ -212,6 +213,10 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.getLinkProperties(apnType);
}
+ public LinkCapabilities getLinkCapabilities(String apnType) {
+ return mActivePhone.getLinkCapabilities(apnType);
+ }
+
public String getActiveApn() {
return mActivePhone.getActiveApn();
}
diff --git a/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java b/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java
index 30d06d8..4c4e718 100644
--- a/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java
+++ b/telephony/java/com/android/internal/telephony/SipPhoneNotifier.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony;
+import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.os.Bundle;
import android.os.RemoteException;
@@ -111,8 +112,10 @@ public class SipPhoneNotifier implements PhoneNotifier {
// pass apnType back up to fetch particular for this one.
TelephonyManager telephony = TelephonyManager.getDefault();
LinkProperties linkProperties = null;
+ LinkCapabilities linkCapabilities = null;
if (state == Phone.DataState.CONNECTED) {
linkProperties = sender.getLinkProperties(apnType);
+ linkCapabilities = sender.getLinkCapabilities(apnType);
}
try {
mRegistry.notifyDataConnection(
@@ -121,6 +124,7 @@ public class SipPhoneNotifier implements PhoneNotifier {
sender.getActiveApn(),
apnType,
linkProperties,
+ linkCapabilities,
((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 5918245..e499e95 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -732,7 +732,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
}
if (ar.exception == null) {
+ // TODO: We should clear LinkProperties/Capabilities when torn down or disconnected
mLinkProperties = getLinkProperties(mActiveDataConnection);
+ mLinkCapabilities = getLinkCapabilities(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 f6887eb..66da6e8 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -1099,7 +1099,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
if (ar.exception == null) {
+ // TODO: We should clear LinkProperties/Capabilities when torn down or disconnected
mLinkProperties = getLinkProperties(mActivePdp);
+ mLinkCapabilities = getLinkCapabilities(mActivePdp);
ApnSetting apn = mActivePdp.getApn();
if (apn.proxy != null && apn.proxy.length() != 0) {