INetd.aidl revision dedd271d9961dbe8b99ffa7d54ffd63ac326f866
1/**
2 * Copyright (c) 2016, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.net;
18
19/** {@hide} */
20interface INetd {
21    /**
22     * Returns true if the service is responding.
23     */
24    boolean isAlive();
25
26    /**
27     * Replaces the contents of the specified UID-based firewall chain.
28     *
29     * The chain may be a whitelist chain or a blacklist chain. A blacklist chain contains DROP
30     * rules for the specified UIDs and a RETURN rule at the end. A whitelist chain contains RETURN
31     * rules for the system UID range (0 to {@code UID_APP} - 1), RETURN rules for for the specified
32     * UIDs, and a DROP rule at the end. The chain will be created if it does not exist.
33     *
34     * @param chainName The name of the chain to replace.
35     * @param isWhitelist Whether this is a whitelist or blacklist chain.
36     * @param uids The list of UIDs to allow/deny.
37     * @return true if the chain was successfully replaced, false otherwise.
38     */
39    boolean firewallReplaceUidChain(String chainName, boolean isWhitelist, in int[] uids);
40
41    /**
42     * Enables or disables data saver mode on costly network interfaces.
43     *
44     * - When disabled, all packets to/from apps in the penalty box chain are rejected on costly
45     *   interfaces. Traffic to/from other apps or on other network interfaces is allowed.
46     * - When enabled, only apps that are in the happy box chain and not in the penalty box chain
47     *   are allowed network connectivity on costly interfaces. All other packets on these
48     *   interfaces are rejected. The happy box chain always contains all system UIDs; to disallow
49     *   traffic from system UIDs, place them in the penalty box chain.
50     *
51     * By default, data saver mode is disabled. This command has no effect but might still return an
52     * error) if {@code enable} is the same as the current value.
53     *
54     * @param enable whether to enable or disable data saver mode.
55     * @return true if the if the operation was successful, false otherwise.
56     */
57    boolean bandwidthEnableDataSaver(boolean enable);
58}
59