Move ConnectivityResources to service-connectivity
The ConnectivityResources class is only usable with QUERY_ALL_PACKAGES permission, so it is not generally usable in framework-connectivity. It is also backed by the ServiceConnectivityResources APK, which is intended as resources for service-connectivity. Move the class to service-connectivity and update callers. CTS needs a way to determine the supported keepalive count as it used the resources from KeepaliveUtils as @hide API, so provide a ConnectivityManager @hide API for testing. Bug: 279108992 Test: atest Change-Id: I3c9a77c580b5ab87c922c32778bce15dc33b4d1d
This commit is contained in:
committed by
Motomu Utsumi
parent
e50f1464bb
commit
bee2ee14f3
@@ -2534,6 +2534,26 @@ public class ConnectivityManager {
|
||||
return new TcpSocketKeepalive(mService, network, dup, executor, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the supported keepalive count for each transport configured in resource overlays.
|
||||
*
|
||||
* @return An array of supported keepalive count for each transport type.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(anyOf = { android.Manifest.permission.NETWORK_SETTINGS,
|
||||
// CTS 13 used QUERY_ALL_PACKAGES to get the resource value, which was implemented
|
||||
// as below in KeepaliveUtils. Also allow that permission so that KeepaliveUtils can
|
||||
// use this method and avoid breaking released CTS. Apps that have this permission
|
||||
// can query the resource themselves anyway.
|
||||
android.Manifest.permission.QUERY_ALL_PACKAGES })
|
||||
public int[] getSupportedKeepalives() {
|
||||
try {
|
||||
return mService.getSupportedKeepalives();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that a network route exists to deliver traffic to the specified
|
||||
* host via the specified network interface. An attempt to add a route that
|
||||
|
||||
Reference in New Issue
Block a user