Commit Graph

42590 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
7ae63c2f2a Merge "Rename shared utils to connectivity-module-utils" am: c5ba57ec15 am: bd514f4993
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757315

Change-Id: I253c86c016332aed02b480c54036e78fb3295bdb
2021-07-09 10:06:29 +00:00
Remi NGUYEN VAN
bd514f4993 Merge "Rename shared utils to connectivity-module-utils" am: c5ba57ec15
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757315

Change-Id: Ib72d1cf70e1d1842ba7563fb106fde3d30e9c4f6
2021-07-09 09:53:36 +00:00
Remi NGUYEN VAN
c5ba57ec15 Merge "Rename shared utils to connectivity-module-utils" 2021-07-09 09:41:22 +00:00
James Mattis
07afe491d5 [automerger skipped] Only pass the NRI for removal in NRI#binderDied am: 4846fff84d -s ours
am skip reason: Merged-In I2a2ad4ec6d415423182a1856a898779203658f8b with SHA-1 8f03680fdb is already in history

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

Change-Id: I8cb520b41a21529fb6afdcf5d62e4433c70f086e
2021-07-09 05:35:15 +00:00
Remi NGUYEN VAN
6685af8fd8 [automerger skipped] Merge "Add new network capabilities to support automotive head unit via USB" am: 8890ead0e0 am: c432565460 -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/+/1757322

Change-Id: I4e0130d24efa406dc30ca1794af0ab413081f639
2021-07-09 05:06:11 +00:00
Remi NGUYEN VAN
c432565460 Merge "Add new network capabilities to support automotive head unit via USB" am: 8890ead0e0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757322

Change-Id: If50a92d2cfbce8f91a179d73b5716b87758df8b2
2021-07-09 04:57:20 +00:00
Remi NGUYEN VAN
58cd24586c Rename shared utils to connectivity-module-utils
Rename net-module-utils-srcs to connectivity-module-utils-srcs.

This is done as the module utils are made specific to
service-connectivity to contain only classes used by
service-connectivity.

Bug: 192998401
Test: Tests prepared in next change
Change-Id: I354f4b84aa90cc12579c4db5479cf2de1dc9cf5d
2021-07-09 13:42:31 +09:00
Remi NGUYEN VAN
8890ead0e0 Merge "Add new network capabilities to support automotive head unit via USB" 2021-07-09 04:38:10 +00:00
James Mattis
4846fff84d Only pass the NRI for removal in NRI#binderDied
When NetworkRequestInfo#binderDied is called in ConnectivityService,
only pass the NRI to handleRemoveNetworkRequest. This is to prevent a
potential crash when unlinkDeathRecipient is called twice for the same
NRI.

Also, as a cleanup, don't iterate mRequests in the log message on binderDied.

As per the bug, the chain of events leading to a potential crash are:

- `Connectivity.NetworkRequestInfo#binderDied()` is called for an NRI
tracking multiple `NetworkRequest` items. This can happen for a TRACK_DEFAULT
request filed by a UID on a different preference than the default, which
copies the request list.
- This in turn triggers multiple `EVENT_RELEASE_NETWORK_REQUEST` events
for the same NRI, one for reach `NetworkRequest` tracked.
- When handling `EVENT_RELEASE_NETWORK_REQUEST`, each `NetworkRequest`
that is passed in will then be used to look up the parent NRI that originally
sent it to be released.
- Therefore if an NRI was tracking three requests, it would trigger three
release network events, then each request would be used to look up the
same NRI again when handling said release event.
- Finally, `ConnectivityService.NetworkRequestInfo#unlinkDeathRecipient` is
called for the NRI in question. Using the scenario above, that means we could
call `unlinkDeathRecipient` multiple times for the same NRI if it was tracking
multiple network requests causing the associated crash.
- If `unlinkDeathRecipient` is called more than once for the same NRI, it will
cause the crash listed in this bug.
- The fix is to only call handleRemoveNetworkRequest for the NRI once. This
works since when removing the NRI, we iterate over all of its requests to
remove them. By only calling handleRemoveNetworkRequest once, it's ensured
`unlinkDeathRecipient` for this NRI as part of
`Connectivity.NetworkRequestInfo#binderDied()` is only called  once and not
potentially multiple times.

