blob: c722fbce32bfa0b06f8e39f4d9dce6cb2a28e75b [file] [log] [blame]
Jeff Sharkeyd5cdd592011-05-03 20:27:17 -07001/*
2 * Copyright (C) 2011 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
Jeff Sharkeyc006f1a2011-05-19 17:12:49 -070019import android.net.INetworkPolicyListener;
Jeff Sharkey21c9c452011-06-07 12:26:43 -070020import android.net.NetworkPolicy;
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070021import android.net.NetworkQuotaInfo;
22import android.net.NetworkState;
Jeff Sharkey41ff7ec2011-07-25 15:21:22 -070023import android.net.NetworkTemplate;
Jeff Sharkeyc006f1a2011-05-19 17:12:49 -070024
Jeff Sharkeyd5cdd592011-05-03 20:27:17 -070025/**
26 * Interface that creates and modifies network policy rules.
27 *
28 * {@hide}
29 */
30interface INetworkPolicyManager {
31
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070032 /** Control UID policies. */
Jeff Sharkeyd0c6ccb2012-09-14 16:26:37 -070033 void setUidPolicy(int uid, int policy);
Dianne Hackbornbe7c50e2014-06-30 14:43:28 -070034 void addUidPolicy(int uid, int policy);
35 void removeUidPolicy(int uid, int policy);
Jeff Sharkeyd0c6ccb2012-09-14 16:26:37 -070036 int getUidPolicy(int uid);
37 int[] getUidsWithPolicy(int policy);
Jeff Sharkeyd5cdd592011-05-03 20:27:17 -070038
Jeff Sharkey9599cc52011-05-22 14:59:31 -070039 boolean isUidForeground(int uid);
40
Dianne Hackbornbe7c50e2014-06-30 14:43:28 -070041 int[] getPowerSaveAppIdWhitelist();
42
Jeff Sharkeyc006f1a2011-05-19 17:12:49 -070043 void registerListener(INetworkPolicyListener listener);
44 void unregisterListener(INetworkPolicyListener listener);
45
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070046 /** Control network policies atomically. */
Jeff Sharkey22c055e2011-06-12 21:13:51 -070047 void setNetworkPolicies(in NetworkPolicy[] policies);
Svet Ganov16a16892015-04-16 10:32:04 -070048 NetworkPolicy[] getNetworkPolicies(String callingPackage);
Jeff Sharkeyd5cdd592011-05-03 20:27:17 -070049
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070050 /** Snooze limit on policy matching given template. */
Jeff Sharkey0e2e5f82012-02-02 16:02:51 -080051 void snoozeLimit(in NetworkTemplate template);
Jeff Sharkey41ff7ec2011-07-25 15:21:22 -070052
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070053 /** Control if background data is restricted system-wide. */
Jeff Sharkey46645002011-07-27 21:11:21 -070054 void setRestrictBackground(boolean restrictBackground);
55 boolean getRestrictBackground();
56
Dianne Hackborn8ad2af72015-03-17 17:00:24 -070057 void setDeviceIdleMode(boolean enabled);
58
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070059 NetworkQuotaInfo getNetworkQuotaInfo(in NetworkState state);
Jeff Sharkey9f7cbf02012-04-12 18:34:54 -070060 boolean isNetworkMetered(in NetworkState state);
Stuart Scottf1fb3972015-04-02 18:00:02 -070061
62 void factoryReset(String subscriber);
Jeff Sharkeyd5cdd592011-05-03 20:27:17 -070063}