Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Revert^2 "Check whether CarrierConfigManager is null"
This reverts commit 7b7cfa45a6.

Reason for revert: prevents crash with no carrierConfigManager support
Test: atest ConnectivityCoverageTests

Change-Id: I9e91d2d25d16c0c2a39388f08a49bef7b17fda42

Jimi Chen   commited 2025-05-21 07:24:00 +00:00
232c944de3
Merge "Revert "Check whether CarrierConfigManager is null"" into main
Priyanka Advani (xWF)   authored and   Android (Google) Code Review   commited 2025-05-20 14:22:25 -07:00
730bb0bfe9
Revert "Check whether CarrierConfigManager is null"
This reverts commit b936f0c5fd.

Reason for revert: Droidmonitor created revert due to b/418898788. Will be verifying through ABTD before submission.

Fix: 418898788
Change-Id: Ia47f0cc9a33ed33f9d53064878992081a792f1ad

Priyanka Advani (xWF)   authored and   Android (Google) Code Review   commited 2025-05-20 11:19:03 -07:00
7b7cfa45a6
Merge "Remove RecorderCallback." into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-05-19 19:23:31 -07:00
0d0fc56209
Merge "Check whether CarrierConfigManager is null" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-05-19 18:48:10 -07:00
87e73ef81a
Check whether CarrierConfigManager is null
Currently, the CarrierConfigManager is null on several non-phone
projects, e.g. tv, wear devices. This is because CarrierConfigManager
is not supported on these devices.

This change checks whether it is null and improve error handling.

Flag: android.net.platform.flags.avoid_bad_wifi_from_carrier_config
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.MultinetworkPolicyTrackerTest \
      --update-device
Fix: 416654774
Change-Id: I40fa7139a349472b1d5cbd36b5bff286309aebc5

Jimi Chen   commited 2025-05-19 11:56:32 +00:00
b936f0c5fd
Remove RecorderCallback.
This class doesn't actually serve a purpose, it only makes
TestableNetworkCallbck more complex.

Test: CtsNetTestCases ConnectivityCoverageTests
Flag: EXEMPT test-only
Change-Id: I39a598b82a3215384bdfe04980f4b280ab2c2716

Chalard Jean   commited 2025-05-19 16:35:53 +09:00
f2994122c1
Merge "Add EthernetPortInfo class" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-05-16 01:39:54 -07:00
59f8d2b8ed
Merge "Add a performance test for filteredClone." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-15 22:42:27 -07:00
c1844e5f8e
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 a performance test for filteredClone.
atest ConnectivityCoverageTests:android.net.connectivity.android.net.NetworkStatsTest#testFilteredPerformance -- --auto-collect DEVICE_TRACE

Flag: TEST_ONLY
Change-Id: Id47edc05bb39ce334da819129d4ee13b0796cbb5

Richard Uhler   authored and   Lorenzo Colitti   commited 2025-05-15 21:06:04 -07:00
bcd9653ed3
Merge "Enable REQUEST_RESTRICTED_WIFI and CARRIER_SERVICE_CHANGED_USE_CALLBACK by default with kill switch" into main
Ying Xu   authored and   Android (Google) Code Review   commited 2025-05-15 09:44:48 -07:00
d49e884b27
Remove deprecated SC_V2 constant
Test: TH
Flag: EXEMPT test-only
Change-Id: I3444fad305f49294ed8c3a850b631f385678c117

Chalard Jean   commited 2025-05-15 09:03:59 +09:00
9373e3442e
Enable REQUEST_RESTRICTED_WIFI and CARRIER_SERVICE_CHANGED_USE_CALLBACK by default with kill switch
Bug: 416044405

Test: atest ConnectivityManagerTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Change-Id: I1b67c00ce3d4054414ce9c538ec4d7b9a55b4302
Flag: com.android.net.flags.request_restricted_wifi

