Commit Graph

12723 Commits

Author SHA1 Message Date
Chalard Jean
d09b89bca8 Merge "Allow any transport with TEST if the network is restricted" 2021-05-12 13:57:31 +00:00
Remi NGUYEN VAN
aaf18dd305 Merge "Use jniThrowErrnoException from JNIHelp" 2021-05-12 13:12:32 +00:00
Remi NGUYEN VAN
8ec3067e56 Merge "Move NetworkUtils JNI out of core/jni" 2021-05-12 13:12:09 +00:00
Remi NGUYEN VAN
d93c6b7585 Merge "Build framework-connectivity using module_current" 2021-05-12 13:11:22 +00:00
Chiachang Wang
ba2466bb62 Merge "Remove sendNetworkConditionsBroadcast" 2021-05-12 09:24:02 +00:00
Lorenzo Colitti
172abc194e Merge "Rename unwanted capabilities to forbidden capabilities." 2021-05-12 09:00:17 +00:00
Paul Hu
06f15f1058 Merge "Add MATCH_ANY_USER flag to PackageInfo queries" 2021-05-12 07:13:17 +00:00
David Su
10ee7c54c2 Merge "Emphasize possibility of multiple networks with same transport" 2021-05-11 15:51:28 +00:00
Remi NGUYEN VAN
5accf986ea Use jniThrowErrnoException from JNIHelp
Use the jniThrowErrnoException that is available in JNIHelp, instead of
reimplementing in NetworkUtils.

Bug: 179229316
Test: device boots and has connectivity
Merged-In: I257a9d55ce1f5a7c588e209b4a89d3e7a3e09994

Change-Id: I257a9d55ce1f5a7c588e209b4a89d3e7a3e09994
2021-05-11 14:18:27 +00:00
Remi NGUYEN VAN
d7ab21a379 Move NetworkUtils JNI out of core/jni
Keep the utilities included via a library, but move them out of
core/jni, and prepare a library to package them together with
framework-connectivity.

Also remove unnecessary dependencies in framework-connectivity.

Bug: 171540887
Test: device boots and has connectivity

Merged-In: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597

Change-Id: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597
2021-05-11 13:02:39 +00:00
Remi NGUYEN VAN
0c00f40374 Build framework-connectivity using module_current
framework-connectivity needs to build only against stable APIs.

Bug: 171540887
Test: m framework-connectivity.impl
Merged-In: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c

Change-Id: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c
2021-05-11 13:00:42 +00:00
Lorenzo Colitti
1291166c38 Rename unwanted capabilities to forbidden capabilities.
Addresses API council feedback.

Bug: 184890428
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device
Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-05-11 17:46:13 +09:00
Chalard Jean
0fb0c47869 Allow any transport with TEST if the network is restricted
This will allow CTS to add the WIFI transport and others,
letting them test a number of essential features of the
ranking algorithm.
It's relatively safe because restricted networks can never
become the default, and NOT_RESTRICTED is a default
capability so very few apps would be affected by the shell
creating such a network.

Bug: 184037351
Test: NetworkScoreTest (which is under review)
Change-Id: I21055dc613fead6130adc2122f2cdd0af9b49adf
2021-05-11 15:42:10 +09:00
Benedict Wong
d0f17eb60b Merge changes from topic "vcn-fwd"
* changes:
  Apply transform to FWD policy if configured to provide tethering
  Add internal support for IPsec forward policies
2021-05-11 01:30:31 +00:00
lucaslin
4beb4bc0ea Remove sendNetworkConditionsBroadcast
sendNetworkConditionsBroadcast is removed, so
TestNetworkStackService.kt cannot override it anymore,
otherwise there will be a build break when running this
test.
Also add a comment for NETWORK_CONDITIONS_MEASURED in
AndroidManifest.xml.

Bug: 124415874
Test: atest FrameworksNetIntegrationTests
Change-Id: I7b43940dc32826c70fa82f471b35bc5cb8394aad
Merged-In: I7b43940dc32826c70fa82f471b35bc5cb8394aad
2021-05-11 09:25:54 +08:00
Benedict Wong
7f70885e5f Add internal support for IPsec forward policies
This change adds support for IPsec forward policies, which are necessary
for packets to be allowed to be forwarded to another interface, as is
the case with tethering. This is necessary and useful only within the
system server, and as such is not exposed as a public API.

This change is safe, since the addition of a FWD policy on IPsec tunnel
interfaces will by default block forwarded traffic (as would be the case
without this patch). In the event that the (system) owner of the tunnel
requires support for forwarded packets (eg tethering), this patch allows
application of transforms in the FWD direction as well.

This will be used to ensure that the VCN can be used as the underlying
network for the purposes of tethering.

