packages/apps/Settings
Revisão | 29b0ea2dbf8f0a31d02af8a4ce17753c9499b167 (tree) |
---|---|
Hora | 2015-10-21 02:21:43 |
Autor | Jeff Sharkey <jsharkey@goog...> |
Commiter | Android (Google) Code Review |
Merge "Clamp large data usage values." into mnc-dr-dev
@@ -22,6 +22,7 @@ import android.content.Context; | ||
22 | 22 | import android.content.res.Resources; |
23 | 23 | import android.net.NetworkPolicy; |
24 | 24 | import android.net.NetworkStatsHistory; |
25 | +import android.net.TrafficStats; | |
25 | 26 | import android.os.Handler; |
26 | 27 | import android.os.Message; |
27 | 28 | import android.text.Spannable; |
@@ -33,6 +34,7 @@ import android.text.format.Formatter.BytesResult; | ||
33 | 34 | import android.text.format.Time; |
34 | 35 | import android.util.AttributeSet; |
35 | 36 | import android.util.Log; |
37 | +import android.util.MathUtils; | |
36 | 38 | import android.view.MotionEvent; |
37 | 39 | import android.view.View; |
38 | 40 |
@@ -535,6 +537,7 @@ public class ChartDataUsageView extends ChartView { | ||
535 | 537 | |
536 | 538 | @Override |
537 | 539 | public long buildLabel(Resources res, SpannableStringBuilder builder, long value) { |
540 | + value = MathUtils.constrain(value, 0, TrafficStats.TB_IN_BYTES); | |
538 | 541 | final BytesResult result = Formatter.formatBytes(res, value, |
539 | 542 | Formatter.FLAG_SHORTER | Formatter.FLAG_CALCULATE_ROUNDED); |
540 | 543 | setText(builder, sSpanSize, result.value, "^1"); |