Merge "Remove DataUsageSummaryPreference unused fields" into main

This commit is contained in:
Chaohui Wang
2023-08-18 10:27:35 +00:00
committed by Android (Google) Code Review
3 changed files with 1 additions and 22 deletions

View File

@@ -67,15 +67,9 @@ public class DataUsageSummaryPreference extends Preference {
private CharSequence mStartLabel; private CharSequence mStartLabel;
private CharSequence mEndLabel; private CharSequence mEndLabel;
/** large vs small size is 36/16 ~ 2.25 */
private static final float LARGER_FONT_RATIO = 2.25f;
private static final float SMALLER_FONT_RATIO = 1.0f;
private boolean mDefaultTextColorSet;
private int mDefaultTextColor;
private int mNumPlans; private int mNumPlans;
/** The specified un-initialized value for cycle time */ /** The specified un-initialized value for cycle time */
private final long CYCLE_TIME_UNINITIAL_VALUE = 0; private static final long CYCLE_TIME_UNINITIAL_VALUE = 0;
/** The ending time of the billing cycle in milliseconds since epoch. */ /** The ending time of the billing cycle in milliseconds since epoch. */
private long mCycleEndTimeMs; private long mCycleEndTimeMs;
/** The time of the last update in standard milliseconds since the epoch */ /** The time of the last update in standard milliseconds since the epoch */

View File

@@ -64,8 +64,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
private static final String TAG = "DataUsageController"; private static final String TAG = "DataUsageController";
private static final String KEY = "status_header"; private static final String KEY = "status_header";
private static final long PETA = 1000000000000000L; private static final long PETA = 1000000000000000L;
private static final float RELATIVE_SIZE_LARGE = 1.25f * 1.25f; // (1/0.8)^2
private static final float RELATIVE_SIZE_SMALL = 1.0f / RELATIVE_SIZE_LARGE; // 0.8^2
private EntityHeaderController mEntityHeaderController; private EntityHeaderController mEntityHeaderController;
private final Lifecycle mLifecycle; private final Lifecycle mLifecycle;
@@ -74,7 +72,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
protected DataUsageInfoController mDataInfoController; protected DataUsageInfoController mDataInfoController;
private NetworkTemplate mDefaultTemplate; private NetworkTemplate mDefaultTemplate;
protected NetworkPolicyEditor mPolicyEditor; protected NetworkPolicyEditor mPolicyEditor;
private int mDataUsageTemplate;
private boolean mHasMobileData; private boolean mHasMobileData;
/** Name of the carrier, or null if not available */ /** Name of the carrier, or null if not available */
@@ -95,8 +92,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
private long mDataBarSize; private long mDataBarSize;
/** The number of bytes used since the start of the cycle. */ /** The number of bytes used since the start of the cycle. */
private long mDataplanUse; private long mDataplanUse;
/** The starting time of the billing cycle in ms since the epoch */
private long mCycleStart;
/** The ending time of the billing cycle in ms since the epoch */ /** The ending time of the billing cycle in ms since the epoch */
private long mCycleEnd; private long mCycleEnd;
@@ -134,13 +129,10 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
mDataInfoController = new DataUsageInfoController(); mDataInfoController = new DataUsageInfoController();
if (subInfo != null) { if (subInfo != null) {
mDataUsageTemplate = R.string.cell_data_template;
mDefaultTemplate = DataUsageLib.getMobileTemplate(context, subscriptionId); mDefaultTemplate = DataUsageLib.getMobileTemplate(context, subscriptionId);
} else if (DataUsageUtils.hasWifiRadio(context)) { } else if (DataUsageUtils.hasWifiRadio(context)) {
mDataUsageTemplate = R.string.wifi_data_template;
mDefaultTemplate = new NetworkTemplate.Builder(NetworkTemplate.MATCH_WIFI).build(); mDefaultTemplate = new NetworkTemplate.Builder(NetworkTemplate.MATCH_WIFI).build();
} else { } else {
mDataUsageTemplate = R.string.ethernet_data_template;
mDefaultTemplate = DataUsageUtils.getDefaultTemplate(context, subscriptionId); mDefaultTemplate = DataUsageUtils.getDefaultTemplate(context, subscriptionId);
} }
} }
@@ -156,7 +148,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
DataUsageInfoController dataInfoController, DataUsageInfoController dataInfoController,
NetworkTemplate defaultTemplate, NetworkTemplate defaultTemplate,
NetworkPolicyEditor policyEditor, NetworkPolicyEditor policyEditor,
int dataUsageTemplate,
Activity activity, Activity activity,
Lifecycle lifecycle, Lifecycle lifecycle,
EntityHeaderController entityHeaderController, EntityHeaderController entityHeaderController,
@@ -167,7 +158,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
mDataInfoController = dataInfoController; mDataInfoController = dataInfoController;
mDefaultTemplate = defaultTemplate; mDefaultTemplate = defaultTemplate;
mPolicyEditor = policyEditor; mPolicyEditor = policyEditor;
mDataUsageTemplate = dataUsageTemplate;
mHasMobileData = true; mHasMobileData = true;
mLifecycle = lifecycle; mLifecycle = lifecycle;
mEntityHeaderController = entityHeaderController; mEntityHeaderController = entityHeaderController;
@@ -302,7 +292,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
mDataplanSize = -1L; mDataplanSize = -1L;
mDataBarSize = mDataInfoController.getSummaryLimit(info); mDataBarSize = mDataInfoController.getSummaryLimit(info);
mDataplanUse = info.usageLevel; mDataplanUse = info.usageLevel;
mCycleStart = info.cycleStart;
mCycleEnd = info.cycleEnd; mCycleEnd = info.cycleEnd;
mSnapshotTime = -1L; mSnapshotTime = -1L;
@@ -322,7 +311,6 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
RecurrenceRule rule = primaryPlan.getCycleRule(); RecurrenceRule rule = primaryPlan.getCycleRule();
if (rule != null && rule.start != null && rule.end != null) { if (rule != null && rule.start != null && rule.end != null) {
mCycleStart = rule.start.toEpochSecond() * 1000L;
mCycleEnd = rule.end.toEpochSecond() * 1000L; mCycleEnd = rule.end.toEpochSecond() * 1000L;
} }
mSnapshotTime = primaryPlan.getDataUsageTime(); mSnapshotTime = primaryPlan.getDataUsageTime();

