Fix TODO in ApnContext#setDataConnectionAc.

Callers that really need to tearDown should call it directly
rather than as a side effect of setDataConnectionAc. The fixes
a "DcActiveState ERROR no such apnContext=" message caused by
an unnecssary tearDown when disconnecting.

Change-Id: I11321d098444659d99dec97b59041cefebb3285e
diff --git a/src/java/com/android/internal/telephony/dataconnection/ApnContext.java b/src/java/com/android/internal/telephony/dataconnection/ApnContext.java
index f38f08b..f11737c 100644
--- a/src/java/com/android/internal/telephony/dataconnection/ApnContext.java
+++ b/src/java/com/android/internal/telephony/dataconnection/ApnContext.java
@@ -87,11 +87,6 @@
             log("setDataConnectionAc: old dcac=" + mDcAc + " new dcac=" + dcac
                     + " this=" + this);
         }
-        if ((dcac == null) && (mDcAc != null)) {
-            // TODO: This tearDown should be done by caller, but for now we'll do it
-            if (DBG) log("setDataConnection: call tearDown");
-            mDcAc.tearDown(this, "", null);
-        }
         mDcAc = dcac;
     }
 
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
index ad9f4a5..ecf690a 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
@@ -745,6 +745,9 @@
                 // If apnContext is not enabled anymore, break the linkage to the DCAC/DC.
                 apnContext.setState(DctConstants.State.IDLE);
                 if (!apnContext.isReady()) {
+                    if (dcac != null) {
+                        dcac.tearDown(apnContext, "", null);
+                    }
                     apnContext.setDataConnectionAc(null);
                 }
             } else {
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java b/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
index cea0d4f..d5e0ac7 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
@@ -428,6 +428,10 @@
                 if (DBG) {
                     log("onActionIntentReconnectAlarm: state is FAILED|IDLE, disassociate");
                 }
+                DcAsyncChannel dcac = apnContext.getDcAc();
+                if (dcac != null) {
+                    dcac.tearDown(apnContext, "", null);
+                }
                 apnContext.setDataConnectionAc(null);
                 apnContext.setState(DctConstants.State.IDLE);
             } else {