Bug: 185495453
Test: atest IpSecServiceTest
Test: atest IpSecServiceParameterizedTest
Test: manual testing with tethering over VCN
Change-Id: I74ecea71f1954029f6fbdbe34598c82e0aac386b
2021-05-07 15:09:42 -07:00
paulhu
cbe2b2686a Add missed break
Bug: none
Test: atest FrameworksNetTests
Change-Id: I8e8d0223de50c75732b06b053b3e60ccf4ef1684
2021-05-05 11:04:59 +08:00
Junyu Lai
8ee3a33ee6 Merge "Add doc to getNetworkCapabilities" 2021-05-03 03:16:24 +00:00
Chalard Jean
53a8bccf94 Add doc to getNetworkCapabilities
Test: doc-only change
Fixes: 158092418
Change-Id: Ic20fb55e1bdd4e836468794d1f86d3e9d0bc5965
2021-04-30 11:24:00 +00:00
Treehugger Robot
0c85894c8b Merge "Add getters to NetworkStateSnapshot" 2021-04-29 09:20:34 +00:00
Treehugger Robot
b812b6d7fc Merge "Add getters to UnderlyingNetworkInfo" 2021-04-29 07:29:08 +00:00
Treehugger Robot
bd9d954805 Merge "Rename getAllNetworkStateSnapshot which should be pluralized" 2021-04-29 04:40:51 +00:00
Les Lee
920f072a94 Merge "wifi data usage: support to get carrier merged wifi network." 2021-04-27 02:13:32 +00:00
James Mattis
c1c37218da Merge "Changing per-app default request to TRACK_DEFAULT" 2021-04-26 14:39:44 +00:00
paulhu
b12a770a66 Add MATCH_ANY_USER flag to PackageInfo queries
- Querying PackageInfo should have MATCH_ANY_USER flag because
   some apps are only installed for specific users. If no flag,
   it will get NameNotFoundException.
- Also add missed break on switch case.

Bug: 186382373
Test: atests FrameworksNetTests
Change-Id: I37c8c42352a9a84ccbe9a37248febcd62b8f59e4
2021-04-26 19:03:20 +08:00
Chiachang Wang
79a90c3b8e Merge "Address API review feedback" 2021-04-26 00:22:27 +00:00
James Mattis
a117e28565 Changing per-app default request to TRACK_DEFAULT
Changing the per-app default request flows to fallback to a request of
type TRACK_DEFAULT as opposed to type REQUEST. The main benefit of this
change is that these requests will no longer be sent to the factories
which is desired.

Bug: 180452284
Bug: 176494815
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I312e55a54f70aa82953a32ab9369d5afc02b75e5
Merged-In: I312e55a54f70aa82953a32ab9369d5afc02b75e5
2021-04-23 07:47:11 -07:00
Remi NGUYEN VAN
eb239b6bd4 Merge "Use connectivity resources in service-connectivity" 2021-04-23 05:42:13 +00:00
Remi NGUYEN VAN
9e9e0e3c30 Merge "Add AOSP certificates for connectivity resources" 2021-04-23 05:40:58 +00:00
Chiachang Wang
6ec9b8daed Address API review feedback
Address API review feedback to:
 - Rename NetworkAgent#setTeardownDelayMs to
   NetworkAgent#setTeardownDelayMillis
 - Use getters instead of fields in VpnTransportInfo
 - Rename registerDefaultNetworkCallbackAsUid to
   registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
Merged-In: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
2021-04-23 02:46:05 +00:00
Remi NGUYEN VAN
97fad72128 Use connectivity resources in service-connectivity
Migrate resource usage to the connectivity resource package.
For framework resources that have known overlays, keep a fallback until
the overlays can be migrated.

Bug: 182125649
Test: atest FrameworksNetTests
Merged-In: I778d94a5aac0c4e20e78b1ba3a002495c17a38a0
(clean cherry-pick)

Change-Id: I778d94a5aac0c4e20e78b1ba3a002495c17a38a0
2021-04-23 10:36:15 +09:00
Remi NGUYEN VAN
0af20fa0a6 Merge "Add QUERY_ALL_PACKAGES to net integration tests" 2021-04-22 14:38:40 +00:00
Aaron Huang
9503dec577 Add getters to UnderlyingNetworkInfo
Address API review feedback, add getters to UnderlyingNetworkInfo
instead of exposing fields.

Instead of wasting memory by converting this into an array, have
migrateTun take a List<String>. In turn, tunAdjustmentInit should
also take a List<String>.

(cherry picked from ag/14211075)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: Id59744097208d91298a25ef110ade91a9cf291a1
Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
2021-04-22 22:30:42 +08:00
Remi NGUYEN VAN
cf20f0a4c5 Add QUERY_ALL_PACKAGES to net integration tests
The permission is necessary for ConnectivityService to obtain its
resource package. As the integration tests run ConnectivityService
in-process, they need the permission.