Bug: 185541983
Change-Id: I918c8620f2975d810894c178277771764923b5a4
Test: atest FrameworksNetTests
Merged-In: I2a2ad4ec6d415423182a1856a898779203658f8b
2021-07-09 02:12:33 +00:00
James Mattis
743bf14a13 Merge "Only pass the NRI for removal in NRI#binderDied" am: 24fa1d7a8f am: 48f3878591
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1741953

Change-Id: I96cf6ee7fa18900fc0c4ea97b424b634c433083c
2021-07-09 00:25:24 +00:00
James Mattis
48f3878591 Merge "Only pass the NRI for removal in NRI#binderDied" am: 24fa1d7a8f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1741953

Change-Id: Iac74fa029c1736ae5a094d80766acbb838a6e212
2021-07-09 00:05:48 +00:00
James Mattis
24fa1d7a8f Merge "Only pass the NRI for removal in NRI#binderDied" 2021-07-08 23:54:46 +00:00
Chalard Jean
5843b474a0 [automerger skipped] Merge "Remove exclusivity restriction of multiple preferences" am: 278b92f6a0 am: b819ff4142 -s ours
am skip reason: Merged-In I6912db753c8b4a194aa7af92b01ca6dcfec10d8b with SHA-1 de5efb90cb is already in history

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

Change-Id: Ifdf1eab16db9955e42cf1fe233edbbe9e9504d06
2021-07-08 04:15:18 +00:00
Chalard Jean
b819ff4142 Merge "Remove exclusivity restriction of multiple preferences" am: 278b92f6a0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1719390

Change-Id: Ib41c5050c389ac115221005f565ff4f59a799502
2021-07-08 04:05:45 +00:00
Chalard Jean
278b92f6a0 Merge "Remove exclusivity restriction of multiple preferences" 2021-07-08 03:50:34 +00:00
Remi NGUYEN VAN
9438d0fa5a Merge "Ensure wifi reconnects before waiting for metered" am: 14f0d14c14 am: 577f3e158d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757311

Change-Id: I22f911df5cb9ba95fdfe672ddd07502fa3e19f1e
2021-07-08 01:12:18 +00:00
Remi NGUYEN VAN
577f3e158d Merge "Ensure wifi reconnects before waiting for metered" am: 14f0d14c14
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757311

Change-Id: Icdf3557348e3a4f58c7e988057609cbbbd9e5e33
2021-07-08 00:54:52 +00:00
lucaslin
6f77442d76 Add new network capabilities to support automotive head unit via USB
- Add a new transport type for USB and a new network capability
to support automotive head unit.
- In order to pass DnsManagerTest#testTransportTypesEqual, Android.bp
needs to link to dnsresolver_aidl_interface-V8-java. That test checks
whether the TRANSPORT types defined in NetworkCapabilities are the
same as IDnsResolver.aidl.

(clean cherry-pick of change in downstream branch history, original
change ID before project move:
Iec2df09a776d779108f95098e01b7ffdf6f8867a)

Bug: 181742019
Test: atest FrameworksNetTests

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie438ec68577ebdaaf990795fa27f1169b0105411
2021-07-08 09:44:39 +09:00
Remi NGUYEN VAN
14f0d14c14 Merge "Ensure wifi reconnects before waiting for metered" 2021-07-08 00:40:37 +00:00
James Mattis
8f03680fdb Only pass the NRI for removal in NRI#binderDied
When NetworkRequestInfo#binderDied is called in ConnectivityService,
only pass the NRI to handleRemoveNetworkRequest. This is to prevent a
potential crash when unlinkDeathRecipient is called twice for the same
NRI.

