Check network slicing declaration for network request

When the application wants to request network with
NET_CAPABILITY_PRIORITIZE_BANDWIDTH or
NET_CAPABILITY_PRIORITIZE_LATENCY, it has to declare
PackageManager.PROPERTY_NETWORK_SLICE_DECLARATIONS property and also
adds the declaration in a separate XML files. Otherwise, the request
will fail with a SecurityException being thrown.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 266524688
Change-Id: I6affc857b803211517368da288e1b2fdc06a955b
This commit is contained in:
Yuyang Huang
2023-01-27 17:05:07 +09:00
parent 66b1b67b24
commit 96e8bfee5f
19 changed files with 1078 additions and 0 deletions

View File

@@ -62,6 +62,17 @@ public final class ConnectivityCompatChanges {
// This was a platform change ID with value 191844585L before T
public static final long RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER = 235355681L;
/**
* The self certified capabilities check should be enabled after android 13.
*
* <p> See {@link android.net.NetworkCapabilities} for more details.
*
* @hide
*/
@ChangeId
@EnabledAfter(targetSdkVersion = Build.VERSION_CODES.TIRAMISU)
public static final long ENABLE_SELF_CERTIFIED_CAPABILITIES_DECLARATION = 266524688;
private ConnectivityCompatChanges() {
}
}