From 34cba144253a1c7e9cfaae5b0a2591cb42a17324 Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Thu, 27 Jan 2022 19:52:43 +0100 Subject: [PATCH 1/2] Define FIREWALL_CHAIN_LOW_POWER_STANDBY Bug: 190822356 Test: atest NetworkManagementServiceTest Change-Id: I970eea0e1952f8074cc5c998bbd2ee1ff5a3dc92 --- framework/api/module-lib-current.txt | 1 + framework/src/android/net/ConnectivityManager.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/framework/api/module-lib-current.txt b/framework/api/module-lib-current.txt index 5cfab5d471..3442a205d6 100644 --- a/framework/api/module-lib-current.txt +++ b/framework/api/module-lib-current.txt @@ -46,6 +46,7 @@ package android.net { 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 int FIREWALL_CHAIN_DOZABLE = 1; // 0x1 + field public static final int FIREWALL_CHAIN_LOW_POWER_STANDBY = 5; // 0x5 field public static final int FIREWALL_CHAIN_POWERSAVE = 3; // 0x3 field public static final int FIREWALL_CHAIN_RESTRICTED = 4; // 0x4 field public static final int FIREWALL_CHAIN_STANDBY = 2; // 0x2 diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java index 75934822c7..267d1c3687 100644 --- a/framework/src/android/net/ConnectivityManager.java +++ b/framework/src/android/net/ConnectivityManager.java @@ -963,13 +963,22 @@ public class ConnectivityManager { @SystemApi(client = MODULE_LIBRARIES) public static final int FIREWALL_CHAIN_RESTRICTED = 4; + /** + * Firewall chain used for low power standby. + * Allowlist of apps that have access in low power standby. + * @hide + */ + @SystemApi(client = MODULE_LIBRARIES) + public static final int FIREWALL_CHAIN_LOW_POWER_STANDBY = 5; + /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = false, prefix = "FIREWALL_CHAIN_", value = { FIREWALL_CHAIN_DOZABLE, FIREWALL_CHAIN_STANDBY, FIREWALL_CHAIN_POWERSAVE, - FIREWALL_CHAIN_RESTRICTED + FIREWALL_CHAIN_RESTRICTED, + FIREWALL_CHAIN_LOW_POWER_STANDBY }) public @interface FirewallChain {} From 2dac94841a3c99f39d7a9f8fb08bed4a8767dc35 Mon Sep 17 00:00:00 2001 From: Robert Horvath Date: Mon, 15 Nov 2021 15:49:37 +0100 Subject: [PATCH 2/2] Define BLOCKED_REASON_LOW_POWER_STANDBY Bug: 190822356 Test: atest NetworkPolicyManagerServiceTest Change-Id: I72c81ba1c3791e40a2d311cc3a06bf3b5d3727d1 --- framework/api/module-lib-current.txt | 1 + framework/src/android/net/ConnectivityManager.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/framework/api/module-lib-current.txt b/framework/api/module-lib-current.txt index 3442a205d6..5961e722b9 100644 --- a/framework/api/module-lib-current.txt +++ b/framework/api/module-lib-current.txt @@ -43,6 +43,7 @@ package android.net { 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_LOCKDOWN_VPN = 16; // 0x10 + field public static final int BLOCKED_REASON_LOW_POWER_STANDBY = 32; // 0x20 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 int FIREWALL_CHAIN_DOZABLE = 1; // 0x1 diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java index 267d1c3687..92ede91a8b 100644 --- a/framework/src/android/net/ConnectivityManager.java +++ b/framework/src/android/net/ConnectivityManager.java @@ -876,6 +876,15 @@ public class ConnectivityManager { @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) public static final int BLOCKED_REASON_LOCKDOWN_VPN = 1 << 4; + /** + * Flag to indicate that an app is subject to Low Power Standby restrictions that would + * result in its network access being blocked. + * + * @hide + */ + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) + public static final int BLOCKED_REASON_LOW_POWER_STANDBY = 1 << 5; + /** * Flag to indicate that an app is subject to Data saver restrictions that would * result in its metered network access being blocked. @@ -914,6 +923,7 @@ public class ConnectivityManager { BLOCKED_REASON_APP_STANDBY, BLOCKED_REASON_RESTRICTED_MODE, BLOCKED_REASON_LOCKDOWN_VPN, + BLOCKED_REASON_LOW_POWER_STANDBY, BLOCKED_METERED_REASON_DATA_SAVER, BLOCKED_METERED_REASON_USER_RESTRICTED, BLOCKED_METERED_REASON_ADMIN_DISABLED,