Commit graph android_packages_modules_Co.../framework-t
Message SHA1
Merge "Convert uses of @hide to block tag" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-09-08 04:21:26 -07:00
4910c42dc7
Convert uses of @hide to block tag
In most places the `@hide` doctag is treated as a block tag on its own
line. However, there are a few places where it is treated as an inline
doctag, e,g. `{@hide}`, and some places where it looks like a block
tag but is inline in the text, e.g. `Some text. @hide`. Dealing with
all the types increases the complexity of Metalava and makes it
slightly slower.

This change replaces the non-block tag forms with a block tag.

Flag: EXEMPT change the form of @hide does not change the API or behavior
Bug: 429965593
Test: m checkapi
Change-Id: I4ffe44a329dbcb7f0a7bd61af16c3bd99cacdac4

Paul Duffin   commited 2025-08-29 21:19:30 +00:00
6eaa841657
Remove service-side TrafficStats rate limit cache
The service-side TrafficStats rate limit cache is no longer needed as
client-side caching is now solely responsible for rate-limiting traffic
stats queries.

This commit removes:
- The `clearTrafficStatsRateLimitCaches` AIDL method.
- The service-side cache implementation, including member variables and
  logic within `NetworkStatsService`.
- Related feature flags and constants used for the service-side cache.
- All unit tests specifically for the service-side cache.

This simplifies the overall traffic statistics caching architecture by
centralizing rate-limiting responsibility on the client side.

Flag: EXEMPT refactoring
Test: atest ConnectivityCoverageTests --test-filter '.*NetworkStats.*' --update-device
Test: atest ConnectivityCoverageTests --test-filter '.*TrafficStats.*' --update-device
Fix: 428098676
Fix: 428097311
Change-Id: I41cbb80a52f04dcf387c3352677a91cb692ffe73

Junyu Lai   commited 2025-08-21 16:47:27 +08:00
e9eb8e2b8a
Merge changes I12e4d492,I4c787e9c,I52a36ebb into main
* changes:
  Add support for TestInterfaceMode to EthernetTracker
  Move call to setEthernetEnabled inside setIncludeTestInterfaces
  Add support for TestInterfaceMode in setIncludeTestInterfaces

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-23 14:16:42 -07:00
23ce59740a
Add support for TestInterfaceMode in setIncludeTestInterfaces
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

Patrick Rohr   commited 2025-07-23 10:00:51 -07:00
6822c19294
Add EthernetPortSelector class
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

Chuwei He   commited 2025-07-22 04:52:05 -07:00
66fef2ea8e
Merge "Prepare to move VCN: Add visibilities for tests" into main
Yan Yan   authored and   Android (Google) Code Review   commited 2025-07-15 13:09:27 -07:00
a5b6808587
Prepare to move VCN: Add visibilities for tests
Before moving VCN code, add the new code locations to the
"visibility" fields of Connectivity dependencies.

Bug: 379938062
Flag: EXEMPT; visibility changes
Test: presubmit
Change-Id: I51becaacb93d5e43b8b8234b80cb9b272181ad01

Yan Yan   commited 2025-07-10 20:47:00 +00:00
e82942e7c5
Update prefix for Persistence and MeteredOverride
This patch updates prefix for Persistence and MeteredOverride IntDef for
consistency.

Test: build
Bug: 397536853
Flag: EXEMPT mainline
Change-Id: Ic39c8d74900929f6ac95795bea2fbe9c686ec533

Chuwei He   commited 2025-07-02 22:46:43 -07:00
0a3ed119fe
Add methods to get metered override and persistence config in string
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

Chuwei He   commited 2025-07-02 19:41:42 -07:00
afc612e02e
Add metered overrride config to EthernetConfiguration
This patch metered override config to EthernetConfiguration.
This config indicates the static configuration of metered override.

Bug: 397536853
Test: atest ConnectivityCoverageTests
Flag: EXEMPT mainline

