From cee6cd88ee306bdf7bf37094cd55e2d194442166 Mon Sep 17 00:00:00 2001 From: Automerger Merge Worker Date: Tue, 25 Feb 2020 09:48:22 +0000 Subject: [PATCH] [SP19] Reduce log when set limit and request stats update setLimit can be ignored if the quota is unlimited and not changed, and the log could be omitted since it will still be logged in HAL. Request stats update will print error log in service if it is not correctly responded in time. Test: atest TetheringTests Test: manual Fix: 149735152 AOSP-Change: 1242601 Change-Id: I01c0191d5b89942fa69b167b8a6b40ed2821300b Merged-In: I92d214f4648fec6be13e04147290ecdd156fab4e (cherry picked from commit b9565c7db00e44b50f9983691b603ebd6918ee45) --- .../connectivity/tethering/OffloadController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java b/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java index cc36f4a9c5..a402ffa473 100644 --- a/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java +++ b/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java @@ -288,10 +288,18 @@ public class OffloadController { @Override 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 // is set. 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) { mInterfaceQuotas.remove(iface); } else { @@ -323,7 +331,6 @@ public class OffloadController { @Override public void requestStatsUpdate(int token) { - mLog.i("requestStatsUpdate: " + token); // Do not attempt to update stats by querying the offload HAL // synchronously from a different thread than the Handler thread. http://b/64771555. mHandler.post(() -> {