19e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt/* 29e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Copyright (C) 2008 The Android Open Source Project 39e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * 49e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Licensed under the Apache License, Version 2.0 (the "License"); 59e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * you may not use this file except in compliance with the License. 69e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * You may obtain a copy of the License at 79e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * 89e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * http://www.apache.org/licenses/LICENSE-2.0 99e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * 109e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Unless required by applicable law or agreed to in writing, software 119e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * distributed under the License is distributed on an "AS IS" BASIS, 129e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * See the License for the specific language governing permissions and 149e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * limitations under the License. 159e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 169e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 179e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwaltpackage android.net; 189e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 199e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwaltimport android.annotation.SdkConstant; 209e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwaltimport android.annotation.SdkConstant.SdkConstantType; 219e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwaltimport android.os.Binder; 229e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwaltimport android.os.RemoteException; 239e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 249e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt/** 259e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Class that handles throttling. It provides read/write numbers per interface 269e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * and methods to apply throttled rates. 279e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 289e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 299e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwaltpublic class ThrottleManager 309e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt{ 319e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 329e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Broadcast each polling period to indicate new data counts. 339e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * 349e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Includes four extras: 359e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * EXTRA_CYCLE_READ - a long of the read bytecount for the current cycle 369e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * EXTRA_CYCLE_WRITE -a long of the write bytecount for the current cycle 379e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * EXTRA_CYLCE_START -a long of MS for the cycle start time 389e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * EXTRA_CYCLE_END -a long of MS for the cycle stop time 399e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 409e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 419e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String THROTTLE_POLL_ACTION = "android.net.thrott.POLL_ACTION"; 429e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 439e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * The lookup key for a long for the read bytecount for this period. Retrieve with 449e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@link android.content.Intent#getLongExtra(String)}. 459e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 469e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 479e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String EXTRA_CYCLE_READ = "cycleRead"; 489e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 499e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * contains a long of the number of bytes written in the cycle 509e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 519e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 529e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String EXTRA_CYCLE_WRITE = "cycleWrite"; 539e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 549e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * contains a long of the number of bytes read in the cycle 559e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 569e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 579e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String EXTRA_CYCLE_START = "cycleStart"; 589e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 599e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * contains a long of the ms since 1970 used to init a calendar, etc for the end 609e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * of the cycle 619e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 629e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 639e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String EXTRA_CYCLE_END = "cycleEnd"; 649e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 659e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 669e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Broadcast when the thottle level changes. 679e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 689e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 699e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String THROTTLE_ACTION = "android.net.thrott.THROTTLE_ACTION"; 709e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 719e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * int of the current bandwidth in TODO 729e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 739e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 749e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final String EXTRA_THROTTLE_LEVEL = "level"; 759e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 7681aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt /** 7781aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt * Broadcast on boot and whenever the settings change. 7881aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt * {@hide} 7981aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt */ 8081aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt public static final String POLICY_CHANGED_ACTION = "android.net.thrott.POLICY_CHANGED_ACTION"; 8181aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt 829e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // {@hide} 839e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int DIRECTION_TX = 0; 849e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // {@hide} 859e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int DIRECTION_RX = 1; 869e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 879e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // {@hide} 889e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_CYCLE = 0; 899e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // {@hide} 909e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_YEAR = 1; 919e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // {@hide} 929e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_MONTH = 2; 939e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // {@hide} 949e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_WEEK = 3; 959e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 969e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_7DAY = 4; 979e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 989e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_DAY = 5; 999e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 1009e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_24HOUR = 6; 1019e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 1029e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_HOUR = 7; 1039e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 1049e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_60MIN = 8; 1059e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 1069e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_MINUTE = 9; 1079e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 1089e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_60SEC = 10; 1099e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt // @hide 1109e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public static final int PERIOD_SECOND = 11; 1119e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 11281aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt 11381aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt 1149e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 1159e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * returns a long of the ms from the epoch to the time the current cycle ends for the 1169e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * named interface 1179e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 1189e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 1199e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public long getResetTime(String iface) { 1209e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt try { 1219e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return mService.getResetTime(iface); 1229e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } catch (RemoteException e) { 1239e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return -1; 1249e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1259e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1269e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 1279e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 1289e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * returns a long of the ms from the epoch to the time the current cycle started for the 1299e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * named interface 1309e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 1319e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 1329e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public long getPeriodStartTime(String iface) { 1339e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt try { 1349e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return mService.getPeriodStartTime(iface); 1359e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } catch (RemoteException e) { 1369e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return -1; 1379e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1389e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1399e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 1409e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 1419e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * returns a long of the byte count either read or written on the named interface 1429e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * for the period described. Direction is either DIRECTION_RX or DIRECTION_TX and 1439e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * period may only be PERIOD_CYCLE for the current cycle (other periods may be supported 1449e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * in the future). Ago indicates the number of periods in the past to lookup - 0 means 1459e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * the current period, 1 is the last one, 2 was two periods ago.. 1469e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 1479e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 1489e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public long getByteCount(String iface, int direction, int period, int ago) { 1499e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt try { 1509e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return mService.getByteCount(iface, direction, period, ago); 1519e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } catch (RemoteException e) { 1529e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return -1; 1539e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1549e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1559e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 1569e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 1579e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * returns the number of bytes read+written after which a particular cliff 15881aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt * takes effect on the named iface. Currently only cliff #1 is supported (1 step) 1599e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 1609e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 1619e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public long getCliffThreshold(String iface, int cliff) { 1629e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt try { 1639e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return mService.getCliffThreshold(iface, cliff); 1649e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } catch (RemoteException e) { 1659e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return -1; 1669e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1679e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1689e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 1699e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 1709e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * returns the thottling bandwidth (bps) for a given cliff # on the named iface. 17181aa0971d7a26ae16ed34fc7da97a55d97fb8e74Robert Greenwalt * only cliff #1 is currently supported. 1729e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 1739e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 1749e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public int getCliffLevel(String iface, int cliff) { 1759e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt try { 1769e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return mService.getCliffLevel(iface, cliff); 1779e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } catch (RemoteException e) { 1789e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt return -1; 1799e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1809e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 1819e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 182c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff /** 183c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff * returns the help URI for throttling 184c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff * {@hide} 185c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff */ 186c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff public String getHelpUri() { 187c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff try { 188c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff return mService.getHelpUri(); 189c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff } catch (RemoteException e) { 190c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff return null; 191c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff } 192c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff } 193c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff 194c9b6851af68bdc20c4903b16c344e9f116647219Irfan Sheriff 1959e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt private IThrottleManager mService; 1969e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 1979e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 1989e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * Don't allow use of default constructor. 1999e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 2009e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt @SuppressWarnings({"UnusedDeclaration"}) 2019e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt private ThrottleManager() { 2029e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 2039e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt 2049e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt /** 2059e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt * {@hide} 2069e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt */ 2079e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt public ThrottleManager(IThrottleManager service) { 2089e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt if (service == null) { 2099e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt throw new IllegalArgumentException( 2109e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt "ThrottleManager() cannot be constructed with null service"); 2119e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 2129e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt mService = service; 2139e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt } 2149e696c29f06d45d2891e1d38fd8d9033a9e21bb9Robert Greenwalt} 215