This ends up crashing the system when the request
is unregistered, because the ref counter finds the
count associated with the relevant UID is zero.
Test: FrameworksNetTests
Test: TODO : this needs a new unit test
Change-Id: I0ee0ce925a826d35d8fd58cefb8a870e98ce9add
When a new preferences object is sent that no longer contains
a particular app, a new set of requests will be generated. All
requests corresponding to that app will be unregistered, and
no new ones will be filed since the preferences no longer
contain that app.
The place where the UID ranges are removed however is in
makeDefaultForApps(), which takes a request. As there no
longer is a default request for this app, makeDefaultForApps()
will never be called with a request for it, and the UID ranges
will never be removed.
This change applies an emergency fix with some side effects
when setting a new preference. This is acceptable, but should
ideally be fixed ; see TODO in the code for details.
Test: FrameworksNetTests
Test: TODO : Need a unit test for this
Change-Id: Iac3f55af5d00d174460e1d4cdd31f581835dbaa6
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
Because the constuctor PersistableBundle(Bundle) is a hidden
API which is not visible to connectivity mainline module.
Currently, EVENT_NETWORK_TESTED and EVENT_DATA_STALL_SUSPECTED
are two events sent by ConnectivityService so they can build a
PersistableBundle directly and send PersistableBundle instead of
setting Bundle in the data field of the Message.
For EVENT_NETWORK_TESTED, add a new PersistableBundle member in
ConnectivityReportEvent so that the PersistableBundle can be
passed with ConnectivityReportEvent.
For EVENT_DATA_STALL_SUSPECTED, create a Pair<Long, PersistableBundle>
and put this in .obj of the Message, then the PersistableBundle can be
sent with timestampMillis together.
Bug: 177865050
Test: FrameworksNetTests
Change-Id: Ia2220f33f000e7c9439d97617cc08014dc4478a3
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
This fixes a small bug in debug code where the wrong
request would be displayed for RequestReassignment#toString.
Test: manual
Change-Id: Ie8d983593e67082eb818ef65bd8708e97596bce2
Create TrafficDescriptor class
Create new APN ENTERPRISE
Update setupDataCall and DataCallResponse to take TrafficDescriptor and
matchAllRuleAllowed
Move ApnTypes from Annotation to ApnSetting
Bug: 179312227
Test: atest FrameworksTelephonyTests
Change-Id: I7433976bfe25bcb2af85ffb9338959cbcc9f42f3
Merged-In: I7433976bfe25bcb2af85ffb9338959cbcc9f42f3
Instead of using hidden symbols in the internal CollectionUtils, use the
CollectionUtils in libs/net that are intended for that usage.
Bug: 174541037
Test: m
Change-Id: Icb282bf2f38eb553eebc7d499bf92f22fae723cc
Replace the hidden API Slog with the Log public API. Log is the utility
used by connectivity modularized code, which QosCallbackAgentConnection
is part of.
Change-Id: Ia50ec1cd3b8253ede010ec4fd1c37d9aa731d032
Test: m
Bug: 172050541
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