* changes:
Add support for TestInterfaceMode to EthernetTracker
Move call to setEthernetEnabled inside setIncludeTestInterfaces
Add support for TestInterfaceMode in setIncludeTestInterfaces
Treehugger Robotauthored and Android (Google) Code Reviewcommited 2025-07-23 14:16:42 -07:00
This will allow EthernetManagerTest to include test interfaces as
NCM-only interfaces.
Note that at this point, setting any TEST_INTERFACE_MODE includes a
test interface in both MODE_ETHERNET and MODE_NCM (equivalent to
setIncludeTestInterface(true)) as the mode is not propagated further
than EthernetServiceImpl.
Test: TH
Flag: EXEMPT mainline
Change-Id: I52a36ebb29bc27a21c7521c1cd9bd186001ac6c5
This patch added EthernetPortSelector class that is used to select a
specific ethernet port by interface name or MAC address.
Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline
Change-Id: I050dc1f484115fdedda349cc2e1a44f4c5fda6db
This patch updates prefix for Persistence and MeteredOverride IntDef for
consistency.
Test: build
Bug: 397536853
Flag: EXEMPT mainline
Change-Id: Ic39c8d74900929f6ac95795bea2fbe9c686ec533
This patch adds methods to get metered override and persistence config
in human readable string in EthernetConfiguration.
This allows more informative logging.
Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline
Change-Id: Ia5a2f4b9f624bfc1c96b197533426925dacfa554
And pass it through to EthernetListener. This will be used to optionally
include callbacks for NCM interfaces which are not tracked by the regex
in tests.
Test: TH
Flag: EXEMPT mainline
Change-Id: If388a37911d3b8ceb2be79f8d303f37560b2678b
This patch added persisted logic to EthernetConfiguration, which allows
ethernet configuration to be set to be persistent across boot or not.
Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline
Change-Id: I6e96dec0f802cf1a58e61bffb6c1dac34a0a91a5
This patch changes the name of class EthernetPortInfo to
EthernetPortState.
Bug: 397536853
Test: build
Flag: EXEMPT mainline
Change-Id: I7f42170cdde33ca31dea3d622678565ea5dc1026
This change address api council review feedback for ag/33705589,
which includes:
1. Mirror `@Transport` annotation in NetworkCapabilities to
the NetworkTemplate class, because such annotation is
not visible to NetworkTemplate class.
2. Add @Transport annotation for the APIs.
3. Add @throws in the javadoc.
Flag: com.android.net.flags.netstats_transport_type
Test: m
Fix: 424088371
Change-Id: I2c3ed5e1abc6d647bbb5af99446e3d75ed167f05
In case there is a bug after rolling out transport
types support in the NetworkIdentity. Add a kill switch
to stop writing transport types to mitigate the
impact if any.
Flag: EXEMPT the change is the kill switch
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkIdentity*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkStats*' --update-device
Test: atest ConnectivityBenchmarkTests
Test: atest FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Test: Manual:
1. Download files
2. adb shell device_config put tethering store_transport_types -1
3. reboot and check Data Usage Settings page.
Bug: 419123367
Change-Id: I52791f6fe5207021748641cf0719055533b5d511
This is needed for counter-part modules to query data usage
with specified transport type.
Flag: com.android.net.flags.netstats_transport_type
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkTemplate*' --update-device
Bug: 419123367
Bug: 420531377
Change-Id: I7778de815bec947be3e6abbd6269e1727de5c550
This is needed for counter-part modules to query data usage
with specified transport type.
This is kept hidden and will be exposed in follow-up
CLs.
Flag: EXEMPT controlled in the counter-part CL
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkTemplate*' --update-device
Bug: 419123367
Bug: 420531377
Change-Id: I503b4d7307d008a64a14aa713d9714428e399809
This change verifies that:
1. For a given match rule, if transports are specified, a deduced
transport type should be included. For example, if MATCH_WIFI
is specified, TRANSPORT_WIFI should be included if at least one
transport is specified.
Flag: EXEMPT implemented in the counter-part CL
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkTemplate*' --update-device
Bug: 419123367
Change-Id: Ic8375e50c3587ef2b757d1c3241f97482d93808b
This change updates NetworkIdentity to have NetworkCapabilities
transport types for improved network identification, and updates
NetworkIdentitySet for backward compatibility with older data.
Flag: EXEMPT implemented in the counter-part CL
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkIdentity*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
'NetworkStats*' --update-device
Bug: 419123367
Change-Id: I26cc770d90b4687d832dd029d9a11db03404db39
This patch adds EthernetPortInfo class which represents information of
an EthernetPort object.
This class is mainlt used in network callbacks.
Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline
Change-Id: I8ab9fa934a710080163d951bb6619050ca38a2ee
This patch adds MAC address support for EthernetNetworkSpecifier under
@hide flag.
After adding the support, EthernetNetworkSpecifier will be able to be
matched by MAC address in addition to existing interface name match. The
specifier can be satisfied with either MAC address and/or interface
name.
Bug: 397536853
Test: atest CtsNetTestCases:android.net.cts.EthernetNetworkSpecifierTest
Flag: EXEMPT mainline
Change-Id: Ibe55411ad0d3fdded6e25c9f33d9898e3eab3a3c
Avoid duplicate calls to getValues for non-matched entries. Performance
experiments suggest it is worth the cost of the additional BitSet
allocation to keep track of what matched. BitSet performs slightly
better, and allocates/uses/frees less memory, than a boolean array.
Bug: 416650909
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.NetworkStatsTest
Flag: EXEMPT bugfix
Change-Id: I932375798a58f8ee59b6028faade5fa88ba053cb
This commit adds the implementation in NsdService to support offloading
only advertisement requests. This is a temporary solution to facilitate
the migration of TV devices to APF-based mDNS offload.
Test: TH
Flag: EXEMPT bug fix
Change-Id: I7b8535956e701a34fca31908b8b21e9ab731505c
Skip including the subtype PTR query for both announcement and offload
packets. This is necessary because devices like Googlecast have
numerous subtypes. Including these subtypes in the packets can easily
exceed the MTU limit. Furthermore, the Wi-Fi firmware has limited RAM
available for hardware offload, and including subtypes would consume
excessive memory resources needed for the offload code.
Test: TH
Flag: EXEMPT bug fix
Change-Id: I2575659983579da0bbf4ff104ba5b8111ee9585e
This commit makes the NsdManager.registerService() API public. This
change will enable developers to implement more customizable mDNS
advertising behavior in their applications.
Bug: 373270045
Test: atest CtsNetTestCases:NsdManagerTest
Flag: com.android.net.flags.mdns_advertising_improvement
API-Coverage-Bug: 415202964
Change-Id: I32359f7265b3597defd57123ecff0deaef0011f8
The NsdManager.registerService() method was originally scheduled to
become a public API in the 25Q2 release. However, this transition did
not occur as planned. The current target for making this method a public
API is the 25Q4 release. In the interim, the @UnsupportedAppUsage
annotation is being added. This is necessary to support an internal
MediaShell use case for the 25Q2 TV release. This change marks the API
as available in the dex so callers can call without being blocked by
hidden API restrictions. This API will be marked as public API
immediately after this change for 25Q4.
Test: TH
Flag: EXEMPT no logic change
Change-Id: I8e6e33ca224f459c3d8344c05ea6d6e5a4556a8d
This patch adds EthernetConfiguration class which represents a
static configuration and network capabilities of a configured ethernet
network interface.
EthernetConfiguration is used ONLY internally to store and track
ethernet configurations, and serves different functionality as
EthernetNetworkUpdateRequest.
Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline
Change-Id: Ib175347096db25b9f2180a2e526746f1f3cf6ceb
Getting the network stats required making 3 full copies of all the
network stats since boot. Reorganize the code so we only have to
allocate incremental network stats objects.
Flag: EXEMPT bugfix
Bug: 399154099
Test: atest ConnectivityCoverageTests
Test: atest NetworkStatsIntegrationTest
Change-Id: Id531c4ffd6e0d127b8aaac38bda6a89a3d700c64
Updated the comment in OffloadServiceInfo to accurately reflect that the
ServiceType field should not include the ".local" suffix.
Test: TH
Change-Id: I8158b413dabeacdda2585ea065b2db2d4ca95e8f
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
This allows obtaining the hostname that is pointing to the address
records, which were already available though #getHostAddresses.
This is covered by existing CTS tests, for example the
servicesWithCustomHost_customHostAddressesFound test in NsdManagerTest.
Test: atest CtsNetTestCases:NsdManagerTest
API-Coverage-Bug: 384841047
Change-Id: Ib939c1977a76d8d98c9b4f79da6a1a6b0acf6a87
to avoid possible deadlock from following DevicePolicyManager.isDeviceOwnerApp
move SYSTEM_UID checking ahead.
Change-Id: I182cadb175ca5028b6fe8e7f6316dcd349e32573
This change introduces client-side rate limiting for TrafficStats
APIs to address a performance issue caused by excessive calls,
resulting in high CPU usage and binder contention. By caching
traffic statistics on the client side, we reduce the frequency
of calls to NetworkStatsService, improving overall system
performance and mitigating potential privacy concerns related
to traffic analysis fingerprints.
This client-side caching mechanism will be disabled and gradually
enabled through a feature flag rollout.
Test: atest CtsNetTestCases:android.net.cts.TrafficStatsTest \
CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
ConnectivityCoverageTests:android.net.connectivity.android.net.TrafficStatsTest \
CtsNetTestCases:android.net.cts.IpSecManagerTest#testIkeOverUdpEncapSocket \
CtsNetTestCasesUpdateStatsPermission:android.net.cts.networkpermission.updatestatspermission.UpdateStatsPermissionTest#testUpdateDeviceStatsPermission
Test: adb shell device_config put tethering trafficstats_client_rate_limit_cache_enabled_flag [-1|1]
Bug: 343260158
Change-Id: If8a252d8d01c1545b23fdc7a00010f249ca09dc2
This is to address review comments at aosp/3324247, where
the test only methods are pretty much always single-threaded.
Remove the synchronized block accordingly.
Test: TH
Bug: 372851500
Change-Id: I14209b090c584912fcb87f5734f57ef3db7b0f3c
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
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
Prepare for implementation of client side
TrafficStats rate limit cache.
1. Write Typeless versions of getIfaceStats,
getUidStats, getTotalStats in INetworkStatsService.aidl
that returns NetworkStats instead of Long.
This is needed because in follow-up changes,
the NetworkStats instead of indiviual numbers will
be stored as a cache entry
2. Move some utils from NetworkStatsService
to TrafficStats. This is needed because in the follow-up
changes, these utils would be both accessed by TrafficStats
and NetworkStatsService.
Test: CtsNetTestCases:android.net.cts.TrafficStatsTest
Test: CtsNetTestCases:android.net.cts.NetworkStatsBinderTest
Test: FrameworksNetIntegrationTests:com.android.server.net.\
integrationtests.NetworkStatsIntegrationTest
Test: FrameworksNetTests:android.net.connectivity.com.android.\
server.net.NetworkStatsServiceTest
Test: FrameworksNetTests:android.net.connectivity.\
android.net.TrafficStatsTest
Test: ConnectivityCoverageTests:android.net.connectivity.\
android.net.TrafficStatsTest
Bug: 343260158
Change-Id: Iace251e1495fd3b81e072526e92ca97cbc7246eb
Connectivity repo now can use java_aconfig_library since this target is
available on all downstream branches.
This CL removes framework-connectivity-t-mdns-standalone-build-sources.
Files in this target use flags which won't be available in the
out-of-tree build but the next out-of-tree library import will not use
the classes in that filegroup anymore.
So the standalone build rule will still match the out-of-tree build.
Bug: 345121279
Test: TH
Change-Id: I2a9aa02bd0c9aa00d460f98cd51d5dec4098fb89
Currently, NetworkStats#addEntry creates a new instance
containing the requested result instead of mutating the
original object. This creates a heavy memory footprint
when the caller invokes it in a loop because a new NetworkStats
instance is created whenever an addEntry is called.
This change introduces a new API that allows callers to
add a set of entries to a NetworkStats instance. This new
API will clone the instance only once, return the newly
created (and modified) instance, and ensure that the original
instance remains immutable.
Additionally, the change adopts config libraries for flagging
the API and corresponding CTS tests, since Android U-based
branches are no longer downstream of current development branches.
Test: atest FrameworksNetTests:android.net.connectivity.android.net.netstats.NetworkStatsApiTest
Test: atest CtsNetTestCases:NetworkStatsApiTest
Bug: 335680025
Fix: 357772271
API-Coverage-Bug: 357772271
Change-Id: I58513844e681c0621a6107ec4b198cd3957f289d
This CL updates the javadoc for NsdServiceInfo to make it clearer that a client must contain all the desired address records for the hostname, and all the other registrations must not have any address records for the same hostname.
Bug: 344799768
Test: None
Change-Id: I8eea39adf870a75de23bcafaf8e13d78ee330da4
This CL simplifies the code for validating the service by reducing a
level of indention.
Bug: 342954618
Change-Id: I8a239c3ea39560e4c2bc3b42e5be0a757a737fdd
If the IpSecTransform is being manipulated in
multiple threads, there is a race between the
clearing of the resource id (setting it to
INVALID_RESOURCE_ID and making binder calls
with it. This wasn't a significant problem before
becasue the only side effect was that it could
occasionally cause an IAE instead of an ISE when
the caller was doing something weird. Unfortunately
the exception type now matters because it is being
relied upon to provide a callback rather than a
throw in the event of an error. Accordingly reads of
mResourceId have to be synchronized against the
the possibility of close() of that resourceId to
ensure that the right exception is thrown on the
service side of the binder.
Bug: 336897538
Test: atest CtsNetTestCases:IpSecManagerTest
Change-Id: I21c893034efa7f322ae2aa81d6c7e00dc9ef8d2f