Merge "Attribute data usage to virtual RAT type for 5G non-standalone mode" am: e36ce3a88b am: 416911a122
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1364497 Change-Id: Idef0dd6e0e0486b76c0067540e580d444e97d6a0
This commit is contained in:
@@ -16,12 +16,14 @@
|
||||
|
||||
package com.android.server.net;
|
||||
|
||||
import static android.net.NetworkTemplate.NETWORK_TYPE_5G_NSA;
|
||||
import static android.net.NetworkTemplate.getCollapsedRatType;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
import android.telephony.Annotation;
|
||||
import android.telephony.NetworkRegistrationInfo;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
@@ -196,7 +198,18 @@ public class NetworkStatsSubscriptionsMonitor extends
|
||||
|
||||
@Override
|
||||
public void onServiceStateChanged(@NonNull ServiceState ss) {
|
||||
final int networkType = ss.getDataNetworkType();
|
||||
// In 5G SA (Stand Alone) mode, the primary cell itself will be 5G hence telephony
|
||||
// would report RAT = 5G_NR.
|
||||
// However, in 5G NSA (Non Stand Alone) mode, the primary cell is still LTE and
|
||||
// network allocates a secondary 5G cell so telephony reports RAT = LTE along with
|
||||
// NR state as connected. In such case, attributes the data usage to NR.
|
||||
// See b/160727498.
|
||||
final boolean is5GNsa = (ss.getDataNetworkType() == TelephonyManager.NETWORK_TYPE_LTE
|
||||
|| ss.getDataNetworkType() == TelephonyManager.NETWORK_TYPE_LTE_CA)
|
||||
&& ss.getNrState() == NetworkRegistrationInfo.NR_STATE_CONNECTED;
|
||||
|
||||
final int networkType =
|
||||
(is5GNsa ? NETWORK_TYPE_5G_NSA : ss.getDataNetworkType());
|
||||
final int collapsedRatType = getCollapsedRatType(networkType);
|
||||
if (collapsedRatType == mLastCollapsedRatType) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user