am 6b2c56a2: Merge "DO NOT MERGE Do not kill sockets going default->hipri" into gingerbread
Merge commit '6b2c56a299eb05deef2b887549e29e9e9f0f2cf6' into gingerbread-plus-aosp * commit '6b2c56a299eb05deef2b887549e29e9e9f0f2cf6': DO NOT MERGE Do not kill sockets going default->hipri
This commit is contained in:
@@ -53,6 +53,10 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
|||||||
private boolean mEnabled;
|
private boolean mEnabled;
|
||||||
private BroadcastReceiver mStateReceiver;
|
private BroadcastReceiver mStateReceiver;
|
||||||
|
|
||||||
|
// DEFAULT and HIPRI are the same connection. If we're one of these we need to check if
|
||||||
|
// the other is also disconnected before we reset sockets
|
||||||
|
private boolean mIsDefaultOrHipri = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new MobileDataStateTracker
|
* Create a new MobileDataStateTracker
|
||||||
* @param context the application context of the caller
|
* @param context the application context of the caller
|
||||||
@@ -71,6 +75,10 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
|||||||
} else {
|
} else {
|
||||||
mApnTypeToWatchFor = mApnType;
|
mApnTypeToWatchFor = mApnType;
|
||||||
}
|
}
|
||||||
|
if (netType == ConnectivityManager.TYPE_MOBILE ||
|
||||||
|
netType == ConnectivityManager.TYPE_MOBILE_HIPRI) {
|
||||||
|
mIsDefaultOrHipri = true;
|
||||||
|
}
|
||||||
|
|
||||||
mPhoneService = null;
|
mPhoneService = null;
|
||||||
if(netType == ConnectivityManager.TYPE_MOBILE) {
|
if(netType == ConnectivityManager.TYPE_MOBILE) {
|
||||||
@@ -138,6 +146,7 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class MobileDataStateReceiver extends BroadcastReceiver {
|
private class MobileDataStateReceiver extends BroadcastReceiver {
|
||||||
|
ConnectivityManager mConnectivityManager;
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
if (intent.getAction().equals(TelephonyIntents.
|
if (intent.getAction().equals(TelephonyIntents.
|
||||||
@@ -190,7 +199,26 @@ public class MobileDataStateTracker extends NetworkStateTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setDetailedState(DetailedState.DISCONNECTED, reason, apnName);
|
setDetailedState(DetailedState.DISCONNECTED, reason, apnName);
|
||||||
if (mInterfaceName != null) {
|
boolean doReset = true;
|
||||||
|
if (mIsDefaultOrHipri == true) {
|
||||||
|
// both default and hipri must go down before we reset
|
||||||
|
int typeToCheck = (Phone.APN_TYPE_DEFAULT.equals(mApnType) ?
|
||||||
|
ConnectivityManager.TYPE_MOBILE_HIPRI :
|
||||||
|
ConnectivityManager.TYPE_MOBILE);
|
||||||
|
if (mConnectivityManager == null) {
|
||||||
|
mConnectivityManager =
|
||||||
|
(ConnectivityManager)context.getSystemService(
|
||||||
|
Context.CONNECTIVITY_SERVICE);
|
||||||
|
}
|
||||||
|
if (mConnectivityManager != null) {
|
||||||
|
NetworkInfo info = mConnectivityManager.getNetworkInfo(
|
||||||
|
typeToCheck);
|
||||||
|
if (info != null && info.isConnected() == true) {
|
||||||
|
doReset = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (doReset && mInterfaceName != null) {
|
||||||
NetworkUtils.resetConnections(mInterfaceName);
|
NetworkUtils.resetConnections(mInterfaceName);
|
||||||
}
|
}
|
||||||
// can't do this here - ConnectivityService needs it to clear stuff
|
// can't do this here - ConnectivityService needs it to clear stuff
|
||||||
|
|||||||
Reference in New Issue
Block a user