Commit Graph

41769 Commits

Author SHA1 Message Date
Chalard Jean
d413b74023 Allow network providers to set the linger duration. am: 550b5214d3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727821

Change-Id: I2a9872dc3da0e89574ae5bab28dfd3bb4c3f3abf
2021-06-08 23:10:08 +00:00
junyulai
602d75b22b Fix nascent timer never get removed am: 36c02987c6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727820

Change-Id: I706b0a9cff0d9e4a18c62143732b067ef63505b8
2021-06-08 23:10:04 +00:00
Chalard Jean
6a529e1a7a [NS13] Remove the last usage of the legacy int am: c81d4c3c7e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727817

Change-Id: I58b48e44563e52d1cce3aa604be148bbadb1fb9f
2021-06-08 23:10:01 +00:00
Chalard Jean
435354afe6 Add documentation am: d89e56da6b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727816

Change-Id: I1d71d2116bc800d9bfd8fb53cd70c3cbc8c1a0ed
2021-06-08 23:09:58 +00:00
Chalard Jean
b0b3e93682 Use filter from CollectionUtils. am: 5e8f8431d8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727815

Change-Id: Ic10e7ca8b202dd788f1ef878997f78ec11c82770
2021-06-08 23:09:55 +00:00
Chalard Jean
605a2a6fcb Fix a bug where updates of offers won't find existing offers am: 9f6d447a42
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727814

Change-Id: If3f706ec47d892221d7d4a23063015edb9edf72e
2021-06-08 23:09:52 +00:00
Chalard Jean
d39f2dbd78 [NS12] Address comments on NS09 am: 29cb06a3e0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727813

Change-Id: I7fc08dfe2babc2e0eea526436a52a8c2658f3624
2021-06-08 23:09:50 +00:00
Chalard Jean
22acfab1bc [NS11] Fix yieldToBadWifi over the policy scoring am: 142f0fe4d4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727812

Change-Id: Ie216a888a6effcf285468e063b66d04f18b8b7c7
2021-06-08 23:09:46 +00:00
Chalard Jean
fd5d21d50e Add doc for NetworkScore#getLegacyInt am: 0422927cd8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727811

Change-Id: Iefcf115b045de94d28fb9d0fe047b27445701851
2021-06-08 23:09:43 +00:00
Chalard Jean
ecaa23f8e0 Expose sendNetworkScore that takes a NetworkScore am: 536a5bac26
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1726730

Change-Id: Id63fba1ea3b4e169559771ba62b8e0bf7a6afa00
2021-06-08 23:09:36 +00:00
Yan Yan
4d50a5f097 Merge changes I00d1aa47,Icffbe67f am: 77f2e95515
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1690132

Change-Id: I59255aaea77c826accc2198ca7f01fca4b57c93f
2021-06-08 22:53:14 +00:00
Junyu Lai
5b15e700bb Merge changes from topics "enable-policy-ranking", "sendNetworkScore"
* changes:
  Adjust a test for policy scoring
  Enable policy ranking
  Add CTS to verify NetworkAgent#setLingerDuration
  Allow network providers to set the linger duration.
  Fix nascent timer never get removed
  [NS13] Remove the last usage of the legacy int
  Add documentation
  Use filter from CollectionUtils.
  Fix a bug where updates of offers won't find existing offers
  [NS12] Address comments on NS09
  [NS11] Fix yieldToBadWifi over the policy scoring
  Add doc for NetworkScore#getLegacyInt
  Expose sendNetworkScore that takes a NetworkScore
2021-06-08 22:34:44 +00:00
Yan Yan
77f2e95515 Merge changes I00d1aa47,Icffbe67f
* changes:
  Add CTS for AES-CMAC
  Add tests for new IPsec algorithms in IpSecManagerTest
2021-06-08 22:30:16 +00:00
TreeHugger Robot
db12176a4d [automerger skipped] Merge "Require location permission for ConnDiags WiFi only." into sc-dev am: 8e345e9637 -s ours
am skip reason: Merged-In I48806533e4e705d2d9be45f3b3d3931d9294b167 with SHA-1 7474f67454 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14885895

Change-Id: Ib8134fe3a3e4a717e9ce2a794a3f3b039967aec8
2021-06-08 15:31:05 +00:00
TreeHugger Robot
8e345e9637 Merge "Require location permission for ConnDiags WiFi only." into sc-dev 2021-06-08 15:18:54 +00:00
Frank Li
aacfddff03 Merge "Add CTS test for API setLegacyExtraInfo" am: 3103a318bf am: 1cccc8db0e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1719131

