Fix NetworkOffer Death link does not exist am: 3ec7e6d9fb am: f405adead7 am: a5208a6aa2

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

Change-Id: Id307e54a38054207ae164851c86bed1314ef7a2b
This commit is contained in:
Tyler Wear
2021-09-29 01:22:00 +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 */);
}