Commit Graph

1129 Commits

Author SHA1 Message Date
Yuyang Huang
97caf8ea9f Merge "Handle downstream tethering interface addresses in MdnsSocketProvider" am: 885854c9ee am: 2215730e12
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2490879

Change-Id: Ifc04af1999382fa03379e65c752462d85f22d44a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-16 02:02:57 +00:00
Yuyang Huang
2215730e12 Merge "Handle downstream tethering interface addresses in MdnsSocketProvider" am: 885854c9ee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2490879

Change-Id: I1052d86478a5caf947369c7ca1bc14e2d065a966
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-16 01:32:49 +00:00
Yuyang Huang
700778be70 Handle downstream tethering interface addresses in MdnsSocketProvider
MdnsSocketProvider currently does not fill addresses of downstream
tethering interfaces in its callbacks. The interface addresses should be
properly updated by listening to the Netlink messages.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 267980538
Change-Id: I753e547a1b092703fe59c6c9e922ee8aca245f67
2023-04-15 21:55:51 +09:00
chiachangwang
f1b1fb4b7f Separate events usage for starting socket keepalives
This is a clean up commit to correct the javadoc of
NetworkAgent.CMD_START_SOCKET_KEEPALIVE. This event was used
between ConnectivityService/NetworkAgent, and also
ConnectivityService/KeepaliveTracker with different semantics.
This may confuse the developers to update the doc incorrectly,
so also separate the usage to different events.

Also move the event definitions together so that a new event
definition will not mis-use the existing values.

Test: atest FrameworksNetTests
Change-Id: I73ebd8abcc610531da3057da2d643a41befb2099
2023-04-14 07:43:56 +00:00
Chalard Jean
c8ef219c26 Improve doc for CSM#setGlobalProxy
Test: comment-only change
Change-Id: I597d2ae8297159202ed52daa2f96e792b6623040
2023-04-14 14:47:00 +09:00
Yan Yan
e5aed4c51e Merge "Retain subscription IDs on restricted test networks" am: 51db40f5e5 am: 5aed3bff05 am: 860598a6a4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2506442

Change-Id: I9e49ad24c24f30496945297ca3b7349ff40eac1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-31 05:04:41 +00:00
Yan Yan
815cedfcbb Merge "Retain subscription IDs on restricted test networks" am: 51db40f5e5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2506442

Change-Id: Ia0a32684c36081d8ad364b5105a8829480e35c95
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-31 04:16:22 +00:00
Yan Yan
9064ee95de Merge "Add allowed capabilities on non cellular test networks" am: d71f6efa89 am: 63df2d1b66 am: e607e8a4e0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2470461

Change-Id: I2dba5901aca1ff4283c7d1e122d258aa692dca5a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-30 19:13:17 +00:00
Yan Yan
ad3e1f3b08 Merge "Add allowed capabilities on non cellular test networks" am: d71f6efa89
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2470461

Change-Id: I35f2fa55c34628cae9cd6556497b0d385c24339e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-30 16:23:18 +00:00
Yan Yan
966fb798a1 Retain subscription IDs on restricted test networks
Fix the bug where subscription IDs will be cleared
on a restricted test network

Bug: 263415068
Test: NetworkCapabilitiesTest
Change-Id: I977781cd81f9d86858bd264825d66a2a69f6ce53
2023-03-30 07:49:13 +00:00
Yan Yan
acd71e68a6 Add allowed capabilities on non cellular test networks
This commit expands the allowed capabilities of non cellular test
networks to include another three values, so that CTS can verify
features that do network selection based on those capabilities.

It is relatively safe becuase for apps that request TRANSPORT_CELLULAR
and the affected capabilities, test networks will still not become their
default networks.

Bug: 263415068
Test: atest NetworkCapabilitiesTest(new tests)
Change-Id: I2e348e4722ecdaa6e277fe77968916ffa2f16af9
2023-03-22 18:27:19 -07:00
Paul Hu
5c28b172f7 Merge "Add a CompatChange flag to enable platform backend" am: 62503cfef1 am: fa2a4f33d9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2452427

Change-Id: I8211177f9cef3b2a36ab5e00a34d77346693e5c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-17 14:24:13 +00:00
Paul Hu
fa2a4f33d9 Merge "Add a CompatChange flag to enable platform backend" am: 62503cfef1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2452427

