Skip to content
Commit 72bbf482 authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Rematch requests first and listens second.

This CL splits rematching in two parts: first rematch requests,
then rematch listens. This will allow us to change a network's
capabilities depending on what requests are on that network, and
properly dispatch callbacks depending on those capabilities.

The behaviour changes are as follows:

- Before this CL, callbacks for requests and listens were sent
  intermingled. After this CL, all request callbacks will be
  grouped together, and all listen callbacks will be grouped
  together.
- Before this CL, the order was:
    1. Send onLost callbacks.
    2. If applicable, switch the default network.
    3. Send onAvailable callbacks.
  After this CL, the order is:
    1. Send onLost callbacks for requests.
    2. If applicable, switch the default network.
    3. Send onLost callbacks for listens.
    4. Send onAvailable callbacks for listens.
    5. Send onAvailable callbacks for requests.

These changes shouldn't affect any apps because:

1. The order of callbacks continues to be first all onLost,
   then all onAvailable.
2. Both the old and the new code send callbacks in no particular
   order. Thus, the possible ordering combinations of callbacks
   in the new code are a strict subset of the possible ordering
   combinations of the old code.
3. The default network is switched before any onAvailable
   callback is sent.
4. Even though the new code does not send all onLost callbacks
   before switching the default network, even before this CL
   there was no guarantee that those callbacks would be received
   before the default network switch anyway, because callbacks
   are asynchronous.

Bug: 23113288
Change-Id: Ia08900c50db9ff43895047e2f4f36b6c6c31a1f9
parent c60f54ed
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment