Do not use warning or limit to display "X B left" above usage bar
Bug: 70950124 Test: manual Test: make RunSettingsRoboTests Change-Id: I46f4f5f1cf6092038e49beaafe5aa6a19ffb0aa1
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.datausage;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.NetworkPolicyManager;
|
||||
@@ -27,7 +26,6 @@ import android.support.v7.preference.Preference;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.SubscriptionPlan;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.BidiFormatter;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
@@ -91,6 +89,8 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
|
||||
* -1 if no information is available.
|
||||
*/
|
||||
private long mDataplanSize;
|
||||
/** The "size" of the data usage bar, i.e. the amount of data its rhs end represents */
|
||||
private long mDataBarSize;
|
||||
/** The number of bytes used since the start of the cycle. */
|
||||
private long mDataplanUse;
|
||||
/** The starting time of the billing cycle in ms since the epoch */
|
||||
@@ -171,6 +171,7 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
|
||||
void setPlanValues(int dataPlanCount, long dataPlanSize, long dataPlanUse) {
|
||||
mDataplanCount = dataPlanCount;
|
||||
mDataplanSize = dataPlanSize;
|
||||
mDataBarSize = dataPlanSize;
|
||||
mDataplanUse = dataPlanUse;
|
||||
}
|
||||
|
||||
@@ -237,13 +238,13 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
|
||||
|
||||
summaryPreference.setUsageNumbers(mDataplanUse, mDataplanSize, mHasMobileData);
|
||||
|
||||
if (mDataplanSize <= 0) {
|
||||
if (mDataBarSize <= 0) {
|
||||
summaryPreference.setChartEnabled(false);
|
||||
} else {
|
||||
summaryPreference.setChartEnabled(true);
|
||||
summaryPreference.setLabels(Formatter.formatFileSize(mContext, 0 /* sizeBytes */),
|
||||
Formatter.formatFileSize(mContext, mDataplanSize));
|
||||
summaryPreference.setProgress(mDataplanUse / (float) mDataplanSize);
|
||||
Formatter.formatFileSize(mContext, mDataBarSize));
|
||||
summaryPreference.setProgress(mDataplanUse / (float) mDataBarSize);
|
||||
}
|
||||
summaryPreference.setUsageInfo(mCycleEnd, mSnapshotTime, mCarrierName,
|
||||
mDataplanCount, mManageSubscriptionIntent);
|
||||
@@ -262,7 +263,8 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
|
||||
// reset data before overwriting
|
||||
mCarrierName = null;
|
||||
mDataplanCount = 0;
|
||||
mDataplanSize = mDataInfoController.getSummaryLimit(info);
|
||||
mDataplanSize = -1L;
|
||||
mDataBarSize = mDataInfoController.getSummaryLimit(info);
|
||||
mDataplanUse = info.usageLevel;
|
||||
mCycleStart = info.cycleStart;
|
||||
mCycleEnd = info.cycleEnd;
|
||||
@@ -278,8 +280,9 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
|
||||
mDataplanCount = plans.size();
|
||||
mDataplanSize = primaryPlan.getDataLimitBytes();
|
||||
if (unlimited(mDataplanSize)) {
|
||||
mDataplanSize = 0L;
|
||||
mDataplanSize = -1L;
|
||||
}
|
||||
mDataBarSize = mDataplanSize;
|
||||
mDataplanUse = primaryPlan.getDataUsageBytes();
|
||||
|
||||
RecurrenceRule rule = primaryPlan.getCycleRule();
|
||||
|
Reference in New Issue
Block a user