Legacy metrics are unused and deprecated, so they are being removed.
Therefore, delete the usage of the hidden MetricsLogger API.
Bug: 157966864
Test: atest CtsNetTestCases
atest CaptivePortalTest
atest ConnectivityServiceTest
Change-Id: I51241f5d50ec580015882c84dd917b015c700c7c
The test is currently flaky as broadcasts can take a long time
to be delivered, often more than 500ms.
Extend the timeout for broadcasts to 30s.
Historically the test would wait for broadcasts for at most 500ms,
but not verify that they were received before proceeding. This was
fixed recently by adding an assertion, but the assertion needs to
give enough time for the broadcast to be received.
Bug: 173331190
Change-Id: I0760f3418c635aa4d68de5aefdb7120a9d3e930b
Test: atest FrameworksNetTests
NetworkState is used by many methods that take or return legacy
network types. It is used because it contains most of the state
related to a network.
This code is not easy to follow and is more expensive than it
needs to be: most of the methods that construct a NetworkState
only really need one of its members (e.g., LinkProperties, or
NetworkInfo), but constructing a NetworkState requires making
defensive copies of all its other members as well.
- Instead of using NetworkState, use NetworkAgentInfo, which
already contains all the same data.
- Replace calls to getUnfilteredActiveNetworkState with calls to
getNetworkAgentInfoForUid. When getUnfilteredActiveNetworkState
returned NetworkState.EMPTY, return a null nai, which causes
any caller to see return null LinkProperties/NetworkInfo/etc.
- Rename filterNetworkStateForUid to getFilteredNetworkInfo,
because that's the only thing it actually filters.
- Rename getFilteredNetworkInfo to getFilteredNetworkInfoForType
to avoid having two methods with the same name perform two
different operations. That method was only introduced recently
in aosp/1552503, so it's probably fine to rename it.
Bug: 174123988
Test: passes existing ConnectivityServiceTest
Change-Id: Idfb5e149967266a442b268de6f13a521884dbb8f
The legacy API getNetworkInfo(int type) is expected to return
NetworkInfo objects for all network types supported by the device
even when those network types are not connected.
This requires a lot of fabrication because all the data
structures in ConnectivityService store information about
connected networks, not networks that don't exist.
Worse, the current behaviour is to return BLOCKED instead of
DISCONNECTED if background data is restricted. This obviously
makes no sense, because a disconnected network cannot be
blocked, and because if that network type did connect and was
unmetered (e.g., Wi-Fi), it would no longer be BLOCKED.
This complicates the code, forcing several methods to deal with
a special case of null NetworkCapabilities, no NetworkAgentInfo,
etc.
Fix this by isolating this outlandish behaviour to its own
method. This allows the main codepaths not to have to support
this unusual and not very useful edge case.
Bug: 174123988
Test: pure refactoring, passes existing tests
Change-Id: Ia52b24c59024c8f6e63e584b864e0225cb572090
This is needed by NetworkStatsService and
NetworkPolicyManagerService to utilize the snapshots of
information of networks that grabbed from ConnectivityService.
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I7e974ef7b23ba9ba6ee775eed9899b0c0e2eca55
This change migrates NetworkStatsService and related code to use
NetworkStateSnapshot which is used for replacing the NetworkState.
This patch also changes some formating which is suggested by
the linter.
Test: FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I547da8f411cb45bdadc376ac3cadf3f3c55bb282
The IPconnectivty metrics was deprecated.
So, remove the usage of the IPconnectivty metrics code in android.
Bug: 157966864
Test: atest CtsNetTestCases
Change-Id: I9ed4d29bf868902f3222aff980758512233b0b0a
UidRange is a data class that is an implementation detail of
Connectivity. Move it to the connectivity boundary.
Remaining usages of UidRange outside of Connectivity (in VPN) should be
migrated to other classes, like Range<Integer> or UidRangeParcel.
Bug: 181512874
Test: m
Change-Id: I6f2e3685ad1c07171dd90480d1e546329de8732d
Move the IOnSetOemNetworkPreferenceListener aidl definition to
framework-connectivity.
The interface is an internal implementation detail of
framework-connectivity, so it should be built inside the jar.
Bug: 181512874
Test: m
Change-Id: I898049b50fc620ee629587a9303f058e0a6d0272
* changes:
Fix comments left on aosp/1547454 and aosp/1556106
Remove INetworkManagementService from ConnectivityService
Remove unused INetworkManagementService
Remove BaseNetworkObserver from Nat464Xlat
Only part of events will report from DnsResolver through
INetdEventListener. So use IDnsResolverUnsolicitedEventListener
to get exactly supporting events from DnsResolver and it uses
Parcelable object to deliver data which can be more updateable
and extendable in the future.
Bug: 173485754
Test: atest FrameworksNetTests
atest CtsNetTestCases
Change-Id: I8d2e700ae8861ed8ceccd287f3ca5bc2f1ed6dee
service-connectivity needs the library so that module utilities are statically
linked, not picked up from the framework jar as hidden symbols.
Bug: 170598012
Change-Id: I1045b3784a4bdb902f44d848ccddb304986631c3
Test: m
UidRange uses PER_USER_RANGE to calculate and get the userid,
but PER_USER_RANGE is a hidden API, so use getIdentifier to get
the userid instead.
Bug: 170598012
Test: atest FrameworksNetTests:UidRangeTest
Change-Id: I06ab0f2da8a33d2b718bbc3a609d3d6a5fe0a095
PacProxySelector is tied to IProxyService, which does not have a formal
API.
Proxy is the interface with ConnectivityService, and all its methods are
public or module API.
Bug: 171540887
Test: m
Change-Id: I8ceba961a81661c3e11d8179955b594d3cab6ff7
The classes were added in S and are used to back ConnectivityManager
APIs. Add them to the connectivity boundary as they belong together with
ConnectivityManager.
Bug: 181512874
Test: m
Change-Id: I03b5978949b200a72813d1ebc4812d851fe3df37
SocketUtils contains system APIs for modules to interact for sockets,
wrapping internal APIs. It should be part of the platform to keep access
to the internal APIs.
This involves splitting NetworkUtils.protectVpn to NetworkUtilsInternal,
since SocketUtils and VpnService are the only users of that method.
The @UnsupportedAppUsage NetworkUtils.protectVpn has low usage
count, and is already available through VpnService.protect.
Bug: 181512874
Test: boots, VPN working
Change-Id: I7028d334975f7536c06afac7a22200c33db707ac
Split out connectivity APIs to connectivity module directories. This
prepares future move of the connectivity code into a mainline module,
but still keeps it implemented by framework-minus-apex for now: the API
stubs are moved to framework-connectivity.stubs, but the implementation
on device remains in the same place.
This allows moving the connectivity code in/out of APEX with minimal
changes.
BYPASS_INCLUSIVE_LANGUAGE_REASON=Moving files, can't modify released API
Bug: 171540887
Test: device boots, connectivity working
Merged-In: I21c42f032efa6c10e36c749df3183ce9679303a7
(cherry-pick from internal branch with API files conflicts)
Change-Id: I21c42f032efa6c10e36c749df3183ce9679303a7
KeepaliveTracker is included in ConnectivityService mainline
module and it will not be able to access internal util class
com.android.internal.util.HexDump. Use the HexDump defined in
net-utils-device-common to remove dependency on internal util
class.
Bug: 177046265
Test: FrameworksNetTests
Change-Id: I1f5a6a749106b98e2baf22d6a290dcf8b51a6c36
Since NetworkState has UnsupportedAppUsage APIs that cannot
be changed, create another class for follow-up patches
to expose as system API.
Test: NetworkStateSnapshotTest
Bug: 174123988
Change-Id: I54ef872847f34166aa34a79f6178c90ac12b6c72
- Follow-up commit will modify getStartUser() and getEndUser(),
to make sure the result is consistent, add test before changing
getStartUser() and getEndUser().
- Add a test for createForUser() to ensure the last uid of
the previous user is smaller than the first uid of the next user.
- Move this test file to tests/net/common, so that it can be run
in CTS.
Bug: 170598012
Test: atest FrameworksNetTests:UidRangeTest
CtsNetTestCasesLatestSdk:UidRangeTest
Also run above tests on Q and R devices.
Change-Id: I8b146aa14b50911e50a39f266e8d8dc17df853b2
Remove INetworkManagementService from ConnectivityService and
related files.
Bug: 174837473
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
Change-Id: Ie6cfd77bbd64a8fd7539b0ea7fd15bf970e40c3d
Let ConnectivityService talk to Nat464Xlat through NetworkAgnetInfo
directly:
- Nat464Xlat will be created once there is a new network bringing up,
but Netd doesn't expose the method for unregistering unsolicited event.
- ConnectivityService has already registered netd unsolicited event
listener, so Nat464Xlat doesn't need to register unsolicited event
listenser by itself, it can get the unsolicited event from
ConnectivityService directly.
Bug: 174837473
Test: atest FrameworksNetTests
Change-Id: I751526e8ffa7d25591696ecd8d93b1585c4c20c7