diff options
| author | 2020-07-17 04:20:02 +0000 | |
|---|---|---|
| committer | 2020-07-17 04:20:02 +0000 | |
| commit | 2909a2ae8fe29d6e4de609e785c1106520ce7257 (patch) | |
| tree | 8059977dc0c696029bebb8f3210b829b617e3839 | |
| parent | fe9d1d5eb184266cd70d71d753487a0e44530bd9 (diff) | |
| parent | 8c4224a07035db1e9ba636eca52c14fd54a3d984 (diff) | |
Merge changes I7d98ab42,I8753e681 into rvc-dev am: 7368ed7d03 am: 8c4224a070
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12166028
Change-Id: I3ef578b89e712915cca0137bea346c1e5f7fe78b
| -rw-r--r-- | cmds/statsd/src/atoms.proto | 6 | ||||
| -rw-r--r-- | services/core/java/com/android/server/stats/pull/StatsPullAtomService.java | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 7a016522d597..36b46c3d03a3 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -5178,6 +5178,12 @@ message DataUsageBytesTransfer { // record is combined across opportunistic data subscriptions. // See {@link SubscriptionManager#setOpportunistic}. optional DataSubscriptionState opportunistic_data_sub = 10; + + // Indicate whether NR is connected, server side could use this with RAT type to determine if + // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and + // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as + // connected. + optional bool is_nr_connected = 11; } /** diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java index dbdef2368c7c..8979d8c6ba10 100644 --- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java @@ -1145,6 +1145,15 @@ public class StatsPullAtomService extends SystemService { private void addDataUsageBytesTransferAtoms(@NonNull NetworkStatsExt statsExt, @NonNull List<StatsEvent> pulledData) { + + // Workaround for 5G NSA mode, see {@link NetworkTemplate#NETWORK_TYPE_5G_NSA}. + // 5G NSA mode means the primary cell is LTE with a secondary connection to an + // NR cell. To mitigate risk, NetworkStats is currently storing this state as + // a fake RAT type rather than storing the boolean separately. + final boolean is5GNsa = statsExt.ratType == NetworkTemplate.NETWORK_TYPE_5G_NSA; + // Report NR connected in 5G non-standalone mode, or if the RAT type is NR to begin with. + final boolean isNR = is5GNsa || statsExt.ratType == TelephonyManager.NETWORK_TYPE_NR; + final NetworkStats.Entry entry = new NetworkStats.Entry(); // for recycling for (int i = 0; i < statsExt.stats.size(); i++) { statsExt.stats.getValues(i, entry); @@ -1156,7 +1165,7 @@ public class StatsPullAtomService extends SystemService { .writeLong(entry.rxPackets) .writeLong(entry.txBytes) .writeLong(entry.txPackets) - .writeInt(statsExt.ratType) + .writeInt(is5GNsa ? TelephonyManager.NETWORK_TYPE_LTE : statsExt.ratType) // Fill information about subscription, these cannot be null since invalid data // would be filtered when adding into subInfo list. .writeString(statsExt.subInfo.mcc) @@ -1165,6 +1174,7 @@ public class StatsPullAtomService extends SystemService { .writeInt(statsExt.subInfo.isOpportunistic ? DATA_USAGE_BYTES_TRANSFER__OPPORTUNISTIC_DATA_SUB__OPPORTUNISTIC : DATA_USAGE_BYTES_TRANSFER__OPPORTUNISTIC_DATA_SUB__NOT_OPPORTUNISTIC) + .writeBoolean(isNR) .build(); pulledData.add(e); } |