• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* //device/java/android/android/os/INetworkManagementService.aidl
2 **
3 ** Copyright 2007, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 package android.os;
19 
20 import android.net.InterfaceConfiguration;
21 import android.net.INetworkManagementEventObserver;
22 import android.net.Network;
23 import android.net.NetworkStats;
24 import android.net.RouteInfo;
25 
26 /**
27  * @hide
28  */
29 interface INetworkManagementService
30 {
31     /**
32      ** GENERAL
33      **/
34 
35     /**
36      * Register an observer to receive events.
37      */
38     @UnsupportedAppUsage
registerObserver(INetworkManagementEventObserver obs)39     void registerObserver(INetworkManagementEventObserver obs);
40 
41     /**
42      * Unregister an observer from receiving events.
43      */
44     @UnsupportedAppUsage
unregisterObserver(INetworkManagementEventObserver obs)45     void unregisterObserver(INetworkManagementEventObserver obs);
46 
47     /**
48      * Returns a list of currently known network interfaces
49      */
listInterfaces()50     String[] listInterfaces();
51 
52     /**
53      * Retrieves the specified interface config
54      *
55      */
56     @UnsupportedAppUsage
getInterfaceConfig(String iface)57     InterfaceConfiguration getInterfaceConfig(String iface);
58 
59     /**
60      * Sets the configuration of the specified interface
61      */
62     @UnsupportedAppUsage
setInterfaceConfig(String iface, in InterfaceConfiguration cfg)63     void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
64 
65     /**
66      * Clear all IP addresses on the specified interface
67      */
68     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
clearInterfaceAddresses(String iface)69     void clearInterfaceAddresses(String iface);
70 
71     /**
72      * Set interface down
73      */
setInterfaceDown(String iface)74     void setInterfaceDown(String iface);
75 
76     /**
77      * Set interface up
78      */
setInterfaceUp(String iface)79     void setInterfaceUp(String iface);
80 
81     /**
82      * Set interface IPv6 privacy extensions
83      */
84     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
setInterfaceIpv6PrivacyExtensions(String iface, boolean enable)85     void setInterfaceIpv6PrivacyExtensions(String iface, boolean enable);
86 
87     /**
88      * Disable IPv6 on an interface
89      */
90     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
disableIpv6(String iface)91     void disableIpv6(String iface);
92 
93     /**
94      * Enable IPv6 on an interface
95      */
96     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
enableIpv6(String iface)97     void enableIpv6(String iface);
98 
99     /**
100      * Set IPv6 autoconf address generation mode.
101      * This is a no-op if an unsupported mode is requested.
102      */
103     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
setIPv6AddrGenMode(String iface, int mode)104     void setIPv6AddrGenMode(String iface, int mode);
105 
106     /**
107      * Shuts down the service
108      */
109     @EnforcePermission("SHUTDOWN")
shutdown()110     void shutdown();
111 
112     /**
113      ** DATA USAGE RELATED
114      **/
115 
116     /**
117      * Set quota for an interface.
118      */
setInterfaceQuota(String iface, long quotaBytes)119     void setInterfaceQuota(String iface, long quotaBytes);
120 
121     /**
122      * Remove quota for an interface.
123      */
removeInterfaceQuota(String iface)124     void removeInterfaceQuota(String iface);
125 
126     /**
127      * Set alert for an interface; requires that iface already has quota.
128      */
setInterfaceAlert(String iface, long alertBytes)129     void setInterfaceAlert(String iface, long alertBytes);
130 
131     /**
132      * Remove alert for an interface.
133      */
removeInterfaceAlert(String iface)134     void removeInterfaceAlert(String iface);
135 
136     /**
137      * Control network activity of a UID over interfaces with a quota limit.
138      */
setUidOnMeteredNetworkDenylist(int uid, boolean enable)139     void setUidOnMeteredNetworkDenylist(int uid, boolean enable);
setUidOnMeteredNetworkAllowlist(int uid, boolean enable)140     void setUidOnMeteredNetworkAllowlist(int uid, boolean enable);
141     @EnforcePermission("NETWORK_SETTINGS")
setDataSaverModeEnabled(boolean enable)142     boolean setDataSaverModeEnabled(boolean enable);
143 
setUidCleartextNetworkPolicy(int uid, int policy)144     void setUidCleartextNetworkPolicy(int uid, int policy);
145 
146     /**
147      * Return status of bandwidth control module.
148      */
149     @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
isBandwidthControlEnabled()150     boolean isBandwidthControlEnabled();
151 
setFirewallEnabled(boolean enabled)152     void setFirewallEnabled(boolean enabled);
isFirewallEnabled()153     boolean isFirewallEnabled();
setFirewallUidRule(int chain, int uid, int rule)154     void setFirewallUidRule(int chain, int uid, int rule);
setFirewallUidRules(int chain, in int[] uids, in int[] rules)155     void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
setFirewallChainEnabled(int chain, boolean enable)156     void setFirewallChainEnabled(int chain, boolean enable);
157 
158     /**
159      * Allow UID to call protect().
160      */
allowProtect(int uid)161     void allowProtect(int uid);
162 
163     /**
164      * Deny UID from calling protect().
165      */
denyProtect(int uid)166     void denyProtect(int uid);
167 
168     @EnforcePermission("OBSERVE_NETWORK_POLICY")
isNetworkRestricted(int uid)169     boolean isNetworkRestricted(int uid);
170 }
171