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

Commit fcfef283 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Clean up when we switch networks."

parents 1c62e72a 4064af84
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public abstract class NetworkAgent extends Handler {
    private AsyncChannel mAsyncChannel;
    private final String LOG_TAG;
    private static final boolean DBG = true;
    private static final boolean VDBG = true;
    // TODO - this class shouldn't cache data or it runs the risk of getting out of sync
    // Make the API require each of these when any is updated so we have the data we need,
    // without caching.
@@ -266,11 +267,14 @@ public abstract class NetworkAgent extends Handler {
     */
    private void evalScores() {
        if (mConnectionRequested) {
            if (VDBG) log("evalScores - already trying - size=" + mNetworkRequests.size());
            // already trying
            return;
        }
        if (VDBG) log("evalScores!");
        for (int i=0; i < mNetworkRequests.size(); i++) {
            int score = mNetworkRequests.valueAt(i).score;
            if (VDBG) log(" checking request Min " + score + " vs my score " + mNetworkScore);
            if (score < mNetworkScore) {
                // have a request that has a lower scored network servicing it
                // (or no network) than we could provide, so lets connect!
+1 −0
Original line number Diff line number Diff line
@@ -3216,6 +3216,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
            // tell the network currently servicing this that it's no longer interested
            NetworkAgentInfo affectedNetwork = mNetworkForRequestId.get(nri.request.requestId);
            if (affectedNetwork != null) {
                mNetworkForRequestId.remove(nri.request.requestId);
                affectedNetwork.networkRequests.remove(nri.request.requestId);
                if (VDBG) {
                    log(" Removing from current network " + affectedNetwork.name() + ", leaving " +