While doing some testing for another change (pa/2844131), I noticed that
an interface in config.xml with no network capabilities listed provided
no internet connection. parseEthernetConfig was updated to provide empty
config capabilities with the default capabilities (which
includes NET_CAPABILITY_INTERNET for non test ifaces).
Flag: BUG_FIX
Test: atest ConnectivityCoverageTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ethernet.EthernetTrackerTest
Bug: 352523028
Change-Id: I6f73b0554f95c20fd1912a3c8da2b3c64f2ac4c4
As part of the major tethering refactor to associate every IpServer with
a TetheringRequest, tether()/untether() APIs should be completely
removed in B and all tethering should go through startTethering() (with
the exception of Wifi LOHS and Wifi P2P, which will move to
startTethering() in a future CL).
Bug: 216524590
Test: atest CtsTetheringTests TetheringTests
Change-Id: If7981f1ee7d80ff0a1cc0069ba7a4ebf79144160
Quang Anh Luongcommited 2025-01-15 08:59:42 +09:00
The reserved offer adapts the reservation requests capabilities, and
additionally populates its own capabilities (namely the PSM provided by
the BluetoothServerSocket).
Test: TH
Change-Id: Ida388b6f1e4552242726bd4d7eba6215bb0577a3
Registers a blanket reservation offer which will receive reservation
requests filed using ConnectivityManager#reserveNetwork.
Test: TH
Change-Id: I2d37fe564a6c40f2c6dee1f6f7aa655c47628b85
The network provider is registered when BLE is supported.
Bug: 372936361
Test: L2capNetworkProviderTest
Change-Id: I8163339015f4a3bb0ff8911f6f52a38ec1730f39
A NetworkOffer can be updated by registering a new set of capabilities
and score using an already registered NetworkOfferCallback object.
Since reserved offers are guaranteed to never send more than a single
onReserved() callback, they cannot support updating the capabilities
(not to mention that the reservationId is also part of the
capabilities).
This change changes NetworkOffer migration to only allow reserved offers
to update their NetworkScore. If a reserved offer tries to update its
capabilities, the existing offer is removed and the new offer is
silently rejected. This change does not affect regular offers (with
RES_ID_UNSET) nor blanket offers (with RES_ID_MATCH_ALL_RESERVATIONS).
Test: CSNetworkReservationTest
Change-Id: I872a1dbda209098f08391a7543b9446e1f50d4f0
This reverts commit 3d51a99dc8.
Reason for revert: Does not close the timerfd object properly, which may cause a memory leak.
Change-Id: I25d7da13591696c9dfda60ee0fdd2574dbcdf337
The flag, used in the newly exposed AdvertisingRequest, allows
skipping the probing step when the service name is known to be unique
already.
This allows implementing RFC 6762 section 8.1 that specifies probing
SHOULD be skipped if it is known via other means that the record set
is unique.
Bug: 384841047
Test: atest CtsNetTestCases:NsdManagerTest
Change-Id: I19d67ff2863af631bd9c2f518b004f1688ac5f87
reserveNetwork allows a requestor to initiate the creation of a network
that requires the system to preallocate resources which can then be
advertised by the requestor on or off device in order to help create the
network.
For example, this API will be used to reserve a IP over L2cap server
network, which requires the system to first create a
BluetoothServerSocket and reserve a PSM (i.e. port). This information is
passed back to the requestor via onReserved() callback and subsequently
advertised via a BLE advertisement. The network is established as soon
as the client connects to the advertised PSM, which will trigger a call
to onAvailable(), just like a regular NetworkRequest.
onReserved() callbacks are exclusive to the reserveNetwork API and are
sent when an NetworkOffer is registered that matches the reservation ID
of an existing request. A reserved offer always follows the reservation
request as it is created in direct response. onReserved() can only be
called once. If for some reason the reservation gets cancelled by the
system (i.e. the NetworkOffer is retracted) or cannot be fulfilled,
onUnavailable() is called. It is up to the app to file a new
NetworkRequest when this happens.
An onReserved() callback is not queued, because
a) it cannot be called more than once for the same reservation,
b) it must always be the first callback, and
c) it only gets cancelled by onUnavailable().
This change does not handle NetworkOffer migrations, such as updating
the score, properly. This must be addressed before the feature can ship
as the yieldToBadWifi logic can update the score on all NetworkOffers.
API-Coverage-Bug: 372936361
Test: Very basic CSNetworkReservationTest; more to follow.
Change-Id: I9b349d469830bf28e006cf403c605574371db267
onReserved() is called in response to a successful Network reservation
with the NetworkCapabilities of the reserved network. onReserved is
called at most once. If the reservation is released, onUnavailable is
called.
Test: TH
API-Coverage-Bug: 372936361
Change-Id: Idcef572ab9d07981799efc349206aadb620e0e69
Advertise with a shorter hostname by default (can be disabled via a
chicken bit), instead of "Android_[32 characters]" as the hostname.
This should allow decreasing the size of APF programs necessary for
advertising offload, and make the advertiser compatible with Matter
use-cases. Some Matter implementations (notably CHIP) interpreted
the example in "4.3.1.1. Host Name Construction" of the spec as
if only 16 character hostnames needed to be supported, despite not
following the rule to construct the hostname based on link-layer
addresses.
The hostname changed once in T when migrating from mdnsresponder to the
current advertiser implementation, so changing the format again is
unlikely to create problems, especially since this keeps the "Android_"
prefix.
Bug: 341141476
Test: atest
Change-Id: Ic8311f41a1a943ec8230203fcd74eda7a26a691c
The transactionId is just a query counter similar to queryIndex, except
that it wraps at UNSIGNED_SHORT_MAX_VALUE.
Calculate it based on queryIndex instead.
Test: atest
Change-Id: I3d18f398f3ca3aac363daacbc2840349baba9125
Instead of having query scheduling time split between MdnsQueryScheduler
and QueryTaskConfig, where QueryTaskConfig has the base run time and
MdnsQueryScheduler does backoff, consolidate it all in
MdnsQueryScheduler.
This allows QueryTaskConfig to only contain parameters used when the
task runs, and not scheduling info.
Test: atest
Change-Id: Ie060802ff2d13c1cea339955d8b609ba95f762f2
This populates the reservationId with the value of the requestId when a
new NetworkRequest is created. Conceptually, the reservationId is not
related to the requestId; however, the requestId fulfills the same
uniqueness requirements that are needed for the reservationId, so it can
just be reused for this purpose.
Test: atest NetworkRequestTest
Change-Id: Icecb889a5269554add5791587f1ce7319271fd9e
Timerfd can provide more accurate delayed callbacks than
Handler#postDelayed because it accounts for the time the device
spends in deep sleep. Using timerfd allows for more precise query
timing, which reduces the possibility of TTL expiration caused
by inaccurate delayed callbacks.
Bug: 366373064
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I980ec8fd43f63976ef5387bb57c7ed70a1b68d82
This is a test-only no-op refactor which only enables the
ability for follow-up changes to add more parameters without
exponentially increasing the number of parameter combinations.
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalAgentCreationTests
Bug: 349487600
Change-Id: I61bcabf7c93dab43984da0ade3e61a7117fe040a
This commit removes the redundant type and caller uid
checks in TrafficStats to address the review feedback at
aosp/3313055.
Test: TH
Bug: 343260158
Change-Id: I0ed6e850835136c9a324efd7271dd80a34160aa6
This is a no-op change since the config is not used yet, and
the feature flag will be gradually rolled out instead of enabled
by default.
However, this change is necessary for follow-up changes to enable
toggling the feature and configuring its behavior through device
configuration flags.
This change includes:
1. Disable the service-side cache flag if the client-side flag
is enabled.
2. Since the apps don't have enough permission to check the
feature flag from DeviceConfig. Provides a binder interface
for returning per-UID config,
which only returns cache enabled if the SDK level is V+
or the app's target SDK is V+.
Test: atest FrameworksNetTests:android.net.connectivity.android.net.TrafficStatsTest \
FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Bug: 343260158
Change-Id: Id9761e4aea65fabe6466c875b787e178317a1da2
Follow-up from aosp/3249945. If the system caller queries stats
for other UIDs, the caller would get UNSUPPORTED.
This follows the official documentation, where the API would
not return stats for all other UIDs.
However, partners or other legacy callers might already depend
on this undocumented behavior. Changing this behavior might
damage existing apps.
Thus, this change reverts the behavior change introduced at
aosp/3249945 and allows a system caller to query stats for
other UIDs.
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.TrafficStatsTest
Bug: 372851500
Change-Id: Ia7ea051f7b0b6349ffcb890c300362bbfbdee3dc
Networks can use widely varying timeouts for their connections. Because
cellular modems use a lot of power, having this configurable is more
useful for tuning this to an optimal value for power drain.
Adding a similar configurable value for WiFi for parity.
Test: atest ConnectivityCoverageTests:\
android.net.connectivity.com.android.server.CSNetworkActivityTest
Bug: 373733012
Change-Id: I2418f09233b2e3fa4e9cdd8fbb6149a35106b735
Currently, if the app's target SDK is V+, the rate-limit cache is
enabled regardless of whether the kill switch is enabled or not.
This creates problems if there is a need to disable the feature
entirely.
Thus, this change makes the kill switch override the target SDK
level. This is necessary for follow-up changes to enable
the client-side cache and disable the service-side cache
simultaneously.
This change also removes the need of initializing/clearing the
caches when the cache is entirely disabled.
Test: atest FrameworksNetTests:android.net.connectivity.android.net.TrafficStatsTest \
FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Bug: 343260158
Change-Id: I38bdfe00220f59712ca4b095fe4e7a3731320708
This change includes:
1. Rename binder interfaces.
2. Use a dedicated class to pass the result of
get{Total|Iface|Uid}Stats, as it is 25% faster than passing
a NetworkStats object through the binder interface.
3. Remove the binder interface only used by the test.
4. Remove NetworkStatsBinderTest on R and S, since the binder
interface is removed, the mainlined service does not run on
those versions and the chance of breaking these tests on
R and S is low.
5. Remove useless TODO comments.
Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Bug: 372851500
Bug: 343260158
Change-Id: Ibd79a17218f54f0117d8ef5d7b9ec6073356f923
aosp/3218864 fixed the crash when ranges are removed from a
destroyed network, but did not fix the case where the ranges are
added to a destroyed network.
This can happen if a multilayer request is filed when a network
has already been destroyed.
Fix: 368989698
Test: updated existing tests for this bug
Change-Id: I7184eaa01141f56b7ad774277c7dee03d5812298
Lorenzo Colitticommited 2024-10-22 11:41:21 +00:00
Move this utility method buildMdnsServiceInfoFromResponse from
MdnsServiceTypeClient to MdnsUtils so it can be used by other
classes.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I8ce1028de325da46f112a5ec58516453727151fe
The removeServices() is running on a different handler, which
might take some time to complete. Therefore, the verification
should include a timeout to wait longer and prevent test flake.
Bug: 367429622
Test: atest MdnsDiscoveryManagerTests#testRemoveServicesAfter\
SocketDestroyed --iteration
Change-Id: I79626bad680a62993c3e7d6b356acc10755257e3
The services in the cache are no longer useful after the network
is disconnected. Because either the Network object or the
interface index will change after the network is reconnected,
these cached services won't be used for any discovery/resolution/
service info callback requests. Therefore, these cached services
should be removed after the network is disconnected. Otherwise,
these useless cached services will occupy memory until the device
is rebooted.
In addition, the cached service may not be reliable after the
last listener is unregistered. Because the socket is
disconnected, the service type client won't receive any updates
for the services. Therefore, remove these cached services after
exceeding the keeping time.
Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I06ff320fec84f71dc2ed742c50fa46f25c284170