Jeff Sharkey | d5cdd59 | 2011-05-03 20:27:17 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.net; |
| 18 | |
Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 19 | import android.net.INetworkPolicyListener; |
Jeff Sharkey | 21c9c45 | 2011-06-07 12:26:43 -0700 | [diff] [blame] | 20 | import android.net.NetworkPolicy; |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 21 | import android.net.NetworkQuotaInfo; |
| 22 | import android.net.NetworkState; |
Jeff Sharkey | 41ff7ec | 2011-07-25 15:21:22 -0700 | [diff] [blame] | 23 | import android.net.NetworkTemplate; |
Jeff Sharkey | 53313d7 | 2017-07-13 16:47:32 -0600 | [diff] [blame] | 24 | import android.telephony.SubscriptionPlan; |
Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 25 | |
Jeff Sharkey | d5cdd59 | 2011-05-03 20:27:17 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Interface that creates and modifies network policy rules. |
| 28 | * |
| 29 | * {@hide} |
| 30 | */ |
| 31 | interface INetworkPolicyManager { |
| 32 | |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 33 | /** Control UID policies. */ |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 34 | @UnsupportedAppUsage |
Jeff Sharkey | d0c6ccb | 2012-09-14 16:26:37 -0700 | [diff] [blame] | 35 | void setUidPolicy(int uid, int policy); |
Dianne Hackborn | be7c50e | 2014-06-30 14:43:28 -0700 | [diff] [blame] | 36 | void addUidPolicy(int uid, int policy); |
| 37 | void removeUidPolicy(int uid, int policy); |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 38 | @UnsupportedAppUsage |
Jeff Sharkey | d0c6ccb | 2012-09-14 16:26:37 -0700 | [diff] [blame] | 39 | int getUidPolicy(int uid); |
| 40 | int[] getUidsWithPolicy(int policy); |
Jeff Sharkey | d5cdd59 | 2011-05-03 20:27:17 -0700 | [diff] [blame] | 41 | |
Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 42 | void registerListener(INetworkPolicyListener listener); |
| 43 | void unregisterListener(INetworkPolicyListener listener); |
| 44 | |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 45 | /** Control network policies atomically. */ |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 46 | @UnsupportedAppUsage |
Jeff Sharkey | 22c055e | 2011-06-12 21:13:51 -0700 | [diff] [blame] | 47 | void setNetworkPolicies(in NetworkPolicy[] policies); |
Svet Ganov | 16a1689 | 2015-04-16 10:32:04 -0700 | [diff] [blame] | 48 | NetworkPolicy[] getNetworkPolicies(String callingPackage); |
Jeff Sharkey | d5cdd59 | 2011-05-03 20:27:17 -0700 | [diff] [blame] | 49 | |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 50 | /** Snooze limit on policy matching given template. */ |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 51 | @UnsupportedAppUsage |
Jeff Sharkey | 0e2e5f8 | 2012-02-02 16:02:51 -0800 | [diff] [blame] | 52 | void snoozeLimit(in NetworkTemplate template); |
Jeff Sharkey | 41ff7ec | 2011-07-25 15:21:22 -0700 | [diff] [blame] | 53 | |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 54 | /** Control if background data is restricted system-wide. */ |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 55 | @UnsupportedAppUsage |
Jeff Sharkey | 4664500 | 2011-07-27 21:11:21 -0700 | [diff] [blame] | 56 | void setRestrictBackground(boolean restrictBackground); |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 57 | @UnsupportedAppUsage |
Jeff Sharkey | 4664500 | 2011-07-27 21:11:21 -0700 | [diff] [blame] | 58 | boolean getRestrictBackground(); |
| 59 | |
Felipe Leme | 70c8b9b | 2016-04-25 14:41:31 -0700 | [diff] [blame] | 60 | /** Callback used to change internal state on tethering */ |
| 61 | void onTetheringChanged(String iface, boolean tethering); |
| 62 | |
Felipe Leme | 1b10323 | 2016-01-22 09:44:57 -0800 | [diff] [blame] | 63 | /** Gets the restrict background status based on the caller's UID: |
| 64 | 1 - disabled |
| 65 | 2 - whitelisted |
| 66 | 3 - enabled |
| 67 | */ |
| 68 | int getRestrictBackgroundByCaller(); |
Felipe Leme | b85a637 | 2016-01-14 16:16:16 -0800 | [diff] [blame] | 69 | |
Dianne Hackborn | 8ad2af7 | 2015-03-17 17:00:24 -0700 | [diff] [blame] | 70 | void setDeviceIdleMode(boolean enabled); |
Jeff Sharkey | 43d2a17 | 2017-07-12 10:50:42 -0600 | [diff] [blame] | 71 | void setWifiMeteredOverride(String networkId, int meteredOverride); |
Dianne Hackborn | 8ad2af7 | 2015-03-17 17:00:24 -0700 | [diff] [blame] | 72 | |
Andrei Onea | 9a8b6bf | 2019-02-25 13:25:32 +0000 | [diff] [blame] | 73 | @UnsupportedAppUsage |
Jeff Sharkey | f0ceede | 2011-08-02 17:22:34 -0700 | [diff] [blame] | 74 | NetworkQuotaInfo getNetworkQuotaInfo(in NetworkState state); |
Stuart Scott | f1fb397 | 2015-04-02 18:00:02 -0700 | [diff] [blame] | 75 | |
Jeff Sharkey | 53313d7 | 2017-07-13 16:47:32 -0600 | [diff] [blame] | 76 | SubscriptionPlan[] getSubscriptionPlans(int subId, String callingPackage); |
| 77 | void setSubscriptionPlans(int subId, in SubscriptionPlan[] plans, String callingPackage); |
Jeff Sharkey | 717f52f | 2018-01-04 16:04:11 -0700 | [diff] [blame] | 78 | String getSubscriptionPlansOwner(int subId); |
Jeff Sharkey | 9252b34 | 2018-01-19 07:58:35 +0900 | [diff] [blame] | 79 | void setSubscriptionOverride(int subId, int overrideMask, int overrideValue, long timeoutMillis, String callingPackage); |
Jeff Sharkey | 53313d7 | 2017-07-13 16:47:32 -0600 | [diff] [blame] | 80 | |
Stuart Scott | f1fb397 | 2015-04-02 18:00:02 -0700 | [diff] [blame] | 81 | void factoryReset(String subscriber); |
Sudheer Shanka | b8f2316 | 2017-08-04 13:30:10 -0700 | [diff] [blame] | 82 | |
| 83 | boolean isUidNetworkingBlocked(int uid, boolean meteredNetwork); |
Jeff Sharkey | d5cdd59 | 2011-05-03 20:27:17 -0700 | [diff] [blame] | 84 | } |