Bug: 186091860
Test: atest FrameworksNetIntegrationTests
Change-Id: I60cf9b54faddf0ea4cb02146c83c9bba58370749
2021-04-22 22:02:01 +09:00
Aaron Huang
b8f56644fb Add getters to NetworkStateSnapshot
Address API council feedback, add getters to NetworkStateSnapshot
instead of exposing the bare fields directly.

(cherry picked from ag/14233655)
Bug: 183972826
Test: FrameworksNetTests
Merged-In: Id1707753b42ae88d2b95e4bd00a792609434e4f5
Change-Id: Id1707753b42ae88d2b95e4bd00a792609434e4f5
2021-04-22 18:21:00 +08:00
Aaron Huang
ee78b1fbbf Rename getAllNetworkStateSnapshot which should be pluralized
Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot
should be pluralized so rename the method to getAllNetworkStateSnapshots

(cherry picked from ag/14221105)
Bug: 183972554
Test: make, FrameworksNetTests
      FrameworksServicesTests
Merged-In: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
2021-04-22 17:45:22 +08:00
Remi NGUYEN VAN
ed1aa13e5b Add AOSP certificates for connectivity resources
Instead of the platform certificate, use a dedicated certificate.

The AOSP certificates are only used for testing as they have known keys,
and are replaced when resigning production images.

Key generated with:
openssl req -x509 -newkey rsa:4096 -nodes -days 999999 -keyout key.pem \
    -out com.android.connectivity.resources.x509.pem
openssl pkcs8 -topk8 -inform PEM -outform DER -in key.pem -out \
    com.android.connectivity.resources.pk8 -nocrypt

Fixes: 184808224
Fixes: 185462051
Test: m
Change-Id: I25cddc8d5ab948da9d3a2dbcd202ece1f61dd5a2
2021-04-22 16:52:19 +09:00
Treehugger Robot
935946812a Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" 2021-04-22 04:43:26 +00:00
Lorenzo Colitti
dc2aad89b1 Merge "Hide NetworkPolicyManager.blockedReasonsToString API." 2021-04-22 02:36:11 +00:00
Treehugger Robot
7056276574 Merge "Do not deduce VCN capability if Builder is derived from request" 2021-04-21 14:06:14 +00:00
junyulai
561a7467c8 Do not deduce VCN capability if Builder is derived from request
If the caller constructed the builder from a request, it means
the user might explicitly want the capabilities from the request.
Thus, the NOT_VCN_MANAGED capabilities should not be touched
later.

Test: TH
Fix: 185876442
Change-Id: I92037cc8547fb72de12d6b6402f060f6c98e1853
2021-04-21 19:10:28 +08:00
Treehugger Robot
e3a86b7ebf Merge "Add the related extra information in the javadoc" 2021-04-21 08:22:43 +00:00
Treehugger Robot
dab7f0912f Merge "Change Connectivity resources SDK version to 30" 2021-04-21 08:00:41 +00:00
Sudheer Shanka
f0ffc77d80 Hide NetworkPolicyManager.blockedReasonsToString API.
BLOCKED_REASON_* constants have been moved to ConnectivityManager
and blockedReasonsToString() util method doesn't belong in
NetworkPolicyManager as an API. So, just removing it for now.

Bug: 185967486
Test: treehugger
Change-Id: Ie04044980fdfc7ec772444be13fc659880953bd1
2021-04-21 07:23:54 +00:00
lucaslin
311b690343 Add the related extra information in the javadoc
Bug: 185876442
Test: make docs
Change-Id: Ib0abc43e2009dbf5ee7b6c2a076424834d3d53f2
2021-04-21 10:43:15 +08:00
James Mattis
b897ff244d Merge "Correctly count nri uid request counts" 2021-04-21 02:06:33 +00:00
Nazanin Bakhshi
c4e424a9ec Merge "Refactoring and mocking to make sure unit test doesn't call the real service" 2021-04-20 15:44:00 +00:00
Treehugger Robot
e796aa56bb Merge "Roll forward: add a test for ParseException" 2021-04-20 10:03:56 +00:00
Remi NGUYEN VAN
3fd29f164a Merge "Revert "Add a test for ParseException"" 2021-04-20 09:25:07 +00:00
Remi NGUYEN VAN
96c7913d98 Update TEST_MAPPING imports for connectivity
Connectivity CTS tests were moved from cts/tests/net to
packages/modules/Connectivity.

Bug: 185751610
Change-Id: Id4efd99c419706a52ad5d708888097bd6312d4e6
Test: treehugger is needed to test
2021-04-20 07:10:41 +00:00