OSDN Git Service

Use dataConnectionNotInUse to decide if a DC is free.
authorWink Saville <wink@google.com>
Wed, 22 Jun 2011 00:58:45 +0000 (17:58 -0700)
committerWink Saville <wink@google.com>
Wed, 22 Jun 2011 00:58:45 +0000 (17:58 -0700)
Change-Id: I89cb2f46dca59d5738dd16eb657104c3158ebcd2

telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java

index 645bc69..b845f9f 100644 (file)
@@ -844,9 +844,16 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
         return result;
     }
 
+    private boolean dataConnectionNotInUse(DataConnectionAc dcac) {
+        for (ApnContext apnContext : mApnContexts.values()) {
+            if (apnContext.getDataConnectionAc() == dcac) return false;
+        }
+        return true;
+    }
+
     private GsmDataConnection findFreeDataConnection() {
         for (DataConnectionAc dcac : mDataConnectionAsyncChannels.values()) {
-            if (dcac.isInactiveSync()) {
+            if (dcac.isInactiveSync() && dataConnectionNotInUse(dcac)) {
                 log("findFreeDataConnection: found free GsmDataConnection");
                 return (GsmDataConnection) dcac.dataConnection;
             }