• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revisão29b0ea2dbf8f0a31d02af8a4ce17753c9499b167 (tree)
Hora2015-10-21 02:21:43
AutorJeff Sharkey <jsharkey@goog...>
CommiterAndroid (Google) Code Review

Mensagem de Log

Merge "Clamp large data usage values." into mnc-dr-dev

Mudança Sumário

Diff

--- a/src/com/android/settings/widget/ChartDataUsageView.java
+++ b/src/com/android/settings/widget/ChartDataUsageView.java
@@ -22,6 +22,7 @@ import android.content.Context;
2222 import android.content.res.Resources;
2323 import android.net.NetworkPolicy;
2424 import android.net.NetworkStatsHistory;
25+import android.net.TrafficStats;
2526 import android.os.Handler;
2627 import android.os.Message;
2728 import android.text.Spannable;
@@ -33,6 +34,7 @@ import android.text.format.Formatter.BytesResult;
3334 import android.text.format.Time;
3435 import android.util.AttributeSet;
3536 import android.util.Log;
37+import android.util.MathUtils;
3638 import android.view.MotionEvent;
3739 import android.view.View;
3840
@@ -535,6 +537,7 @@ public class ChartDataUsageView extends ChartView {
535537
536538 @Override
537539 public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
540+ value = MathUtils.constrain(value, 0, TrafficStats.TB_IN_BYTES);
538541 final BytesResult result = Formatter.formatBytes(res, value,
539542 Formatter.FLAG_SHORTER | Formatter.FLAG_CALCULATE_ROUNDED);
540543 setText(builder, sSpanSize, result.value, "^1");