Commit Graph

2396 Commits

Author SHA1 Message Date
Chalard Jean
380318053b Fix a stupid NPE
Okay so this is really not a behavior change as it converts an
NPE into an illegal argument exception, but still, that's what
should happen (and that's what the upcoming test actually tests
for).

Test: upcoming NetworkAgentTest
Bug: 139268426
Change-Id: I3e17211c03bc74426bf5e2e414ec322d73b0060b
2020-04-03 07:17:13 +09:00
Lorenzo Colitti
7fb7c3e0bf Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Merged-In: I59cf48552bca98092d1212e3d718fd420add5458
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-02 10:36:19 +00:00
Chalard Jean
9122e56202 Merge changes from topics "api-fix-networkagent", "satisfiedby"
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.
2020-04-02 05:51:02 +00:00
Lorenzo Colitti
62d2333abd Merge "Only apply VPN isolation if it's fully routed" am: 5c5d1a1282 am: d24e7fb5a1
Change-Id: I9230f1a73698344eb40ae3e0ebc5d73cc259f2d0
2020-04-02 04:50:41 +00:00
Lorenzo Colitti
5c5d1a1282 Merge "Only apply VPN isolation if it's fully routed" 2020-04-02 04:10:12 +00:00
Chalard Jean
c62f9a53d8 Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
Merged-In: I076876a6662bde143ef7d315ce3767acafff93c1
2020-04-01 20:38:30 +08:00
Rubin Xu
ab8cf306ea Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-01 09:36:29 +01:00
Chalard Jean
691a34d96b Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Copy from ag/10866511
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed
Merged-In: I8a785ae0e74e659c317deaaa28c203356c7766ed
2020-04-01 16:01:04 +08:00
Aaron Huang
f210e24871 Merge changes from topics "networkagent_api", "networkprovider_api"
* changes:
  Update the NetworkProvider API for council comments
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments
2020-04-01 05:33:28 +00:00
Cody Kesting
84cfd6c6e4 Merge "Clarify comments for Connectivity Diagnostics reports." am: 87ce14f328 am: 1d99c7333f
Change-Id: I4e6452b4875a8c3e3739dea4d3bc281a006156eb
2020-03-31 18:17:26 +00:00
Cody Kesting
ad6fd5bfc8 Merge "Sort administrator UIDs for NetworkCapabilities." am: c350963548 am: 8d84479831
Change-Id: I453f81bcb7c426ab4b529acce5c32c502a29331b
2020-03-31 18:17:14 +00:00
Cody Kesting
975c5c699a Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." am: e4df39ba4b am: e0463c56eb
Change-Id: Ic8fc22f0eb47836053fc6b9423018c16ae46ef46
2020-03-31 18:16:18 +00:00
Cody Kesting
87ce14f328 Merge "Clarify comments for Connectivity Diagnostics reports." 2020-03-31 17:43:44 +00:00
Cody Kesting
c350963548 Merge "Sort administrator UIDs for NetworkCapabilities." 2020-03-31 17:43:02 +00:00
Cody Kesting
e4df39ba4b Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." 2020-03-31 17:42:18 +00:00
Chalard Jean
5f12f81206 Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826397
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302
Merged-In: I6b086572cfc72a0727f4510351cff0e74cbc4302
2020-03-31 11:57:59 +00:00
Chalard Jean
aea539a13e Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826396
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
Merged-In: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
2020-03-31 11:51:05 +00:00
Chalard Jean
f5d1bfd77f Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10824609
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5
Merged-In: I9a2691f783f4449348c3f767568e05620f0b9df5
2020-03-31 11:34:42 +00:00
Cody Kesting
22f3171c07 Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." am: a365c81bfa am: 7439991aec
Change-Id: Ib65d67f8d9a6e44d03f745cdcb27d7535fd40c58
2020-03-31 00:54:30 +00:00
Cody Kesting
7d4ef21010 Clarify comments for Connectivity Diagnostics reports.
Clarify when
ConnectivityDiagnosticsCallback#onConnectivityReportAvailable will be
invoked. Clarify when NetworkAgentInfo#mConnectivityReport will be null
vs non-null.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I748bd9ded72a34d89f13bd4362d6d4da62b910b8
Merged-In: I748bd9ded72a34d89f13bd4362d6d4da62b910b8
(cherry picked from commit 604dd40cf077f42c2d4b6ff80ff41d89cfbcacee)
2020-03-30 17:14:56 -07:00
Cody Kesting
9c341963ac Sort administrator UIDs for NetworkCapabilities.
Administrator UIDs stored in NetworkCapabilities should be sorted. This
allows for easier equals checks and hashCode computation. Additionally,
duplicate UIDs should be prevented.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
Merged-In: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
(cherry picked from commit 2091bd9059d1d24f8c6bd1cd345361f185cab1ea)
2020-03-30 17:14:44 -07:00
Chalard Jean
0d667c5508 Add combine() and equals() for NetworkCapabilities admin UIDs.
NetworkCapabilities#mAdministratorUids should be checked for equality
when combining NetworkCapabilities. Administrator UIDs should also be
included in NetworkCapabilities equals() and hashCode().

