Merge "Add getUidFirewallRule to ConnectivityManager"

This commit is contained in:
Motomu Utsumi
2023-02-17 01:53:00 +00:00
committed by Gerrit Code Review
3 changed files with 32 additions and 0 deletions

View File

@@ -6035,6 +6035,30 @@ public class ConnectivityManager {
}
}
/**
* Get firewall rule of specified firewall chain on specified uid.
*
* @param chain target chain.
* @param uid target uid
* @return either FIREWALL_RULE_ALLOW or FIREWALL_RULE_DENY
* @throws UnsupportedOperationException if called on pre-T devices.
* @throws ServiceSpecificException in case of failure, with an error code indicating the
* cause of the failure.
* @hide
*/
@RequiresPermission(anyOf = {
android.Manifest.permission.NETWORK_SETTINGS,
android.Manifest.permission.NETWORK_STACK,
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
})
public int getUidFirewallRule(@FirewallChain final int chain, final int uid) {
try {
return mService.getUidFirewallRule(chain, uid);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Enables or disables the specified firewall chain.
*