testSampleConnectivityState was flaky since sometimes networks were
disconnected before ConnectivityService#sampleConnectivityState
generates metrics
This CL fixes this issue by adding setKeepConnectedReason to prevent
networks are disconnected
Bug: 318546530
Test: TH
Change-Id: I824f5cd379c8144b48341cc0fd18eb976a4b1cde
- onRoleHoldersChanged & onRoleSmsChanged handling for multiple Users
- Different satelliteNetworkFallbackUids cache for each user.
- Merging uid of each user cache and sending for Multi Layer request
- check SATELLITE_COMMUNICATION permission based package manager
context at different UserHandle
Bug: 324347502
Test: atest FrameworksNetTests
Change-Id: If98524ec7846909d70db3e962e2a11c912768551
The hasNetworkStackPermission() method does not enfore the
permission check. It should be replaced with
enforceNetworkStackPermission().
Bug: 325984919
Test: atest FrameworksNetTests
Change-Id: I9ad0b47190dbc9afd2ee6f5dfc21a4935036733a
This is used in follow-up changes to rate-limit TrafficStats
get* API calls.
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.TrafficStatsRateLimitCacheTest
Bug: N/A
Change-Id: I91bc71dda3a1b7c0b5525278b3c04d12492972fa
When multiple listeners are registered for a resolve query, they were
duplicated in servicesToResolve, so the A/AAAA/PTR/SRV queries would
appear multiple times in the question section of query packets.
Ensure that makeResponsesForResolve does not generate duplicate
responses for duplicate listeners to avoid the duplicate queries.
Bug: 288174267
Fixes: 285090822
Test: atest
Change-Id: Ie6f76de6bfc5018c4c479505f99fbe6d81b64434
Remi NGUYEN VANauthored and Paul Hucommited 2024-02-21 03:41:05 +00:00
Always store the corresponding SubscriptionId together with the Carrier
uid so that when the carrier loses the Privilege, both the uid and
SubscriptionID will be used in the onCarrierPrivilegesLost callback
Bug: 324357121
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.CarrierPrivilegeAuthenticatorTest
atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Change-Id: I28e51c583261a67d4441c6f825ade6781b862ee4
Raise the max listener per client limit from 10 to 200.
A frequent use-case for NsdManager is to file a DiscoveryListener,
and try to resolve/listen for every service using a ServiceInfoCallback.
The current limit of 10 callbacks is easy to hit in that case, since it
would happen if there are at least 10 devices on the network.
Raise the limit to 200 to avoid such problems. In practice it is very
unlikely that there would be more than 200 services on a network; if
advertised by different devices, they would barely fit in a /24 IPv4
prefix, so a limit of 200 should generally be high enough.
Note that for discovery 200 listeners does not mean that batches of 200
queries will be sent: listeners on the same service type are grouped
together so only one query is sent for the type, and results are
distributed to matching listeners.
Note also that the limit is currently only checked when registering
discovery or advertising requests. This should be also checked when
registering other kinds of listeners in a future change.
Bug: 324377460
Test: atest
Change-Id: I86fc00777e9dea3e5192b575581ba562e7401e42
Starting thread from constructor could cause thread leak when assumption
fails and teardown is not called.
This CL moves initialization that starts thread to the setup.
Test: TH
Bug: 322659435
Change-Id: I8e84c12600a98d8019b7759103032c7d668cecd1
- Implement handleSetSatelliteNetworkPreference() at ConnectivityService
to create multi layer request with preference order
PREFERENCE_ORDER_SATELLITE_FALLBACK.
- unit test coverage
Bug: 320514105
Test: m and atest FrameworksNetTests
Change-Id: I3f71104f8c3c998599eaab71ae4076985f4bed77
- create SatelliteAccessController class to identify role sms and
satellite communication enabled uid's, to keep track of role changes
through OnRoleHoldersChangedListener and to request to create
multi layer request to ConnectivityService.
- unit test coverage
Bug: 320514105
Test: m and atest FrameworksNetTests
Change-Id: I95086f7a4fd6fe1261f432e605d792204ff5310b
This CL allows the Carrier Config app to request restricted WiFi nework
by setting the correspoding subscription ID in the network request.
Bug: 315835605
Test: atest android.net.cts.NetworkRequestTest
atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.CarrierPrivilegeAuthenticatorTest
atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Change-Id: I237e692d092ff5f969ce4b7962f6d58099a6f3a9
The check*Permission methods are a bit error-prone because people
can forget to check the return value and expect that they behave
like the enforce* methods. This was pointed out before in some bugs.
This change adds @CheckResult annotation to enforce linter warning
and rename methods accordingly.
Test: TH
Fix: 279691948
Change-Id: Ibb0df6540fe0ed40289bb190b790130daaa2f763
A lot of WTF logs reported were barely 1 second over the 1 hour
limit. AlarmManager has a maximum window of 1 hour so these cases
are possible and expected.
Increase the max metrics duration deviation to 2 hours to avoid
this log.
Bug: 297292877
Test: Manual test
Change-Id: I9a476e8061944c6499fe1b1d6e9ad1e19e6ce2b9
Previously only the subtypes of the last registered listener would be
included in the discovery queries.
This fixes that by combining the subtypes of all registered listeners,
to be included in the queries. By moving the queried subtypes from the
QueryTaskConfig to the QueryTask, they are now recalculated before each
send (like the existing servicesToResolve), so are always in sync with
the registered listeners.
Fixes: 322918399
Test: atest
Change-Id: I9a4c94189f997e3a9f92e46b5eb1762e9925cf4c
Address the remaining comments in aosp/2874718 to simplify the
burst time logic.
Bug: 271067818
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I619f45189b10da3e09759ee1d57a898173a9fff8
The current query scan modes, active and passive, have
limitations. Unicast queries only originate from the first query
session, multicast queries should be sent simultaneously with
unicast, and both modes suffer from infrequent scans. To
address these shortcomings, a aggressive query mode is proposed.
Bug: 271067818
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I87100e03a5b6306dcae79f05c034f000e6dc2889
If a service is found without a requested subtype, then updated to have
that subtype, onServiceUpdated would be sent instead of onServiceFound.
Fix this by tracking which services have been found by each listener, as
whether a service is newly found or updated depends on the options (in
this case the subtype filter) of each listener.
Fixes: 317167170
Test: atest
Change-Id: If8dbe04d858082a872c0f068433a3680331c670b
This CL adds the service-side implementation of the custom host support
added in aosp/2890957.
Bug: 284904661
Bug: 320838284
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I92c774ead4778870ff7358ccb28d6ad6e266f1b5
This is a no-op change. Currently, the query mode employs a
boolean value to toggle between passive and active modes. To
accommodate a broader range of query modes for different
requirements, switch to an integer value that facilitating
the addition of new modes more seamlessly.
Bug: 271067818
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: Ia9a12d4581246c3a5776cd241755a10994e32454
This is no longer needed due to being done synchronously via nativeRegisterIface()
Test: TreeHugger
atest libnetworkstats_test
atest NetworkStackIntegrationTests:android.net.NetworkStatsIntegrationTest
atest FrameworksNetTests:android.net.connectivity.com.android.server.net.BpfInterfaceMapUpdaterTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9c0c79d23657fb5cb5296fb918f76f1fc896baa1
Maciej Żenczykowskicommited 2024-01-26 15:24:19 -08:00
When a query packet is truncated, the responder should defer
the generation of a response until all packets have been received
and processed. If an answer present in the query packet's answer
section also appears in the responder's response, and the
known-answer's TTL exceeds half of the original TTL, suppress
the corresponding response.
Bug: 312657709
Test: atest FrameworksNetTests NsdManagerTest
Passed DISTRIBUTED DUPLICATE SUPPRESSION and \
MULTIPLE QUESTIONS - DISTRIBUTED DUPLICATE SUPPRESSION \
test cases of BCT
Change-Id: I781cd813d46f7d0db267f3fe23a15a81ae319e51
A simple unit test for the SkDestroyListener::dump().
(The follow-up of aosp/2916465)
Bug: 306919485
Bug: 319348954
Test: atest FrameworksNetTests:android.net.connectivity.com.android.serv
er.net.SkDestroyListenerTest
Change-Id: Ica70b2b344ffb2df8047cd936e8edc583e636ceb
Not all SocketTypeClients are cleaned up when their corresponding
sockets are closed. This occurs because the active socket check
for each callback examines the socket from all callbacks, even
those scheduled for removal in later notifications. To fix this,
check the active socket from the current callback only.
Fix: 317461509
Test: atest FrameworksNetTests NsdManagerTest
Manually test with multiple discovery requests and
Wifi on/off.
Change-Id: I2f81bb8e75f2c038d5e9dc025b208dcc6b441112
Implement the TODO to assign priority to services based on an
overlayable configuration.
This changes the default priority from 0 to MAX_VALUE, as higher
priority values are less prioritized, so services not in the priority
list should have a high value. There is currently no user of the API
depending on the priority, so the change should not affect clients.
Test: atest
Change-Id: I3aae9b5fa7756de64c63974c192e4c96b632ce4e
When sockets are destroyed, the SkDestroyListener receives a
NETLINK_INET_DIAG message informing it to delete the socket cookie from
the BPF CookieTagMap. However, under unknown conditions, all 10,000
spaces on the map were still observed to be filled. SkDestroyListener
and its parent classes, NetlinkMonitor, and FdEventsReader will log
errors. But due to the time required to fill the 10,000 fields is long,
traces in the device log are likely to have been overwritten and cannot
be observed.
This commit enables dumpsys netstats to print the last 20 traces of the
SkDestroyListener. If the issue is caused by the SkDestroyListener,
this will help in obtaining further clues when the issue is reported
again.
Bug: 306919485
Bug: 319348954
Test: atest FrameworksNetTests:android.net.connectivity.com.android.serv
er.net.NetworkStatsServiceTest#testDumpSkDestroyListenerLogs
Test: manually add mLog.e(...) in
SkDestroyListener#processNetlinkMessage and check dumpsys netstats
Change-Id: I5bbfe07e05cf959f809f28a7633ee5f99e29f641