Skip to content

Commit 2d9d7fb

Browse files
Robert GreenwaltAndroid Git Automerger
authored andcommitted
am 1b2583c: am 7874efe: am c8711ca: Merge "Stop using shared DUN APN when tethering stops." into ics-mr1
* commit '1b2583c41c37c055821d8f4ebbdc717f108c3b48': Stop using shared DUN APN when tethering stops.
2 parents f8b8eaf + 1b2583c commit 2d9d7fb

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

telephony/java/com/android/internal/telephony/DataConnectionTracker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,8 @@ protected void onEnableApn(int apnId, int enabled) {
10401040
}
10411041
}
10421042
if (didDisable) {
1043-
if (enabledCount == 0) {
1043+
if ((enabledCount == 0) || (apnId == APN_DUN_ID)) {
1044+
mRequestedApnType = Phone.APN_TYPE_DEFAULT;
10441045
onCleanUpConnection(true, apnId, Phone.REASON_DATA_DISABLED);
10451046
}
10461047

telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
143143

144144
@Override
145145
public void dispose() {
146-
cleanUpConnection(false, null);
146+
cleanUpConnection(false, null, false);
147147

148148
super.dispose();
149149

@@ -300,7 +300,7 @@ private boolean trySetupData(String reason) {
300300
* @param tearDown true if the underlying DataConnection should be disconnected.
301301
* @param reason for the clean up.
302302
*/
303-
private void cleanUpConnection(boolean tearDown, String reason) {
303+
private void cleanUpConnection(boolean tearDown, String reason, boolean doAll) {
304304
if (DBG) log("cleanUpConnection: reason: " + reason);
305305

306306
// Clear the reconnect alarm, if set.
@@ -320,9 +320,15 @@ private void cleanUpConnection(boolean tearDown, String reason) {
320320
DataConnectionAc dcac =
321321
mDataConnectionAsyncChannels.get(conn.getDataConnectionId());
322322
if (tearDown) {
323-
if (DBG) log("cleanUpConnection: teardown, call conn.disconnect");
324-
conn.tearDown(reason, obtainMessage(EVENT_DISCONNECT_DONE,
325-
conn.getDataConnectionId(), 0, reason));
323+
if (doAll) {
324+
if (DBG) log("cleanUpConnection: teardown, conn.tearDownAll");
325+
conn.tearDownAll(reason, obtainMessage(EVENT_DISCONNECT_DONE,
326+
conn.getDataConnectionId(), 0, reason));
327+
} else {
328+
if (DBG) log("cleanUpConnection: teardown, conn.tearDown");
329+
conn.tearDown(reason, obtainMessage(EVENT_DISCONNECT_DONE,
330+
conn.getDataConnectionId(), 0, reason));
331+
}
326332
notificationDeferred = true;
327333
} else {
328334
if (DBG) log("cleanUpConnection: !tearDown, call conn.resetSynchronously");
@@ -604,7 +610,7 @@ protected void onNVReady() {
604610
@Override
605611
protected void onEnableNewApn() {
606612
// No mRequestedApnType check; only one connection is supported
607-
cleanUpConnection(true, Phone.REASON_APN_SWITCHED);
613+
cleanUpConnection(true, Phone.REASON_APN_SWITCHED, false);
608614
}
609615

610616
/**
@@ -786,13 +792,13 @@ protected void onVoiceCallEnded() {
786792
@Override
787793
protected void onCleanUpConnection(boolean tearDown, int apnId, String reason) {
788794
// No apnId check; only one connection is supported
789-
cleanUpConnection(tearDown, reason);
795+
cleanUpConnection(tearDown, reason, (apnId == APN_DUN_ID));
790796
}
791797

792798
@Override
793799
protected void onCleanUpAllConnections(String cause) {
794800
// Only one CDMA connection is supported
795-
cleanUpConnection(true, cause);
801+
cleanUpConnection(true, cause, false);
796802
}
797803

798804
private void createAllDataConnectionList() {
@@ -838,7 +844,7 @@ private void onCdmaDataDetached() {
838844
notifyDataConnection(Phone.REASON_CDMA_DATA_DETACHED);
839845
} else {
840846
if (mState == State.FAILED) {
841-
cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED);
847+
cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED, false);
842848
mDataConnections.get(0).resetRetryCount();
843849

844850
CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation());
@@ -917,7 +923,7 @@ protected void onDataStateChanged(AsyncResult ar) {
917923
log("onDataStateChanged: No active connection"
918924
+ "state is CONNECTED, disconnecting/cleanup");
919925
writeEventLogCdmaDataDrop();
920-
cleanUpConnection(true, null);
926+
cleanUpConnection(true, null, false);
921927
return;
922928
}
923929

0 commit comments

Comments
 (0)