Change-Id: I6ed1598065cf55021d4ffea88f3c0f21e4e4ff64
2021-06-08 11:42:35 +00:00
Frank Li
1cccc8db0e Merge "Add CTS test for API setLegacyExtraInfo" am: 3103a318bf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1719131

Change-Id: I2cab45cff92215389eb6bba7b14270e3329d600d
2021-06-08 11:28:34 +00:00
Frank Li
3103a318bf Merge "Add CTS test for API setLegacyExtraInfo" 2021-06-08 11:15:06 +00:00
Remi NGUYEN VAN
679a8e0a72 Move connectivity test defaults to tests/common
The build file currently holds a single build rule in test/. Move it to
the existing build file in tests/common/Android.bp.

(clean cherry-pick of history in downstream branch)

Test: m
Bug: 186628461
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ifa32681c0cdd2f6a70cb83a81cd7fec0f91824d1
2021-06-08 19:54:35 +09:00
Remi NGUYEN VAN
3912c80e99 Add framework-connectivity-test-defaults
The defaults follow the same pattern as framework-wifi-test-defaults to
allow unit tests to build against hidden API in Connectivity.

(clean cherry-pick of history in downstream branch)

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ia8531f672820fcc8968f98494903e486c4e42652
2021-06-08 19:54:27 +09:00
Mark Chien
1f5e9d4d83 Merge changes Ib8fe719f,Ia8c05780 am: 7648833bd4 am: f9074acfa3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729160

Change-Id: Iae8f9bb61662f17b2aa3ae7f4f4983f94144f799
2021-06-08 10:45:58 +00:00
Remi NGUYEN VAN
908b002ed2 Fix restorePrivateDnsSetting with null hostnames
When private DNS setting was set to opportunistic (mode) and null
(hostname), CtsNetUtils would not restore it.

Make sure that private DNS settings are restored after every test. Also
fail if restore is called without having saved any setting beforehand.

Bug: 190465704
Test: atest CtsNetTestCases
Change-Id: Ic5d8d8b729469e0eef89a0b53f166e604264c1ee
2021-06-08 19:29:08 +09:00
Mark Chien
f9074acfa3 Merge changes Ib8fe719f,Ia8c05780 am: 7648833bd4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729160

Change-Id: Ia8ff14142da45de950d2bac507ed5b943d81533e
2021-06-08 10:26:52 +00:00
Remi NGUYEN VAN
bba8ec0d43 Remove ConnectivityServiceTest signature perms use
To allow unit tests to run without platform certificates, remove
signature permission usage in ConnectivityServiceTest.

This mocks permission checks done in ConnectivityService for which the
test assumed that the permission was held, and mocks calls to
BatteryStatsManager. Calls to ActivityManagerService (through
PendingIntent) are done with shell permissions as the test uses real
PendingIntent mechanics.

Bug: 187935317
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I80c5cae5fcd3d40be55d1a79a93d614e665fbbf4
2021-06-08 19:12:13 +09:00
Remi NGUYEN VAN
98b76cc2ec Use mockito-extended in FrameworksNetTests
This is necessary to mock classes like BatteryStatsManager, which cannot
be used without signature permissions, and to merge the test with other
test suites that use mockito extended.

Bug: 187935317
Test: atest FrameworksNetTests
Change-Id: I5dba65d806c5d06b3ff8f633846edb911a7a44ec
2021-06-08 19:12:09 +09:00
Mark Chien
7648833bd4 Merge changes Ib8fe719f,Ia8c05780
* changes:
  Suppress IpServer message logs
  Remove *Locked wording
2021-06-08 10:02:44 +00:00
Remi NGUYEN VAN
e9bdf0c514 [automerger skipped] Merge changes from topic "framework-conn-stub-cp" am: 674ce27fee am: bdcb9a7baf -s ours
am skip reason: Merged-In I556747f9ba934f8b44b6ea9a518adbccc84ac2a9 with SHA-1 02b94faf80 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723151

Change-Id: I579d04cbec63e13f1aff3e3afde781d9545e36b4
2021-06-08 09:56:17 +00:00
Remi NGUYEN VAN
b3f480065e [automerger skipped] Merge framework-connectivity impl and stub targets am: e70cd84601 am: b6edc1a9b9 -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723150

Change-Id: Ieaea1c915534c2d90c8688f22725f5591cb820f7
2021-06-08 09:56:14 +00:00
Remi NGUYEN VAN
bdcb9a7baf Merge changes from topic "framework-conn-stub-cp" am: 674ce27fee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723151