Also, as a cleanup, don't iterate mRequests in the log message on binderDied.

As per the bug, the chain of events leading to a potential crash are:

- `Connectivity.NetworkRequestInfo#binderDied()` is called for an NRI
tracking multiple `NetworkRequest` items. This can happen for a TRACK_DEFAULT
request filed by a UID on a different preference than the default, which
copies the request list.
- This in turn triggers multiple `EVENT_RELEASE_NETWORK_REQUEST` events
for the same NRI, one for reach `NetworkRequest` tracked.
- When handling `EVENT_RELEASE_NETWORK_REQUEST`, each `NetworkRequest`
that is passed in will then be used to look up the parent NRI that originally
sent it to be released.
- Therefore if an NRI was tracking three requests, it would trigger three
release network events, then each request would be used to look up the
same NRI again when handling said release event.
- Finally, `ConnectivityService.NetworkRequestInfo#unlinkDeathRecipient` is
called for the NRI in question. Using the scenario above, that means we could
call `unlinkDeathRecipient` multiple times for the same NRI if it was tracking
multiple network requests causing the associated crash.
- If `unlinkDeathRecipient` is called more than once for the same NRI, it will
cause the crash listed in this bug.
- The fix is to only call handleRemoveNetworkRequest for the NRI once. This
works since when removing the NRI, we iterate over all of its requests to
remove them. By only calling handleRemoveNetworkRequest once, it's ensured
`unlinkDeathRecipient` for this NRI as part of
`Connectivity.NetworkRequestInfo#binderDied()` is only called  once and not
potentially multiple times.

Bug: 185541983
Test: atest FrameworksNetTests
Change-Id: I2a2ad4ec6d415423182a1856a898779203658f8b
2021-07-07 17:16:59 -07:00
Sudheer Shanka
a4d94a61fd Merge "Recheck if the network state in expedited job is unexpected." into sc-dev am: 1ec983c471
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15191249

Change-Id: I7dbb85aa1aae966318a4d256f48d99bed396cb02
2021-07-07 18:34:46 +00:00
Sudheer Shanka
1ec983c471 Merge "Recheck if the network state in expedited job is unexpected." into sc-dev 2021-07-07 18:20:02 +00:00
Sudheer Shanka
ce96fa05a7 Recheck if the network state in expedited job is unexpected.
Unfortunately, this could happen if there is a delay in updating the
network rules for the app hosting the job.

Bug: 179319857
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I60cfd5c5946a4cd0ef5ebf0c1e56b0667cc3164d
Ignore-AOSP-First: Expedited jobs are not available in AOSP yet
2021-07-07 18:19:50 +00:00
paulhu
aa0743d7c4 Remove exclusivity restriction of multiple preferences
- Each network preference has been assigned a priority value so
  that netd can know which uid range rule has higher priority. So
  remove the restriction that all network preferences are
  exclusive.
- Add priority check when getting request for uid.

Bug: 171872461
Test: atest FrameworksNetTests
(cherry-pick from ag/14731887)
Merged-In: I6912db753c8b4a194aa7af92b01ca6dcfec10d8b

Change-Id: I6912db753c8b4a194aa7af92b01ca6dcfec10d8b
2021-07-07 23:06:43 +08:00
Paul Hu
cebf317bef Merge "Remove exclusivity restriction of multiple preferences" into sc-dev am: fd301c05c5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731887

Change-Id: I7df8b49e044891f69a2af7477ab9b8fab0353b50
2021-07-07 14:46:32 +00:00
Paul Hu
fd301c05c5 Merge "Remove exclusivity restriction of multiple preferences" into sc-dev 2021-07-07 14:36:22 +00:00
paulhu
de5efb90cb Remove exclusivity restriction of multiple preferences
- Each network preference has been assigned a priority value so
  that netd can know which uid range rule has higher priority. So
  remove the restriction that all network preferences are
  exclusive.
