* commit '7874efeb138204230475720d0b97f2d199a21502': Stop using shared DUN APN when tethering stops.
This commit is contained in:
@ -1031,9 +1031,14 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
if ((ni.isConnectedOrConnecting() == true) &&
|
if ((ni.isConnectedOrConnecting() == true) &&
|
||||||
!network.isTeardownRequested()) {
|
!network.isTeardownRequested()) {
|
||||||
if (ni.isConnected() == true) {
|
if (ni.isConnected() == true) {
|
||||||
// add the pid-specific dns
|
final long token = Binder.clearCallingIdentity();
|
||||||
handleDnsConfigurationChange(usedNetworkType);
|
try {
|
||||||
if (VDBG) log("special network already active");
|
// add the pid-specific dns
|
||||||
|
handleDnsConfigurationChange(usedNetworkType);
|
||||||
|
if (VDBG) log("special network already active");
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
return Phone.APN_ALREADY_ACTIVE;
|
return Phone.APN_ALREADY_ACTIVE;
|
||||||
}
|
}
|
||||||
if (VDBG) log("special network already connecting");
|
if (VDBG) log("special network already connecting");
|
||||||
@ -1221,6 +1226,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ConnectivityManager.isNetworkTypeValid(networkType)) {
|
if (!ConnectivityManager.isNetworkTypeValid(networkType)) {
|
||||||
|
if (DBG) log("requestRouteToHostAddress on invalid network: " + networkType);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NetworkStateTracker tracker = mNetTrackers[networkType];
|
NetworkStateTracker tracker = mNetTrackers[networkType];
|
||||||
@ -1233,11 +1239,16 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
final long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
InetAddress addr = InetAddress.getByAddress(hostAddress);
|
InetAddress addr = InetAddress.getByAddress(hostAddress);
|
||||||
LinkProperties lp = tracker.getLinkProperties();
|
LinkProperties lp = tracker.getLinkProperties();
|
||||||
return addRouteToAddress(lp, addr);
|
return addRouteToAddress(lp, addr);
|
||||||
} catch (UnknownHostException e) {}
|
} catch (UnknownHostException e) {
|
||||||
|
if (DBG) log("requestRouteToHostAddress got " + e.toString());
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1277,7 +1288,10 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
|
|
||||||
private boolean modifyRoute(String ifaceName, LinkProperties lp, RouteInfo r, int cycleCount,
|
private boolean modifyRoute(String ifaceName, LinkProperties lp, RouteInfo r, int cycleCount,
|
||||||
boolean doAdd, boolean toDefaultTable) {
|
boolean doAdd, boolean toDefaultTable) {
|
||||||
if ((ifaceName == null) || (lp == null) || (r == null)) return false;
|
if ((ifaceName == null) || (lp == null) || (r == null)) {
|
||||||
|
if (DBG) log("modifyRoute got unexpected null: " + ifaceName + ", " + lp + ", " + r);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (cycleCount > MAX_HOSTROUTE_CYCLE_COUNT) {
|
if (cycleCount > MAX_HOSTROUTE_CYCLE_COUNT) {
|
||||||
loge("Error modifying route - too much recursion");
|
loge("Error modifying route - too much recursion");
|
||||||
@ -1309,7 +1323,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
if (VDBG) loge("Exception trying to add a route: " + e);
|
if (DBG) loge("Exception trying to add a route: " + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1323,7 +1337,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
mNetd.removeRoute(ifaceName, r);
|
mNetd.removeRoute(ifaceName, r);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
if (VDBG) loge("Exception trying to remove a route: " + e);
|
if (DBG) loge("Exception trying to remove a route: " + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1335,7 +1349,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
mNetd.removeSecondaryRoute(ifaceName, r);
|
mNetd.removeSecondaryRoute(ifaceName, r);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
if (VDBG) loge("Exception trying to remove a route: " + e);
|
if (DBG) loge("Exception trying to remove a route: " + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2004,7 +2018,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
mNetd.removeRoute(ifaceName, r);
|
mNetd.removeRoute(ifaceName, r);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
if (VDBG) loge("Exception trying to remove a route: " + e);
|
if (DBG) loge("Exception trying to remove a route: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2218,7 +2232,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
|
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
|
||||||
mNetd.setDefaultInterfaceForDns(iface);
|
mNetd.setDefaultInterfaceForDns(iface);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (VDBG) loge("exception setting default dns interface: " + e);
|
if (DBG) loge("exception setting default dns interface: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
|
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
|
||||||
@ -2248,7 +2262,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
|
|||||||
mNetd.setDnsServersForInterface(p.getInterfaceName(),
|
mNetd.setDnsServersForInterface(p.getInterfaceName(),
|
||||||
NetworkUtils.makeStrings(dnses));
|
NetworkUtils.makeStrings(dnses));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (VDBG) loge("exception setting dns servers: " + e);
|
if (DBG) loge("exception setting dns servers: " + e);
|
||||||
}
|
}
|
||||||
// set per-pid dns for attached secondary nets
|
// set per-pid dns for attached secondary nets
|
||||||
List pids = mNetRequestersPids[netType];
|
List pids = mNetRequestersPids[netType];
|
||||||
|
@ -68,6 +68,8 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
private List<ApnContext> mApnList = null;
|
private List<ApnContext> mApnList = null;
|
||||||
PendingIntent mReconnectIntent = null;
|
PendingIntent mReconnectIntent = null;
|
||||||
|
|
||||||
|
private DataConnectionTracker mDataConnectionTracker = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally for saving connecting parameters.
|
* Used internally for saving connecting parameters.
|
||||||
*/
|
*/
|
||||||
@ -202,6 +204,7 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
protected static final int EVENT_DEACTIVATE_DONE = BASE + 3;
|
protected static final int EVENT_DEACTIVATE_DONE = BASE + 3;
|
||||||
protected static final int EVENT_DISCONNECT = BASE + 4;
|
protected static final int EVENT_DISCONNECT = BASE + 4;
|
||||||
protected static final int EVENT_RIL_CONNECTED = BASE + 5;
|
protected static final int EVENT_RIL_CONNECTED = BASE + 5;
|
||||||
|
protected static final int EVENT_DISCONNECT_ALL = BASE + 6;
|
||||||
|
|
||||||
//***** Tag IDs for EventLog
|
//***** Tag IDs for EventLog
|
||||||
protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;
|
protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;
|
||||||
@ -234,10 +237,12 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
|
|
||||||
|
|
||||||
//***** Constructor
|
//***** Constructor
|
||||||
protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm) {
|
protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm,
|
||||||
|
DataConnectionTracker dct) {
|
||||||
super(name);
|
super(name);
|
||||||
if (DBG) log("DataConnection constructor E");
|
if (DBG) log("DataConnection constructor E");
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
|
this.mDataConnectionTracker = dct;
|
||||||
mId = id;
|
mId = id;
|
||||||
mRetryMgr = rm;
|
mRetryMgr = rm;
|
||||||
this.cid = -1;
|
this.cid = -1;
|
||||||
@ -316,11 +321,19 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
*
|
*
|
||||||
* @param dp is the DisconnectParams.
|
* @param dp is the DisconnectParams.
|
||||||
*/
|
*/
|
||||||
private void notifyDisconnectCompleted(DisconnectParams dp) {
|
private void notifyDisconnectCompleted(DisconnectParams dp, boolean sendAll) {
|
||||||
if (VDBG) log("NotifyDisconnectCompleted");
|
if (VDBG) log("NotifyDisconnectCompleted");
|
||||||
|
|
||||||
|
ApnContext alreadySent = null;
|
||||||
|
String reason = null;
|
||||||
|
|
||||||
if (dp.onCompletedMsg != null) {
|
if (dp.onCompletedMsg != null) {
|
||||||
|
// Get ApnContext, but only valid on GSM devices this is a string on CDMA devices.
|
||||||
Message msg = dp.onCompletedMsg;
|
Message msg = dp.onCompletedMsg;
|
||||||
|
if (msg.obj instanceof ApnContext) {
|
||||||
|
alreadySent = (ApnContext)msg.obj;
|
||||||
|
}
|
||||||
|
reason = dp.reason;
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log(String.format("msg=%s msg.obj=%s", msg.toString(),
|
log(String.format("msg=%s msg.obj=%s", msg.toString(),
|
||||||
((msg.obj instanceof String) ? (String) msg.obj : "<no-reason>")));
|
((msg.obj instanceof String) ? (String) msg.obj : "<no-reason>")));
|
||||||
@ -328,6 +341,17 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
AsyncResult.forMessage(msg);
|
AsyncResult.forMessage(msg);
|
||||||
msg.sendToTarget();
|
msg.sendToTarget();
|
||||||
}
|
}
|
||||||
|
if (sendAll) {
|
||||||
|
for (ApnContext a : mApnList) {
|
||||||
|
if (a == alreadySent) continue;
|
||||||
|
if (reason != null) a.setReason(reason);
|
||||||
|
Message msg = mDataConnectionTracker.obtainMessage(
|
||||||
|
DataConnectionTracker.EVENT_DISCONNECT_DONE, a);
|
||||||
|
AsyncResult.forMessage(msg);
|
||||||
|
msg.sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp);
|
if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -706,6 +730,13 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
deferMessage(msg);
|
deferMessage(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_DISCONNECT_ALL:
|
||||||
|
if (DBG) {
|
||||||
|
log("DcDefaultState deferring msg.what=EVENT_DISCONNECT_ALL" + mRefCount);
|
||||||
|
}
|
||||||
|
deferMessage(msg);
|
||||||
|
break;
|
||||||
|
|
||||||
case EVENT_RIL_CONNECTED:
|
case EVENT_RIL_CONNECTED:
|
||||||
ar = (AsyncResult)msg.obj;
|
ar = (AsyncResult)msg.obj;
|
||||||
if (ar.exception == null) {
|
if (ar.exception == null) {
|
||||||
@ -771,7 +802,7 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
}
|
}
|
||||||
if (mDisconnectParams != null) {
|
if (mDisconnectParams != null) {
|
||||||
if (VDBG) log("DcInactiveState: enter notifyDisconnectCompleted");
|
if (VDBG) log("DcInactiveState: enter notifyDisconnectCompleted");
|
||||||
notifyDisconnectCompleted(mDisconnectParams);
|
notifyDisconnectCompleted(mDisconnectParams, true);
|
||||||
}
|
}
|
||||||
clearSettings();
|
clearSettings();
|
||||||
}
|
}
|
||||||
@ -812,7 +843,13 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
|
|
||||||
case EVENT_DISCONNECT:
|
case EVENT_DISCONNECT:
|
||||||
if (DBG) log("DcInactiveState: msg.what=EVENT_DISCONNECT");
|
if (DBG) log("DcInactiveState: msg.what=EVENT_DISCONNECT");
|
||||||
notifyDisconnectCompleted((DisconnectParams)msg.obj);
|
notifyDisconnectCompleted((DisconnectParams)msg.obj, false);
|
||||||
|
retVal = HANDLED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVENT_DISCONNECT_ALL:
|
||||||
|
if (DBG) log("DcInactiveState: msg.what=EVENT_DISCONNECT_ALL");
|
||||||
|
notifyDisconnectCompleted((DisconnectParams)msg.obj, false);
|
||||||
retVal = HANDLED;
|
retVal = HANDLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -989,12 +1026,24 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
transitionTo(mDisconnectingState);
|
transitionTo(mDisconnectingState);
|
||||||
} else {
|
} else {
|
||||||
if (msg.obj != null) {
|
if (msg.obj != null) {
|
||||||
notifyDisconnectCompleted((DisconnectParams) msg.obj);
|
notifyDisconnectCompleted((DisconnectParams) msg.obj, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retVal = HANDLED;
|
retVal = HANDLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_DISCONNECT_ALL:
|
||||||
|
if (DBG) {
|
||||||
|
log("DcActiveState msg.what=EVENT_DISCONNECT_ALL RefCount=" + mRefCount);
|
||||||
|
}
|
||||||
|
mRefCount = 0;
|
||||||
|
DisconnectParams dp = (DisconnectParams) msg.obj;
|
||||||
|
dp.tag = mTag;
|
||||||
|
tearDownData(dp);
|
||||||
|
transitionTo(mDisconnectingState);
|
||||||
|
retVal = HANDLED;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("DcActiveState not handled msg.what=0x" +
|
log("DcActiveState not handled msg.what=0x" +
|
||||||
@ -1124,4 +1173,16 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
public void tearDown(String reason, Message onCompletedMsg) {
|
public void tearDown(String reason, Message onCompletedMsg) {
|
||||||
sendMessage(obtainMessage(EVENT_DISCONNECT, new DisconnectParams(reason, onCompletedMsg)));
|
sendMessage(obtainMessage(EVENT_DISCONNECT, new DisconnectParams(reason, onCompletedMsg)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tear down the connection through the apn on the network. Ignores refcount and
|
||||||
|
* and always tears down.
|
||||||
|
*
|
||||||
|
* @param onCompletedMsg is sent with its msg.obj as an AsyncResult object.
|
||||||
|
* With AsyncResult.userObj set to the original msg.obj.
|
||||||
|
*/
|
||||||
|
public void tearDownAll(String reason, Message onCompletedMsg) {
|
||||||
|
sendMessage(obtainMessage(EVENT_DISCONNECT_ALL,
|
||||||
|
new DisconnectParams(reason, onCompletedMsg)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1030,7 +1030,8 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (didDisable) {
|
if (didDisable) {
|
||||||
if (enabledCount == 0) {
|
if ((enabledCount == 0) || (apnId == APN_DUN_ID)) {
|
||||||
|
mRequestedApnType = Phone.APN_TYPE_DEFAULT;
|
||||||
onCleanUpConnection(true, apnId, Phone.REASON_DATA_DISABLED);
|
onCleanUpConnection(true, apnId, Phone.REASON_DATA_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import android.os.Message;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.telephony.DataConnection;
|
import com.android.internal.telephony.DataConnection;
|
||||||
|
import com.android.internal.telephony.DataConnectionTracker;
|
||||||
import com.android.internal.telephony.Phone;
|
import com.android.internal.telephony.Phone;
|
||||||
import com.android.internal.telephony.RILConstants;
|
import com.android.internal.telephony.RILConstants;
|
||||||
import com.android.internal.telephony.RetryManager;
|
import com.android.internal.telephony.RetryManager;
|
||||||
@ -32,8 +33,9 @@ public class CdmaDataConnection extends DataConnection {
|
|||||||
private static final String LOG_TAG = "CDMA";
|
private static final String LOG_TAG = "CDMA";
|
||||||
|
|
||||||
// ***** Constructor
|
// ***** Constructor
|
||||||
private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm) {
|
private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm,
|
||||||
super(phone, name, id, rm);
|
DataConnectionTracker dct) {
|
||||||
|
super(phone, name, id, rm, dct);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,12 +46,13 @@ public class CdmaDataConnection extends DataConnection {
|
|||||||
* @param rm the RetryManager
|
* @param rm the RetryManager
|
||||||
* @return CdmaDataConnection that was created.
|
* @return CdmaDataConnection that was created.
|
||||||
*/
|
*/
|
||||||
static CdmaDataConnection makeDataConnection(CDMAPhone phone, int id, RetryManager rm) {
|
static CdmaDataConnection makeDataConnection(CDMAPhone phone, int id, RetryManager rm,
|
||||||
|
DataConnectionTracker dct) {
|
||||||
synchronized (mCountLock) {
|
synchronized (mCountLock) {
|
||||||
mCount += 1;
|
mCount += 1;
|
||||||
}
|
}
|
||||||
CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDC-" + mCount,
|
CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDC-" + mCount,
|
||||||
id, rm);
|
id, rm, dct);
|
||||||
cdmaDc.start();
|
cdmaDc.start();
|
||||||
if (DBG) cdmaDc.log("Made " + cdmaDc.getName());
|
if (DBG) cdmaDc.log("Made " + cdmaDc.getName());
|
||||||
return cdmaDc;
|
return cdmaDc;
|
||||||
|
@ -140,7 +140,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
cleanUpConnection(false, null);
|
cleanUpConnection(false, null, false);
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
* @param tearDown true if the underlying DataConnection should be disconnected.
|
* @param tearDown true if the underlying DataConnection should be disconnected.
|
||||||
* @param reason for the clean up.
|
* @param reason for the clean up.
|
||||||
*/
|
*/
|
||||||
private void cleanUpConnection(boolean tearDown, String reason) {
|
private void cleanUpConnection(boolean tearDown, String reason, boolean doAll) {
|
||||||
if (DBG) log("cleanUpConnection: reason: " + reason);
|
if (DBG) log("cleanUpConnection: reason: " + reason);
|
||||||
|
|
||||||
// Clear the reconnect alarm, if set.
|
// Clear the reconnect alarm, if set.
|
||||||
@ -315,9 +315,15 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
DataConnectionAc dcac =
|
DataConnectionAc dcac =
|
||||||
mDataConnectionAsyncChannels.get(conn.getDataConnectionId());
|
mDataConnectionAsyncChannels.get(conn.getDataConnectionId());
|
||||||
if (tearDown) {
|
if (tearDown) {
|
||||||
if (DBG) log("cleanUpConnection: teardown, call conn.disconnect");
|
if (doAll) {
|
||||||
conn.tearDown(reason, obtainMessage(EVENT_DISCONNECT_DONE,
|
if (DBG) log("cleanUpConnection: teardown, conn.tearDownAll");
|
||||||
conn.getDataConnectionId(), 0, reason));
|
conn.tearDownAll(reason, obtainMessage(EVENT_DISCONNECT_DONE,
|
||||||
|
conn.getDataConnectionId(), 0, reason));
|
||||||
|
} else {
|
||||||
|
if (DBG) log("cleanUpConnection: teardown, conn.tearDown");
|
||||||
|
conn.tearDown(reason, obtainMessage(EVENT_DISCONNECT_DONE,
|
||||||
|
conn.getDataConnectionId(), 0, reason));
|
||||||
|
}
|
||||||
notificationDeferred = true;
|
notificationDeferred = true;
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("cleanUpConnection: !tearDown, call conn.resetSynchronously");
|
if (DBG) log("cleanUpConnection: !tearDown, call conn.resetSynchronously");
|
||||||
@ -599,7 +605,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
@Override
|
@Override
|
||||||
protected void onEnableNewApn() {
|
protected void onEnableNewApn() {
|
||||||
// No mRequestedApnType check; only one connection is supported
|
// No mRequestedApnType check; only one connection is supported
|
||||||
cleanUpConnection(true, Phone.REASON_APN_SWITCHED);
|
cleanUpConnection(true, Phone.REASON_APN_SWITCHED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -781,13 +787,13 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCleanUpConnection(boolean tearDown, int apnId, String reason) {
|
protected void onCleanUpConnection(boolean tearDown, int apnId, String reason) {
|
||||||
// No apnId check; only one connection is supported
|
// No apnId check; only one connection is supported
|
||||||
cleanUpConnection(tearDown, reason);
|
cleanUpConnection(tearDown, reason, (apnId == APN_DUN_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCleanUpAllConnections(String cause) {
|
protected void onCleanUpAllConnections(String cause) {
|
||||||
// Only one CDMA connection is supported
|
// Only one CDMA connection is supported
|
||||||
cleanUpConnection(true, cause);
|
cleanUpConnection(true, cause, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAllDataConnectionList() {
|
private void createAllDataConnectionList() {
|
||||||
@ -806,7 +812,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int id = mUniqueIdGenerator.getAndIncrement();
|
int id = mUniqueIdGenerator.getAndIncrement();
|
||||||
dataConn = CdmaDataConnection.makeDataConnection(mCdmaPhone, id, rm);
|
dataConn = CdmaDataConnection.makeDataConnection(mCdmaPhone, id, rm, this);
|
||||||
mDataConnections.put(id, dataConn);
|
mDataConnections.put(id, dataConn);
|
||||||
DataConnectionAc dcac = new DataConnectionAc(dataConn, LOG_TAG);
|
DataConnectionAc dcac = new DataConnectionAc(dataConn, LOG_TAG);
|
||||||
int status = dcac.fullyConnectSync(mPhone.getContext(), this, dataConn.getHandler());
|
int status = dcac.fullyConnectSync(mPhone.getContext(), this, dataConn.getHandler());
|
||||||
@ -833,7 +839,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
notifyDataConnection(Phone.REASON_CDMA_DATA_DETACHED);
|
notifyDataConnection(Phone.REASON_CDMA_DATA_DETACHED);
|
||||||
} else {
|
} else {
|
||||||
if (mState == State.FAILED) {
|
if (mState == State.FAILED) {
|
||||||
cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED);
|
cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED, false);
|
||||||
mDataConnections.get(0).resetRetryCount();
|
mDataConnections.get(0).resetRetryCount();
|
||||||
|
|
||||||
CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation());
|
CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation());
|
||||||
@ -912,7 +918,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
log("onDataStateChanged: No active connection"
|
log("onDataStateChanged: No active connection"
|
||||||
+ "state is CONNECTED, disconnecting/cleanup");
|
+ "state is CONNECTED, disconnecting/cleanup");
|
||||||
writeEventLogCdmaDataDrop();
|
writeEventLogCdmaDataDrop();
|
||||||
cleanUpConnection(true, null);
|
cleanUpConnection(true, null, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import android.util.Patterns;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.android.internal.telephony.DataConnection;
|
import com.android.internal.telephony.DataConnection;
|
||||||
|
import com.android.internal.telephony.DataConnectionTracker;
|
||||||
import com.android.internal.telephony.Phone;
|
import com.android.internal.telephony.Phone;
|
||||||
import com.android.internal.telephony.PhoneBase;
|
import com.android.internal.telephony.PhoneBase;
|
||||||
import com.android.internal.telephony.RILConstants;
|
import com.android.internal.telephony.RILConstants;
|
||||||
@ -38,8 +39,9 @@ public class GsmDataConnection extends DataConnection {
|
|||||||
protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT;
|
protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT;
|
||||||
protected String mActiveApnType = Phone.APN_TYPE_DEFAULT;
|
protected String mActiveApnType = Phone.APN_TYPE_DEFAULT;
|
||||||
//***** Constructor
|
//***** Constructor
|
||||||
private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm) {
|
private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm,
|
||||||
super(phone, name, id, rm);
|
DataConnectionTracker dct) {
|
||||||
|
super(phone, name, id, rm, dct);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,11 +52,12 @@ public class GsmDataConnection extends DataConnection {
|
|||||||
* @param rm the RetryManager
|
* @param rm the RetryManager
|
||||||
* @return GsmDataConnection that was created.
|
* @return GsmDataConnection that was created.
|
||||||
*/
|
*/
|
||||||
static GsmDataConnection makeDataConnection(PhoneBase phone, int id, RetryManager rm) {
|
static GsmDataConnection makeDataConnection(PhoneBase phone, int id, RetryManager rm,
|
||||||
|
DataConnectionTracker dct) {
|
||||||
synchronized (mCountLock) {
|
synchronized (mCountLock) {
|
||||||
mCount += 1;
|
mCount += 1;
|
||||||
}
|
}
|
||||||
GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDC-" + mCount, id, rm);
|
GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDC-" + mCount, id, rm, dct);
|
||||||
gsmDc.start();
|
gsmDc.start();
|
||||||
if (DBG) gsmDc.log("Made " + gsmDc.getName());
|
if (DBG) gsmDc.log("Made " + gsmDc.getName());
|
||||||
return gsmDc;
|
return gsmDc;
|
||||||
|
@ -850,9 +850,28 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
// Connection is still there. Try to clean up.
|
// Connection is still there. Try to clean up.
|
||||||
if (dcac != null) {
|
if (dcac != null) {
|
||||||
if (apnContext.getState() != State.DISCONNECTING) {
|
if (apnContext.getState() != State.DISCONNECTING) {
|
||||||
if (DBG) log("cleanUpConnection: tearing down");
|
boolean disconnectAll = false;
|
||||||
|
if (Phone.APN_TYPE_DUN.equals(apnContext.getApnType())) {
|
||||||
|
ApnSetting dunSetting = fetchDunApn();
|
||||||
|
if (dunSetting != null &&
|
||||||
|
dunSetting.equals(apnContext.getApnSetting())) {
|
||||||
|
if (DBG) log("tearing down dedicated DUN connection");
|
||||||
|
// we need to tear it down - we brought it up just for dun and
|
||||||
|
// other people are camped on it and now dun is done. We need
|
||||||
|
// to stop using it and let the normal apn list get used to find
|
||||||
|
// connections for the remaining desired connections
|
||||||
|
disconnectAll = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DBG) {
|
||||||
|
log("cleanUpConnection: tearing down" + (disconnectAll ? " all" :""));
|
||||||
|
}
|
||||||
Message msg = obtainMessage(EVENT_DISCONNECT_DONE, apnContext);
|
Message msg = obtainMessage(EVENT_DISCONNECT_DONE, apnContext);
|
||||||
apnContext.getDataConnection().tearDown(apnContext.getReason(), msg);
|
if (disconnectAll) {
|
||||||
|
apnContext.getDataConnection().tearDownAll(apnContext.getReason(), msg);
|
||||||
|
} else {
|
||||||
|
apnContext.getDataConnection().tearDown(apnContext.getReason(), msg);
|
||||||
|
}
|
||||||
apnContext.setState(State.DISCONNECTING);
|
apnContext.setState(State.DISCONNECTING);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2213,7 +2232,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
|
|
||||||
RetryManager rm = new RetryManager();
|
RetryManager rm = new RetryManager();
|
||||||
int id = mUniqueIdGenerator.getAndIncrement();
|
int id = mUniqueIdGenerator.getAndIncrement();
|
||||||
GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm);
|
GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm, this);
|
||||||
mDataConnections.put(id, conn);
|
mDataConnections.put(id, conn);
|
||||||
DataConnectionAc dcac = new DataConnectionAc(conn, LOG_TAG);
|
DataConnectionAc dcac = new DataConnectionAc(conn, LOG_TAG);
|
||||||
int status = dcac.fullyConnectSync(mPhone.getContext(), this, conn.getHandler());
|
int status = dcac.fullyConnectSync(mPhone.getContext(), this, conn.getHandler());
|
||||||
|
Reference in New Issue
Block a user