Move BLOCKED_REASON_* constants from NPMS into ConnectivityManager.
These constants will now be including all the reasons for why an uid's network access can be blocked, instead of only the restrictions that could be imposed by NPMS. Bug: 183473548 Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java Merged-In: I4c544415e12adf442fd2415c371b1b70a39c3aa4 Change-Id: I6dcea43fbefa9eac8b5a971b822a5be5422a54b4
This commit is contained in:
committed by
Lorenzo Colitti
parent
074c7d7537
commit
f1520bb8dc
@@ -22,6 +22,14 @@ package android.net {
|
||||
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_TEST_NETWORKS, android.Manifest.permission.NETWORK_STACK}) public void simulateDataStall(int, long, @NonNull android.net.Network, @NonNull android.os.PersistableBundle);
|
||||
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void startCaptivePortalApp(@NonNull android.net.Network);
|
||||
method public void systemReady();
|
||||
field public static final int BLOCKED_METERED_REASON_ADMIN_DISABLED = 262144; // 0x40000
|
||||
field public static final int BLOCKED_METERED_REASON_DATA_SAVER = 65536; // 0x10000
|
||||
field public static final int BLOCKED_METERED_REASON_USER_RESTRICTED = 131072; // 0x20000
|
||||
field public static final int BLOCKED_REASON_APP_STANDBY = 4; // 0x4
|
||||
field public static final int BLOCKED_REASON_BATTERY_SAVER = 1; // 0x1
|
||||
field public static final int BLOCKED_REASON_DOZE = 2; // 0x2
|
||||
field public static final int BLOCKED_REASON_NONE = 0; // 0x0
|
||||
field public static final int BLOCKED_REASON_RESTRICTED_MODE = 8; // 0x8
|
||||
field public static final String PRIVATE_DNS_MODE_OFF = "off";
|
||||
field public static final String PRIVATE_DNS_MODE_OPPORTUNISTIC = "opportunistic";
|
||||
field public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
|
||||
|
||||
@@ -826,6 +826,94 @@ public class ConnectivityManager {
|
||||
})
|
||||
public @interface PrivateDnsMode {}
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is not subject to any restrictions that could result in its
|
||||
* network access blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_REASON_NONE = 0;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to Battery saver restrictions that would
|
||||
* result in its network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_REASON_BATTERY_SAVER = 1 << 0;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to Doze restrictions that would
|
||||
* result in its network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_REASON_DOZE = 1 << 1;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to App Standby restrictions that would
|
||||
* result in its network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_REASON_APP_STANDBY = 1 << 2;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to Restricted mode restrictions that would
|
||||
* result in its network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_REASON_RESTRICTED_MODE = 1 << 3;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to Data saver restrictions that would
|
||||
* result in its metered network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_METERED_REASON_DATA_SAVER = 1 << 16;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to user restrictions that would
|
||||
* result in its metered network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_METERED_REASON_USER_RESTRICTED = 1 << 17;
|
||||
|
||||
/**
|
||||
* Flag to indicate that an app is subject to Device admin restrictions that would
|
||||
* result in its metered network access being blocked.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||
public static final int BLOCKED_METERED_REASON_ADMIN_DISABLED = 1 << 18;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(flag = true, prefix = {"BLOCKED_"}, value = {
|
||||
BLOCKED_REASON_NONE,
|
||||
BLOCKED_REASON_BATTERY_SAVER,
|
||||
BLOCKED_REASON_DOZE,
|
||||
BLOCKED_REASON_APP_STANDBY,
|
||||
BLOCKED_REASON_RESTRICTED_MODE,
|
||||
BLOCKED_METERED_REASON_DATA_SAVER,
|
||||
BLOCKED_METERED_REASON_USER_RESTRICTED,
|
||||
BLOCKED_METERED_REASON_ADMIN_DISABLED,
|
||||
})
|
||||
public @interface BlockedReason {}
|
||||
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 130143562)
|
||||
private final IConnectivityManager mService;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user