- Add priority check when getting request for uid.

Bug: 171872461
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I6912db753c8b4a194aa7af92b01ca6dcfec10d8b
2021-07-07 12:38:16 +08:00
Treehugger Robot
24713b1f4c Merge "Fix flake in testConnectivityDiagnosticsCallbackOnConnectivityReported" am: 1d2ad89424 am: 5c7e4c179b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755630

Change-Id: I32db3adb9f1a9c95b99ace428044e331df780821
2021-07-07 04:27:16 +00:00
Treehugger Robot
0c865b6ff9 Merge "Fix flake in testMobileDataAlwaysOn" am: 02ea3f55c1 am: b9b4ee6d0e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755251

Change-Id: I5ca65eba0f45846df6b75d11d42b67c81fb177c3
2021-07-07 04:27:08 +00:00
Treehugger Robot
5c7e4c179b Merge "Fix flake in testConnectivityDiagnosticsCallbackOnConnectivityReported" am: 1d2ad89424
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755630

Change-Id: I4539d7b5d254c09d629e4d0bdb8b5db4a9d9db96
2021-07-07 04:11:26 +00:00
Treehugger Robot
b9b4ee6d0e Merge "Fix flake in testMobileDataAlwaysOn" am: 02ea3f55c1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755251

Change-Id: Ide762b07177c861a7308690a8e39040de2414506
2021-07-07 04:11:20 +00:00
Treehugger Robot
1d2ad89424 Merge "Fix flake in testConnectivityDiagnosticsCallbackOnConnectivityReported" 2021-07-07 03:53:17 +00:00
Treehugger Robot
02ea3f55c1 Merge "Fix flake in testMobileDataAlwaysOn" 2021-07-07 03:52:38 +00:00
Remi NGUYEN VAN
013e9789b7 Merge changes I99ce72bd,I5a11a802 am: 527ffb6f0c am: 3499d73016
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1756971

Change-Id: Ic26bab1331de18f8b362849e275f986d0b7fa97e
2021-07-07 03:32:44 +00:00
Paul Hu
7a6f3364c9 [automerger skipped] Merge "Use Netd new added/removed uid range methods" am: 51bfbbfb1b am: cef78638b5 -s ours
am skip reason: Merged-In I08bbdbcb8450b08e6208fa730137348550f9e3d2 with SHA-1 de2a23958d is already in history

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

Change-Id: Ifa99945cc5b761eb2f1a45c21838b5db078d584b
2021-07-07 03:32:37 +00:00
Remi NGUYEN VAN
3499d73016 Merge changes I99ce72bd,I5a11a802 am: 527ffb6f0c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1756971

Change-Id: Icb435dbe7be5eb125b88336263fd3519139501db
2021-07-07 03:21:57 +00:00
Paul Hu
cef78638b5 Merge "Use Netd new added/removed uid range methods" am: 51bfbbfb1b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755053

Change-Id: I1ab928e64501c47adbb1416555640084098cf72f
2021-07-07 03:21:51 +00:00
Remi NGUYEN VAN
527ffb6f0c Merge changes I99ce72bd,I5a11a802
* changes:
  Add retries for WifiManager#connect
  Use WifiManager.connect to reconnect wifi
2021-07-07 03:07:21 +00:00
Paul Hu
51bfbbfb1b Merge "Use Netd new added/removed uid range methods" 2021-07-07 03:07:10 +00:00
paulhu
0e79d95332 Use Netd new added/removed uid range methods
Replace network[Add|Remove]UidRanges to
network[Add|Remove]UidRangesParcel. The new methods are passing
NativeUidRangeConfig which contains priority value for each uid
range rules.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest HostsideVpnTests
(cherry-pick from ag/14911836)
Merged-In: I08bbdbcb8450b08e6208fa730137348550f9e3d2

