Consider NetworkOffer is unneeded if it cannot satisfy the request
Currently, to prevent from network connect-teardown-loops that caused by inaccurate reports, e.g. the provider always provides a better network than the offer, the NetworkOffer is considered needed if its provider is currently serving the request. This is because there is no accurate way to know whether the offer is corresponding to the network that is currently serving the request. However, if the offer cannot even satisfies the request, consider the offer is needed does not make any sense. Since it can never be the one that currently serving the request, nor be the one that might beat current satisfier. Test: android.net.NetworkProviderTest Bug: 189074532 Change-Id: Ie3ea59f980c3767782b8e6b03e401c02f664f9bd
This commit is contained in:
parent
33b4929cfe
commit
dc3a7a39d4
1 changed files with 11 additions and 13 deletions
|
|
@ -8322,13 +8322,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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue