Merge "Add support for tracking PANS data usage" am: dbedad0dd5 am: 16e2ef942a am: 24e858dc96

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1578684

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3d586ff455baccbf87f0ffb835af83c90735ba56
This commit is contained in:
Chris Weir
2021-03-01 07:59:54 +00:00
committed by Automerger Merge Worker
4 changed files with 107 additions and 13 deletions

View File

@@ -40,6 +40,7 @@ public class NetworkIdentitySet extends HashSet<NetworkIdentity> implements
private static final int VERSION_ADD_NETWORK_ID = 3;
private static final int VERSION_ADD_METERED = 4;
private static final int VERSION_ADD_DEFAULT_NETWORK = 5;
private static final int VERSION_ADD_OEM_MANAGED_NETWORK = 6;
public NetworkIdentitySet() {
}
@@ -84,13 +85,20 @@ public class NetworkIdentitySet extends HashSet<NetworkIdentity> implements
defaultNetwork = true;
}
final int oemNetCapabilities;
if (version >= VERSION_ADD_OEM_MANAGED_NETWORK) {
oemNetCapabilities = in.readInt();
} else {
oemNetCapabilities = NetworkIdentity.OEM_NONE;
}
add(new NetworkIdentity(type, subType, subscriberId, networkId, roaming, metered,
defaultNetwork));
defaultNetwork, oemNetCapabilities));
}
}
public void writeToStream(DataOutput out) throws IOException {
out.writeInt(VERSION_ADD_DEFAULT_NETWORK);
out.writeInt(VERSION_ADD_OEM_MANAGED_NETWORK);
out.writeInt(size());
for (NetworkIdentity ident : this) {
out.writeInt(ident.getType());
@@ -100,6 +108,7 @@ public class NetworkIdentitySet extends HashSet<NetworkIdentity> implements
out.writeBoolean(ident.getRoaming());
out.writeBoolean(ident.getMetered());
out.writeBoolean(ident.getDefaultNetwork());
out.writeInt(ident.getOemManaged());
}
}

View File

@@ -1319,7 +1319,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
NetworkIdentity vtIdent = new NetworkIdentity(ident.getType(),
ident.getSubType(), ident.getSubscriberId(), ident.getNetworkId(),
ident.getRoaming(), true /* metered */,
true /* onDefaultNetwork */);
true /* onDefaultNetwork */, ident.getOemManaged());
findOrCreateNetworkIdentitySet(mActiveIfaces, IFACE_VT).add(vtIdent);
findOrCreateNetworkIdentitySet(mActiveUidIfaces, IFACE_VT).add(vtIdent);
}