Change-Id: I08bbdbcb8450b08e6208fa730137348550f9e3d2
2021-07-07 03:06:32 +00:00
Maciej Żenczykowski
aa6e564726 remove obsolete/no-op NativeQtaguidTest am: 2aabf4138e am: 4f8727b8a7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757412

Change-Id: Ifcfbc5d49ebffaf177ab0e5e3e500f933fd068ce
2021-07-07 02:17:15 +00:00
Treehugger Robot
2001d44cde [automerger skipped] add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes am: cba9f66098 -s ours
am skip reason: Merged-In Ibaedb8fcb28591ffba1506514f2305d55712a26b with SHA-1 bbc4ea32bc is already in history

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

Change-Id: Ie39372d2403e42bfa874000533e7eabae0e0ec05
2021-07-07 02:16:35 +00:00
Maciej Żenczykowski
4f8727b8a7 remove obsolete/no-op NativeQtaguidTest am: 2aabf4138e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757412

Change-Id: I43c6fa74b4fbd45cd047b6169316e656debae855
2021-07-07 02:07:54 +00:00
Remi NGUYEN VAN
c6be26e0ef Ensure wifi reconnects before waiting for metered
testGetMultipathPreference assumes that wifi will auto-reconnect after
changing its metered status, but this is not necessarily the case if the
BSSID has been blocklisted after it failed validating too many times.

Call ensureWifiConnected to force wifi to reconnect before waiting for
it to become metered.

Bug: 190913510
Test: atest ConnectivityManagerTest
Change-Id: Iafe9837b97e4d654bb0f3962d48a94c1f31bbebc
2021-07-07 10:55:39 +09:00
Maciej Żenczykowski
2aabf4138e remove obsolete/no-op NativeQtaguidTest
qtaguid is long dead - test is thus a no-op

New test logs:
  Running Tests...

  x86 CtsNativeNetTestCases
  -------------------------
  CtsNativeNetTestCases (1 Test)
  [1/1] BpfTest#bpfStructSizeTest: PASSED (0ms)

  Summary
  -------
  x86 CtsNativeNetTestCases: Passed: 1, Failed: 0, Ignored: 0, Assumption Failed: 0,

  All tests passed!

Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9ff784dbfda0ce981904d53eacb7bc831cbe81da
2021-07-06 22:15:44 +00:00
Treehugger Robot
cba9f66098 add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes
This test is required to ensure that the system is compatible
with future updates of the tethering mainline module, which
updates BPF .o files on device.

This test must already be passing on OEM devices because otherwise
the offload.o program in the Tethering mainline module would bootloop
the device.

Bug: 190519702
Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1756440
Merged-In: Ibaedb8fcb28591ffba1506514f2305d55712a26b
Change-Id: Ibaedb8fcb28591ffba1506514f2305d55712a26b
2021-07-06 21:13:24 +00:00
Treehugger Robot
58a4324397 Merge "add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes" am: 464d0b2bdd am: b2817e8e31
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1756440

Change-Id: I4b57219491ad0fef352ea0d834f402fb429b67a2
2021-07-06 21:12:19 +00:00
Treehugger Robot
b2817e8e31 Merge "add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes" am: 464d0b2bdd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1756440

Change-Id: I8414a4ab963e8754978c781635a66de52be39813
2021-07-06 20:58:42 +00:00
Treehugger Robot
464d0b2bdd Merge "add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes" 2021-07-06 20:44:57 +00:00
Maciej Żenczykowski
bbc4ea32bc add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes
This test is required to ensure that the system is compatible
with future updates of the tethering mainline module, which
updates BPF .o files on device.

This test must already be passing on OEM devices because otherwise
the offload.o program in the Tethering mainline module would bootloop
the device.

Bug: 190519702
Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibaedb8fcb28591ffba1506514f2305d55712a26b
2021-07-06 02:50:47 -07:00