[SM07] Make combine subtype configurable from Settings

Note that enabling/disabling would not take effect until device
reboot. This will be addressed in follow-up patch.

Test: 1. atest NetworkStatsServieTest SettingsBackupTest
      2. adb shell settings put global netstats_combine_subtype_enabled 1|0
Bug: 146415925

Change-Id: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
Merged-In: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
(cherry picked from commit 550d61b8fa and
 fix merge conflict in SettingsBackupTest)
This commit is contained in:
junyulai
2020-01-02 19:35:59 +08:00
parent 0a59b1e599
commit 3faf37539a
2 changed files with 45 additions and 35 deletions

View File

@@ -40,13 +40,6 @@ import java.util.Objects;
public class NetworkIdentity implements Comparable<NetworkIdentity> {
private static final String TAG = "NetworkIdentity";
/**
* When enabled, combine all {@link #mSubType} together under
* {@link #SUBTYPE_COMBINED}.
*/
// TODO: make this flag configurable through settings. See http://b/146415925
public static final boolean COMBINE_SUBTYPE_ENABLED = false;
public static final int SUBTYPE_COMBINED = -1;
final int mType;
@@ -61,7 +54,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
int type, int subType, String subscriberId, String networkId, boolean roaming,
boolean metered, boolean defaultNetwork) {
mType = type;
mSubType = COMBINE_SUBTYPE_ENABLED ? SUBTYPE_COMBINED : subType;
mSubType = subType;
mSubscriberId = subscriberId;
mNetworkId = networkId;
mRoaming = roaming;
@@ -93,7 +86,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
final StringBuilder builder = new StringBuilder("{");
builder.append("type=").append(getNetworkTypeName(mType));
builder.append(", subType=");
if (COMBINE_SUBTYPE_ENABLED) {
if (mSubType == SUBTYPE_COMBINED) {
builder.append("COMBINED");
} else {
builder.append(mSubType);