Throttling framework addins
Add ThrottleManager in getSystemService
Add API for URL fetch
Bug: 2576057
Change-Id: Icd25c8b91ea4beea15c74e8ad7292ab48c962253
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 950f34f..9019af6 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -67,6 +67,8 @@
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 @@
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 @@
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 @@
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) {
diff --git a/core/java/android/net/IThrottleManager.aidl b/core/java/android/net/IThrottleManager.aidl
index 298de6e..a12469d 100644
--- a/core/java/android/net/IThrottleManager.aidl
+++ b/core/java/android/net/IThrottleManager.aidl
@@ -35,4 +35,6 @@
long getCliffThreshold(String iface, int cliff);
int getCliffLevel(String iface, int cliff);
+
+ String getHelpUri();
}
diff --git a/core/java/android/net/ThrottleManager.java b/core/java/android/net/ThrottleManager.java
index 0500f6f..79c2d6f 100644
--- a/core/java/android/net/ThrottleManager.java
+++ b/core/java/android/net/ThrottleManager.java
@@ -171,6 +171,19 @@
}
}
+ /**
+ * returns the help URI for throttling
+ * {@hide}
+ */
+ public String getHelpUri() {
+ try {
+ return mService.getHelpUri();
+ } catch (RemoteException e) {
+ return null;
+ }
+ }
+
+
private IThrottleManager mService;
/**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index eb14815..e640005 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3333,6 +3333,13 @@
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
*/
public static final String[] SETTINGS_TO_BACKUP = {