Merge "Dont check on interface value on API" into froyo

This commit is contained in:
Irfan Sheriff
2010-04-17 09:27:25 -07:00
committed by Android (Google) Code Review

View File

@@ -168,36 +168,37 @@ public class ThrottleService extends IThrottleManager.Stub {
"ThrottleService"); "ThrottleService");
} }
// TODO - fetch for the iface
public synchronized long getResetTime(String iface) { public synchronized long getResetTime(String iface) {
enforceAccessPermission(); enforceAccessPermission();
if ((iface != null) && if (mRecorder != null) {
iface.equals(mIface) &&
(mRecorder != null)) {
mRecorder.getPeriodEnd(); mRecorder.getPeriodEnd();
} }
return 0; return 0;
} }
// TODO - fetch for the iface
public synchronized long getPeriodStartTime(String iface) { public synchronized long getPeriodStartTime(String iface) {
enforceAccessPermission(); enforceAccessPermission();
if ((iface != null) && if (mRecorder != null) {
iface.equals(mIface) &&
(mRecorder != null)) {
mRecorder.getPeriodStart(); mRecorder.getPeriodStart();
} }
return 0; return 0;
} }
//TODO - a better name? getCliffByteCountThreshold? //TODO - a better name? getCliffByteCountThreshold?
// TODO - fetch for the iface
public synchronized long getCliffThreshold(String iface, int cliff) { public synchronized long getCliffThreshold(String iface, int cliff) {
enforceAccessPermission(); enforceAccessPermission();
if ((iface != null) && (cliff == 1) && iface.equals(mIface)) { if (cliff == 1) {
return mPolicyThreshold; return mPolicyThreshold;
} }
return 0; return 0;
} }
// TODO - a better name? getThrottleRate? // TODO - a better name? getThrottleRate?
// TODO - fetch for the iface
public synchronized int getCliffLevel(String iface, int cliff) { public synchronized int getCliffLevel(String iface, int cliff) {
enforceAccessPermission(); enforceAccessPermission();
if ((iface != null) && (cliff == 1) && iface.equals(mIface)) { if (cliff == 1) {
return mPolicyThrottleValue; return mPolicyThrottleValue;
} }
return 0; return 0;
@@ -209,11 +210,10 @@ public class ThrottleService extends IThrottleManager.Stub {
Settings.Secure.THROTTLE_HELP_URI); Settings.Secure.THROTTLE_HELP_URI);
} }
// TODO - fetch for the iface
public synchronized long getByteCount(String iface, int dir, int period, int ago) { public synchronized long getByteCount(String iface, int dir, int period, int ago) {
enforceAccessPermission(); enforceAccessPermission();
if ((iface != null) && if ((period == ThrottleManager.PERIOD_CYCLE) &&
iface.equals(mIface) &&
(period == ThrottleManager.PERIOD_CYCLE) &&
(mRecorder != null)) { (mRecorder != null)) {
if (dir == ThrottleManager.DIRECTION_TX) return mRecorder.getPeriodTx(ago); if (dir == ThrottleManager.DIRECTION_TX) return mRecorder.getPeriodTx(ago);
if (dir == ThrottleManager.DIRECTION_RX) return mRecorder.getPeriodRx(ago); if (dir == ThrottleManager.DIRECTION_RX) return mRecorder.getPeriodRx(ago);
@@ -222,9 +222,10 @@ public class ThrottleService extends IThrottleManager.Stub {
} }
// TODO - a better name - getCurrentThrottleRate? // TODO - a better name - getCurrentThrottleRate?
// TODO - fetch for the iface
public synchronized int getThrottle(String iface) { public synchronized int getThrottle(String iface) {
enforceAccessPermission(); enforceAccessPermission();
if ((iface != null) && iface.equals(mIface) && (mThrottleIndex == 1)) { if (mThrottleIndex == 1) {
return mPolicyThrottleValue; return mPolicyThrottleValue;
} }
return 0; return 0;