Change-Id: I9591abf64328d91a470bccb9816ad19bf09672f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-17 13:49:09 +00:00
Paul Hu
62503cfef1 Merge "Add a CompatChange flag to enable platform backend" 2023-03-17 13:14:19 +00:00
Paul Hu
2e0a88c0fa Add a CompatChange flag to enable platform backend
Apps targeting sdk < U are considered to use a legacy native
daemon as NsdManager backend, but other apps use a
platform-integration mDNS implementation as backend. So add a
CompatChange flag to enable platform backend for non-legacy
apps.

Bug: 270306772
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I7ba58f8a5186fb49ad5f8aeacc8b8234bef1eabe
2023-03-17 09:10:46 +08:00
Anton Hansson
893cd2592c Merge "Use filegroup defaults for framework sources" am: 41ad986490 am: 2b246a30df
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2489555

Change-Id: Ia00a74bb0665cda921f8ab8194c4e0dfced721be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-16 10:01:06 +00:00
Anton Hansson
2b246a30df Merge "Use filegroup defaults for framework sources" am: 41ad986490
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2489555

Change-Id: Ib228177586d24d210a1abf808af2557d929141c0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-16 09:27:51 +00:00
Anton Hansson
57f3d69fd5 Use filegroup defaults for framework sources
There's now a shared defaults module for this kind of filegroup. Use
that and remove the previously duplicated prop.

Bug: 271816210
Test: m
Change-Id: Ia4547984a73179fdfc98c427482dd10246f9722c
2023-03-15 10:36:52 +00:00
Chiachang Wang
3e50f69b9f Merge "Correct nullability and add extra check for underpinnedNetwork" am: e932d646b3 am: 0168ce6b10
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2483815

Change-Id: Id69e4e1f79c5f4ddda1a771b50f2a40289b4e3d4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-14 02:34:50 +00:00
Chiachang Wang
0168ce6b10 Merge "Correct nullability and add extra check for underpinnedNetwork" am: e932d646b3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2483815

Change-Id: I4de1de03e0de8750ea4bfd12b8a6bdffe10bab11
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-14 01:55:56 +00:00
chiachangwang
c51a705a45 Correct nullability and add extra check for underpinnedNetwork
As the review feedback, this commits address below concern.

1. The TCP keepalive code doesn't use the network parameter
at all. This parameter doesn't seem meaningful for TCP
keepalives. Starting a TCP keepalive with a non-null underpinned
network should throw IllegalArgumentException.

2. The feedback mention that the start version which takes a
@NonNull network should throw NPE if the network is null. But
Starting a NATT keepalive does not always require a underpinned
network. A new IkeSession started from Vpn will also not assign
the underpinned network at the initial stage which means
underpinned will be null until setNetwork() is called. Thus,
the underpinned network should be @Nullable instead.

Fix: 271797087
Test: atest FrameworksNetTests
Change-Id: Ieb57a7b15a06b2ccd94358b65cc00768c4f62e7d
2023-03-13 09:00:43 +00:00
Cole Faust
14ac5adac5 Baseline NewApi issues
NewApi was recently updated to support linting methods in
the system, module_lib, and system_server sdks, and was
demoted to a warning due to the new issues it finds.
Baseline all the new issues that NewApi can be made an error
again.

These cls were generated automatically by a script that
copied the NewApi issues from the reference baselines.

Bug: 268261262
Test: m lint-check
Change-Id: I5b97824b873987073bd17a9af16bdf822f649f4a
2023-03-09 14:07:52 -08:00
Sherri Lin
8e5dd3d277 Merge "Update ConnectivityManager javadoc" am: 9e8162c6e0 am: 5eaf68e0e1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2423128

Change-Id: Ie4649b1fcf72c07c6a4814e420878cd290e68439
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-07 17:57:34 +00:00
Sherri Lin
5eaf68e0e1 Merge "Update ConnectivityManager javadoc" am: 9e8162c6e0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2423128

