diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2012-05-02 18:11:52 -0700 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2012-05-03 12:12:10 -0700 |
| commit | ac3fcb1590e1da21324c13ce237ec48f2bf488bf (patch) | |
| tree | 696d28037cf8b7f078287a256f0eed8323923a10 /core/java | |
| parent | e8914c36276710de50b347c1e6aecfa45d6a56cd (diff) | |
Reduce persist threshold for lower warning/limit.
Default is 2MB persist threshold, but even that can be substantial
for devices on 100MB/month plans. This change gradually reduces the
persist threshold up to 8x lower (256kb outstanding) based on lowest
active policy.
Bug: 5382676
Change-Id: Ief4e8cdb169bfb151a3d1b45722a8eaa01926508
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/net/INetworkStatsService.aidl | 2 | ||||
| -rw-r--r-- | core/java/android/util/MathUtils.java | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl index 08d4c6cbf4ab..b7b87318554c 100644 --- a/core/java/android/net/INetworkStatsService.aidl +++ b/core/java/android/net/INetworkStatsService.aidl @@ -42,5 +42,7 @@ interface INetworkStatsService { void setUidForeground(int uid, boolean uidForeground); /** Force update of statistics. */ void forceUpdate(); + /** Advise persistance threshold; may be overridden internally. */ + void advisePersistThreshold(long thresholdBytes); } diff --git a/core/java/android/util/MathUtils.java b/core/java/android/util/MathUtils.java index b35dd1eac0de..13a692ea18c9 100644 --- a/core/java/android/util/MathUtils.java +++ b/core/java/android/util/MathUtils.java @@ -39,6 +39,10 @@ public final class MathUtils { return amount < low ? low : (amount > high ? high : amount); } + public static long constrain(long amount, long low, long high) { + return amount < low ? low : (amount > high ? high : amount); + } + public static float constrain(float amount, float low, float high) { return amount < low ? low : (amount > high ? high : amount); } |
