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

Commit 5a4f25d1 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed incorrect handling of re-creating network agent

1. When re-creating the network agent, the previous link
   properties needs to be filled.
2. Fixed the incorrect logic to detect immutable capabilities
   changed.

Fix: 217568288
Fix: 216855332
Test: atest DataNetworkTest
Change-Id: Ib938c050deafa834b2cd6e30de3e9560f2d72536
parent 1045a9b4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1268,8 +1268,8 @@ public class DataNetwork extends StateMachine {
        List<Integer> newImmutableCapabilities = Arrays.stream(newCapabilities.getCapabilities())
                .boxed().collect(Collectors.toList());
        newImmutableCapabilities.removeAll(MUTABLE_CAPABILITIES);
        return oldImmutableCapabilities.size() == newImmutableCapabilities.size()
                && oldImmutableCapabilities.containsAll(newImmutableCapabilities);
        return oldImmutableCapabilities.size() != newImmutableCapabilities.size()
                || !oldImmutableCapabilities.containsAll(newImmutableCapabilities);
    }

    /**
+2 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.KeepalivePacketData;
import android.net.LinkProperties;
import android.net.NetworkAgent;
import android.net.NetworkAgentConfig;
import android.net.NetworkProvider;
@@ -151,8 +150,8 @@ public class TelephonyNetworkAgent extends NetworkAgent implements NotifyQosSess
            @NonNull NetworkAgentConfig config, @NonNull NetworkProvider provider,
            @NonNull TelephonyNetworkAgentCallback callback) {
        super(phone.getContext(), looper, "TelephonyNetworkAgent",
                dataNetwork.getNetworkCapabilities(), new LinkProperties(), score, config,
                provider);
                dataNetwork.getNetworkCapabilities(), dataNetwork.getLinkProperties(), score,
                config, provider);
        register();
        mDataNetwork = dataNetwork;
        mTelephonyNetworkAgentCallbacks.add(callback);