Change-Id: Id06b8ddac302e9ed0aaba137d45cf1da1e709ce8
2021-06-08 09:36:00 +00:00
Remi NGUYEN VAN
b6edc1a9b9 Merge framework-connectivity impl and stub targets am: e70cd84601
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723150

Change-Id: Ia52b0081f916dc06be7b89c339236689807b454b
2021-06-08 09:35:54 +00:00
Remi NGUYEN VAN
0ced8489fc [automerger skipped] Merge "Add min_sdk_version to connectivity targets" am: 12474fdab5 am: 1534bf0adf -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729155

Change-Id: I79109840fe826185f21c7d79ccb1b80924a0814a
2021-06-08 09:26:07 +00:00
Remi NGUYEN VAN
674ce27fee Merge changes from topic "framework-conn-stub-cp"
* changes:
  Reference framework-connectivity stubs explicitly
  Merge framework-connectivity impl and stub targets
2021-06-08 09:15:15 +00:00
Anton Hansson
175e9a0873 Add tethering bootclasspath fragment to its sdk am: 3669599dec
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14881273

Change-Id: I80ecfa0d0b9f3d1258f6db5402539ba52df98d27
2021-06-08 09:15:00 +00:00
Remi NGUYEN VAN
1534bf0adf Merge "Add min_sdk_version to connectivity targets" am: 12474fdab5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729155

Change-Id: I1d5eadb1baf7915a7f017788588865626ad2b563
2021-06-08 09:06:32 +00:00
Remi NGUYEN VAN
12474fdab5 Merge "Add min_sdk_version to connectivity targets" 2021-06-08 08:44:21 +00:00
Paul Hu
9b574bfcbb [automerger skipped] Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" am: 7cba5f4163 am: 997f6e9893 -s ours
am skip reason: Merged-In Ibea354d8dda1f02652a193820f3f9eb573b9a956 with SHA-1 a1ac564748 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729092

Change-Id: Ib5ba2903f1a5a57764b05ce49617b66343ebd1a9
2021-06-08 08:21:23 +00:00
markchien
21021efbe1 Suppress IpServer message logs
To avoid log flooding, suppress CMD_IPV6_TETHER_UPDATE and
CMD_NEIGHBOR_EVENT message log because they appear frequentlg and
don't have any content which means they are ueseless for debugging.
Also remove logMessage from BaseServingState to fix duplicated
message because all the message already log in TetheredState
and LocalHotspotState which inherit BaseServingState.

Bug: 162920185
Bug: 185649441
Test: atest TetheringCoverageTests
      atest MtsTetheringTestLatestSdk
      atest CtsTetheringTest
Change-Id: Ib8fe719f3c1c4a65e6b5152df5e5adf33aba2079
2021-06-08 15:57:04 +08:00
markchien
dc5903ae56 Remove *Locked wording
Since tethering run in single thread without any synchronized lock,
remove "Locked" wording from the methods which the use lock before.

Bug: 162920185
Test: atest TetheringCoverageTest
Change-Id: Ia8c057800cab30cdcbacae4db2d706b6427e9861
2021-06-08 15:56:14 +08:00
Paul Hu
997f6e9893 Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" am: 7cba5f4163
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729092

Change-Id: Ib2e80a59085eea9decade271da3dec2b5a3e2b72
2021-06-08 07:47:06 +00:00
Paul Hu
7cba5f4163 Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" 2021-06-08 07:23:39 +00:00
Paul Hu
867862c930 [automerger skipped] Merge "Address leftover comments" am: e2791b00d3 am: a9d6f3c4c5 -s ours
am skip reason: Merged-In I9056758db15e8a21b84ef244d4cacf24c3b79894 with SHA-1 5d8340f7ae is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729091

Change-Id: Iab3e813878c17b3043a3e0ee72f51b5ca752b0df
2021-06-08 06:58:35 +00:00
Lorenzo Colitti
b4bf015b57 Don't send onLinkPropertiesChanged after onLost for 464xlat.
Currently, when a network that uses 464xlat is torn down,
NetworkCallbacks will receive onLinkPropertiesChanged after
onLost. This is confusing and incorrect.

The incorrect callback is sent because handleLinkProperties
checks that the netId of the agent still exists, not that the
NetworkAgent is still registered. This is normally correct,
because the NetworkAgent is removed from mNetworkAgentInfos and
the netId are removed from mNetworkForNetId by the same method,
disconnectAndDestroyNetwork.

