diff options
author | Kazuhiro Ondo <kazuhiro.ondo@motorola.com> | 2011-05-18 00:02:31 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-05-18 00:02:31 -0700 |
commit | b22a9fd9bb32133cbc7dc4fc7752dbf68e52dffe (patch) | |
tree | a509a5fc9f7e6263df7efe35b37a94465af8661f /services | |
parent | e34a7686a36bf0f48cd9d20090b4b8df1bf0d1ce (diff) | |
parent | 01758e81b3ad89934581885bb2fc7006510ec639 (diff) | |
download | frameworks_base-b22a9fd9bb32133cbc7dc4fc7752dbf68e52dffe.zip frameworks_base-b22a9fd9bb32133cbc7dc4fc7752dbf68e52dffe.tar.gz frameworks_base-b22a9fd9bb32133cbc7dc4fc7752dbf68e52dffe.tar.bz2 |
am 01758e81: Linkproperties update via unsol data call state change.
* commit '01758e81b3ad89934581885bb2fc7006510ec639':
Linkproperties update via unsol data call state change.
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 14 | ||||
-rw-r--r-- | services/java/com/android/server/connectivity/Tethering.java | 31 |
2 files changed, 38 insertions, 7 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 6780b03..5f5e1db 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -1395,6 +1395,12 @@ public class ConnectivityService extends IConnectivityManager.Stub { } addPrivateDnsRoutes(mNetTrackers[netType]); } + + /** Notify TetheringService if interface name has been changed. */ + if (TextUtils.equals(mNetTrackers[netType].getNetworkInfo().getReason(), + Phone.REASON_LINK_PROPERTIES_CHANGED)) { + handleTetherIfaceChange(netType); + } } else { if (mNetConfigs[netType].isDefault()) { removeDefaultRoute(mNetTrackers[netType]); @@ -2207,6 +2213,14 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } + private void handleTetherIfaceChange(int type) { + String iface = mNetTrackers[type].getLinkProperties().getInterfaceName(); + + if (isTetheringSupported()) { + mTethering.handleTetherIfaceChange(iface); + } + } + private void log(String s) { Slog.d(TAG, s); } diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java index 9ff5233..ffadc65 100644 --- a/services/java/com/android/server/connectivity/Tethering.java +++ b/services/java/com/android/server/connectivity/Tethering.java @@ -668,6 +668,16 @@ public class Tethering extends INetworkManagementEventObserver.Stub { return retVal; } + public void handleTetherIfaceChange(String iface) { + // check if iface is white listed + for (String regex : mUpstreamIfaceRegexs) { + if (iface.matches(regex)) { + if (DEBUG) Log.d(TAG, "Tethering got Interface Change"); + mTetherMasterSM.sendMessage(TetherMasterSM.CMD_IFACE_CHANGED, iface); + break; + } + } + } class TetherInterfaceSM extends StateMachine { // notification from the master SM that it's not in tether mode @@ -1076,6 +1086,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub { static final int CMD_CELL_CONNECTION_RENEW = 4; // we don't have a valid upstream conn, check again after a delay static final int CMD_RETRY_UPSTREAM = 5; + // received an indication that upstream interface has changed + static final int CMD_IFACE_CHANGED = 6; // This indicates what a timeout event relates to. A state that // sends itself a delayed timeout event and handles incoming timeout events @@ -1429,13 +1441,18 @@ public class Tethering extends INetworkManagementEventObserver.Stub { turnOnMobileConnection(); } break; - case CMD_RETRY_UPSTREAM: - chooseUpstreamType(mTryCell); - mTryCell = !mTryCell; - break; - default: - retValue = false; - break; + case CMD_RETRY_UPSTREAM: + chooseUpstreamType(mTryCell); + mTryCell = !mTryCell; + break; + case CMD_IFACE_CHANGED: + String iface = (String)message.obj; + if (DEBUG) Log.d(TAG, "Activie upstream interface changed: " + iface); + notifyTetheredOfNewUpstreamIface(iface); + break; + default: + retValue = false; + break; } return retValue; } |