Adds a new RESERVATION request type

RESERVATION requests allow supporting networks which require a two step
configuration mechanism, such as IP over L2cap networks. In the case of
IP over L2cap, the NetworkProvider must first create a
BluetoothServerSocket to generate a PSM. That PSM must then be
communicated back to the app to be included in a BluetoothAdvertisement
before the network can be established.
Using a RESERVATION request eliminates the need for the side-channel
APIs that have historically been used to solve this problem. RESERVATION
requests are handled by "blanket" NetworkOffers which generate a
NetworkOffer specific to the rservation in response. The requests
includes a reservationId (copied from the requestId) in its
NetworkCapabilities which is considered in matching.

Test: TH
Change-Id: I3665d843fc3fa6dd6a7223eb84d7cf2fdeeea0a1
This commit is contained in:
Patrick Rohr 2024-11-26 10:35:39 -08:00
commit 517c2e319d

View file

@ -193,6 +193,16 @@ public class NetworkRequest implements Parcelable {
* callbacks about the single, highest scoring current network
* (if any) that matches the specified NetworkCapabilities, or
*
* - RESERVATION requests behave identically to those of type REQUEST.
* For example, unlike LISTEN, they cause networks to remain
* connected, and they match exactly one network (the best one).
* A RESERVATION generates a unique reservationId in its
* NetworkCapabilities by copying the requestId which affects
* matching. A NetworkProvider can register a "blanket" NetworkOffer
* with reservationId = MATCH_ALL_RESERVATIONS to indicate that it
* is capable of generating NetworkOffers in response to RESERVATION
* requests.
*
* - TRACK_DEFAULT, which causes the framework to issue callbacks for
* the single, highest scoring current network (if any) that will
* be chosen for an app, but which cannot cause the framework to
@ -229,6 +239,7 @@ public class NetworkRequest implements Parcelable {
BACKGROUND_REQUEST,
TRACK_SYSTEM_DEFAULT,
LISTEN_FOR_BEST,
RESERVATION,
};
/**
@ -703,7 +714,7 @@ public class NetworkRequest implements Parcelable {
* @hide
*/
public boolean isRequest() {
return type == Type.REQUEST || type == Type.BACKGROUND_REQUEST;
return type == Type.REQUEST || type == Type.BACKGROUND_REQUEST || type == Type.RESERVATION;
}
/**