Commit graph android_packages_modules_Co.../framework/src/android/net
Message SHA1
Address comment from ag/12107302
Test: trivial doc-only change
Bug: 140807677
Change-Id: I57440e8b54709a2f0e8c875d30f2c295fa3e1f3d

Chalard Jean   commited 2023-07-27 17:29:18 +09:00
f8d1d6c4f9
NetworkCapabilities: initialize ALL_VALID_CAPABILITIES without loop
This change also removes the MIN_NET_CAPABILITY constant that is not
actually used and can always be re-added in the future (though, I would
imagine that NetworkCapabilities will not be deprecated / removed in
numerical order).

Test: TH
Change-Id: I97ccbc9e915eb74a0ef52c576e16fc8ce8d5b646

Patrick Rohr   commited 2023-07-19 14:24:00 -07:00
7a042d869f
Merge "Deduplicate the isIpv6ULA implementation." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-07-19 02:25:20 +00:00
4b19802eee
Deduplicate the isIpv6ULA implementation.
Leverage the ConnectivityUtils#isIPv6ULA implementation which is also
accessible for modules, to deduplicate the implementation.

Bug: 183601771
Test: TH
Change-Id: I0943cd76f95e2f54d619015231f68b326194c8b9

Xiao Ma   commited 2023-07-18 20:04:43 +09:00
a74b0066e0
NetworkCapabilities: convert ALL_VALID_CAPABILITIES to long
ALL_VALID_CAPABILITIES should be a long, since there are now 35 NetworkCapabilities that are stored in a bitfield.

This caused NetworkCapabilities to be lost during parceling.

Bug: 291160389
Test: TH
Change-Id: Ia021ba5fd2094fdaec87446c73de2037c920c4f1

Patrick Rohr   commited 2023-07-18 02:35:32 +00:00
200bd72898
Correct typo variable
Bug: 196453719
Test: atest FrameworksNetTests
Change-Id: I97604d077433f4c5505912f9cbebab77a43fb548

chiachangwang   authored and   Chiachang Wang   commited 2023-06-15 01:43:07 +00:00
980e767188
Add helper method to generate a v6 NAT-T keepalive packet
This is a part of preliminary work for sending a v6 NAT-T
keepalive packet in a v6 only network. This commit
release the constraint on constructing a v6 NAT-T keepalive
packet.

Bug: 196453719
Test: Manually connect to v6 only network and check if the
      keepalive packets are sent with subsequent commit
Test: atest FrameworksNetTests with the updated test
Change-Id: I9dc96e840265c5dee6b9e3ef2b3901a0aeb4ff9e

chiachangwang   commited 2023-06-13 11:50:13 +00:00
c18f0bbbb3
Set DF flag on NAT-T keepalive packet
This commit
- Set the DF flag on the NAT-T keepalive packet
- Add comment for TTL value
- Do some cleanups

Bug: 196453719
Test: m
Change-Id: I401ae52d8f16e43120210cdea223fd251d53ea3b

chiachangwang   authored and   Chiachang Wang   commited 2023-06-07 02:05:27 +00:00
c6a2f6faf5
Make a v4 nattKeepalivePacket helper method
This is a preparation change for the subsequent changes to
separate the logic for constructing a v4 NAT-T keepalive
packets to a dedicated method.

Bug: 196453719
Test: atest FrameworksNetTests
Change-Id: If72b4875e65a547bbf90367eacce7b145358006a

chiachangwang   authored and   Chiachang Wang   commited 2023-06-07 02:05:10 +00:00
df347448a1
Fix a bug where the PAC proxy port is not set correctly.
Test: new test for this behavior in the preliminary change
Test: FrameworksNetTests NetworkStackTests
Fixes: 138810051
Fixes: 140610528
Change-Id: I95a979d232fb60ece2e33e972bf5d66d20357a1f

Aaron Huang   authored and   Chalard Jean   commited 2023-06-05 20:24:59 +09:00
9fe47bee09
Merge "DO not throw exception for ERROR_NO_SUCH_SLOT error"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-05-23 07:13:52 +00:00
95336cf4fc
DO not throw exception for ERROR_NO_SUCH_SLOT error
There are multiple independent reasons a keepalive can stop. Some
are software (e.g. the app stops the keepalive) and some are hardware
(e.g. the SIM card gets removed). Therefore, there is a very low
probability that both of these happen at the same time, which would
result in the first stop attempt returning SUCCESS and the second
stop attempt returning NO_SUCH_SLOT. Such a race condition can be
ignored with a log, not to crash the system. Change to wtf log so
that the issue could still be visible since this implies possible
bugs in the system.