Change-Id: I73d854cd8f891b457c6474c568f1a024adc4ebef
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-07 17:25:48 +00:00
Sherri Lin
9e8162c6e0 Merge "Update ConnectivityManager javadoc" 2023-03-07 16:50:15 +00:00
Chalard Jean
72de76b501 [DO NOT MERGE]Change @link to @code for classes not yet in tm-mainline-prod
Test: TreeHugger
Bug: 271772099
Ignore-AOSP-First: stopgap fix for old builds like tm-mainline-prod
Change-Id: Ie4f7c7d6eca1f64b8ebd948d67d41ce13759871a
2023-03-06 02:58:59 +00:00
Chalard Jean
82f1b5e818 Improve doc for NetCaps and NetRequest, and add slice XML docs
Test: comment-only change
Bug: 266524688
Change-Id: Iffeba94ea8e2f4913188ae33933ef30c532ea13a
2023-03-03 16:10:37 +09:00
Yuyang Huang
a908d816de Merge "Check network slicing declaration for network request" 2023-03-01 02:13:31 +00:00
Yuyang Huang
96e8bfee5f Check network slicing declaration for network request
When the application wants to request network with
NET_CAPABILITY_PRIORITIZE_BANDWIDTH or
NET_CAPABILITY_PRIORITIZE_LATENCY, it has to declare
PackageManager.PROPERTY_NETWORK_SLICE_DECLARATIONS property and also
adds the declaration in a separate XML files. Otherwise, the request
will fail with a SecurityException being thrown.

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 266524688
Change-Id: I6affc857b803211517368da288e1b2fdc06a955b
2023-02-28 17:38:30 +09:00
Kangping Dong
7dc4459d33 Merge "add TRANSPORT_THREAD to NetworkCapabilities" 2023-02-28 07:16:16 +00:00
Motomu Utsumi
7f3dfbfacf Merge "Add getUidFirewallRule to ConnectivityManager" 2023-02-17 01:53:00 +00:00
Quang Luong
0f6a2e69cd Merge "Allow SUW to access registerSystemDefaultNetworkCallback" 2023-02-15 20:22:10 +00:00
Chiachang Wang
b7f97fd70e Merge "Add underpinned Network parameter in SocketKeepalive.start()" 2023-02-14 12:35:30 +00:00
chiachangwang
676c84ef98 Add underpinned Network parameter in SocketKeepalive.start()
Take a Network parameter to have an one-to-one mapping between
keepalive and its underpinned network on the automatic keepalive.

Existing design could not really tell which network should the
automatic keepalive check for the TCP socket status if there are
multiple automatic keepalives enabled, e.g. Bothe IWLAN and VPN
on WiFi enable the automatic keepalive. The keepalive for IWLAN
should check if there are any TCP sockets on the IWLAN network
instead of VPN network.

Bug: 259000745
Test: atest FrameworksNetTests
Test: Cts in the follow up commit
Change-Id: I7353f4ef43e8fdad02c4d4a0bb5f6efa7d94c1b4
2023-02-14 10:29:19 +00:00
Jean Chalard
17cbf06773 Correct a wrong doc tag
Change-Id: Icefc5599d0a500ccd9b5d2247ece75ac5cdc5c7e
Test: doc-only change
2023-02-13 05:08:11 +00:00
Jean Chalard
b5ebe944b5 Merge changes I99d494d3,I208ceceb
* changes:
  [DK4-0]Add CM#setTestLowTcpPollingTimerForKeepalive for testing
  [DK3] Send onPause/onResume keepalive callbacks
2023-02-13 05:06:20 +00:00
Quang Luong
98858d6b27 Allow SUW to access registerSystemDefaultNetworkCallback
registerSystemDefaultNetworkCallback is required by WifiTrackerLib to
detect the system default network for UI purposes. Currently this API is
allowed for holders of the NETWORK_SETTINGS permission, but not
NETWORK_SETUP_WIZARD. Since SUW also uses WifiTrackerLib, we should
allow this API for NETWORK_SETUP_WIZARD as well.

Bug: 230643853
Test: atest ConnectivityServiceTest
Change-Id: Ic01a186f91ed67b4603b6b8964921be7473a483a
2023-02-11 00:31:59 +00:00
Yuyang Huang
90a2cbdd8d Moves all compatibility flags to ConnectivityCompatChanges.java
ConnectivityCompatChanges.java becomes the centralized place for all the
CompatChanges used in the Connectivity module. By putting all the
CompatChanges here, we are able to manage them under a single
platform_compat_config.

Bug: 268440216
Test: atest FrameworksNetTests
Change-Id: I3e17af545718073d7d1c96e27298e7790563fd33
2023-02-09 19:51:37 +09:00
Sherri Lin
443b7182a6 Update ConnectivityManager javadoc
Removed usages of throws with @link that generates bad HTML and added
@CallbackExecutor on executors.

