Merge "Consider NetworkOffer is unneeded if it cannot satisfy the request"

This commit is contained in:
Junyu Lai
2021-07-05 08:57:07 +00:00
committed by Gerrit Code Review
3 changed files with 11 additions and 13 deletions

View File

@@ -8352,13 +8352,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
// Second phase : deal with the active request (if any)
if (null != activeRequest && activeRequest.isRequest()) {
final boolean oldNeeded = offer.neededFor(activeRequest);
// An offer is needed if it is currently served by this provider or if this offer
// can beat the current satisfier.
// If an offer can satisfy the request, it is considered needed if it is currently
// served by this provider or if this offer can beat the current satisfier.
final boolean currentlyServing = satisfier != null
&& satisfier.factorySerialNumber == offer.providerId;
final boolean newNeeded = (currentlyServing
|| (activeRequest.canBeSatisfiedBy(offer.caps)
&& networkRanker.mightBeat(activeRequest, satisfier, offer)));
&& satisfier.factorySerialNumber == offer.providerId
&& activeRequest.canBeSatisfiedBy(offer.caps);
final boolean newNeeded = currentlyServing
|| networkRanker.mightBeat(activeRequest, satisfier, offer);
if (newNeeded != oldNeeded) {
if (newNeeded) {
offer.onNetworkNeeded(activeRequest);