OSDN Git Service

Use consistent formatter to convert byte->MB->GB.
authorFan Zhang <zhfan@google.com>
Tue, 24 Jan 2017 19:29:27 +0000 (11:29 -0800)
committerFan Zhang <zhfan@google.com>
Tue, 24 Jan 2017 19:50:27 +0000 (11:50 -0800)
In data usage screen, displaying and setting data warning/limit should
use the same value to convert units.

Change-Id: Ic237203dbaf23cb0c99165d0055f259a30fd8cf9
Fix: 34204773
Test: RunSettingsRoboTests

src/com/android/settings/datausage/BillingCycleSettings.java

index 9b39840..dda984b 100644 (file)
@@ -44,14 +44,16 @@ import com.android.settingslib.net.DataUsageController;
 
 import static android.net.NetworkPolicy.LIMIT_DISABLED;
 import static android.net.NetworkPolicy.WARNING_DISABLED;
-import static android.net.TrafficStats.GB_IN_BYTES;
-import static android.net.TrafficStats.MB_IN_BYTES;
 
 public class BillingCycleSettings extends DataUsageBase implements
         Preference.OnPreferenceChangeListener, DataUsageEditController {
 
     private static final String TAG = "BillingCycleSettings";
     private static final boolean LOGD = false;
+    public static final long KB_IN_BYTES = 1000;
+    public static final long MB_IN_BYTES = KB_IN_BYTES * 1000;
+    public static final long GB_IN_BYTES = MB_IN_BYTES * 1000;
+
     private static final long MAX_DATA_LIMIT_BYTES = 50000 * GB_IN_BYTES;
 
     private static final String TAG_CONFIRM_LIMIT = "confirmLimit";