Change-Id: I37303bbb5a6803254e149bb374703e6a2e66c062

Chuwei He   commited 2025-07-02 18:12:33 -07:00
1939c90a98
Add hidden flags parameter to addInterfaceStateListener
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

Patrick Rohr   commited 2025-07-01 22:14:54 -07:00
3454b0bdee
[API] make ThreadNetworkSpecifier @SystemApi
This class can be used with ConnectivityManager#requestNetwork to
request connecting to a specific Thread network from system apps.

Bug: 377258309
Flag: com.android.net.thread.flags.thread_mobile_enabled
Change-Id: I80cb992380236b045e4e331b9861274d8cd10cfd

Kangping Dong   commited 2025-06-30 17:08:51 +08:00
c4d212c5d4
Add persisted logic to EthernetConfiguration
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

Chuwei He   commited 2025-06-25 23:25:37 -07:00
7e60f9a82f
Merge "Change EthernetPortInfo to EthernetPortState" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-06-18 21:26:04 -07:00
7882140d7d
Change EthernetPortInfo to EthernetPortState
This patch changes the name of class EthernetPortInfo to
EthernetPortState.

Bug: 397536853
Test: build
Flag: EXEMPT mainline
Change-Id: I7f42170cdde33ca31dea3d622678565ea5dc1026

Chuwei He   commited 2025-06-17 13:48:42 +09:00
d790973d3e
Improve annotation and javadoc for set/getTransportType APIs
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

Junyu Lai   commited 2025-06-12 14:03:04 +08:00
c5f7cf21b5
Merge "Add kill switch for storing transport types" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-06-10 16:52:20 -07:00
4be13fb54d
Add kill switch for storing transport types
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

Junyu Lai   commited 2025-06-10 17:57:11 +08:00
1c5f5b5270
Expose NetworkTemplate get/set transport type APIs
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

Junyu Lai   commited 2025-06-08 23:14:07 -07:00
19ff6a1025
Add NetworkTemplate get/set transport type methods
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

Junyu Lai   commited 2025-06-09 14:09:46 +08:00
dc7bfba12e
Support checking transport types in NetworkTemplate
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

Junyu Lai   commited 2025-05-28 18:24:56 +08:00
572575ee95
Support matches transport types in NetworkTemplate
Flag: EXEMPT implemented in the counter-part CL
Test: atest CtsNetTestCases --test-filter \
      'NetworkStats*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
      'NetworkStats*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
      'NetworkTemplate*' --update-device
Bug: 419123367
Change-Id: I0c8bf2e24502befd810081f519ff915491b0a905

Junyu Lai   commited 2025-05-27 20:35:40 +08:00
3fd36e5f93
Merge "Add NetworkCapabilities transport types into NetworkIdentity." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-27 00:41:35 -07:00
2a4acb194c
Add NetworkCapabilities transport types into NetworkIdentity.
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

Junyu Lai   commited 2025-05-24 00:30:41 +08:00
bebd4090ae
Merge "Optimize NetworkStats.filteredClone function." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-20 19:24:17 -07:00
8737133bc1
Add EthernetPortInfo class
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

Chuwei He   commited 2025-05-16 13:14:48 +09:00
76330fa8a2
Add MAC address support for EthernetNetworkSpecifier
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

Chuwei He   commited 2025-05-14 18:10:02 -07:00
4259f55ef1
Optimize NetworkStats.filteredClone function.
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

Richard Uhler   commited 2025-05-14 13:00:07 -07:00
27189f4dff
Implement offload only code path in NsdService for TV migration
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

Yuyang Huang   commited 2025-05-12 13:45:30 +09:00
af0d036f6e
Skip subtype PTR records in announcements/offload
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

Yuyang Huang   commited 2025-05-12 13:34:26 +09:00
e41b66393c
Make NsdManager.registerService() public API
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

