Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1ec23c2 authored by Wink Saville's avatar Wink Saville
Browse files

Use dataConnectionNotInUse to decide if a DC is free.

Change-Id: I89cb2f46dca59d5738dd16eb657104c3158ebcd2
parent 885c3c11
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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;
            }