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 Ignore-AOSP-First: Merging internally first to handle conflicts. Change-Id: I4c544415e12adf442fd2415c371b1b70a39c3aa4
This commit is contained in:
@@ -829,6 +829,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