Yuyang Huang   commited 2025-05-02 15:23:14 +09:00
9e74d41f3d
Add @UnsupportedAppUsage to NsdManager.registerService for MediaShell
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

Yuyang Huang   commited 2025-04-30 15:33:43 +09:00
d3bae6f3cc
Merge "Add EthernetConfiguration class" into main
Patrick Rohr   authored and   Android (Google) Code Review   commited 2025-04-24 13:37:32 -07:00
584fea045b
Add EthernetConfiguration class
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

Chuwei He   commited 2025-04-24 13:26:06 +09:00
e0e89ef66f
Avoid excessive allocation churn in network stats.
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

Richard Uhler   commited 2025-04-15 10:46:35 -07:00
5ed47754aa
Correct OffloadServiceInfo Javadoc
Updated the comment in OffloadServiceInfo to accurately reflect that the
ServiceType field should not include the ".local" suffix.

Test: TH
Change-Id: I8158b413dabeacdda2585ea065b2db2d4ca95e8f

Yuyang Huang   commited 2025-01-09 12:48:09 +09:00
65642656b7
Merge "in NetworkStatsAccess.checkAccessLevel, check SYSTEM_UID ahead" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-06 15:22:01 -08:00
8ec9d71510
Add API for FLAG_SKIP_PROBING
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

Remi NGUYEN VAN   commited 2024-12-24 16:00:53 +09:00
7a3423b65b
Expose NsdServiceInfo#getHostname
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

Remi NGUYEN VAN   commited 2024-12-23 09:40:02 +09:00
265216ba40
in NetworkStatsAccess.checkAccessLevel, check SYSTEM_UID ahead
to avoid possible deadlock from following DevicePolicyManager.isDeviceOwnerApp
move SYSTEM_UID checking ahead.

Change-Id: I182cadb175ca5028b6fe8e7f6316dcd349e32573

WeiZhang   commited 2024-12-15 14:06:34 -06:00
8fe5189801
Merge "Conditionally include VCN in Tethering module" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-12-11 10:41:55 -08:00
1f277bbab7
Conditionally include VCN in Tethering module
When the build system flag RELEASE_MOVE_VCN_TO_MAINLINE is true,
VCN framework lib will be included in the tethering boot classpath
fragment and the VCN service lib will be included in the
service-connectivity.jar

Bug: 375213246
Test: flag enabled: VCN libs are in the tethering module
      flag disabled: VCN libs are in the platform
Flag: RELEASE_MOVE_VCN_TO_MAINLINE
Change-Id: If0239eb1684b861b63794762915dab0d62379885

Yan Yan   commited 2024-12-09 12:04:12 -08:00
b4ccc6aff7
Introduce client-side rate limiting for TrafficStats APIs
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

Junyu Lai   commited 2024-12-06 08:13:08 +00:00
43b334ea5d
Remove synchronized block for test only variable
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

Junyu Lai   commited 2024-12-02 07:04:20 +00:00
219d7f9275
Expose Connectivity libraries to VCN and tests
This patch exposes Connectivity libraries to allow migrating VCN to
its own non-updatable framework and service libraries. It also
creates a utility library for VCN.

Bug: 369703242
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT no functional change
Change-Id: I1981f1cc824dcf426a76a0af8e4e3460fccb754e

Yan Yan   commited 2024-11-23 23:07:44 -08:00
587f996eb4
Merge "Drop the redundant type and caller uid checks for TrafficStats" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-11-06 08:58:27 +00:00
6258c4482f
Drop the redundant type and caller uid checks for TrafficStats
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

Junyu Lai   commited 2024-11-06 13:17:23 +08:00
739d200d35
Merge "Disable debug log by default" into main
Jaewan Kim   authored and   Gerrit Code Review   commited 2024-11-05 02:18:48 +00:00
555bbc4844
Merge "Add config for client-side traffic stats rate-limit cache." into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-10-31 07:22:36 +00:00
30ff675df5