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

Commit 8add478e authored by Chalard Jean's avatar Chalard Jean Committed by Automerger Merge Worker
Browse files

Merge "Fix a bug where a spurious capabilities callback is sent." am: 9ef70c4b am: fd3eac2f

Change-Id: Ied089ed5ca553b206bdb3f7195f9e623aaabfa00
parents 8007d1ee fd3eac2f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -7132,6 +7132,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
            networkAgent.networkCapabilities.addCapability(NET_CAPABILITY_FOREGROUND);

            if (!createNativeNetwork(networkAgent)) return;
            if (networkAgent.isVPN()) {
                // Initialize the VPN capabilities to their starting values according to the
                // underlying networks. This will avoid a spurious callback to
                // onCapabilitiesUpdated being sent in updateAllVpnCapabilities below as
                // the VPN would switch from its default, blank capabilities to those
                // that reflect the capabilities of its underlying networks.
                updateAllVpnsCapabilities();
            }
            networkAgent.created = true;
        }

+0 −2
Original line number Diff line number Diff line
@@ -5394,8 +5394,6 @@ public class ConnectivityServiceTest {

        // Even though the VPN is unvalidated, it becomes the default network for our app.
        callback.expectAvailableCallbacksUnvalidated(vpnNetworkAgent);
        // TODO: this looks like a spurious callback.
        callback.expectCallback(CallbackEntry.NETWORK_CAPS_UPDATED, vpnNetworkAgent);
        callback.assertNoCallback();

        assertTrue(vpnNetworkAgent.getScore() > mEthernetNetworkAgent.getScore());