View File

@@ -44,7 +44,6 @@ import androidx.preference.PreferenceFragmentCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.logging.nano.MetricsProto; import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.ShadowEntityHeaderController; import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
import com.android.settings.widget.EntityHeaderController; import com.android.settings.widget.EntityHeaderController;
@@ -147,7 +146,6 @@ public class DataUsageSummaryPreferenceControllerTest {
mDataInfoController, mDataInfoController,
mNetworkTemplate, mNetworkTemplate,
mPolicyEditor, mPolicyEditor,
R.string.cell_data_template,
mActivity, null, null, null, mDefaultSubscriptionId)); mActivity, null, null, null, mDefaultSubscriptionId));
doReturn(null).when(mController).getSubscriptionInfo( doReturn(null).when(mController).getSubscriptionInfo(
SubscriptionManager.INVALID_SUBSCRIPTION_ID); SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -375,7 +373,6 @@ public class DataUsageSummaryPreferenceControllerTest {
mDataInfoController, mDataInfoController,
mNetworkTemplate, mNetworkTemplate,
mPolicyEditor, mPolicyEditor,
R.string.cell_data_template,
mActivity, mLifecycle, mHeaderController, mPreferenceFragment, mActivity, mLifecycle, mHeaderController, mPreferenceFragment,
mDefaultSubscriptionId)); mDefaultSubscriptionId));