Merge "Add setFirewallChainEnabled API"
This commit is contained in:
@@ -5674,4 +5674,26 @@ public class ConnectivityManager {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the specified firewall chain.
|
||||
*
|
||||
* @param chain target chain.
|
||||
* @param enable whether the chain should be enabled.
|
||||
* @throws IllegalStateException if set firewall chain failed.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.NETWORK_SETTINGS,
|
||||
android.Manifest.permission.NETWORK_STACK,
|
||||
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
|
||||
})
|
||||
public void setFirewallChainEnabled(@FirewallChain final int chain, final boolean enable) {
|
||||
try {
|
||||
mService.setFirewallChainEnabled(chain, enable);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,4 +236,6 @@ interface IConnectivityManager
|
||||
void updateMeteredNetworkDenyList(int uid, boolean add);
|
||||
|
||||
void updateFirewallRule(int chain, int uid, boolean allow);
|
||||
|
||||
void setFirewallChainEnabled(int chain, boolean enable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user