Also update the javadoc for SocketKeepalive.ERROR_NO_SUCH_SLOT.

Bug: 281484381
Test: atest FrameworksNetTests
Change-Id: I316a2193fc7302b04e074ff0b03dc43946fe5ce6

chiachangwang   commited 2023-05-23 05:08:45 +00:00
75673ba502
Merge "Improve doc for CSM#setGlobalProxy"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-05-23 04:04:45 +00:00
b92d8ccd39
LinkProperties: use ordered comparison for P-CSCFs - only on U+
to make sure a mainline update doesn't break devices in the field

Test: TreeHugger
Bug: 268479036
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iadcd861509d31b3ed6352d452a159cd89af479dd

Maciej Å»enczykowski   commited 2023-05-18 05:57:51 +00:00
f7939fa8d1
Merge "Fix agents disconnecting in SUSPENDED state."
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-05-17 01:59:18 +00:00
ec4511c8aa
Fix agents disconnecting in SUSPENDED state.
Network state is not changed to disconnected when a networkagent
is disconnected and network state is SUSPENDED.

So the function requiresClat return true. Clat is not stoped.

Bug: 277682237
Test: atest FrameworksNetTests

Change-Id: I5edfcf64aca5d2d34325d722dd29fab41bcf2600

wangshengrjxtjcb   authored and   Motomu Utsumi   commited 2023-05-16 16:35:03 +09:00
fd5d3d90e1
LinkProperties: use ordered comparison for P-CSCFs.
P-CSCF list is ordered list. Two lists with same servers but
in different order are not equal. Use proper comparison.

The P-CSCF address is a kind of entry point (proxy) of Server
for IMS transaction between device and IMS Server.  It can have
multiple addresses as a list. Even if the same addresses have
different orders, it is assumed that the server order has changed.

Bug: 268479036
Test: TreeHugger
Change-Id: Ia1884f37739a20d871dd0024cc72cb18c083dc8e

Maciej Å»enczykowski   commited 2023-05-07 13:14:15 +00:00
b0fc6627a6
Merge "Expose internal representation of transport types."
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-05-02 06:43:07 +00:00
c745e52e04
Move ConnectivityResources to service-connectivity
The ConnectivityResources class is only usable with QUERY_ALL_PACKAGES
permission, so it is not generally usable in framework-connectivity. It
is also backed by the ServiceConnectivityResources APK, which is
intended as resources for service-connectivity.

Move the class to service-connectivity and update callers. CTS needs a
way to determine the supported keepalive count as it used the
resources from KeepaliveUtils as @hide API, so provide a
ConnectivityManager @hide API for testing.

Bug: 279108992
Test: atest
Change-Id: I3c9a77c580b5ab87c922c32778bce15dc33b4d1d

Remi NGUYEN VAN   authored and   Motomu Utsumi   commited 2023-04-28 19:18:39 +09:00
bee2ee14f3
Expose internal representation of transport types.
Add getTransportTypesInternal as a hidden api for internal callers. This
will be used for any metrics that need to store the transport types of a
network.

Bug: 273451360
Test: atest FrameworksNetTests
Change-Id: I527638e5408e7971a450135345e7e51b6125d665

Hansen Kurli   commited 2023-04-26 13:09:35 +00:00
13189e957d
Merge changes I33bc80cc,Ie84e2cd4
* changes:
  EthernetManagerTest: update tests that bring up tap without carrier
  TestNetworkService: use IFF_NO_CARRIER to bring up iface without carrier

Treehugger Robot   authored and   Gerrit Code Review   commited 2023-04-20 18:01:28 +00:00
fd402476f1
Merge "Separate events usage for starting socket keepalives"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-04-17 02:32:00 +00:00
2cf6b2c4fd
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

Yuyang Huang   commited 2023-04-15 21:55:51 +09:00
700778be70
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

