| 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 |
|
| 19 |
import android.net.INetworkPolicyListener; |
| 20 |
import android.net.Network; |
| 21 |
import android.net.NetworkPolicy; |
| 22 |
import android.net.NetworkTemplate; |
| 23 |
import android.telephony.SubscriptionPlan; |
| 24 |
|
| 25 |
/** |
| 26 |
* Interface that creates and modifies network policy rules. |
| 27 |
* |
| 28 |
* {@hide} |
| 29 |
*/ |
| 30 |
interface INetworkPolicyManager { |
| 31 |
|
| 32 |
/** Control UID policies. */ |
| 33 |
@UnsupportedAppUsage |
| 34 |
void setUidPolicy(int uid, int policy); |
| 35 |
void addUidPolicy(int uid, int policy); |
| 36 |
void removeUidPolicy(int uid, int policy); |
| 37 |
@UnsupportedAppUsage |
| 38 |
int getUidPolicy(int uid); |
| 39 |
int[] getUidsWithPolicy(int policy); |
| 40 |
|
| 41 |
void registerListener(INetworkPolicyListener listener); |
| 42 |
void unregisterListener(INetworkPolicyListener listener); |
| 43 |
|
| 44 |
/** Control network policies atomically. */ |
| 45 |
@UnsupportedAppUsage |
| 46 |
void setNetworkPolicies(in NetworkPolicy[] policies); |
| 47 |
NetworkPolicy[] getNetworkPolicies(String callingPackage); |
| 48 |
|
| 49 |
/** Snooze limit on policy matching given template. */ |
| 50 |
@UnsupportedAppUsage |
| 51 |
void snoozeLimit(in NetworkTemplate template); |
| 52 |
|
| 53 |
/** Control if background data is restricted system-wide. */ |
| 54 |
@UnsupportedAppUsage |
| 55 |
void setRestrictBackground(boolean restrictBackground); |
| 56 |
@UnsupportedAppUsage |
| 57 |
boolean getRestrictBackground(); |
| 58 |
|
| 59 |
/** Gets the restrict background status based on the caller's UID: |
| 60 |
1 - disabled |
| 61 |
2 - whitelisted |
| 62 |
3 - enabled |
| 63 |
*/ |
| 64 |
int getRestrictBackgroundByCaller(); |
| 65 |
int getRestrictBackgroundStatus(int uid); |
| 66 |
|
| 67 |
void setDeviceIdleMode(boolean enabled); |
| 68 |
void setWifiMeteredOverride(String networkId, int meteredOverride); |
| 69 |
|
| 70 |
int getMultipathPreference(in Network network); |
| 71 |
|
| 72 |
SubscriptionPlan getSubscriptionPlan(in NetworkTemplate template); |
| 73 |
void notifyStatsProviderWarningOrLimitReached(); |
| 74 |
SubscriptionPlan[] getSubscriptionPlans(int subId, String callingPackage); |
| 75 |
void setSubscriptionPlans(int subId, in SubscriptionPlan[] plans, long expirationDurationMillis, String callingPackage); |
| 76 |
String getSubscriptionPlansOwner(int subId); |
| 77 |
void setSubscriptionOverride(int subId, int overrideMask, int overrideValue, in int[] networkTypes, long expirationDurationMillis, String callingPackage); |
| 78 |
|
| 79 |
void factoryReset(String subscriber); |
| 80 |
|
| 81 |
boolean isUidNetworkingBlocked(int uid, boolean meteredNetwork); |
| 82 |
boolean isUidRestrictedOnMeteredNetworks(int uid); |
| 83 |
} |