Merge "Fix a possible system server crash" am: 51176d0a67 am: d79bd5c622

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

Change-Id: Id71b3d6e530a053b1950ed9cecbf74a83b36b4e8
This commit is contained in:
Chalard Jean
2021-07-27 05:12:15 +00:00
committed by Automerger Merge Worker
2 changed files with 47 additions and 1 deletions

View File

@@ -5915,7 +5915,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
public void binderDied() {
log("ConnectivityService NetworkRequestInfo binderDied(" +
"uid/pid:" + mUid + "/" + mPid + ", " + mBinder + ")");
mHandler.post(() -> handleRemoveNetworkRequest(this));
// As an immutable collection, mRequests cannot change by the time the
// lambda is evaluated on the handler thread so calling .get() from a binder thread
// is acceptable. Use handleReleaseNetworkRequest and not directly
// handleRemoveNetworkRequest so as to force a lookup in the requests map, in case
// the app already unregistered the request.
mHandler.post(() -> handleReleaseNetworkRequest(mRequests.get(0),
mUid, false /* callOnUnavailable */));
}
@Override