Bug: 147903575
Test: FrameworksNetTests
Change-Id: I803bdec80e27ee80d3a39844c5fb7aed584ab07d
Merged-In: I803bdec80e27ee80d3a39844c5fb7aed584ab07d
(cherry picked from commit 5fad8aa761336012bb228afc3b6f7d42fa274242)
2020-03-30 17:14:33 -07:00
Cody Kesting
fe059d8c30 Invoke onConnectivityReport on registering ConnectivityDiagnostics.
This change updates the behavior for registering
ConnectivityDiagnosticsCallbacks. Now, after a successful register()
call, callbacks will receive cached ConnectivityReports for all
matching, permissioned networks. This allows registrants to be updated
with the network state for their networks without having to wait for the
next network validation.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I924ba8fdcc847f453557021591bde38602fe089c
Merged-In: I924ba8fdcc847f453557021591bde38602fe089c
(cherry picked from commit 95ec0b206b759e1d26bc1dbb2255a515bb24358a)
2020-03-30 17:13:55 -07:00
Cody Kesting
9f8773c32e Clean up handling of NetworkCapabilities#administratorUids.
Update ConnectivityService's check for administrator UIDs to use
ArrayUtils to check for UID inclusion. Update the NetworkCapabilities
annotation on the administrator UIDs field to clarify that it is
NonNull.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
Merged-In: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
(cherry picked from commit 898496365aa1f3601cdbb305004ad0de11ff6bfc)
2020-03-30 17:13:37 -07:00
Cody Kesting
a365c81bfa Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." 2020-03-31 00:06:26 +00:00
Cody Kesting
5c96dc912b Merge "Clean up handling of NetworkCapabilities#administratorUids." am: eb0b80c9e5 am: 2ea7a457b0
Change-Id: Ie2e85fc61fe3765beebcc511f2256bd6b4c37b1f
2020-03-30 22:50:39 +00:00
Cody Kesting
eb0b80c9e5 Merge "Clean up handling of NetworkCapabilities#administratorUids." 2020-03-30 22:04:43 +00:00
Cody Kesting
9a4168bd3b Clarify comments for Connectivity Diagnostics reports.
Clarify when
ConnectivityDiagnosticsCallback#onConnectivityReportAvailable will be
invoked. Clarify when NetworkAgentInfo#mConnectivityReport will be null
vs non-null.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I748bd9ded72a34d89f13bd4362d6d4da62b910b8
2020-03-30 14:51:24 -07:00
Cody Kesting
ec5a0cb0ff Sort administrator UIDs for NetworkCapabilities.
Administrator UIDs stored in NetworkCapabilities should be sorted. This
allows for easier equals checks and hashCode computation. Additionally,
duplicate UIDs should be prevented.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
2020-03-30 14:51:24 -07:00
Chalard Jean
20e92eca29 Add combine() and equals() for NetworkCapabilities admin UIDs.
NetworkCapabilities#mAdministratorUids should be checked for equality
when combining NetworkCapabilities. Administrator UIDs should also be
included in NetworkCapabilities equals() and hashCode().