Bug: 268170423
Test: atest ConnectivityServiceTest
Change-Id: I2e4264c201b1779b1636e3f1c581237490fd0930
2023-02-08 04:49:29 +01:00
Jean Chalard
b5a87674f0 Merge "Use the binder to identify keepalive in IConnectivityManager" 2023-02-07 08:17:26 +00:00
David Gutierrez
c1e778a67b Merge "Revert "Adds document for self certified network capabilities"" 2023-02-06 21:21:20 +00:00
David Gutierrez
ad7e542ab4 Revert "Adds document for self certified network capabilities"
This reverts commit 75c7df1cab.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_tm-mainline-prod&target=sdk_phone_x86_64-sdk&lkgb=9566659&lkbb=9569194&fkbb=9566666, bug 267986902
BUG: 267986902

Change-Id: Ic65c729f95920e73c11bcf0e3b83e4331a678055
2023-02-06 21:01:58 +00:00
chiachangwang
e0192a7433 [DK4-0]Add CM#setTestLowTcpPollingTimerForKeepalive for testing
The default TCP polling alarm timer is very large(2 mins).
It's expensive in the CTS to wait for a couple alarms.
The polling alarm should be deprecated soon and replace
with callback design, so add the hidden method for testing
purpose to support the short term usage until design is
replaced with callbacks.

With the hidden method, the alarm timer will decrease to
1 second for a specified time period. The TCP sockets status
could be verified every 1 second.

Bug: 259000745
Test: m ; atest HostsideVpnTests with the follow up test
Change-Id: I99d494d3b50b2fbee73b926e92e97b1e194d43d4
2023-02-06 13:25:01 +00:00
Chalard Jean
bdb8282604 [DK3] Send onPause/onResume keepalive callbacks
Test: CTS in the patch immediately on top of this, [DK4]
Change-Id: I208ceceb37c7977452479361f70f046fabafb37a
2023-02-06 13:23:13 +00:00
Chalard Jean
f0b261e7cc Use the binder to identify keepalive in IConnectivityManager
This is much simpler and less error-prone, as well as less
subject to race conditions.

It also allows for cleaning up some TODOs.

Test: FrameworksNetTests
      CtsNetTestCases
Bug: 267116236
Change-Id: I470c709446946ef35a0324427defe2f58b434339
2023-02-06 13:22:53 +00:00
Yuyang Huang
c8c0d1f03b Merge "Adds document for self certified network capabilities" 2023-02-06 06:00:53 +00:00
Yuyang Huang
75c7df1cab Adds document for self certified network capabilities
String from Android 14, the user must explicitly declare some
capabilities in the application if the application need to call
ConnectivityManager.requestNetwork() with those capabilities.

Test: atest FrameworksNetTests
Bug: 266524688
Change-Id: I8b4816ae3a425ff59d2c1ef09331e079b0e9596e
2023-02-06 11:35:07 +09:00
Chalard Jean
98732dbd6d Use the binder token to reference AutoKI in alarm
This patch uses the binder token represented by the callback
to communicate the identity of the AutoOnOffKeepalive through
the alarm mechanism. This is a lot more robust and easy to
understand.

Addressing this, on top of the robustness and readability
advantages, corrects three bugs.

• The |obj| in the message to CMD_MONITOR_AUTOMATIC_KEEPALIVE
  is now the binder token both on the sender side and the
  receiver side, while the previous code had a Network in the
  sender while the receiver expected AutoOnOffKeepalive,
  crashing the system server with a wrong cast.
• The intent sent in the alarm would have a yet-uninitialized
  value for the slot, so it would not be possible to find the
  auto keepalive when the alarm fires.
• When the slot is reassigned, the alarm continued to fire
  with the same slot value, so the auto keepalive would no
  longer be found after a pause/resume cycle that would
  change the slot.

Test: FrameworksNetTests
Change-Id: Ibdbfcd884e0d3559206cbaae7b6b7a524972c3ca
2023-02-04 08:05:00 +00:00
Motomu Utsumi
900b806a3b Add getUidFirewallRule to ConnectivityManager
Upcoming CLs use this method to add chain status to failure log of
ConnectivityManagerTest#testFirewallBlocking which is a flaky test

Test: m
Bug: 262141231
Change-Id: Ieb6b4402a3435571decbd8a26fdf666b2db732fe
2023-02-01 17:05:39 +09:00
Chalard Jean
23f1bfd471 Always have an AutomaticOnOffKeepalive to manage a KI
Test: FrameworksNetTests 'CtsNetTestCases' CtsHostsideNetworkTests
Change-Id: Ic216b525d8297fce0f390daae327e667a14b7775
2023-01-31 02:34:44 +00:00