Ying Xu   commited 2025-05-14 10:56:45 -07:00
7e4e0952f8
Merge "Add unit test for filteredClone." into main
Richard Uhler   authored and   Android (Google) Code Review   commited 2025-05-13 13:02:06 -07:00
918c8e490f
Merge "Fix IPv4 link-local, default routes network guess" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-12 21:17:59 -07:00
bff79be55a
Fix IPv4 link-local, default routes network guess
Inet4Address#isLinkLocalAddress can also return true if the address is
in the 169.254.0.0/16 range.

The code should also only consider directly-connected routes for
guessing, as default routes would match any address.

This is not used in platform code. This code path is only used when the
mDNS stack is used as a library.

Bug: 415483522
Test: atest
Flag: EXEMPT dead code in the platform
Change-Id: I53d8ad7f96368d4609b1baa804cd75aa65628c0c

Remi NGUYEN VAN   commited 2025-05-13 11:36:00 +09:00
5453629266
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
Add unit test for filteredClone.
BUG: 416650909
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.NetworkStatsTest
Flag: TEST_ONLY
Change-Id: I03d38e6960d82b2b2b98454fba68359800188fff

Richard Uhler   commited 2025-05-09 10:11:11 -07:00
26bbed3c5b
Merge "Extend QosFilter address matching function" into main
Sewook Seo   authored and   Android (Google) Code Review   commited 2025-05-09 01:02:33 -07:00
ceb29e6cdf
Extend QosFilter address matching function
Extend QosFilter address match function for IP address range based on
prefix length.

Bug: 406146808
Bug: 399960748
Flag: com.android.net.flags.qos_filter_ip_range_matching
Test: atest CtsNetTestCases
Test: atest ConnectivityCoverageTests
Change-Id: I78d995fda111d258da9a912c7afa5e472e43437f

Sewook Seo   commited 2025-05-08 22:37:32 -07:00
6305252415
Merge "Log improvement when the meta-data format is unexpected" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-05-08 19:59:45 -07:00
27aa3082b6
Log improvement when the meta-data format is unexpected
Currently, if the value of opt-in meta-data is not a String,
calling Bundle#getString would result in flooding the system
log with Bundle warning log and callstacks, but without
useful information like the package name.

Thus, a manual type check is performed, and the package name
is logged if a mismatch occurs.

Flag: EXEMPT flagged with a kill switch
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideSatelliteDataOptInTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
      --update-device
Bug: 416351099
Change-Id: Iae8e26f657e009edb8630dbbe64c7e3e958abc43

Junyu Lai   commited 2025-05-09 09:15:12 +08:00
4943a17fb6
Merge "Implement network avoid bad wifi from carrier config" into main
Jimi Chen   authored and   Android (Google) Code Review   commited 2025-05-08 17:46:53 -07:00
ae13aeb0fd
Add Kill Switch for PermissionMonitor Refactoring
As a follow-up to ag/33089478 and ag/33101784, the intent
receiving and dispatching logic was refactored and centralized
within the newly introduced BroadcastReceiveHelper.

However, due to the potential risks associated with this
refactoring, a kill switch is being added specifically for the
PermissionMonitor refactoring. This will allow for reverting
to the previous implementation (potentially involving code
duplication) to mitigate risks if issues arise.

Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest \
      --update-device
Bug: 410731080
Change-Id: I7889ef457d841c750da60a80e50ed6208c45448f

Junyu Lai   commited 2025-05-08 19:01:25 +08:00
638c43f201
Implement network avoid bad wifi from carrier config
Flag: android.net.platform.flags.avoid_bad_wifi_from_carrier_config
Bug: 410976315
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.MultinetworkPolicyTrackerTest
Change-Id: I89c579a8d5c7299303278280c463aa4c7c5bea99

Jimi Chen   commited 2025-05-08 07:25:36 +00:00
0881fc0a7d
Merge "Update link properties early for VPN networks" into main
Paul Hu   authored and   Android (Google) Code Review   commited 2025-05-07 22:28:58 -07:00
c360088112
Merge "Ensure Thread network is never mDNS capable" into main
Handa Wang   authored and   Android (Google) Code Review   commited 2025-05-06 19:48:34 -07:00
0c23270fbc
Ensure Thread network is never mDNS capable
Thread doesn't use mDNS and we should prevent NsdService from sending any mDNS traffic to Thread.

