Attribute data usage to virtual RAT type for 5G non-standalone mode

Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Bug: 160727498
Change-Id: I8753e68140c0993773017c9a49bd8a666a364071
Merged-In: I8753e68140c0993773017c9a49bd8a666a364071
(cherry-picked from ag/12167624)
This commit is contained in:
junyulai
2020-07-16 13:48:09 +08:00
parent 43b3142dc3
commit c3e3a1d0ef
2 changed files with 59 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ import android.net.NetworkStats.METERED_ALL
import android.net.NetworkStats.ROAMING_ALL
import android.net.NetworkTemplate.MATCH_MOBILE
import android.net.NetworkTemplate.MATCH_WIFI
import android.net.NetworkTemplate.NETWORK_TYPE_5G_NSA
import android.net.NetworkTemplate.NETWORK_TYPE_ALL
import android.net.NetworkTemplate.buildTemplateMobileWithRatType
import android.telephony.TelephonyManager
@@ -145,11 +146,13 @@ class NetworkTemplateTest {
assertParcelSane(templateWifi, 8)
}
// Verify NETWORK_TYPE_ALL does not conflict with TelephonyManager#NETWORK_TYPE_* constants.
// Verify NETWORK_TYPE_* constants in NetworkTemplate do not conflict with
// TelephonyManager#NETWORK_TYPE_* constants.
@Test
fun testNetworkTypeAll() {
fun testNetworkTypeConstants() {
for (ratType in TelephonyManager.getAllNetworkTypes()) {
assertNotEquals(NETWORK_TYPE_ALL, ratType)
assertNotEquals(NETWORK_TYPE_5G_NSA, ratType)
}
}
}