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

Commit 228f0d97 authored by Junyu Lai's avatar Junyu Lai Committed by Automerger Merge Worker
Browse files

Merge "Remove the reference of new Network(int) in Vpn.java" am: 4e616680

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649306

Change-Id: If453ebbf3b2ad8f3165196b84e52aadfcd3c7685
parents d3b14cf1 4e616680
Loading
Loading
Loading
Loading
+4 −13
Original line number Diff line number Diff line
@@ -1859,22 +1859,13 @@ public class Vpn {
    /**
     * Updates underlying network set.
     */
    public synchronized boolean setUnderlyingNetworks(Network[] networks) {
    public synchronized boolean setUnderlyingNetworks(@Nullable Network[] networks) {
        if (!isCallerEstablishedOwnerLocked()) {
            return false;
        }
        if (networks == null) {
            mConfig.underlyingNetworks = null;
        } else {
            mConfig.underlyingNetworks = new Network[networks.length];
            for (int i = 0; i < networks.length; ++i) {
                if (networks[i] == null) {
                    mConfig.underlyingNetworks[i] = null;
                } else {
                    mConfig.underlyingNetworks[i] = new Network(networks[i].getNetId());
                }
            }
        }
        // Make defensive copy since the content of array might be altered by the caller.
        mConfig.underlyingNetworks =
                (networks != null) ? Arrays.copyOf(networks, networks.length) : null;
        mNetworkAgent.setUnderlyingNetworks((mConfig.underlyingNetworks != null)
                ? Arrays.asList(mConfig.underlyingNetworks) : null);
        return true;