[FUI06] Stop using NetworkInfo in NetworkState from external callers

This is achieved by:
  1. Use legacy network type inside NetworkState to replace the
     needs of referencing NetworkInfo.getType().
  2. Let getAllNetworkState only return networks with isConnected()
     equals true. This allows callers such as NPMS or NSS does not
     have to reference to NetworkInfo.isConnected().

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I1c4eb08d18ca973eb8f41d06258872eabc0006b8
This commit is contained in:
junyulai
2020-12-29 19:17:01 +08:00
parent ab4b0cdccc
commit d49aab92c9
3 changed files with 8 additions and 2 deletions

View File

@@ -62,7 +62,6 @@ class NetworkTemplateTest {
): NetworkState {
val info = mock(NetworkInfo::class.java)
doReturn(type).`when`(info).type
doReturn(NetworkInfo.State.CONNECTED).`when`(info).state
val lp = LinkProperties()
val caps = NetworkCapabilities().apply {
setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED, false)