Fix a race condition for data change notification

We could sometimes not be told about network state changes breaking subsequent mms access.
Turning on more logging too.

bug: 2069106
This commit is contained in:
Robert Greenwalt
2009-08-20 15:25:14 -07:00
parent 2e951b5511
commit ec9fe4672a
3 changed files with 11 additions and 1 deletions

View File

@ -320,6 +320,7 @@ public class MobileDataStateTracker extends NetworkStateTracker {
mEnabled = true;
// need to set self to CONNECTING so the below message is handled.
mMobileDataState = Phone.DataState.CONNECTING;
setDetailedState(DetailedState.CONNECTING, Phone.REASON_APN_CHANGED, null);
//send out a connected message
Intent intent = new Intent(TelephonyIntents.
ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);

View File

@ -48,7 +48,7 @@ public abstract class NetworkStateTracker extends Handler {
private boolean mDefaultRouteSet;
private boolean mTeardownRequested;
private static boolean DBG = Config.LOGV;
private static boolean DBG = true;
private static final String TAG = "NetworkStateTracker";
public static final int EVENT_STATE_CHANGED = 1;

View File

@ -357,6 +357,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
for (int t=0; t <= ConnectivityManager.MAX_RADIO_TYPE; t++) {
if (t != mNetworkPreference &&
mNetTrackers[t].getNetworkInfo().isConnected()) {
if (DBG) {
Log.d(TAG, "tearing down " +
mNetTrackers[t].getNetworkInfo() +
" in enforcePreference");
}
teardown(mNetTrackers[t]);
}
}
@ -1232,6 +1237,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
NetworkInfo i = net.getNetworkInfo();
if (i.isConnected() &&
!mNetAttributes[i.getType()].isDefault()) {
if (DBG) {
Log.d(TAG, "tearing down " + i +
" to restore the default network");
}
teardown(net);
}
}