Merge "[SP19] Reduce log when set limit and request stats update"

This commit is contained in:
Treehugger Robot
2020-02-25 09:14:24 +00:00
committed by Gerrit Code Review

View File

@@ -288,10 +288,18 @@ public class OffloadController {
@Override @Override
public void setLimit(String iface, long quotaBytes) { public void setLimit(String iface, long quotaBytes) {
mLog.i("setLimit: " + iface + "," + quotaBytes);
// Listen for all iface is necessary since upstream might be changed after limit // Listen for all iface is necessary since upstream might be changed after limit
// is set. // is set.
mHandler.post(() -> { mHandler.post(() -> {
final Long curIfaceQuota = mInterfaceQuotas.get(iface);
// If the quota is set to unlimited, the value set to HAL is Long.MAX_VALUE,
// which is ~8.4 x 10^6 TiB, no one can actually reach it. Thus, it is not
// useful to set it multiple times.
// Otherwise, the quota needs to be updated to tell HAL to re-count from now even
// if the quota is the same as the existing one.
if (null == curIfaceQuota && QUOTA_UNLIMITED == quotaBytes) return;
if (quotaBytes == QUOTA_UNLIMITED) { if (quotaBytes == QUOTA_UNLIMITED) {
mInterfaceQuotas.remove(iface); mInterfaceQuotas.remove(iface);
} else { } else {
@@ -323,7 +331,6 @@ public class OffloadController {
@Override @Override
public void requestStatsUpdate(int token) { public void requestStatsUpdate(int token) {
mLog.i("requestStatsUpdate: " + token);
// Do not attempt to update stats by querying the offload HAL // Do not attempt to update stats by querying the offload HAL
// synchronously from a different thread than the Handler thread. http://b/64771555. // synchronously from a different thread than the Handler thread. http://b/64771555.
mHandler.post(() -> { mHandler.post(() -> {