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

Commit ff5fb794 authored by James Mattis's avatar James Mattis
Browse files

Using defensive copy for default request remove

Passing in a defensive copy for the default requests in
ConnectivityService prior to updating that collection so as to not have
issues when removing elements as part of the per-app preference update
flow.

Bug: 176494815
Bug: 178632672
Test: atest FrameworksNetTests
atest FrameworksNetTests:com.android.server
.ConnectivityServiceTest#testSetOemNetworkPreference
ClearPreviousOemValues --iterations

Change-Id: Ia683d5035dda2be35fd2f2b7ee038e806caab6f9
parent c1115803
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9033,7 +9033,8 @@ public class ConnectivityService extends IConnectivityManager.Stub

    private void updateDefaultNetworksForOemNetworkPreference(
            @NonNull final Set<NetworkRequestInfo> nris) {
        handleRemoveNetworkRequests(mDefaultNetworkRequests);
        // Pass in a defensive copy as this collection will be updated on remove.
        handleRemoveNetworkRequests(new ArraySet<>(mDefaultNetworkRequests));
        addPerAppDefaultNetworkRequests(nris);
    }