[SUBID01-0]Grow NetworkIdentity to include a new mSubId field

In the previous design of NSS and NPMS, those only had IMSI to identify
the cell network. Now the telephony has created the "subId" handle,
which is the preferred mechanism for identifying subscribers.

This commit adds NetworkStats support for subscriberId as a part of
the network identity key

Bug: 80526261
Test: atest NetworkTemplateTest NetworkStatsCollectionTest
            NetworkStatsServiceTest NetworkIdentityTest
            NetworkStatsDataMigrationUtilsTest

 (cherry-picked from ag/16825721)

Change-Id: Ie1fe81006555dbcca4b62457fa6c319f04b4576d
Merged-In: Ie1fe81006555dbcca4b62457fa6c319f04b4576d
This commit is contained in:
lifr
2021-11-01 18:50:54 +08:00
committed by Frank
parent fbb8986a58
commit 7c9fde88d6
4 changed files with 75 additions and 12 deletions

View File

@@ -1540,10 +1540,15 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
NetworkCapabilities.NET_CAPABILITY_IMS) && !ident.isMetered()) {
// Copy the identify from IMS one but mark it as metered.
NetworkIdentity vtIdent = new NetworkIdentity(ident.getType(),
ident.getRatType(), ident.getSubscriberId(), ident.getWifiNetworkKey(),
ident.isRoaming(), true /* metered */,
true /* onDefaultNetwork */, ident.getOemManaged());
NetworkIdentity vtIdent = new NetworkIdentity.Builder()
.setType(ident.getType())
.setRatType(ident.getRatType())
.setSubscriberId(ident.getSubscriberId())
.setWifiNetworkKey(ident.getWifiNetworkKey())
.setRoaming(ident.isRoaming()).setMetered(true)
.setDefaultNetwork(true)
.setOemManaged(ident.getOemManaged())
.setSubId(ident.getSubId()).build();
final String ifaceVt = IFACE_VT + getSubIdForMobile(snapshot);
findOrCreateNetworkIdentitySet(mActiveIfaces, ifaceVt).add(vtIdent);
findOrCreateNetworkIdentitySet(mActiveUidIfaces, ifaceVt).add(vtIdent);