Bug: 414258735
Test: CI
Flag: EXEMPT bugfix
Change-Id: I62299769cd44d2984b81b273adea7ce459d3d773

Handa Wang   commited 2025-05-06 19:34:34 -07:00
b59c829ff1
Merge "Use the corresponding PackageManager for different users" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-05 21:58:40 -07:00
8c31a84f9f
Use the corresponding PackageManager for different users
Currently, isSatelliteDataOptimizedApp utilizes the PackageManager
from the primary user's context. However, if the added package is
not visible to the primary user, the satellite controller will
fail to parse the required information from the AndroidManifest.

Therefore, the corresponding PackageManager should be used when
a package is being checked.

Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
      --update-device
Test: Manual:
      1. Create and setup 2nd user.
      2. adb install --user 10 CtsHostsideSatelliteDataOptimizedWithMetaData.apk
      3. adb shell dumpsys connectivity
      4. adb uninstall com.android.cts.net.hostside.satellitedataoptin.testapp
Bug: 410731080

Change-Id: I7adadb3449ec2ff984e6672ffb97919a2418e9b7

Junyu Lai   commited 2025-05-06 10:59:50 +08:00
988d00e57b
Format MdnsInterfaceAdvertiserTest with ktlint
Test: TH
Flag: EXEMPT test only change
Change-Id: I1f278dfebb17836ff0a928c08b68a7266ac4d90a

Yuyang Huang   commited 2025-05-04 14:39:36 +09:00
21a4193c7b
Merge "Read meta-data instead of property" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-01 22:47:52 -07:00
3305741269
Read meta-data instead of property
Currently, the SatelliteAccessController checks if apps are
opt-in via a property tag under the application. This is
incorrect because PROPERTY_SATELLITE_DATA_OPTIMIZED is an
existing, released meta-data usage for Android B and needs
to be preserved.

Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
  --update-device
Bug: 410731080
Change-Id: If09890faf5d208d007179ecc29b7cf16f6fe6ebb

Junyu Lai   commited 2025-05-02 12:08:38 +08:00
0beea1e992
Merge "Enforce run on handler thread for SatelliteAccessController" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-01 20:30:51 -07:00
be4ecf0ac4
Enforce run on handler thread for SatelliteAccessController
This is a no-op refactoring that ensures events are handled
on the handler thread. While this is already the case in
production code, it's not consistently true in the tests.

This change adds the necessary methods for faking events
on the handler thread while maintaining readability in the
tests.

Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
      --update-device
Bug: 410731080
Change-Id: I816233a823314c4c276138438bbaf33f781eccfe

Junyu Lai   commited 2025-05-02 09:50:40 +08:00
00625abeda
Merge changes Id3eaa838,If07fb6c1 into main
* changes:
  Move failWithErrorReason to a common place
  Enable the last preference tests

Jean Chalard   authored and   Android (Google) Code Review   commited 2025-04-30 20:05:50 -07:00
175e8aeebf
Deduplicate fallback UID callbacks
Currently, onUserAdded calls onRoleSmsChanged, which triggers a
fallback UIDs callback.  Updating opt-in UIDs also triggers a
callback. The callback triggered by onRoleSmsChanged actually
not necessary and should be removed.

Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
      --update-device
Bug: 410731080

Change-Id: Ifc6aa8d6b798cca2bfc575f986a012c52ea75667

Junyu Lai   commited 2025-04-30 16:12:06 +08:00
f0e3d9b1d7
Improve naming for SatelliteAccessController
This is a no-op refactoring, which renames several methods and
variables to more accurately reflect their functionality and
follow the naming style.

Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
--update-device
Bug: 410731080

Change-Id: I84b9eca60f2b8543b8bdb7cf972103b79105e670

