Fix NetworkOffer Death link does not exist am: 3ec7e6d9fb

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1799528

Change-Id: Ic1b0cb9e06d05d334cedd4b50bc7e8cf91dcc59a
This commit is contained in:
Tyler Wear
2021-09-29 00:55:19 +00:00
committed by Automerger Merge Worker

View File

@@ -6908,7 +6908,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
if (DBG) {
log("unregister offer from providerId " + noi.offer.providerId + " : " + noi.offer);
}
mNetworkOffers.remove(noi);
// If the provider removes the offer and dies immediately afterwards this
// function may be called twice in a row, but the array will no longer contain
// the offer.
if (!mNetworkOffers.remove(noi)) return;
noi.offer.callback.asBinder().unlinkToDeath(noi, 0 /* flags */);
}