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

Commit 39e10e88 authored by Hugo Benichi's avatar Hugo Benichi
Browse files

ConnectivityManager: no double callback remove

This patch partially undoes ag/869831 (Change-Id:
Ia42ed7aefaebd8caf3eada8e42b6cb7a940d7647) so that ConnectivityManager
does not remove callbacks from its internal request-to-callback map at
unregistration, but instead let the singleton CallbackHandler do it when
receiving a CALLBACK_RELEASED from ConnectivityService.

ag/869831 was thought to fix b/26749700 that reported a callback leak
from sNetworkCallback, but a finer analysis of the code shows that
callbacks were correctly removed by the CallbackHandler before
ag/869831. There was therefore no callback leak.

Bug: 26749700
Bug: 28537383
Change-Id: I421d889d0e225c0e3d1eebea664f44a1cc0f3191
parent 018a2058
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -3103,14 +3103,11 @@ public class ConnectivityManager {
            throw new IllegalArgumentException("Invalid NetworkCallback");
        }
        try {
            // CallbackHandler will release callback when receiving CALLBACK_RELEASED.
            mService.releaseNetworkRequest(networkCallback.networkRequest);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }

        synchronized (sNetworkCallback) {
            sNetworkCallback.remove(networkCallback.networkRequest);
        }
    }

    /**