Merge "Fix a possible system server crash"

This commit is contained in:
Chalard Jean 2021-07-27 04:37:43 +00:00 • committed by Gerrit Code Review
commit 51176d0a67

View file

@ -5907,7 +5907,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