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

Commit f7347c3b authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Chalard Jean
Browse files

Use network list in UNDERLYING_NETWORKS_CHANGED

The bundle is no longer necessary, as this message is not sent across
processes: the network list can be sent directly in the message obj
pair.

Bug: 173574274
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: Iae049a24212ff9df19b29aead20bf4a594f05f99
parent 8c03d3c0
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -227,12 +227,6 @@ public abstract class NetworkAgent {
     */
    public static final String REDIRECT_URL_KEY = "redirect URL";

    /**
     * Bundle key for the underlying networks in {@code EVENT_UNDERLYING_NETWORKS_CHANGED}.
     * @hide
     */
    public static final String UNDERLYING_NETWORKS_KEY = "underlyingNetworks";

     /**
     * Sent by the NetworkAgent to ConnectivityService to indicate this network was
     * explicitly selected.  This should be sent before the NetworkInfo is marked
+1 −7
Original line number Diff line number Diff line
@@ -2764,13 +2764,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
                        Log.wtf(TAG, "Non-virtual networks cannot have underlying networks");
                        break;
                    }
                    final ArrayList<Network> underlying;
                    try {
                        underlying = ((Bundle) arg.second).getParcelableArrayList(
                                NetworkAgent.UNDERLYING_NETWORKS_KEY);
                    } catch (NullPointerException | ClassCastException e) {
                        break;
                    }
                    final List<Network> underlying = (List<Network>) arg.second;
                    final Network[] oldUnderlying = nai.declaredUnderlyingNetworks;
                    nai.declaredUnderlyingNetworks = (underlying != null)
                            ? underlying.toArray(new Network[0]) : null;
+1 −11
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.net.NetworkMonitorManager;
import android.net.NetworkRequest;
import android.net.NetworkState;
import android.net.TcpKeepalivePacketData;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.INetworkManagementService;
@@ -53,7 +52,6 @@ import com.android.internal.util.WakeupMessage;
import com.android.server.ConnectivityService;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
@@ -583,16 +581,8 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {

        @Override
        public void sendUnderlyingNetworks(@Nullable List<Network> networks) {
            final Bundle args = new Bundle();
            if (networks instanceof ArrayList<?>) {
                args.putParcelableArrayList(NetworkAgent.UNDERLYING_NETWORKS_KEY,
                        (ArrayList<Network>) networks);
            } else {
                args.putParcelableArrayList(NetworkAgent.UNDERLYING_NETWORKS_KEY,
                        networks == null ? null : new ArrayList<>(networks));
            }
            mHandler.obtainMessage(NetworkAgent.EVENT_UNDERLYING_NETWORKS_CHANGED,
                    new Pair<>(NetworkAgentInfo.this, args)).sendToTarget();
                    new Pair<>(NetworkAgentInfo.this, networks)).sendToTarget();
        }
    }