Junyu Lai   commited 2025-04-30 11:58:49 +08:00
b0b5dcf96e
Merge "Listen to onExternalApplicationsAvailable in SatelliteAccessController" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-28 06:37:49 -07:00
bc08a1ffcb
Listen to onExternalApplicationsAvailable in SatelliteAccessController
For maintaining constrained data satellite opt-in apps, this is
needed for tracking apps installed on the storage.

Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
  --update-device
Bug: 410731080
Change-Id: I2a686a5a37747de97dcee6b78f66965cb4fd9942

Junyu Lai   commited 2025-04-28 16:35:36 +08:00
63dbd3ec93
Update link properties early for VPN networks
When LinkProperties are updated after a private DNS configuration
is set in updateNetworkInfo(), particularly when private DNS mode
is set to opportunistic and the VPN server uses its own DNS
servers, this can cause the private DNS to use the underlying
network for TLS handshaking, potentially leading to a leak.
To fix this, adjusting the order of operations—setting the private
DNS configuration before updating LinkProperties should resolve
the issue. This ensures that private DNS validation occurs after
the VPN's network configuration is fully applied.

Bug: 274867806
Test: atest ConnectivityCoverageTests
Flag: EXEMPT legacy flag early_link_properties_update_for_vpn
Change-Id: If684b51e6522a8284d5baee8db0d2f767405d359

Paul Hu   commited 2025-04-28 01:16:25 -07:00
515efcf47d
Merge changes Iabc2fad0,I2078330b into main
* changes:
  Improve TestableNetworkOfferCallback
  Add a way to poll with a position for ReadHead

Jean Chalard   authored and   Android (Google) Code Review   commited 2025-04-27 23:25:04 -07:00
74dcb4637c
Merge "Add EthernetPort class" into main
Chuwei He   authored and   Android (Google) Code Review   commited 2025-04-27 22:56:01 -07:00
8e31d9d8e9
Merge changes I579b3cd9,Ib008e63c into main
* changes:
  Allow QuicConnectionCloser to close loopback QUIC connection
  Enable QUIC connection close by default in ConnectivityService

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-04-27 22:20:38 -07:00
5ae058b9d4
Enable QUIC connection close by default in ConnectivityService
This feature will be controlled by the caller.
Cronet calls the register/unregisterQuicConnectionClosePayload APIs only
when the Chromium experiment flag is enabled
(http://crrev.com/c/6421621/).

This CL also updates testRegisterQuicConnectionClosePayload
to be skipped on U or older releases since FIREWALL_CHAIN_BACKGROUND is
supported on V or higher releases.

Flag: EXEMPT guarded by chromium flag
Bug: 311792075
Test: TH
Change-Id: Ib008e63c585cfe8775b25783cd55b0873bb5e2f0

Motomu Utsumi   commited 2025-04-28 12:52:58 +09:00
2ea5939672
Add EthernetPort class
This patch adds EthernetPort class which is used to track configuration
of ethernet networks internally.

Bug: 397536853
Test: atest ConnectivityCoverageTests:android.net.connectivity.
      com.android.server.ethernet.EthernetPortTest
Flag: EXEMPT mainline

Change-Id: Iba1c4461ae7d666aa31c076baa33c32c2c1f7603

Chuwei He   commited 2025-04-27 20:52:26 -07:00
8092ae7d29
Pipe the satellite network opt-in UIDs down to ConnectivityService
Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
  --update-device
Bug: 410731080
Change-Id: I76a57a3c42659b594cd541c55e0e179062461085

Junyu Lai   commited 2025-04-28 10:21:57 +08:00
2fd0d11db3
Improve TestableNetworkOfferCallback
Update it to follow the latest conventions and add support for
eventuallyExpect.

Test: ConnectivityCoverageTest
Flag: EXEMPT test-only change
Change-Id: Iabc2fad051b874e3e18a0645361409f0427891fb

Chalard Jean   commited 2025-04-27 15:54:34 +09:00
5f3997b6af