Bug: 147903575
Test: FrameworksNetTests
Change-Id: I803bdec80e27ee80d3a39844c5fb7aed584ab07d
2020-03-30 14:27:20 -07:00
Cody Kesting
b77bf707c6 Invoke onConnectivityReport on registering ConnectivityDiagnostics.
This change updates the behavior for registering
ConnectivityDiagnosticsCallbacks. Now, after a successful register()
call, callbacks will receive cached ConnectivityReports for all
matching, permissioned networks. This allows registrants to be updated
with the network state for their networks without having to wait for the
next network validation.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I924ba8fdcc847f453557021591bde38602fe089c
2020-03-30 11:10:46 -07:00
Cody Kesting
7b987276db Clean up handling of NetworkCapabilities#administratorUids.
Update ConnectivityService's check for administrator UIDs to use
ArrayUtils to check for UID inclusion. Update the NetworkCapabilities
annotation on the administrator UIDs field to clarify that it is
NonNull.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
2020-03-30 16:55:21 +00:00
Remi NGUYEN VAN
e3aade0a30 Merge "Create a builder for NetworkCapabilities." 2020-03-30 02:58:45 +00:00
Chalard Jean
ec85550d64 Merge changes from topics "api-fix-networkagent", "networkprovider_api", "satisfiedby" into rvc-dev am: 199c91b659
Change-Id: I041fa5232ac2f653f0ff9070b9bcd924345f9987
2020-03-27 22:56:26 +00:00
Chalard Jean
51b8e287ad Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
2020-03-27 23:46:30 +09:00
Chalard Jean
812e8cb87e Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed
2020-03-27 17:57:24 +09:00
Chalard Jean
fd23dbbf07 Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302
2020-03-27 17:53:05 +09:00
Aaron Huang
a09a992749 Merge "API review: access field by method" 2020-03-27 07:03:25 +00:00
Chalard Jean
58603f3a63 Merge changes from topic "networkagent_api" into rvc-dev am: f79df94011
Change-Id: If16fd956e2d694fa36492cc1a1512a9d12dee3dd
2020-03-27 06:23:56 +00:00
Chalard Jean
f79df94011 Merge changes from topic "networkagent_api" into rvc-dev
* changes:
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments
2020-03-27 06:20:37 +00:00
Chalard Jean
15a3adbdf3 Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
2020-03-25 22:43:13 +09:00
Chalard Jean
68d0e42789 Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5
2020-03-25 22:35:41 +09:00
Chalard Jean
abd9a140a6 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" am: a982d12943 am: 3870a078e3
Change-Id: Ia0f76216636ae11d1d9cbea5ed6ff0ee4e2a3f5b
2020-03-25 10:49:54 +00:00
Chalard Jean
d22cb127b9 Allow MANAGE_TEST_NETWORKS to register limited agents
This puts in force some restrictions against test networks,
and in exchange relaxes the restrictions around registering
a network agent that provides a test network.
Test networks can only ever have transport TEST, and have
only a few capabilities available to them.

This is useful in particular to test CTS. See aosp/1253423
for first, basic usage of this capability.

Test: IpSecManagerTunnelTest
Test: new CTS aosp/1253423
Bug: 139268426

Change-Id: Ibd162792a7ab02fcbb06130f21a825a386678c05
(cherry picked from commit 2c129e97cca2234ee6dd079a9c07df0c530d8b36)
2020-03-25 10:43:26 +00:00
Aaron Huang
df68f4f75e Merge "API review: make exception class and Builder final" into rvc-dev am: 9c9366b2df
Change-Id: I974be68ce205a701619a71e9ef7f43d8f8be0f8c
2020-03-25 09:47:47 +00:00
Chalard Jean
a982d12943 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" 2020-03-25 09:47:03 +00:00
Chalard Jean
5b63976366 Allow MANAGE_TEST_NETWORKS to register limited agents
This puts in force some restrictions against test networks,
and in exchange relaxes the restrictions around registering
a network agent that provides a test network.
Test networks can only ever have transport TEST, and have
only a few capabilities available to them.

This is useful in particular to test CTS. See aosp/1253423
for first, basic usage of this capability.

Test: IpSecManagerTunnelTest
Test: new CTS aosp/1253423
Bug: 139268426
Change-Id: I47600e6097e8519e50ae771daa13bb6bb7640451
2020-03-25 16:28:50 +09:00
Aaron Huang
4b1aada0aa API review: make exception class and Builder final
- InvalidPacketException exception class should be final
- NetworkCapabilities.Builder should be final

Bug: 152203926
Test: atest FrameworksNetTests
Change-Id: If9b799151aff6d41c9bcd8bb86c65a58e46bad73
2020-03-25 13:36:38 +08:00
Chalard Jean
542e60001a Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I69c00c9e3963950e55d7105d8825f7d3a3ec9b2f
Merged-In: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99
(cherry picked from commit 9771f34dae9cdeb857636cac2b3c2d473713914e)
2020-03-25 13:27:04 +09:00
Chalard Jean
461f81faac Merge "Expose netId by adding getter API" 2020-03-25 02:23:03 +00:00