chiachangwang   commited 2023-04-14 07:43:56 +00:00
f1b1fb4b7f
Improve doc for CSM#setGlobalProxy
Test: comment-only change
Change-Id: I597d2ae8297159202ed52daa2f96e792b6623040

Chalard Jean   commited 2023-04-14 14:47:00 +09:00
c8ef219c26
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

Yan Yan   commited 2023-03-30 07:49:13 +00:00
966fb798a1
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

Yan Yan   commited 2023-03-22 18:27:19 -07:00
acd71e68a6
Merge "Add a CompatChange flag to enable platform backend"
Paul Hu   authored and   Gerrit Code Review   commited 2023-03-17 13:14:19 +00:00
62503cfef1
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

Paul Hu   commited 2023-03-17 09:10:46 +08:00
2e0a88c0fa
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

chiachangwang   commited 2023-03-13 09:00:43 +00:00
c51a705a45
Merge "Update ConnectivityManager javadoc"
Sherri Lin   authored and   Gerrit Code Review   commited 2023-03-07 16:50:15 +00:00
9e8162c6e0
Improve doc for NetCaps and NetRequest, and add slice XML docs
Test: comment-only change
Bug: 266524688
Change-Id: Iffeba94ea8e2f4913188ae33933ef30c532ea13a

Chalard Jean   commited 2023-03-03 16:10:37 +09:00
82f1b5e818
Merge "Check network slicing declaration for network request"
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-03-01 02:13:31 +00:00
a908d816de
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

Yuyang Huang   commited 2023-02-28 17:38:30 +09:00
96e8bfee5f
Merge "add TRANSPORT_THREAD to NetworkCapabilities"
Kangping Dong   authored and   Gerrit Code Review   commited 2023-02-28 07:16:16 +00:00
7dc4459d33
Merge "Add getUidFirewallRule to ConnectivityManager"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-02-17 01:53:00 +00:00
7f3dfbfacf
Merge "Allow SUW to access registerSystemDefaultNetworkCallback"
Quang Luong   authored and   Gerrit Code Review   commited 2023-02-15 20:22:10 +00:00
0f6a2e69cd
Merge "Add underpinned Network parameter in SocketKeepalive.start()"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-02-14 12:35:30 +00:00
b7f97fd70e
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

chiachangwang   commited 2023-02-14 10:29:19 +00:00
676c84ef98
Correct a wrong doc tag
Change-Id: Icefc5599d0a500ccd9b5d2247ece75ac5cdc5c7e
Test: doc-only change

Jean Chalard   commited 2023-02-13 05:08:11 +00:00
17cbf06773
Merge changes I99d494d3,I208ceceb
* changes:
  [DK4-0]Add CM#setTestLowTcpPollingTimerForKeepalive for testing
  [DK3] Send onPause/onResume keepalive callbacks

Jean Chalard   authored and   Gerrit Code Review   commited 2023-02-13 05:06:20 +00:00
b5ebe944b5
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

Quang Luong   commited 2023-02-11 00:31:59 +00:00
98858d6b27
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

Yuyang Huang   commited 2023-02-09 19:51:37 +09:00
90a2cbdd8d
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

Sherri Lin   commited 2023-02-08 04:49:29 +01:00
443b7182a6
Merge "Use the binder to identify keepalive in IConnectivityManager"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-02-07 08:17:26 +00:00
b5a87674f0
Merge "Revert "Adds document for self certified network capabilities""
David Gutierrez   authored and   Gerrit Code Review   commited 2023-02-06 21:21:20 +00:00
c1e778a67b
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

David Gutierrez   authored and   Gerrit Code Review   commited 2023-02-06 21:01:58 +00:00
ad7e542ab4
[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

chiachangwang   commited 2023-02-06 13:25:01 +00:00
e0192a7433
[DK3] Send onPause/onResume keepalive callbacks
Test: CTS in the patch immediately on top of this, [DK4]
Change-Id: I208ceceb37c7977452479361f70f046fabafb37a

Chalard Jean   authored and   chiachangwang   commited 2023-02-06 13:23:13 +00:00
bdb8282604
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

Chalard Jean   authored and   chiachangwang   commited 2023-02-06 13:22:53 +00:00
f0b261e7cc