[MS78.2] Fix NetworkIdentity#Builder crashing on 5G NSA networks
Test: atest NetworkIdentityTest Fix: 216193400 Change-Id: I00abc97a98dfdf17d5f0c2e6b45d28be9899c5c3
This commit is contained in:
parent
317be96553
commit
30f06afda3
1 changed files with 4 additions and 3 deletions
|
|
@ -171,7 +171,7 @@ class NetworkIdentityTest {
|
|||
fun testBuilder_ratType() {
|
||||
// Assert illegal ratTypes cannot make an identity.
|
||||
listOf(Integer.MIN_VALUE, NetworkTemplate.NETWORK_TYPE_ALL,
|
||||
TelephonyManager.NETWORK_TYPE_UNKNOWN - 1, Integer.MAX_VALUE)
|
||||
NetworkTemplate.NETWORK_TYPE_5G_NSA - 1, Integer.MAX_VALUE)
|
||||
.forEach {
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
NetworkIdentity.Builder()
|
||||
|
|
@ -184,6 +184,7 @@ class NetworkIdentityTest {
|
|||
// Verify legitimate ratTypes can make an identity.
|
||||
TelephonyManager.getAllNetworkTypes().toMutableList().also {
|
||||
it.add(TelephonyManager.NETWORK_TYPE_UNKNOWN)
|
||||
it.add(NetworkTemplate.NETWORK_TYPE_5G_NSA)
|
||||
}.forEach { rat ->
|
||||
NetworkIdentity.Builder()
|
||||
.setType(TYPE_MOBILE)
|
||||
|
|
@ -199,11 +200,11 @@ class NetworkIdentityTest {
|
|||
// Assert illegal oemManage values cannot make an identity.
|
||||
listOf(Integer.MIN_VALUE, NetworkTemplate.OEM_MANAGED_ALL, NetworkTemplate.OEM_MANAGED_YES,
|
||||
Integer.MAX_VALUE)
|
||||
.forEach {
|
||||
.forEach { oemManaged ->
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
NetworkIdentity.Builder()
|
||||
.setType(TYPE_MOBILE)
|
||||
.setRatType(it)
|
||||
.setOemManaged(oemManaged)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue