Merge "NetworkManagementService: Combine setInterfaceRx/Tx throttle and add max speed" into froyo

This commit is contained in:
San Mehat
2010-04-05 10:35:56 -07:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 17 deletions

View File

@@ -191,14 +191,9 @@ interface INetworkManagementService
long getInterfaceRxCounter(String iface);
/**
* Configures RX bandwidth throttling on an interface
* Configures bandwidth throttling on an interface
*/
void setInterfaceRxThrottle(String iface, int kbps);
/**
* Configures TX bandwidth throttling on an interface
*/
void setInterfaceTxThrottle(String iface, int kbps);
void setInterfaceThrottle(String iface, int maxKbits, int rxKbps, int txKbps);
/**
* Returns the currently configured RX throttle values
@@ -211,4 +206,5 @@ interface INetworkManagementService
* for the specified interface
*/
int getInterfaceTxThrottle(String iface);
}

View File

@@ -564,19 +564,11 @@ class NetworkManagementService extends INetworkManagementService.Stub {
return getInterfaceCounter(iface, false);
}
private void setInterfaceThrottle(String iface, boolean rx, int kbps) {
public void setInterfaceThrottle(String iface, int maxKbps, int rxKbps, int txKbps) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService");
mConnector.doCommand(String.format(
"interface setthrottle %s %s %d", iface, (rx ? "rx" : "tx"), kbps));
}
public void setInterfaceRxThrottle(String iface, int kbps) {
setInterfaceThrottle(iface, true, kbps);
}
public void setInterfaceTxThrottle(String iface, int kbps) {
setInterfaceThrottle(iface, false, kbps);
"interface setthrottle %s %d %d %d", iface, maxKbps, rxKbps, txKbps));
}
private int getInterfaceThrottle(String iface, boolean rx) {