am c9b6851a: Throttling framework addins
Merge commit 'c9b6851af68bdc20c4903b16c344e9f116647219' into froyo-plus-aosp * commit 'c9b6851af68bdc20c4903b16c344e9f116647219': Throttling framework addins
This commit is contained in:
@@ -67,6 +67,8 @@ import android.location.LocationManager;
|
||||
import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.IConnectivityManager;
|
||||
import android.net.ThrottleManager;
|
||||
import android.net.IThrottleManager;
|
||||
import android.net.Uri;
|
||||
import android.net.wifi.IWifiManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
@@ -164,6 +166,7 @@ class ContextImpl extends Context {
|
||||
private static AlarmManager sAlarmManager;
|
||||
private static PowerManager sPowerManager;
|
||||
private static ConnectivityManager sConnectivityManager;
|
||||
private static ThrottleManager sThrottleManager;
|
||||
private static WifiManager sWifiManager;
|
||||
private static LocationManager sLocationManager;
|
||||
private static final HashMap<File, SharedPreferencesImpl> sSharedPrefs =
|
||||
@@ -929,6 +932,8 @@ class ContextImpl extends Context {
|
||||
return getPowerManager();
|
||||
} else if (CONNECTIVITY_SERVICE.equals(name)) {
|
||||
return getConnectivityManager();
|
||||
} else if (THROTTLE_SERVICE.equals(name)) {
|
||||
return getThrottleManager();
|
||||
} else if (WIFI_SERVICE.equals(name)) {
|
||||
return getWifiManager();
|
||||
} else if (NOTIFICATION_SERVICE.equals(name)) {
|
||||
@@ -1028,6 +1033,18 @@ class ContextImpl extends Context {
|
||||
return sConnectivityManager;
|
||||
}
|
||||
|
||||
private ThrottleManager getThrottleManager()
|
||||
{
|
||||
synchronized (sSync) {
|
||||
if (sThrottleManager == null) {
|
||||
IBinder b = ServiceManager.getService(THROTTLE_SERVICE);
|
||||
IThrottleManager service = IThrottleManager.Stub.asInterface(b);
|
||||
sThrottleManager = new ThrottleManager(service);
|
||||
}
|
||||
}
|
||||
return sThrottleManager;
|
||||
}
|
||||
|
||||
private WifiManager getWifiManager()
|
||||
{
|
||||
synchronized (sSync) {
|
||||
|
||||
@@ -35,4 +35,6 @@ interface IThrottleManager
|
||||
long getCliffThreshold(String iface, int cliff);
|
||||
|
||||
int getCliffLevel(String iface, int cliff);
|
||||
|
||||
String getHelpUri();
|
||||
}
|
||||
|
||||
@@ -171,6 +171,19 @@ public class ThrottleManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the help URI for throttling
|
||||
* {@hide}
|
||||
*/
|
||||
public String getHelpUri() {
|
||||
try {
|
||||
return mService.getHelpUri();
|
||||
} catch (RemoteException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private IThrottleManager mService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3332,6 +3332,13 @@ public final class Settings {
|
||||
*/
|
||||
public static final String THROTTLE_IFACE = "throttle_iface";
|
||||
|
||||
/**
|
||||
* Help URI for data throttling policy
|
||||
* @hide
|
||||
*/
|
||||
public static final String THROTTLE_HELP_URI = "throttle_help_uri";
|
||||
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
|
||||
@@ -157,6 +157,12 @@ public class ThrottleService extends IThrottleManager.Stub {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getHelpUri() {
|
||||
enforceAccessPermission();
|
||||
return Settings.Secure.getString(mContext.getContentResolver(),
|
||||
Settings.Secure.THROTTLE_HELP_URI);
|
||||
}
|
||||
|
||||
public synchronized long getByteCount(String iface, int dir, int period, int ago) {
|
||||
enforceAccessPermission();
|
||||
if (iface.equals(mPolicyIface) &&
|
||||
|
||||
Reference in New Issue
Block a user