Fix a memory leak in ConnectivityManager.
Remove callbacks from the internal storage when they are being unregistered. Change-Id: Ia42ed7aefaebd8caf3eada8e42b6cb7a940d7647
This commit is contained in:
@@ -2734,7 +2734,7 @@ public class ConnectivityManager {
|
||||
private void incCallbackHandlerRefCount() {
|
||||
synchronized(sCallbackRefCount) {
|
||||
if (sCallbackRefCount.incrementAndGet() == 1) {
|
||||
// TODO - switch this over to a ManagerThread or expire it when done
|
||||
// TODO: switch this to ConnectivityThread
|
||||
HandlerThread callbackThread = new HandlerThread("ConnectivityManager");
|
||||
callbackThread.start();
|
||||
sCallbackHandler = new CallbackHandler(callbackThread.getLooper(),
|
||||
@@ -3093,6 +3093,10 @@ public class ConnectivityManager {
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
synchronized (sNetworkCallback) {
|
||||
sNetworkCallback.remove(networkCallback.networkRequest);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user