Expose new isUidCurrentlyDisallowedByPolicy
Allows determining if a UID is blocked based on its transports.
Change-Id: I2729b61c349ec2812a74d7d1c04b90a58b0f5b88
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java
index 4ab2d0f..0a05d43 100644
--- a/framework/src/android/net/ConnectivityManager.java
+++ b/framework/src/android/net/ConnectivityManager.java
@@ -1438,6 +1438,24 @@
}
/**
+ * Returns whether the specified UID is blocked due to disallowed transports.
+ *
+ * @hide
+ */
+ @RequiresPermission(anyOf = {
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
+ android.Manifest.permission.NETWORK_STACK,
+ android.Manifest.permission.NETWORK_SETTINGS})
+ @SystemApi(client = MODULE_LIBRARIES)
+ public boolean isUidCurrentlyDisallowedByPolicy(int uid) {
+ try {
+ return mService.isUidCurrentlyDisallowedByPolicy(uid);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Informs ConnectivityService of whether the legacy lockdown VPN, as implemented by
* LockdownVpnTracker, is in use. This is deprecated for new devices starting from Android 12
* but is still supported for backwards compatibility.