Commit Graph

44648 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
44f31fd1c0 Merge "Remove catch clause on compat shim" am: 5b37955322 am: 19122edbc5 am: 2cff18c9f5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760688

Change-Id: I0a75b7759892b86647bd142e9fa5ffd2cdf2867a
2021-07-12 04:32:02 +00:00
Remi NGUYEN VAN
2cff18c9f5 Merge "Remove catch clause on compat shim" am: 5b37955322 am: 19122edbc5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760688

Change-Id: I962a30ce497292d4bc65d6724251d2a16a98d995
2021-07-12 04:19:04 +00:00
Remi NGUYEN VAN
19122edbc5 Merge "Remove catch clause on compat shim" am: 5b37955322
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760688

Change-Id: I9b3dea9ce41f0afb1093c9c0affb185e870c4cd3
2021-07-12 04:05:37 +00:00
Remi NGUYEN VAN
5b37955322 Merge "Remove catch clause on compat shim" 2021-07-12 03:52:54 +00:00
Remi NGUYEN VAN
2205be85bb Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70 am: 3c5a0f7de9 am: 92b099b4e7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: I0d2477417b15a91a8cd0776e3b2d018558fed663
2021-07-12 02:59:14 +00:00
Remi NGUYEN VAN
92b099b4e7 Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70 am: 3c5a0f7de9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: I9a96b7cbef135a86d13171cd5b1edfc69b68c2e0
2021-07-12 02:50:20 +00:00
Remi NGUYEN VAN
3c5a0f7de9 Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: If2a051f415f46544955e6646ed7d74c52d4e2d22
2021-07-12 02:31:43 +00:00
Remi NGUYEN VAN
946da61e70 Merge "Remove hidden ArrayUtils usage in test" 2021-07-12 02:21:12 +00:00
Remi NGUYEN VAN
12f4783a07 Merge "Rename shared utils to connectivity-module-utils" am: c5ba57ec15 am: bd514f4993 am: 7ae63c2f2a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757315

Change-Id: I72f122d1c2cf9e0d4baadf7747361bbccad80507
2021-07-09 10:20:09 +00:00
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
61cc1ac9bd Remove hidden ArrayUtils usage in test
Internal utils are generally jarjared by connectivity jarjar rules, but
ArrayUtils is not actually statically linked into the tests, so this
makes the ConnectivityCoverageTests fail. FrameworksNetTests has been
fine because it does not use jarjar, but does not exercise updated code
because of that.

Remove usage of the hidden utility, as there are reasonable alternatives
with non-hidden APIs that avoid other breakages long-term.

Bug: 187935317
Test: atest ConnectivityCoverageTests:ConnectivityServiceTest
Change-Id: I8ed85b941c3d1028771a5ac33196b1509a95789d
2021-07-09 18:52:51 +09:00
Remi NGUYEN VAN
c5ba57ec15 Merge "Rename shared utils to connectivity-module-utils" 2021-07-09 09:41:22 +00:00
James Mattis
d8037b7bca [automerger skipped] Only pass the NRI for removal in NRI#binderDied am: 4846fff84d am: a89e4e03ed -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: Ia142bb0eb716e07ac078c1a0361dedc826fb39fe
2021-07-09 05:51:17 +00:00
James Mattis
00f01b169b [automerger skipped] Only pass the NRI for removal in NRI#binderDied am: 4846fff84d -s ours am: 07afe491d5 -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: Idb38af8a6c4d86a3f72e4ad5d73d76d756d54d60
2021-07-09 05:47:37 +00:00
James Mattis
a89e4e03ed Only pass the NRI for removal in NRI#binderDied am: 4846fff84d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15236913

Change-Id: I101f9e5e148b77ffde136db16c75f21991d39d98
2021-07-09 05:36:14 +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
9c7d164498 [automerger skipped] Merge "Add new network capabilities to support automotive head unit via USB" am: 8890ead0e0 am: c432565460 -s ours am: 6685af8fd8 -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: I83cc94c771b9d0b0518268d858b49b5ba96da66d
2021-07-09 05:21:55 +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
Remi NGUYEN VAN
ca5530ed1d Remove catch clause on compat shim
registerSystemDefaultNetworkCallback no longer throws
UnsupportedApiLevelException as it has compatibility behavior down to Q,
so remove the catch clause for the checked exception.

The exception would previously not be thrown since the Tethering module
is only running on R+.

Bug: 182961265
Test: atest TetheringTests
Change-Id: I3c58235f3a59294995e5f32502fec6ccd17a3cf0
2021-07-09 10:24:44 +09:00
James Mattis
e23f928666 Merge "Only pass the NRI for removal in NRI#binderDied" am: 24fa1d7a8f am: 48f3878591 am: 743bf14a13
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1741953

Change-Id: I89c7e2b31f700da5a448b06abbb9d2d6378c7901
2021-07-09 00:40:37 +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
50227eacc9 [automerger skipped] Merge "Remove exclusivity restriction of multiple preferences" am: 278b92f6a0 am: b819ff4142 -s ours am: 5843b474a0 -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: I9d89c3519a491ff2e729469cec35edee30c30934
2021-07-08 04:28:38 +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
544872f16c Merge "Ensure wifi reconnects before waiting for metered" am: 14f0d14c14 am: 577f3e158d am: 9438d0fa5a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757311

Change-Id: I116618f8a244902727c43e4ba529ca9826f10666
2021-07-08 01:25:44 +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
Automerger Merge Worker
e3012d8e40 Merge "Merge "Recheck if the network state in expedited job is unexpected." into sc-dev am: 1ec983c471 am: a4d94a61fd" into sc-v2-dev-plus-aosp 2021-07-07 18:57:32 +00:00
Sudheer Shanka
96d8ff8313 Merge "Recheck if the network state in expedited job is unexpected." into sc-dev am: 1ec983c471 am: a4d94a61fd
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15191249

Change-Id: I637678dfecd375cce092e9e5e92ec75cd59bf045
2021-07-07 18:57:27 +00:00
Sudheer Shanka
0810fff8a5 Merge "Recheck if the network state in expedited job is unexpected." into sc-dev am: 1ec983c471 am: a20e2702dd
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15191249

Change-Id: I9688f4989a22f77530a2dd47e37eda934fb2929e
2021-07-07 18:57:26 +00:00
Sudheer Shanka
a20e2702dd 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: I02fb4442949afbe1b6ba4330f4986f7369f97851
2021-07-07 18:35:55 +00: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
33e0aa7489 Merge "Remove exclusivity restriction of multiple preferences" into sc-dev am: fd301c05c5 am: f534ef200d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731887

Change-Id: I4c88f8516ed9ebe4510f7f8485514a49a098ffcd
2021-07-07 15:03:54 +00:00
Paul Hu
32292c4288 Merge "Remove exclusivity restriction of multiple preferences" into sc-dev am: fd301c05c5 am: cebf317bef
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731887

Change-Id: I2dedac6259ce55e4c356a1a92fd34631af7f2586
2021-07-07 15:00:12 +00:00
Paul Hu
f534ef200d 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: I99af87f0106609da19f93306a8c06b79d4634fed
2021-07-07 14:47:31 +00: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