[VCN13] Implement tracking best matching network
This is done by:
1. In requestNetwork, provide a basic permission check.
2. rematchNetworksAndRequests: no change, since non listen
requests will be automatically processed to track
best satisfying network.
3. applyNetworkReassignment: no change, since non-request
will not be sent to factories.
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_noIssueToFactory
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_trackBestNetwork
Bug: 175662146
Change-Id: I8cf4ab334df6812d84cdda160e9b72b6f54062af
This commit is contained in:
@@ -18,8 +18,8 @@ package android.net;
|
|||||||
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
|
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
|
||||||
import static android.net.NetworkRequest.Type.BACKGROUND_REQUEST;
|
import static android.net.NetworkRequest.Type.BACKGROUND_REQUEST;
|
||||||
import static android.net.NetworkRequest.Type.LISTEN;
|
import static android.net.NetworkRequest.Type.LISTEN;
|
||||||
|
import static android.net.NetworkRequest.Type.LISTEN_FOR_BEST;
|
||||||
import static android.net.NetworkRequest.Type.REQUEST;
|
import static android.net.NetworkRequest.Type.REQUEST;
|
||||||
import static android.net.NetworkRequest.Type.TRACK_BEST;
|
|
||||||
import static android.net.NetworkRequest.Type.TRACK_DEFAULT;
|
import static android.net.NetworkRequest.Type.TRACK_DEFAULT;
|
||||||
import static android.net.NetworkRequest.Type.TRACK_SYSTEM_DEFAULT;
|
import static android.net.NetworkRequest.Type.TRACK_SYSTEM_DEFAULT;
|
||||||
import static android.net.QosCallback.QosCallbackRegistrationException;
|
import static android.net.QosCallback.QosCallbackRegistrationException;
|
||||||
@@ -4249,7 +4249,7 @@ public class ConnectivityManager {
|
|||||||
@NonNull NetworkCallback networkCallback, @NonNull Handler handler) {
|
@NonNull NetworkCallback networkCallback, @NonNull Handler handler) {
|
||||||
final NetworkCapabilities nc = request.networkCapabilities;
|
final NetworkCapabilities nc = request.networkCapabilities;
|
||||||
final CallbackHandler cbHandler = new CallbackHandler(handler);
|
final CallbackHandler cbHandler = new CallbackHandler(handler);
|
||||||
sendRequestForNetwork(nc, networkCallback, 0, TRACK_BEST, TYPE_NONE, cbHandler);
|
sendRequestForNetwork(nc, networkCallback, 0, LISTEN_FOR_BEST, TYPE_NONE, cbHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class NetworkRequest implements Parcelable {
|
|||||||
REQUEST,
|
REQUEST,
|
||||||
BACKGROUND_REQUEST,
|
BACKGROUND_REQUEST,
|
||||||
TRACK_SYSTEM_DEFAULT,
|
TRACK_SYSTEM_DEFAULT,
|
||||||
TRACK_BEST,
|
LISTEN_FOR_BEST,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -513,6 +513,15 @@ public class NetworkRequest implements Parcelable {
|
|||||||
return type == Type.LISTEN;
|
return type == Type.LISTEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true iff. this NetworkRequest is of type LISTEN_FOR_BEST.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isListenForBest() {
|
||||||
|
return type == Type.LISTEN_FOR_BEST;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true iff. the contained NetworkRequest is one that:
|
* Returns true iff. the contained NetworkRequest is one that:
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user