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

Commit bdc4549d authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Make CALLBACK_PRECHECK actually work.

Currently, CALLBACK_PRECHECK is never fired, because we attempt
to send it just after a network has connected, before matching
requests to that network. So notifyNetworkCallbacks scans the
list of requests for the network, finds none, and does nothing.

Bug: 20038463
Change-Id: Ib0c6377c45990e358f926217d7c7defa74c1d59b
parent bd3af28f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4237,9 +4237,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
            networkAgent.created = true;
            updateLinkProperties(networkAgent, null);
            notifyIfacesChanged();
            notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_PRECHECK);

            networkAgent.networkMonitor.sendMessage(NetworkMonitor.CMD_NETWORK_CONNECTED);
            scheduleUnvalidatedPrompt(networkAgent);

            if (networkAgent.isVPN()) {
                // Temporarily disable the default proxy (not global).
                synchronized (mProxyLock) {
@@ -4252,9 +4253,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
                }
                // TODO: support proxy per network.
            }

            // Consider network even though it is not yet validated.
            rematchNetworkAndRequests(networkAgent, NascentState.NOT_JUST_VALIDATED,
                    ReapUnvalidatedNetworks.REAP);

            // This has to happen after matching the requests, because callbacks are just requests.
            notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_PRECHECK);
        } else if (state == NetworkInfo.State.DISCONNECTED ||
                state == NetworkInfo.State.SUSPENDED) {
            networkAgent.asyncChannel.disconnect();