Merge "Revert "Attribute data usage to 5G for 5G non-standalone mode"" am: 13c5ee8313 am: 56df7e2c1a

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

Change-Id: If052329128326fba72ff27c024a2c6652b7bb1ef
This commit is contained in:
Treehugger Robot
2020-07-10 05:41:05 +00:00
committed by Automerger Merge Worker

View File

@@ -22,7 +22,6 @@ import android.annotation.NonNull;
import android.content.Context; import android.content.Context;
import android.os.Looper; import android.os.Looper;
import android.telephony.Annotation; import android.telephony.Annotation;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
import android.telephony.ServiceState; import android.telephony.ServiceState;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
@@ -197,19 +196,7 @@ public class NetworkStatsSubscriptionsMonitor extends
@Override @Override
public void onServiceStateChanged(@NonNull ServiceState ss) { public void onServiceStateChanged(@NonNull ServiceState ss) {
// In 5G SA (Stand Alone) mode, the primary cell itself will be 5G hence telephony final int networkType = ss.getDataNetworkType();
// 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 ? TelephonyManager.NETWORK_TYPE_NR : ss.getDataNetworkType());
final int collapsedRatType = getCollapsedRatType(networkType); final int collapsedRatType = getCollapsedRatType(networkType);
if (collapsedRatType == mLastCollapsedRatType) return; if (collapsedRatType == mLastCollapsedRatType) return;