In this specific case it's not correct, because the call to
handleUpdateLinkProperties is from disconnectAndDestroyNetwork
itself via nai.clatd.update and calls Nat464Xlat#stop.

No other callers of handleUpdateLinkProperties are affected
because:

- EVENT_NETWORK_PROPERTIES_CHANGED is called only by
  maybeHandleNetworkAgentMessage, which first checks that the
  NetworkAgent is registered.
- handlePrivateDnsSettingsChanged only looks at registered
  NetworkAgents (it loops over mNetworkAgentInfos).
- handlePrivateDnsValidationUpdate, handleNat64PrefixEvent and
  handleCapportApiDataUpdate call getNetworkAgentInfoForNetId,
  which will correctly determine that the agent is no longer
  registered, since they run on the handler thread and thus
  cannot run at the same time as disconnectAndDestroyNetwork.

The existing code contains a check for the netId being current.
This is intended to ensure that an update from a NetworkAgent
cannot affect another agent with the same Network. This extra
check is not necessary, because code running on the handler
thread can never observe a NetworkAgent in mNetworkAgentInfos
unless mNetworkForNetId maps that NetworkAgent's Network to that
NetworkAgent. This is because mNetworkForNetId is updated by the
same methods as mNetworkAgentInfos, and those updates occur on
the handler thread. So all code on the handler thread will see
those two as consistent.

Bug: 176496580
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
2021-06-08 15:48:57 +09:00
Lorenzo Colitti
284ca22f0c Improve test coverage for disconnecting networks with clat.
Ensure that NetworkCallbacks and netd operations are accounted
for. Also add a test for the spurious onLinkPropertiesChanged
callback that is currently send out after onLost.

Bug: 176496580
Test: atest ConnectivityServiceTest
Change-Id: I69cf58bc87dfe55ea359a2cd76167d03fe2c953d
2021-06-08 15:43:17 +09:00
Paul Hu
a9d6f3c4c5 Merge "Address leftover comments" am: e2791b00d3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729091

Change-Id: I97628a5e88d4410f0745c4a0b1d1bc3bef8111e5
2021-06-08 06:36:02 +00:00
Remi NGUYEN VAN
f20103940e Reference framework-connectivity stubs explicitly
To merge the framework-connectivity and framework-connectivity.impl
targets, framework-connectivity stubs need to be referenced explicitly
in java_sdk_libraries, otherwise the build system will currently see
dependency cycles.

Bug: 183600168
Test: m
Merged-In: I556747f9ba934f8b44b6ea9a518adbccc84ac2a9
Change-Id: I0ff10dcb553115d349e287c9f648d77579158f9d
2021-06-08 15:24:05 +09:00
Remi NGUYEN VAN
e70cd84601 Merge framework-connectivity impl and stub targets
Instead of using api_only: true, use a single java_sdk_library to
generate both framework-connectivity stubs and
framework-connectivity.impl.

Original change (project moved):
I76d7cf1ba31a3f38ae6b9facbf1b668860c8c165

Bug: 183600168
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I07d8c4c92c91939b8e8890fdb5db517b75faee2c
2021-06-08 15:24:05 +09:00
Remi NGUYEN VAN
da43ef0b68 Add min_sdk_version to connectivity targets
All targets need min_sdk_version 30 to be included in the tethering
APEX. They will actually never be used on SDK 30 and are only loaded on
31, but this is necessary to be included in com.android.tethering.

Original change (project moved):
I190fd1f3c9fabff057d0a2bd7f45b63a4fe447b3

This also includes changes to the lint baseline to make it match actual
filenames.

Bug: 171540887
Test: m
Test: m lint-check
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I24198565bc98d85d0c036be02e3a6c311b5bb2a3
2021-06-08 15:23:40 +09:00
Paul Hu
e2791b00d3 Merge "Address leftover comments" 2021-06-08 06:18:19 +00:00
Remi NGUYEN VAN
3b143d3369 [automerger skipped] Merge "Revert "Add min_sdk_version to connectivity targets"" am: 8665528151 am: ffddb67ddc -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history. Merged-In was found from reverted change.

Reverted change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729095

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729694

Change-Id: Ib216b167d9239624748a3e847a626d626f7708ed
2021-06-08 05:07:42 +00:00
Remi NGUYEN VAN
265f25869d [automerger skipped] Merge "Add min_sdk_version to connectivity targets" am: bf7cffa7a0 am: 4c9c1ed2ac -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729095

Change-Id: I75a795f6771184ee10db5c4ee40f4e2349c60777
2021-06-08 05:07:33 +00:00